Details
-
Type: Bug
-
Status: Done/Fixed
-
Priority: Major
-
Resolution: Fixed/Completed
-
Affects Version/s: 4.6.9
-
Fix Version/s: None
-
Component/s: CiviCRM API
-
Labels:
-
Documentation Required?:None
-
Funding Source:Contributed Code
Description
Test not happening when custom variable on membership is used in an API filter. For instance, I created the following using the API explorer ...
$result = civicrm_api3('Membership', 'get', array( 'sequential' => 1, 'custom_7' => "CI", ));
At least in my mind, only records where custom_7 has "CI" as the value should be returned.
However, all values of custom_7 are returned.
{ "is_error":0, "version":3, "count":25, "values":[{ "id":"29139", "contact_id":"11847", "membership_type_id":"7", "join_date":"2012-10-01", "start_date":"2012-10-01", "end_date":"2016-10-31", "status_id":"2", "max_related":"4", "is_test":"0", "is_pay_later":"0", "membership_name":"Family/Household", "relationship_name":"Household Member of", "custom_7":"LB", "custom_7_29116":"LB" }, { "id":"29140", "contact_id":"3848", "membership_type_id":"7", "join_date":"2012-10-01", "start_date":"2012-10-01", "end_date":"2016-10-31", "status_id":"2", "owner_membership_id":"29139", "is_test":"0", "is_pay_later":"0", "membership_name":"Family/Household", "relationship_name":"Household Member of", "custom_7":"LB", "custom_7_29117":"LB" }, { "id":"29141", "contact_id":"11385", "membership_type_id":"7", "join_date":"2012-10-01", "start_date":"2012-10-01", "end_date":"2016-10-31", "status_id":"2", "owner_membership_id":"29139", "is_test":"0", "is_pay_later":"0", "membership_name":"Family/Household", "relationship_name":"Household Member of", "custom_7":"LB", "custom_7_29118":"LB" }, .........................etc.
A similar result occur if the test is expressed as "IN"
$result = civicrm_api3('Membership', 'get', array( 'sequential' => 1, 'custom_7' => array('IN' => array("CI")), ));
I don't think it matters which form of the API is used – the problem definitely exists if REST is used.