Add Rules integration for Unit and State Related Event Fields

Created on 4 February 2017, almost 8 years ago
Updated 14 January 2024, 10 months ago

Hi.

We are looking to integrate BAT with the commerce module. I have a product for meeting rooms; and have a meeting room variation for each room category with its corresponding price. I have added the Bat Calendar Unit Type Reference field to the product so that our customers can see the availability calendar so that they can choose the correct available date/times and unit before completing the booking request form. I added a commerce custom line item type for meeting rooms to include the fields for the booking request form. All is setup and working properly.

Now I'm using rules to create an event based on the information provided in the fields on the booking request form from the commerce custom line item type; (the fields are (unit label, unit #, start date and time, end date and type, event type state label, event type state id). Through rules I created the entity and set data for the start date and time, end date and time, and event type but cannot find/gain access to the following fields in rules (unit label, unit #, event type state label, event type state id). Where can I find these fields/How can I gain access to these in rules?

In the admin interface, it appears that when we select the date/time on the available unit, the popup allows us to change the state and the unit is taken from the calendar. Are the unit label, unit #, event type state label, and event type state id fields available in rules so that they can be used to create a new event or modify an existing event?

Please see the attached export of my rule as well as screenshot showing those fields are not available.

Thanks in advance,

Export of Rule

{ "rules_test" : {
"LABEL" : "Test",
"PLUGIN" : "reaction rule",
"OWNER" : "rules",
"REQUIRES" : [ "commerce_order", "rules", "rules_conditional", "commerce_checkout" ],
"ON" : { "commerce_checkout_complete" : [] },
"IF" : [
{ "commerce_order_contains_product_type" : {
"commerce_order" : [ "commerce_order" ],
"product_type" : { "value" : { "meeting_rooms" : "meeting_rooms" } },
"operator" : "\u003E=",
"value" : "1"
}
},
{ "user_has_role" : {
"account" : [ "commerce-order:owner" ],
"roles" : { "value" : { "2" : "2", "3" : "3" } },
"operation" : "OR"
}
}
],
"DO" : [
{ "commerce_order_update_status" : { "commerce_order" : [ "commerce_order" ], "order_status" : "pending" } },
{ "LOOP" : {
"USING" : { "list" : [ "commerce-order:commerce-line-items" ] },
"ITEM" : { "current_line_item" : "Current Line Item" },
"DO" : [
{ "CONDITIONAL" : [
{
"IF" : { "entity_has_field" : { "entity" : [ "current-line-item" ], "field" : "commerce_product" } },
"DO" : [
{ "entity_create" : {
"USING" : { "type" : "bat_event" },
"PROVIDE" : { "entity_created" : { "bat_event_entity_created" : "Bat Event" } }
}
},
{ "CONDITIONAL" : [
{
"IF" : { "entity_has_field" : { "entity" : [ "current-line-item" ], "field" : "field_unit" } },
"DO" : [
{ "data_set" : {
"data" : [ "bat-event-entity-created:type" ],
"value" : "meeting_room_availability"
}
}
]
}
]
},
{ "CONDITIONAL" : [
{
"IF" : { "entity_has_field" : {
"entity" : [ "current-line-item" ],
"field" : "field_booking_start_date"
}
},
"DO" : [
{ "data_set" : {
"data" : [ "bat-event-entity-created:start-date" ],
"value" : [ "current-line-item:field-booking-start-date" ]
}
}
]
}
]
},
{ "CONDITIONAL" : [
{
"IF" : { "entity_has_field" : { "entity" : [ "current-line-item" ], "field" : "field_booking_end_date" } },
"DO" : [
{ "data_set" : {
"data" : [ "bat-event-entity-created:end-date" ],
"value" : [ "current-line-item:field-booking-end-date" ]
}
}
]
}
]
},
{ "CONDITIONAL" : [
{
"IF" : { "entity_has_field" : { "entity" : [ "current-line-item" ], "field" : "field_unit" } },
"DO" : []
}
]
}
]
}
]
}
]
}
}
]
}
}

Feature request
Status

Closed: outdated

Version

1.17

Component

Code

Created by

🇺🇸United States oystercrackher

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇮🇹Italy afagioli Rome

    No more support for BAT on Drupal 7.
    Latest BAT for Drupal 10 has full support from the Community and most of the bugs fixed.
    Consider upgrading.

Production build 0.71.5 2024