From 5234b466d6c1376b5c56fecce8a308ec0397d5fe Mon Sep 17 00:00:00 2001
From: Jared Hancock <jared@osticket.com>
Date: Wed, 20 May 2015 15:30:02 -0500
Subject: [PATCH] i18n: Cascade to system default timezone

---
 include/class.config.php | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)

diff --git a/include/class.config.php b/include/class.config.php
index cb1f15d5c..fa08a5127 100644
--- a/include/class.config.php
+++ b/include/class.config.php
@@ -258,18 +258,23 @@ class OsticketConfig extends Config {
         return $this->get('default_timezone');
     }
 
-    function getTimezone() {
+    function getTimezone($user=false) {
         global $thisstaff, $thisclient;
 
-        if ($thisstaff)
-            $zone = $thisstaff->getTimezone();
-        #elseif ($thisclient)
-        #    $zone = $thisclient->getTimezone();
-        else
+        $user = $user ?: $thisstaff;
+
+        if (!$user && $thisclient)
+            $user = $thisclient->getAccount();
+
+        if ($user)
+            $zone = $user->getTimezone();
+
+        if (!$zone)
             $zone = $this->get('default_timezone');
 
         if (!$zone)
             $zone = ini_get('date.timezone');
+
         return $zone;
     }
 
-- 
GitLab