From 7bae3d15b0faa1070ac41e432df466f2c6cf553f Mon Sep 17 00:00:00 2001
From: Jared Hancock <jared@osticket.com>
Date: Thu, 22 May 2014 16:53:15 -0500
Subject: [PATCH]  pjax: Cancel auto refresh on manual refresh

---
 scp/js/scp.js   | 3 +--
 scp/tickets.php | 3 ++-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/scp/js/scp.js b/scp/js/scp.js
index d77060212..cc9db7daa 100644
--- a/scp/js/scp.js
+++ b/scp/js/scp.js
@@ -632,8 +632,7 @@ getConfig = (function() {
 })();
 
 $(document).on('pjax:click', function(options) {
-    if (window.ticket_refresh !== undefined)
-        clearInterval(window.ticket_refresh);
+    clearTimeout(window.ticket_refresh);
     // Release ticket lock (maybe)
     if ($.autoLock !== undefined)
         $.autoLock.releaseLock();
diff --git a/scp/tickets.php b/scp/tickets.php
index f22f7a064..82f0e569f 100644
--- a/scp/tickets.php
+++ b/scp/tickets.php
@@ -620,7 +620,8 @@ if($ticket) {
 
     //set refresh rate if the user has it configured
     if(!$_POST && !$_REQUEST['a'] && ($min=$thisstaff->getRefreshRate())) {
-        $js = "window.ticket_refresh = setTimeout($.refreshTicketView,"
+        $js = "clearTimeout(window.ticket_refresh);
+               window.ticket_refresh = setTimeout($.refreshTicketView,"
             .($min*60000).");";
         $ost->addExtraHeader('<script type="text/javascript">'.$js.'</script>',
             $js);
-- 
GitLab