Remove early return on joinTable
authoreileen <emcnaughton@wikimedia.org>
Mon, 4 Nov 2019 01:05:30 +0000 (14:05 +1300)
committereileen <emcnaughton@wikimedia.org>
Mon, 4 Nov 2019 01:06:01 +0000 (14:06 +1300)
I looked up the reason for the early return here and it was that the UI for adding other tables
in was too complex. In other words the removed lines should never be true.

However, I don't think it's the place of the query object to enforce not attempting a query the
UI struggles with. Removing this will save a later person having to figure that out

CRM/Core/BAO/CustomQuery.php

index a3e2cf2736773a5d336c807136530713a2284470..776d2554eca98fda732de1ffa650ec3ed6f0694c 100644 (file)
@@ -148,7 +148,7 @@ class CRM_Core_BAO_CustomQuery {
    * @param array $locationSpecificFields
    */
   public function __construct($ids, $contactSearch = FALSE, $locationSpecificFields = []) {
-    $this->_ids = &$ids;
+    $this->_ids = $ids;
     $this->_locationSpecificCustomFields = $locationSpecificFields;
 
     $this->_select = [];
@@ -222,10 +222,6 @@ SELECT f.id, f.label, f.data_type,
       $this->_select[$fieldName] = "{$field['table_name']}.{$field['column_name']} as $fieldName";
       $this->_element[$fieldName] = 1;
       $joinTable = $field['search_table'];
-      // CRM-14265
-      if ($joinTable == 'civicrm_group' || empty($joinTable)) {
-        return;
-      }
 
       $this->joinCustomTableForField($field);