From 8f0fd14c0d2025102c94209ac4b43d30bb158551 Mon Sep 17 00:00:00 2001 From: Alajede Samson Date: Sat, 16 Dec 2017 13:19:12 +0100 Subject: [PATCH] CRM-21159 Address fields cause DB errors when adding contacts to group from Search Builder --- CRM/Contact/BAO/Query.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/CRM/Contact/BAO/Query.php b/CRM/Contact/BAO/Query.php index b4c5951fb6..43a71e7ba8 100644 --- a/CRM/Contact/BAO/Query.php +++ b/CRM/Contact/BAO/Query.php @@ -2142,6 +2142,7 @@ class CRM_Contact_BAO_Query { } $this->_where[$grouping][] = self::buildClause($where, $op, $value); + $this->_tables[$aName] = $this->_whereTables[$aName] = 1; list($qillop, $qillVal) = self::buildQillForFieldValue('CRM_Core_DAO_Address', "state_province_id", $value, $op); $this->_qill[$grouping][] = ts("%1 %2 %3", array(1 => $field['title'], 2 => $qillop, 3 => $qillVal)); } @@ -2170,8 +2171,9 @@ class CRM_Contact_BAO_Query { } $this->_where[$grouping][] = self::buildClause($where, $op, $value, 'Positive'); + $this->_tables[$aName] = $this->_whereTables[$aName] = 1; - list($qillop, $qillVal) = CRM_Contact_BAO_Query::buildQillForFieldValue(NULL, $name, $value, $op); + list($qillop, $qillVal) = CRM_Contact_BAO_Query::buildQillForFieldValue(NULL, $name, $value, $op); $this->_qill[$grouping][] = ts("%1 %2 %3", array(1 => $field['title'], 2 => $qillop, 3 => $qillVal)); } elseif ($name === 'world_region') { -- 2.25.1