From d9170202310744904f91b2f407e8fbaea693fedf Mon Sep 17 00:00:00 2001 From: Mathieu Lutfy Date: Fri, 28 Feb 2020 16:52:06 -0500 Subject: [PATCH] CiviCase: fix case custom data values in Case Audit Report --- CRM/Case/XMLProcessor/Report.php | 18 +++--------------- templates/CRM/Case/Audit/Report.tpl | 24 +++++++++++++----------- 2 files changed, 16 insertions(+), 26 deletions(-) diff --git a/CRM/Case/XMLProcessor/Report.php b/CRM/Case/XMLProcessor/Report.php index fc4d6a2d3ece..840202bde12f 100644 --- a/CRM/Case/XMLProcessor/Report.php +++ b/CRM/Case/XMLProcessor/Report.php @@ -956,26 +956,14 @@ public static function printCaseReport() { // 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(); - foreach ($groupTree as $gid => $group_values) { - foreach ($group_values['fields'] as $id => $field_values) { - if (array_key_exists($id, $customValues)) { - $caseCustomFields[$gid]['title'] = $group_values['title']; - $caseCustomFields[$gid]['values'][$id] = array( - 'label' => $field_values['label'], - 'value' => $customValues[$id], - ); - } - } - } + $groupTree = CRM_Core_BAO_CustomGroup::getTree('Case', NULL, $caseID); + CRM_Core_BAO_CustomGroup::buildCustomDataView($template, $groupTree, FALSE, NULL, NULL, NULL, $caseID); + $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, diff --git a/templates/CRM/Case/Audit/Report.tpl b/templates/CRM/Case/Audit/Report.tpl index fb28c7034daa..55b8a64a24ac 100644 --- a/templates/CRM/Case/Audit/Report.tpl +++ b/templates/CRM/Case/Audit/Report.tpl @@ -114,17 +114,19 @@ {/if} -{if $caseCustomFields} - {foreach from=$caseCustomFields item=group} -

{$group.title}

- - {foreach from=$group.values item=row} - - - - {/foreach} -
{$row.label} - {$row.value}
+{if $viewCustomData} + {foreach from=$viewCustomData item=cd} + {foreach from=$cd item=group} +

{$group.title}

+ + {foreach from=$group.fields item=row} + + + + {/foreach} +
{$row.field_title} + {$row.field_value}
+ {/foreach} {/foreach} {/if}