CRM-13011 : applied the patch
authorPratik Joshi <pratik.joshi@webaccess.co.in>
Mon, 8 Jul 2013 15:01:22 +0000 (20:31 +0530)
committerPratik Joshi <pratik.joshi@webaccess.co.in>
Mon, 8 Jul 2013 15:01:22 +0000 (20:31 +0530)
CRM/Contact/BAO/Query.php

index b02f972a88f7d759891e79f0a2f889aa42e8fda0..ea7e41a501244083141420ac283b44f6d5b14ac4 100644 (file)
@@ -860,7 +860,10 @@ class CRM_Contact_BAO_Query {
           if (($elementName != 'phone') && ($elementName != 'im')) {
             $cond = self::getPrimaryCondition($elementType);
           }
-          if ((!$cond) && ($elementName == 'phone')) {
+          // CRM-13011 : If location type is primary, do not restrict search to the phone
+          // type id - we want the primary phone, regardless of what type it is.
+          // Otherwise, restrict to the specified phone type for the given field.
+          if ((!$cond) && ($elementName == 'phone') && $elements['location_type'] != 'Primary') {
             $cond = "phone_type_id = '$elementType'";
           }
           elseif ((!$cond) && ($elementName == 'im')) {