When adding unlimited resources to booking, choosing the resource you want to add using the select combo box should load the options configured for that resource (eg. Choosing 'Hot Beverages' loads options 'Tea' and 'Coffee'). This was not happening, on some cases loading options for a different resource instead, while on others the options simply never loaded.
Before
Loading of options is done via a series of chained API calls, from Resource, to Resource Set, to Resource Set Options. A bug injected on CiviCRM v4.7.19 on PR https://github.com/civicrm/civicrm-core/pull/10033, caused chained API calls using '$value.' to chain values to be interpreted as operators with syntax: array('OP' => $val) instead. This only happened if the first parameter for the chained API call uses '$value.'. The bug has been fixed on CiviCRM core and is set to be released on v4.7.28.
After
Fixed by implementing civicrm_apiWrappers hook to preprocess parameters array to make sure the first parameter of a chained API call is not a chained value. This way, the calls should work both on versions with the bug and versions without it.
Overview
When adding unlimited resources to booking, choosing the resource you want to add using the select combo box should load the options configured for that resource (eg. Choosing 'Hot Beverages' loads options 'Tea' and 'Coffee'). This was not happening, on some cases loading options for a different resource instead, while on others the options simply never loaded.
Before
Loading of options is done via a series of chained API calls, from Resource, to Resource Set, to Resource Set Options. A bug injected on CiviCRM v4.7.19 on PR https://github.com/civicrm/civicrm-core/pull/10033, caused chained API calls using '$value.' to chain values to be interpreted as operators with syntax: array('OP' => $val) instead. This only happened if the first parameter for the chained API call uses '$value.'. The bug has been fixed on CiviCRM core and is set to be released on v4.7.28.
After
Fixed by implementing civicrm_apiWrappers hook to preprocess parameters array to make sure the first parameter of a chained API call is not a chained value. This way, the calls should work both on versions with the bug and versions without it.
Comments
Line that injects the bug: https://github.com/civicrm/civicrm-core/blob/4.7.19/api/api.php#L136 Fix done on CiviCRM: https://github.com/civicrm/civicrm-core/blob/4.7.28-rc/api/api.php#L132-L135