From 97529ad0ff53eccd96e78bdfb46ffc0931a8baab Mon Sep 17 00:00:00 2001 From: mgrauer Date: Mon, 1 Feb 2016 23:05:35 +0000 Subject: [PATCH 1/2] Add details & Gmail view action to threshold notification --- modules/tracker/Notification.php | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/modules/tracker/Notification.php b/modules/tracker/Notification.php index 86d12c207..e7620ab13 100644 --- a/modules/tracker/Notification.php +++ b/modules/tracker/Notification.php @@ -168,7 +168,14 @@ public function sendEmail($params) $producerDao = $trendDao->getProducer(); $fullUrl = UtilityComponent::getServerURL().$this->webroot; $email = $userDao->getEmail(); - $subject = 'Tracker Dashboard Threshold Notification'; + + $producerName = $producerDao->getDisplayName(); + $trendName = $trendDao->getDisplayName(); + $thresholdValue = $notification['value']; + $thresholdComparison = $notification['comparison']; + $scalarValue = $scalar['value']; + $subject = 'Threshold Alert: ' . $producerName . ': ' . $trendName . ' value ' . $scalarValue . ' ' . $thresholdComparison . ' ' . $thresholdValue; + $body = 'Hello,

This email was sent because a submitted scalar value exceeded a threshold that you specified.

'; $body .= 'Community: '.htmlspecialchars($producerDao->getCommunity()->getName(), ENT_QUOTES, 'UTF-8').'
'; @@ -176,7 +183,19 @@ public function sendEmail($params) ).'">'.htmlspecialchars($producerDao->getDisplayName(), ENT_QUOTES, 'UTF-8').'
'; $body .= 'Trend: '.htmlspecialchars($trendDao->getDisplayName(), ENT_QUOTES, 'UTF-8').'
'; - $body .= 'Value: '.htmlspecialchars($scalar['value'], ENT_QUOTES, 'UTF-8'); + $body .= 'Visit the above Trend link to change or disable notifications.
'; + $body .= 'Value: '.htmlspecialchars($scalarValue, ENT_QUOTES, 'UTF-8').'
'; + $body .= 'Threshold: '.htmlspecialchars($thresholdComparison, ENT_QUOTES, 'UTF-8').' '.htmlspecialchars($thresholdValue, ENT_QUOTES, 'UTF-8').'
'; + + // Add gmail "View Action". + $trendTrackerUrl = $fullUrl.'/'.$this->moduleName.'/trend/view?trendId='.$trendDao->getKey(); + $body .= '
'; + $body .= '
'; + $body .= ' '; + $body .= ' '; + $body .= '
'; + $body .= ' '; + $body .= '
'; Zend_Registry::get('notifier')->callback( 'CALLBACK_CORE_SEND_MAIL_MESSAGE', From 34f21eb156eaeed84a9e16ecabbf16a3da66cb71 Mon Sep 17 00:00:00 2001 From: Patrick Reynolds Date: Mon, 1 Feb 2016 21:56:23 -0500 Subject: [PATCH 2/2] Applied fixes from StyleCI --- modules/tracker/Notification.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/tracker/Notification.php b/modules/tracker/Notification.php index e7620ab13..0859a771a 100644 --- a/modules/tracker/Notification.php +++ b/modules/tracker/Notification.php @@ -174,7 +174,7 @@ public function sendEmail($params) $thresholdValue = $notification['value']; $thresholdComparison = $notification['comparison']; $scalarValue = $scalar['value']; - $subject = 'Threshold Alert: ' . $producerName . ': ' . $trendName . ' value ' . $scalarValue . ' ' . $thresholdComparison . ' ' . $thresholdValue; + $subject = 'Threshold Alert: '.$producerName.': '.$trendName.' value '.$scalarValue.' '.$thresholdComparison.' '.$thresholdValue; $body = 'Hello,

This email was sent because a submitted scalar value exceeded a threshold that you specified.

'; $body .= 'Community: