From 4ad408ae037b8d04231bd8efec6a5bc661bb1fd8 Mon Sep 17 00:00:00 2001 From: Vangelis Pantazis Date: Tue, 22 Oct 2019 08:47:51 +0100 Subject: [PATCH] Adds missing join on the custom table --- CRM/Contact/BAO/Query.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CRM/Contact/BAO/Query.php b/CRM/Contact/BAO/Query.php index 6f7cc442d6..0776ee72a5 100644 --- a/CRM/Contact/BAO/Query.php +++ b/CRM/Contact/BAO/Query.php @@ -1303,6 +1303,9 @@ class CRM_Contact_BAO_Query { break; default: + if (isset($addressCustomFields[$elementName]['custom_field_id']) && !empty($addressCustomFields[$elementName]['custom_field_id'])) { + $this->_tables[$tName] = "\nLEFT JOIN $tableName `$tName` ON `$tName`.id = $aName.id"; + } if ($addWhere) { $this->_whereTables["{$name}-address"] = $addressJoin; } -- 2.25.1