CRM-16930 - enable custom case fields on case report.
authorJamie McClelland <jm@mayfirst.org>
Wed, 29 Jul 2015 16:22:53 +0000 (12:22 -0400)
committerJamie McClelland <jm@mayfirst.org>
Wed, 29 Jul 2015 16:22:53 +0000 (12:22 -0400)
CRM/Case/XMLProcessor/Report.php
templates/CRM/Case/Audit/Report.tpl

index cdbe24399eef2196d7645e519222ad0a1740b445..d3396432d698a7bca9ef2330536b783607ea0fdd 100644 (file)
@@ -974,11 +974,27 @@ LIMIT  1
       }
     }
 
+    // Retrieve custom values for cases.
+    $customValues = CRM_Core_BAO_CustomValueTable::getEntityValues($caseID, 'Case');
+    $extends = array('case');
+    $groupTree = CRM_Core_BAO_CustomGroup::getGroupDetail(NULL, NULL, $extends);
+    $caseCustomFields = array();
+    while(list($id, $group_values) = each($groupTree)) {
+      while(list($id, $field_values) = each($group_values['fields'])) {
+        if(array_key_exists($id, $customValues)) {
+          $caseCustomFields[$id] = array(
+            'label' => $field_values['label'],
+            'value' => $customValues[$id],
+          );
+        }
+      }
+    }
     $template->assign('caseRelationships', $caseRelationships);
     $template->assign('caseRoles', $caseRoles);
     $template->assign('otherRelationships', $otherRelationships);
     $template->assign('globalRelationships', $relGlobal);
     $template->assign('globalGroupInfo', $globalGroupInfo);
+    $template->assign('caseCustomFields', $caseCustomFields);
     $contents = self::getCaseReport($clientID,
       $caseID,
       $activitySetName,
index a2beff3a23d262b0a48b21f99793a323df13db1f..5dd29686c4e127efe8b83280e6f47371a9187a02 100644 (file)
     </table>
 {/if}
 
+{if $caseCustomFields}
+<h2>{ts}Case Custom Fields{/ts}</h2>
+    <table class ="report-layout">
+      {foreach from=$caseCustomFields item=row}
+        <tr>
+          <th class="label">{$row.label}</td>
+          <td class="crm-case-report-custom-field">{$row.value}</td>
+        </tr>
+      {/foreach}
+    </table>
+{/if}
+
 <h2>{ts}Case Activities{/ts}</h2>
 {foreach from=$activities item=activity key=key}
   <table  class ="report-layout">