}
else {
$formValues = CRM_Contact_BAO_SavedSearch::getFormValues($savedSearchID);
-
+ // CRM-17075 using the formValues in this way imposes extra logic and complexity.
+ // we have the where_clause and where tables stored in the saved_search table
+ // and should use these rather than re-processing the form criteria (which over-works
+ // the link between the form layer & the query layer too).
+ // It's hard to think of when you would want to use anything other than return
+ // properties = array('contact_id' => 1) here as the point would appear to be to
+ // generate the list of contact ids in the group.
+ // @todo review this to use values in saved_search table (preferably for 4.8).
$query
= new CRM_Contact_BAO_Query(
$ssParams, $returnProperties, NULL,
case 'membership_status_id':
case 'membership_type':
case 'membership_type_id':
+ // CRM-17075 we are specifically handling the possibility we are dealing with the entity reference field
+ // for membership_type_id here (although status would be handled if converted). The unhandled pathway at the moment
+ // is from groupContactCache::load and this is a small fix to get the entity reference field to work.
+ // However, it would seem the larger fix would be to NOT invoke the form formValues for
+ // the load function. The where clause and the whereTables are saved so they should suffice to generate the query
+ // to get a contact list. But, better to deal with in 4.8 now...
+ if (is_string($value) && strpos($value, ',') && $op == '=') {
+ $value = array('IN' => explode(',', $value));
+ }
case 'member_id':
case 'member_campaign_id':