From 494d81e9376f6cc9597875565af59a0c7ac84fd6 Mon Sep 17 00:00:00 2001 From: Seamus Lee Date: Wed, 26 Feb 2020 13:02:04 +1100 Subject: [PATCH] [REF] Apply fix for CRM-607 for when building the select section of the query as well as in where --- CRM/Core/BAO/CustomQuery.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CRM/Core/BAO/CustomQuery.php b/CRM/Core/BAO/CustomQuery.php index 7e60838cba7..737b4b180c0 100644 --- a/CRM/Core/BAO/CustomQuery.php +++ b/CRM/Core/BAO/CustomQuery.php @@ -198,6 +198,10 @@ public function select() { } foreach (array_keys($this->_ids) as $id) { + // Ignore any custom field ids within the ids array that are not present in the fields array. + if (empty($this->_fields[$id])) { + continue; + } $field = $this->_fields[$id]; if ($this->_contactSearch && $field['search_table'] === 'contact_a') {