According to hook_rules_data_info() documentation:

property info: (optional) May be used for non-entity data structures to provide info about the data properties, such that data selectors via an entity metadata wrapper are supported. Specify an array as expected by the $info parameter of entity_metadata_wrapper().

according to entity_metadata_wrapper() documentation:

property info: (optional) May be used to use a wrapper with an arbitrary data structure (type 'struct'). Use this key for specifying info about properties in the same structure as used by hook_entity_property_info().

according to hook_entity_property_info() documentation:

properties: The array describing all properties for this entity. Entries are keyed by the property name and contain an array of metadata for each property. The name may only contain alphanumeric lowercase characters and underscores.

The structure of uc_shipment in uc_shipping_rules_data_info() is like this:

  $entities['uc_shipment'] = array(
    //...
    'property info' => array(
      'sid' => array(/*...*/),
      'order-id' => array((/*...*/), // WRONG: Should be order_id - hyphen is not allowed.
      'origin' => array(/*...*/),
      'destination' => array(/*...*/),
      'shipping_method' => array(/*...*/),
      'accessorials' => array(/*...*/),
      'carrier' => array(/*...*/),
      'transaction-id' => array(/*...*/, // WRONG: hyphen is not allowed.
      'tracking-number' => array(/*...*/), WRONG: hyphen is not allowed.
      // ...
    ),
    //...
  );

What is wrong if name contains hyphen? Try to create a schedule rule on A shipment is saved event for example, and add an action to Schedule component evaluation with date selector shipment:ship-date or shipment:expected-delivery then click Save. The form will not validate saying that the parameter is incorect.

Patch will be provided.

CommentFileSizeAuthor
#1 Issue-2323887-1.patch3.27 KBSilviuChingaru

Comments

SilviuChingaru’s picture

Status: Active » Needs review
StatusFileSize
new3.27 KB

Fixed!

Status: Needs review » Needs work

The last submitted patch, 1: Issue-2323887-1.patch, failed testing.

Status: Needs work » Needs review

fiftyz queued 1: Issue-2323887-1.patch for re-testing.

  • longwave committed 0a40c4e on 7.x-3.x authored by fiftyz
    Issue #2323887 by fiftyz: Fixed implementation of hook_rules_data_info...
longwave’s picture

Status: Needs review » Fixed

Committed, thanks for the report and patch!

  • longwave committed 5ed4c8a on 8.x-4.x authored by fiftyz
    Issue #2323887 by fiftyz: Fixed implementation of hook_rules_data_info...
SilviuChingaru’s picture

Glad I could help. You're welcome, as always. ;-)

SilviuChingaru’s picture

Title: Incorect implementation of hook_rules_data_info() » Incorrect implementation of hook_rules_data_info()

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.