From f68eb308c648d249ae4efb8670e46b69d4b25f4f Mon Sep 17 00:00:00 2001
From: Jared Hancock <jared@osticket.com>
Date: Tue, 6 Jan 2015 11:51:26 -0600
Subject: [PATCH] oops: Fix advanced search regression from fcb34cfb

Don't add to endTime if not already set
---
 include/ajax.tickets.php | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/include/ajax.tickets.php b/include/ajax.tickets.php
index 4c2998693..4ad0d061f 100644
--- a/include/ajax.tickets.php
+++ b/include/ajax.tickets.php
@@ -191,7 +191,9 @@ class TicketsAjaxAPI extends AjaxController {
         //dates
         $startTime  =($req['startDate'] && (strlen($req['startDate'])>=8))?strtotime($req['startDate']):0;
         $endTime    =($req['endDate'] && (strlen($req['endDate'])>=8))?strtotime($req['endDate']):0;
-		$endTime += (60 * 60 * 24) - 1;	// $endTime should be the last second of the day, not the first like $startTime
+        if ($endTime)
+            // $endTime should be the last second of the day, not the first like $startTime
+            $endTime += (60 * 60 * 24) - 1;
         if( ($startTime && $startTime>time()) or ($startTime>$endTime && $endTime>0))
             $startTime=$endTime=0;
 
-- 
GitLab