From 58f497045804ed7585dabb3675ced39478e30082 Mon Sep 17 00:00:00 2001 From: jitendrapurohit Date: Tue, 9 Aug 2016 12:54:41 +0530 Subject: [PATCH] more changes for additional intervals and mailing summary report --- CRM/Report/Form/Mailing/Summary.php | 18 +++++++++--------- CRM/Utils/OpenFlashChart.php | 14 ++++++++------ 2 files changed, 17 insertions(+), 15 deletions(-) diff --git a/CRM/Report/Form/Mailing/Summary.php b/CRM/Report/Form/Mailing/Summary.php index 2c2a0b798d..2386ac479e 100644 --- a/CRM/Report/Form/Mailing/Summary.php +++ b/CRM/Report/Form/Mailing/Summary.php @@ -580,26 +580,26 @@ class CRM_Report_Form_Mailing_Summary extends CRM_Report_Form { foreach ($rows as $row) { $chartInfo['values'][$row['civicrm_mailing_name']] = array(); if ($plotCount) { - foreach ($criteria['count'] as $criteria => $label) { - if (isset($row[$criteria])) { - $chartInfo['values'][$row['civicrm_mailing_name']][$label] = $row[$criteria]; + foreach ($criteria['count'] as $criteriaName => $label) { + if (isset($row[$criteriaName])) { + $chartInfo['values'][$row['civicrm_mailing_name']][$label] = $row[$criteriaName]; $chartInfo['tip'][$label] = "{$label} #val#"; $plotRate = FALSE; } - elseif (isset($criteria['count'][$criteria])) { - unset($criteria['count'][$criteria]); + elseif (isset($criteria['count'][$criteriaName])) { + unset($criteria['count'][$criteriaName]); } } } if ($plotRate) { - foreach ($criteria['rate'] as $criteria => $label) { + foreach ($criteria['rate'] as $criteriaName => $label) { if (isset($row[$criteria])) { - $chartInfo['values'][$row['civicrm_mailing_name']][$label] = $row[$criteria]; + $chartInfo['values'][$row['civicrm_mailing_name']][$label] = $row[$criteriaName]; $chartInfo['tip'][$label] = "{$label} #val#"; $plotCount = FALSE; } - elseif (isset($criteria['rate'][$criteria])) { - unset($criteria['rate'][$criteria]); + elseif (isset($criteria['rate'][$criteriaName])) { + unset($criteria['rate'][$criteriaName]); } } } diff --git a/CRM/Utils/OpenFlashChart.php b/CRM/Utils/OpenFlashChart.php index 0cd64aa973..99e7ed8396 100644 --- a/CRM/Utils/OpenFlashChart.php +++ b/CRM/Utils/OpenFlashChart.php @@ -410,23 +410,22 @@ class CRM_Utils_OpenFlashChart { $label = ucfirst($lcInterval); $chartData = $dateKeys = array(); $intervalLabels = array( + 'year' => ts('Yearly'), + 'fiscalyear' => ts('Yearly (Fiscal)'), 'month' => ts('Monthly'), 'quarter' => ts('Quarterly'), 'week' => ts('Weekly'), + 'yearweek' => ts('Weekly'), ); switch ($lcInterval) { case 'month': case 'quarter': case 'week': + case 'yearweek': foreach ($rows['receive_date'] as $key => $val) { list($year, $month) = explode('-', $val); - if ($lcInterval != 'year') { - $dateKeys[] = substr($rows[$interval][$key], 0, 3) . ' of ' . $year; - } - else { - $dateKeys[] = $year; - } + $dateKeys[] = substr($rows[$interval][$key], 0, 3) . ' of ' . $year; } $legend = $intervalLabels[$lcInterval]; break; @@ -437,6 +436,9 @@ class CRM_Utils_OpenFlashChart { $dateKeys[] = $year; } $legend = ts("%1", array(1 => $label)); + if (!empty($intervalLabels[$lcInterval])) { + $legend = $intervalLabels[$lcInterval]; + } break; } -- 2.25.1