From: eileenmcnaugton Date: Thu, 8 Oct 2015 04:53:05 +0000 (+1300) Subject: CRM-17075 hack back in handling for membership_type_id as temp fix X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=beccb90fd6cbdcd6463b573ab4faef35f5eac088;p=civicrm-core.git CRM-17075 hack back in handling for membership_type_id as temp fix --- diff --git a/CRM/Contact/BAO/GroupContactCache.php b/CRM/Contact/BAO/GroupContactCache.php index 74fbe77fe1..f1a347db0b 100644 --- a/CRM/Contact/BAO/GroupContactCache.php +++ b/CRM/Contact/BAO/GroupContactCache.php @@ -486,7 +486,14 @@ WHERE id = %1 } 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, diff --git a/CRM/Member/BAO/Query.php b/CRM/Member/BAO/Query.php index 4ea1590660..ea4f03eb2f 100644 --- a/CRM/Member/BAO/Query.php +++ b/CRM/Member/BAO/Query.php @@ -211,6 +211,15 @@ class CRM_Member_BAO_Query { 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':