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;
Logging::log("deltaDay: {$deltaDay}");
Logging::log("deltaMin: {$deltaMin}");
Logging::log("addDeltas: original time {$newDateTime->format('Y-m-d H:i:s')}");
$days = abs($deltaDay);
$mins = abs($deltaMin);
@ -216,8 +212,6 @@ class Application_Model_ShowInstance {
$newDateTime->sub($minInterval);
}
Logging::log("addDeltas: modified time {$newDateTime->format('Y-m-d H:i:s')}");
return $newDateTime;
}
@ -252,6 +246,21 @@ class Application_Model_ShowInstance {
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()) {
try {
@ -438,7 +447,7 @@ class Application_Model_ShowInstance {
public function delete()
{
global $CC_DBC;
// see if it was recording show
$recording = $this->isRecorded();
// get show id
@ -448,7 +457,7 @@ class Application_Model_ShowInstance {
$current_timestamp = gmdate("Y-m-d H:i:s");
if ($current_timestamp <= $this->getShowInstanceEnd()) {
if ($current_timestamp <= $this->getShowInstanceEnd()) {
if ($show->isRepeating()) {
CcShowInstancesQuery::create()