From 3743fd3dfeee1fabe2c1707b3cd58c2d44121095 Mon Sep 17 00:00:00 2001 From: Coleman Watts Date: Thu, 9 Nov 2017 08:33:12 -0500 Subject: [PATCH] CRM-21349 - Improve batch merge status message --- CRM/Contact/Page/DedupeFind.php | 6 ++++-- CRM/Dedupe/Merger.php | 11 +++++------ 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/CRM/Contact/Page/DedupeFind.php b/CRM/Contact/Page/DedupeFind.php index 344efad2aa..99a91201de 100644 --- a/CRM/Contact/Page/DedupeFind.php +++ b/CRM/Contact/Page/DedupeFind.php @@ -147,9 +147,11 @@ class CRM_Contact_Page_DedupeFind extends CRM_Core_Page_Basic { //reload from cache table $cacheKeyString = CRM_Dedupe_Merger::getMergeCacheKeyString($rgid, $gid, $criteria); - $stats = CRM_Dedupe_Merger::getMergeStatsMsg($cacheKeyString); + $stats = CRM_Dedupe_Merger::getMergeStats($cacheKeyString); if ($stats) { - CRM_Core_Session::setStatus($stats, ts('Batch Complete'), 'alert', array('expires' => 0)); + $message = CRM_Dedupe_Merger::getMergeStatsMsg($stats); + $status = empty($stats['skipped']) ? 'success' : 'alert'; + CRM_Core_Session::setStatus($message, ts('Batch Complete'), $status, array('expires' => 0)); // reset so we not displaying same message again CRM_Dedupe_Merger::resetMergeStats($cacheKeyString); } diff --git a/CRM/Dedupe/Merger.php b/CRM/Dedupe/Merger.php index 47cc8b7435..974b94e162 100644 --- a/CRM/Dedupe/Merger.php +++ b/CRM/Dedupe/Merger.php @@ -739,18 +739,17 @@ INNER JOIN civicrm_membership membership2 ON membership1.membership_type_id = m /** * Get merge statistics message. * - * @param string $cacheKeyString + * @param array $stats * * @return string */ - public static function getMergeStatsMsg($cacheKeyString) { - $msg = ''; - $stats = CRM_Dedupe_Merger::getMergeStats($cacheKeyString); + public static function getMergeStatsMsg($stats) { + $msg = ''; if (!empty($stats['merged'])) { - $msg = "{$stats['merged']} " . ts('Contact(s) were merged.'); + $msg = '

' . ts('One contact merged.', array(1 => $stats['merged'], 'plural' => '%1 contacts merged.')) . '

'; } if (!empty($stats['skipped'])) { - $msg .= $stats['skipped'] . ts(' Contact(s) were skipped.'); + $msg .= '

' . ts('One contact was skipped.', array(1 => $stats['skipped'], 'plural' => '%1 contacts were skipped.')) . '

'; } return $msg; } -- 2.25.1