//we have a join on an address table - possibly in conjunction with search builder - CRM-14263
$parts = explode('-', $name);
$locationID = array_search($parts[0], CRM_Core_BAO_Address::buildOptions('location_type_id', 'get', array('name' => $parts[0])));
- $from .= " $side JOIN civicrm_address `{$name}` ON ( contact_a.id = `{$name}`.contact_id ) and location_type_id = $locationID ";
+ $from .= " $side JOIN civicrm_address `{$name}` ON ( contact_a.id = `{$name}`.contact_id ) and `{$name}`.location_type_id = $locationID ";
}
else {
$from .= CRM_Core_Component::from($name, $mode, $side);