CC-5074: Editing a linked instance sets incorrect schedule start times
This commit is contained in:
parent
1384c5d39d
commit
4ca60ca676
|
@ -634,10 +634,7 @@ class Application_Model_Scheduler
|
||||||
$pstart = microtime(true);
|
$pstart = microtime(true);
|
||||||
|
|
||||||
//recalculate the start/end times after the inserted items.
|
//recalculate the start/end times after the inserted items.
|
||||||
Logging::info($excludeIds);
|
|
||||||
Logging::info($initalStartDT);
|
|
||||||
foreach ($followingSchedItems as $item) {
|
foreach ($followingSchedItems as $item) {
|
||||||
Logging::info($item);
|
|
||||||
$endTimeDT = $this->findEndTime($nextStartDT, $item->getDbClipLength());
|
$endTimeDT = $this->findEndTime($nextStartDT, $item->getDbClipLength());
|
||||||
|
|
||||||
$item->setDbStarts($nextStartDT);
|
$item->setDbStarts($nextStartDT);
|
||||||
|
|
|
@ -185,4 +185,10 @@ class CcShowInstances extends BaseCcShowInstances {
|
||||||
return $this->getDbRebroadcast() == 1 ? true : false;
|
return $this->getDbRebroadcast() == 1 ? true : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getLocalStartDateTime()
|
||||||
|
{
|
||||||
|
$startDT = $this->getDbStarts(null);
|
||||||
|
return $startDT->setTimezone(new DateTimeZone(Application_Model_Preference::GetTimezone()));
|
||||||
|
}
|
||||||
|
|
||||||
} // CcShowInstances
|
} // CcShowInstances
|
||||||
|
|
|
@ -69,9 +69,14 @@ class Application_Service_SchedulerService
|
||||||
->filterByDbInstanceId($instanceIds, Criteria::IN)
|
->filterByDbInstanceId($instanceIds, Criteria::IN)
|
||||||
->find();
|
->find();
|
||||||
foreach ($ccSchedules as $ccSchedule) {
|
foreach ($ccSchedules as $ccSchedule) {
|
||||||
|
$interval = new DateInterval("PT".$diff."S");
|
||||||
|
$start = new DateTime($ccSchedule->getDbStarts());
|
||||||
|
$newStart = $start->add($interval);
|
||||||
|
$end = new DateTime($ccSchedule->getDbEnds());
|
||||||
|
$newEnd = $end->add($interval);
|
||||||
$ccSchedule
|
$ccSchedule
|
||||||
->setDbStarts($ccSchedule->getDbStarts() + $diff)
|
->setDbStarts($newStart->format("Y-m-d H:i:s"))
|
||||||
->setDbEnds($ccSchedule->getDbEnds() + $diff)
|
->setDbEnds($newEnd->format("Y-m-d H:i:s"))
|
||||||
->save();
|
->save();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,18 +52,21 @@ class Application_Service_ShowService
|
||||||
//so we can get the original start date and time
|
//so we can get the original start date and time
|
||||||
$oldCcShow = CcShowQuery::create()
|
$oldCcShow = CcShowQuery::create()
|
||||||
->findPk($showData["add_show_id"]);
|
->findPk($showData["add_show_id"]);
|
||||||
$currentShowDay = $oldCcShow->getFirstCcShowDay();
|
|
||||||
|
|
||||||
//DateTime in user's local time
|
//DateTime in user's local time
|
||||||
$newStartDateTime = new DateTime($showData["add_show_start_date"]." ".
|
$newStartDateTime = new DateTime($showData["add_show_start_date"]." ".
|
||||||
$showData["add_show_start_time"],
|
$showData["add_show_start_time"],
|
||||||
new DateTimeZone(Application_Model_Preference::GetTimezone()));
|
new DateTimeZone(Application_Model_Preference::GetTimezone()));
|
||||||
|
|
||||||
|
$ccShowInstanceOrig = CcShowInstancesQuery::create()
|
||||||
|
->findPk($showData["add_show_instance_id"]);
|
||||||
$diff = $this->calculateShowStartDiff($newStartDateTime,
|
$diff = $this->calculateShowStartDiff($newStartDateTime,
|
||||||
$currentShowDay->getLocalStartDateAndTime());
|
$ccShowInstanceOrig->getLocalStartDateTime());
|
||||||
|
|
||||||
|
if ($diff > 0) {
|
||||||
Application_Service_SchedulerService::updateScheduleStartTime(
|
Application_Service_SchedulerService::updateScheduleStartTime(
|
||||||
array($showData["add_show_instance_id"]), $diff);
|
array($showData["add_show_instance_id"]), $diff);
|
||||||
|
}
|
||||||
/****** UPDATE SCHEDULE START TIME ENDS******/
|
/****** UPDATE SCHEDULE START TIME ENDS******/
|
||||||
|
|
||||||
$this->setCcShow($showData);
|
$this->setCcShow($showData);
|
||||||
|
@ -89,10 +92,7 @@ class Application_Service_ShowService
|
||||||
}
|
}
|
||||||
|
|
||||||
//delete the edited instance from the repeating sequence
|
//delete the edited instance from the repeating sequence
|
||||||
CcShowInstancesQuery::create()
|
$ccShowInstanceOrig->setDbModifiedInstance(true)->save();
|
||||||
->findPk($showData["add_show_instance_id"])
|
|
||||||
->setDbModifiedInstance(true)
|
|
||||||
->save();
|
|
||||||
|
|
||||||
$service_showForm = new Application_Service_ShowFormService($showData["add_show_id"]);
|
$service_showForm = new Application_Service_ShowFormService($showData["add_show_id"]);
|
||||||
list($start, $end) = $service_showForm->getNextFutureRepeatShowTime();
|
list($start, $end) = $service_showForm->getNextFutureRepeatShowTime();
|
||||||
|
|
Loading…
Reference in New Issue