CRM-19337 fix contact sub_type display on reports
authoreileen <emcnaughton@wikimedia.org>
Tue, 11 Oct 2016 16:19:21 +0000 (17:19 +0100)
committereileen <emcnaughton@wikimedia.org>
Tue, 11 Oct 2016 16:20:06 +0000 (17:20 +0100)
CRM/Report/Form.php
CRM/Report/Form/Contact/Summary.php

index 95ffc12c84792caf28f86681e004598eceab3c0b..481828d2524ed648ed90326d8f9bb02c225ce686 100644 (file)
@@ -4309,10 +4309,17 @@ LEFT JOIN civicrm_contact {$field['alias']} ON {$field['alias']}.id = {$this->_a
     // There is no reason not to add links for all fields but it seems a bit odd to be able to click on
     // 'Mrs'. Also, we don't have metadata about the title. So, add selectively to addLinks.
     $addLinks = array('gender_id' => 'Gender');
-    foreach (array('prefix_id', 'suffix_id', 'gender_id') as $fieldName) {
+    foreach (array('prefix_id', 'suffix_id', 'gender_id', 'contact_sub_type', 'preferred_language') as $fieldName) {
       if (array_key_exists('civicrm_contact_' . $fieldName, $row)) {
         if (($value = $row['civicrm_contact_' . $fieldName]) != FALSE) {
-          $rows[$rowNum]['civicrm_contact_' . $fieldName] = CRM_Core_Pseudoconstant::getLabel('CRM_Contact_BAO_Contact', $fieldName, $value);
+          $rowValues = explode(CRM_Core_DAO::VALUE_SEPARATOR, $value);
+          $rowLabels = array();
+          foreach ($rowValues as $rowValue) {
+            if ($rowValue) {
+              $rowLabels[] = CRM_Core_Pseudoconstant::getLabel('CRM_Contact_BAO_Contact', $fieldName, $rowValue);
+            }
+          }
+          $rows[$rowNum]['civicrm_contact_' . $fieldName] = implode(', ', $rowLabels);
           if ($baseUrl && ($title = CRM_Utils_Array::value($fieldName, $addLinks)) != FALSE) {
             $this->addLinkToRow($rows[$rowNum], $baseUrl, $linkText, $value, $fieldName, 'civicrm_contact', $title);
           }
@@ -4513,6 +4520,7 @@ LEFT JOIN civicrm_contact {$field['alias']} ON {$field['alias']}.id = {$this->_a
       'do_not_sms' => array(),
       'is_opt_out' => array(),
       'is_deceased' => array(),
+      'preferred_language' => array(),
     );
   }
 
@@ -4579,6 +4587,9 @@ LEFT JOIN civicrm_contact {$field['alias']} ON {$field['alias']}.id = {$this->_a
         'title' => ts('Do not bulk email'),
         'type' => CRM_Utils_Type::T_BOOLEAN,
       ),
+      'preferred_language' => array(
+        'title' => ts('Preferred Language'),
+      ),
     );
   }
 
index b3759306ae04fda41ce6b9c41ddf9cd2b0e67db9..e3cc8bfea1b8118e4e55257f284961b533529a5e 100644 (file)
@@ -232,31 +232,6 @@ class CRM_Report_Form_Contact_Summary extends CRM_Report_Form {
     $this->endPostProcess($rows);
   }
 
-  /**
-   * Initialise basic row.
-   *
-   * @param array $rows
-   *
-   * @param bool $entryFound
-   * @param array $row
-   * @param int $rowId
-   * @param int $rowNum
-   * @param array $types
-   *
-   * @return bool
-   */
-  private function _initBasicRow(&$rows, &$entryFound, $row, $rowId, $rowNum, $types) {
-    if (!array_key_exists($rowId, $row)) {
-      return FALSE;
-    }
-
-    $value = $row[$rowId];
-    if ($value) {
-      $rows[$rowNum][$rowId] = $types[$value];
-    }
-    $entryFound = TRUE;
-  }
-
   /**
    * Alter display of rows.
    *