CC-5594 : Remove all date_default_timezone_get()
updating move show code to work with the user's timezone. unified method signature for updateScheduleStartTime to always use the $diff param.
This commit is contained in:
parent
061897a58b
commit
7e9ca3e950
3 changed files with 20 additions and 31 deletions
|
@ -244,8 +244,8 @@ class Application_Service_CalendarService
|
|||
|
||||
$today_timestamp = time();
|
||||
|
||||
$startsDateTime = new DateTime($this->ccShowInstance->getDbStarts(), new DateTimeZone("UTC"));
|
||||
$endsDateTime = new DateTime($this->ccShowInstance->getDbEnds(), new DateTimeZone("UTC"));
|
||||
$startsDateTime = $this->ccShowInstance->getDbStarts(null);
|
||||
$endsDateTime = $this->ccShowInstance->getDbEnds(null);
|
||||
|
||||
if ($today_timestamp > $startsDateTime->getTimestamp()) {
|
||||
throw new Exception(_("Can't move a past show"));
|
||||
|
@ -315,13 +315,16 @@ class Application_Service_CalendarService
|
|||
$con = Propel::getConnection();
|
||||
$con->beginTransaction();
|
||||
|
||||
//new starts,ends are in UTC
|
||||
list($newStartsDateTime, $newEndsDateTime) = $this->validateShowMove(
|
||||
$deltaDay, $deltaMin);
|
||||
|
||||
$oldStartDateTime = $this->ccShowInstance->getDbStarts(null);
|
||||
|
||||
$this->ccShowInstance
|
||||
->setDbStarts($newStartsDateTime)
|
||||
->setDbEnds($newEndsDateTime)
|
||||
->save();
|
||||
->save($con);
|
||||
|
||||
if (!$this->ccShowInstance->getCcShow()->isRebroadcast()) {
|
||||
//we can get the first show day because we know the show is
|
||||
|
@ -331,11 +334,13 @@ class Application_Service_CalendarService
|
|||
$ccShowDay
|
||||
->setDbFirstShow($newStartsDateTime->setTimezone($showTimezone)->format("Y-m-d"))
|
||||
->setDbStartTime($newStartsDateTime->format("H:i"))
|
||||
->save();
|
||||
->save($con);
|
||||
}
|
||||
|
||||
|
||||
$diff = $newStartsDateTime->getTimestamp() - $oldStartDateTime->getTimestamp();
|
||||
|
||||
Application_Service_SchedulerService::updateScheduleStartTime(
|
||||
array($this->ccShowInstance->getDbId()), null, $newStartsDateTime);
|
||||
array($this->ccShowInstance->getDbId()), $diff);
|
||||
|
||||
$con->commit();
|
||||
Application_Model_RabbitMq::PushSchedule();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue