Adds missing join on the custom table
authorVangelis Pantazis <v.pantazis@ixiam.com>
Tue, 22 Oct 2019 07:47:51 +0000 (08:47 +0100)
committerVangelis Pantazis <v.pantazis@ixiam.com>
Wed, 23 Oct 2019 11:50:10 +0000 (12:50 +0100)
CRM/Contact/BAO/Query.php

index 6f7cc442d644b31c0a7fe96b26649e3f345aa31d..0776ee72a52ca44c64d7b80b82d6c1d0a1d54422 100644 (file)
@@ -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;
                   }