Fix broken subtype icon CRM-12054
authorColeman Watts <coleman@civicrm.org>
Sat, 9 Mar 2013 00:07:08 +0000 (16:07 -0800)
committerColeman Watts <coleman@civicrm.org>
Sat, 9 Mar 2013 00:07:08 +0000 (16:07 -0800)
CRM/Contact/Selector.php

index 02311baf6bc891cb8a52aef7d2be0261499f2863..33c00616c786a12e402849aed3d730cf0ada81de 100644 (file)
@@ -752,7 +752,7 @@ class CRM_Contact_Selector extends CRM_Core_Selector_Base implements CRM_Core_Se
           $result->contact_id
         );
 
-        $row['contact_type_orig'] = $result->contact_type;
+        $row['contact_type_orig'] = $result->contact_sub_type ? $result->contact_sub_type : $result->contact_type;
         $row['contact_sub_type']  = $result->contact_sub_type ?
           CRM_Contact_BAO_ContactType::contactTypePairs(FALSE, $result->contact_sub_type, ', ') : $result->contact_sub_type;
         $row['contact_id'] = $result->contact_id;
@@ -861,16 +861,8 @@ class CRM_Contact_Selector extends CRM_Core_Selector_Base implements CRM_Core_Se
       // allow components to add more actions
       CRM_Core_Component::searchAction($row, $row['contact_id']);
 
-      $contactType = null;
-      if ( CRM_Utils_Array::value('contact_sub_type', $row) ) {
-        $contactType = $row['contact_sub_type'];
-    }
-      elseif ( CRM_Utils_Array::value('contact_type_orig', $row) ) {
-        $contactType = $row['contact_type_orig'];
-  }
-
-      if ( $contactType ) {
-        $row['contact_type'] = CRM_Contact_BAO_Contact_Utils::getImage($contactType,
+      if (!empty($row['contact_type_orig'])) {
+        $row['contact_type'] = CRM_Contact_BAO_Contact_Utils::getImage($row['contact_type_orig'],
           FALSE, $row['contact_id']);
       }
     }