From 002a80ee6c4d8e9a53ddc4a4db055d2d42c02163 Mon Sep 17 00:00:00 2001 From: denise Date: Wed, 25 Sep 2013 14:32:16 -0400 Subject: [PATCH] CC-5323: User's Timezone Can Improperly Edit Show -made localizeDate a static function in ShowFormService --- .../application/controllers/ScheduleController.php | 9 ++------- airtime_mvc/application/services/ShowFormService.php | 7 ++++--- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/airtime_mvc/application/controllers/ScheduleController.php b/airtime_mvc/application/controllers/ScheduleController.php index 87f142d4f..d8d5d6d30 100644 --- a/airtime_mvc/application/controllers/ScheduleController.php +++ b/airtime_mvc/application/controllers/ScheduleController.php @@ -643,21 +643,16 @@ class ScheduleController extends Zend_Controller_Action $this->_helper->json->sendJson(array("redrawLibTable" => $redrawLibTable)); } - /** - * When the timezone is changed in add-show form this function - * applies the new timezone to the start and end time - */ public function localizeStartEndTimeAction() { - $service_showForm = new Application_Service_ShowFormService(); $newTimezone = $this->_getParam('newTimezone'); $oldTimezone = $this->_getParam('oldTimezone'); $localTime = array(); - $localTime["start"] = $service_showForm->localizeDateTime( + $localTime["start"] = Application_Service_ShowFormService::localizeDateTime( $this->_getParam('startDate'), $this->_getParam('startTime'), $newTimezone, $oldTimezone); - $localTime["end"] = $service_showForm->localizeDateTime( + $localTime["end"] = Application_Service_ShowFormService::localizeDateTime( $this->_getParam('endDate'), $this->_getParam('endTime'), $newTimezone, $oldTimezone); $this->_helper->json->sendJson($localTime); diff --git a/airtime_mvc/application/services/ShowFormService.php b/airtime_mvc/application/services/ShowFormService.php index 4e8d49f44..2ef3b3c3d 100644 --- a/airtime_mvc/application/services/ShowFormService.php +++ b/airtime_mvc/application/services/ShowFormService.php @@ -489,13 +489,14 @@ class Application_Service_ShowFormService } /** - * - * Enter description here ... + * When the timezone is changed in add-show form this function + * applies the new timezone to the start and end time + * * @param $date String * @param $time String * @param $timezone String */ - public function localizeDateTime($date, $time, $newTimezone, $oldTimezone) + public static function localizeDateTime($date, $time, $newTimezone, $oldTimezone) { $dt = new DateTime($date." ".$time, new DateTimeZone($oldTimezone));