From e81416232a61bba1f706c0abc0fc2e8e09703f9b Mon Sep 17 00:00:00 2001
From: Peter Rotich <peter@osticket.com>
Date: Sun, 7 Apr 2013 13:52:28 -0400
Subject: [PATCH] Stop internal note alerts from being sent to the staff
 posting the note/activity.

---
 include/class.ticket.php | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/include/class.ticket.php b/include/class.ticket.php
index 21a4bd8f1..60d26d7eb 100644
--- a/include/class.ticket.php
+++ b/include/class.ticket.php
@@ -1549,8 +1549,11 @@ class Ticket {
             $attachments = $note->getAttachments();
             $sentlist=array();
             foreach( $recipients as $k=>$staff) {
-                if(!$staff || !is_object($staff) || !$staff->getEmail() || !$staff->isAvailable()) continue;
-                if(in_array($staff->getEmail(), $sentlist) || ($staffId && $staffId==$staff->getId())) continue;
+                if(!is_object($staff)
+                        || !$staff->isAvailable() //Don't bother vacationing staff.
+                        || in_array($staff->getEmail(), $sentlist) //No duplicates.
+                        || $note->getStaffId() == $staff->getId())  //No need to alert the poster!
+                    continue;
                 $alert = str_replace('%{recipient}', $staff->getFirstName(), $msg['body']);
                 $email->sendAlert($staff->getEmail(), $msg['subj'], $alert, $attachments);
                 $sentlist[] = $staff->getEmail();
-- 
GitLab