CRM-14919 fix api test failures and notice fixes
authorNileema <nileema@nileema.(none)>
Mon, 30 Jun 2014 11:53:34 +0000 (17:23 +0530)
committerNileema <nileema@nileema.(none)>
Mon, 30 Jun 2014 11:54:28 +0000 (17:24 +0530)
----------------------------------------
* CRM-14919: Add icon for related contact in listing in the relationship tab
  https://issues.civicrm.org/jira/browse/CRM-14919

CRM/Contact/BAO/Relationship.php

index 19f2a9d3a6fcb24a3b2122425561819d81208117..d5f0a02e03eb3df198ad88568bd7115aa63f96a5 100644 (file)
@@ -846,6 +846,7 @@ WHERE  relationship_type_id = " . CRM_Utils_Type::escape($type, 'Integer');
                               civicrm_state_province.abbreviation as state,
                               civicrm_country.name as country,
                               civicrm_email.email as email,
+                              civicrm_contact.contact_type as contact_type,
                               civicrm_phone.phone as phone,
                               civicrm_contact.id as civicrm_contact_id,
                               civicrm_relationship.contact_id_b as contact_id_b,
@@ -861,13 +862,11 @@ WHERE  relationship_type_id = " . CRM_Utils_Type::escape($type, 'Integer');
 
       if ($direction == 'a_b') {
         $select .= ', civicrm_relationship_type.label_a_b as label_a_b,
-                              civicrm_relationship_type.label_b_a as relation,
-                              civicrm_contact.contact_type as contact_type_a_b ';
+                              civicrm_relationship_type.label_b_a as relation ';
       }
       else {
         $select .= ', civicrm_relationship_type.label_a_b as label_a_b,
-                              civicrm_relationship_type.label_a_b as relation,
-                              civicrm_contact.contact_type as contact_type_b_a ';
+                              civicrm_relationship_type.label_a_b as relation ';
       }
     }
 
@@ -1055,8 +1054,7 @@ LEFT JOIN  civicrm_country ON (civicrm_address.country_id = civicrm_country.id)
         $values[$rid]['cid'] = $cid;
         $values[$rid]['contact_id_a'] = $relationship->contact_id_a;
         $values[$rid]['contact_id_b'] = $relationship->contact_id_b;
-        $values[$rid]['contact_type_a_b'] = $relationship->contact_type_a_b;
-        $values[$rid]['contact_type_b_a'] = $relationship->contact_type_b_a;
+        $values[$rid]['contact_type'] = $relationship->contact_type;
         $values[$rid]['relationship_type_id'] = $relationship->civicrm_relationship_type_id;
         $values[$rid]['relation'] = $relationship->relation;
         $values[$rid]['name'] = $relationship->sort_name;
@@ -1709,7 +1707,7 @@ AND cc.sort_name LIKE '%$name%'";
       // format params
       foreach ($relationships as $relationshipId => $values) {
         //Add image icon for related contacts: CRM-14919
-        $icon = CRM_Contact_BAO_Contact_Utils::getImage($values['contact_type_a_b'],
+        $icon = CRM_Contact_BAO_Contact_Utils::getImage($values['contact_type'],
           FALSE,
           $values['cid']
         );