CC-5323: User's Timezone Can Improperly Edit Show
This commit is contained in:
parent
9e8fdb50ca
commit
ad778ec971
airtime_mvc
application
public/js/airtime/schedule
|
@ -649,16 +649,16 @@ class ScheduleController extends Zend_Controller_Action
|
||||||
*/
|
*/
|
||||||
public function localizeStartEndTimeAction()
|
public function localizeStartEndTimeAction()
|
||||||
{
|
{
|
||||||
$service_showForm = new Application_Service_ShowFormService(
|
$service_showForm = new Application_Service_ShowFormService();
|
||||||
$this->_getParam("showId"));
|
$newTimezone = $this->_getParam('newTimezone');
|
||||||
$timezone = $this->_getParam('timezone');
|
$oldTimezone = $this->_getParam('oldTimezone');
|
||||||
$localTime = array();
|
$localTime = array();
|
||||||
|
|
||||||
$localTime["start"] = $service_showForm->localizeDateTime(
|
$localTime["start"] = $service_showForm->localizeDateTime(
|
||||||
$this->_getParam('startDate'), $this->_getParam('startTime'), $timezone);
|
$this->_getParam('startDate'), $this->_getParam('startTime'), $newTimezone, $oldTimezone);
|
||||||
|
|
||||||
$localTime["end"] = $service_showForm->localizeDateTime(
|
$localTime["end"] = $service_showForm->localizeDateTime(
|
||||||
$this->_getParam('endDate'), $this->_getParam('endTime'), $timezone);
|
$this->_getParam('endDate'), $this->_getParam('endTime'), $newTimezone, $oldTimezone);
|
||||||
|
|
||||||
$this->_helper->json->sendJson($localTime);
|
$this->_helper->json->sendJson($localTime);
|
||||||
}
|
}
|
||||||
|
|
|
@ -495,16 +495,15 @@ class Application_Service_ShowFormService
|
||||||
* @param $time String
|
* @param $time String
|
||||||
* @param $timezone String
|
* @param $timezone String
|
||||||
*/
|
*/
|
||||||
public function localizeDateTime($date, $time, $timezone)
|
public function localizeDateTime($date, $time, $newTimezone, $oldTimezone)
|
||||||
{
|
{
|
||||||
$dt = new DateTime($date." ".$time, new DateTimeZone(
|
$dt = new DateTime($date." ".$time, new DateTimeZone($oldTimezone));
|
||||||
$this->ccShow->getFirstCcShowDay()->getDbTimezone()));
|
|
||||||
|
|
||||||
$dt->setTimeZone(new DateTimeZone($timezone));
|
$dt->setTimeZone(new DateTimeZone($newTimezone));
|
||||||
|
|
||||||
return array(
|
return array(
|
||||||
"date" => $dt->format("Y-m-d"),
|
"date" => $dt->format("Y-m-d"),
|
||||||
"time" => $dt->format("h:i")
|
"time" => $dt->format("H:i")
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1330,7 +1330,7 @@ SQL;
|
||||||
$showDay->setDbFirstShow($startDateTime->format("Y-m-d"));
|
$showDay->setDbFirstShow($startDateTime->format("Y-m-d"));
|
||||||
$showDay->setDbLastShow($endDate);
|
$showDay->setDbLastShow($endDate);
|
||||||
$showDay->setDbStartTime($startDateTime->format("H:i:s"));
|
$showDay->setDbStartTime($startDateTime->format("H:i:s"));
|
||||||
$showDay->setDbTimezone(Application_Model_Preference::GetTimezone());
|
$showDay->setDbTimezone($showData['add_show_timezone']);
|
||||||
$showDay->setDbDuration($showData['add_show_duration']);
|
$showDay->setDbDuration($showData['add_show_duration']);
|
||||||
$showDay->setDbRepeatType($this->repeatType);
|
$showDay->setDbRepeatType($this->repeatType);
|
||||||
$showDay->setDbShowId($showId);
|
$showDay->setDbShowId($showId);
|
||||||
|
|
|
@ -227,13 +227,18 @@ function setAddShowEvents() {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// in case user is creating a new show, there will be
|
||||||
|
// no show_id so we have to store the default timezone
|
||||||
|
// to be able to do the conversion when the timezone
|
||||||
|
// setting changes
|
||||||
|
var currentTimezone = form.find("#add_show_timezone").val();
|
||||||
|
|
||||||
form.find("#add_show_timezone").change(function(){
|
form.find("#add_show_timezone").change(function(){
|
||||||
var startDateField = form.find("#add_show_start_date"),
|
var startDateField = form.find("#add_show_start_date"),
|
||||||
startTimeField = form.find("#add_show_start_time"),
|
startTimeField = form.find("#add_show_start_time"),
|
||||||
endDateField = form.find("#add_show_end_date_no_repeat"),
|
endDateField = form.find("#add_show_end_date_no_repeat"),
|
||||||
endTimeField = form.find("#add_show_end_time"),
|
endTimeField = form.find("#add_show_end_time"),
|
||||||
timezone = form.find("#add_show_timezone").val(),
|
newTimezone = form.find("#add_show_timezone").val();
|
||||||
showId = form.find("#add_show_id").val();
|
|
||||||
|
|
||||||
$.post(baseUrl+"Schedule/localize-start-end-time",
|
$.post(baseUrl+"Schedule/localize-start-end-time",
|
||||||
{format: "json",
|
{format: "json",
|
||||||
|
@ -241,8 +246,8 @@ function setAddShowEvents() {
|
||||||
startTime: startTimeField.val(),
|
startTime: startTimeField.val(),
|
||||||
endDate: endDateField.val(),
|
endDate: endDateField.val(),
|
||||||
endTime: endTimeField.val(),
|
endTime: endTimeField.val(),
|
||||||
timezone: timezone,
|
newTimezone: newTimezone,
|
||||||
showId: showId}, function(json){
|
oldTimezone: currentTimezone}, function(json){
|
||||||
|
|
||||||
startDateField.val(json.start.date);
|
startDateField.val(json.start.date);
|
||||||
startTimeField.val(json.start.time);
|
startTimeField.val(json.start.time);
|
||||||
|
|
Loading…
Reference in New Issue