CC-3185 : Live show can be dragged into a future date after the rebroadcasting

This commit is contained in:
Naomi Aro 2011-12-13 13:04:03 +01:00
parent 3cd11c696f
commit e81c14c1db
1 changed files with 17 additions and 8 deletions

View File

@ -192,10 +192,6 @@ class Application_Model_ShowInstance {
$newDateTime = clone $dateTime; $newDateTime = clone $dateTime;
Logging::log("deltaDay: {$deltaDay}");
Logging::log("deltaMin: {$deltaMin}");
Logging::log("addDeltas: original time {$newDateTime->format('Y-m-d H:i:s')}");
$days = abs($deltaDay); $days = abs($deltaDay);
$mins = abs($deltaMin); $mins = abs($deltaMin);
@ -216,8 +212,6 @@ class Application_Model_ShowInstance {
$newDateTime->sub($minInterval); $newDateTime->sub($minInterval);
} }
Logging::log("addDeltas: modified time {$newDateTime->format('Y-m-d H:i:s')}");
return $newDateTime; return $newDateTime;
} }
@ -252,6 +246,21 @@ class Application_Model_ShowInstance {
return "Can't move show into past"; return "Can't move show into past";
} }
if ($this->isRecorded()) {
//rebroadcasts should start at max 1 hour after a recorded show has ended.
$minRebroadcastStart = self::addDeltas($newEndsDateTime, 0, 60);
//check if we are moving a recorded show less than 1 hour before any of its own rebroadcasts.
$rebroadcasts = CcShowInstancesQuery::create()
->filterByDbOriginalShow($this->_instanceId)
->filterByDbStarts($minRebroadcastStart->format('Y-m-d H:i:s'), Criteria::LESS_THAN)
->find();
if (count($rebroadcasts) > 0) {
return "Can't move a recorded show less than 1 hour before its rebroadcasts.";
}
}
if ($this->isRebroadcast()) { if ($this->isRebroadcast()) {
try { try {