From 40554aa3221fa3d7e853065700f81ed0c6e5d673 Mon Sep 17 00:00:00 2001 From: Deepak Srivastava Date: Wed, 4 Sep 2013 17:30:48 +0530 Subject: [PATCH] CRM-13335 --- CRM/Logging/ReportDetail.php | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/CRM/Logging/ReportDetail.php b/CRM/Logging/ReportDetail.php index ed054a8ec7..0ee0fad709 100644 --- a/CRM/Logging/ReportDetail.php +++ b/CRM/Logging/ReportDetail.php @@ -152,20 +152,24 @@ class CRM_Logging_ReportDetail extends CRM_Report_Form { continue; } - // CRM-7251: special-case preferred_communication_method - if ($field == 'preferred_communication_method') { - $froms = array(); - $tos = array(); - foreach (explode(CRM_Core_DAO::VALUE_SEPARATOR, $from) as $val) $froms[] = CRM_Utils_Array::value($val, $values[$field]); - foreach (explode(CRM_Core_DAO::VALUE_SEPARATOR, $to) as $val) $tos[] = CRM_Utils_Array::value($val, $values[$field]); + // special-case for multiple values. Also works for CRM-7251: preferred_communication_method + if ((substr($from, 0, 1) == CRM_Core_DAO::VALUE_SEPARATOR && + substr($from, -1, 1) == CRM_Core_DAO::VALUE_SEPARATOR) || + (substr($to, 0, 1) == CRM_Core_DAO::VALUE_SEPARATOR && + substr($to, -1, 1) == CRM_Core_DAO::VALUE_SEPARATOR)) { + $froms = $tos = array(); + foreach (explode(CRM_Core_DAO::VALUE_SEPARATOR, trim($from, CRM_Core_DAO::VALUE_SEPARATOR)) as $val) { + $froms[] = CRM_Utils_Array::value($val, $values[$field]); + } + foreach (explode(CRM_Core_DAO::VALUE_SEPARATOR, trim($to, CRM_Core_DAO::VALUE_SEPARATOR)) as $val) { + $tos[] = CRM_Utils_Array::value($val, $values[$field]); + } $from = implode(', ', array_filter($froms)); - $to = implode(', ', array_filter($tos)); + $to = implode(', ', array_filter($tos)); } if (isset($values[$field][$from])) { - $from = $values[$field][$from]; - } if (isset($values[$field][$to])) { $to = $values[$field][$to]; -- 2.25.1