SAAS-1094 - update backend to prevent removal of items in linked shows while on air

This commit is contained in:
Duncan Sommerville 2015-09-30 14:44:06 -04:00
parent 98d565ff3d
commit b01fdc6805

View file

@ -80,7 +80,7 @@ class Application_Model_Scheduler
* *
* @param array $items, an array containing pks of cc_schedule items. * @param array $items, an array containing pks of cc_schedule items.
*/ */
private function validateRequest($items, $addAction=false) private function validateRequest($items, $addRemoveAction=false)
{ {
//$items is where tracks get inserted (they are schedule locations) //$items is where tracks get inserted (they are schedule locations)
@ -164,7 +164,7 @@ class Application_Model_Scheduler
* currently playing? * currently playing?
* If yes, throw an exception * If yes, throw an exception
*/ */
if ($addAction) { if ($addRemoveAction) {
$ccShow = $instance->getCcShow(); $ccShow = $instance->getCcShow();
if ($ccShow->isLinked()) { if ($ccShow->isLinked()) {
//get all the linked shows instances and check if //get all the linked shows instances and check if
@ -175,7 +175,7 @@ class Application_Model_Scheduler
if ($ccShowInstance->getDbStarts() <= $timeNowUTC && if ($ccShowInstance->getDbStarts() <= $timeNowUTC &&
$ccShowInstance->getDbEnds() > $timeNowUTC) { $ccShowInstance->getDbEnds() > $timeNowUTC) {
throw new Exception(_("Content in linked shows must be scheduled before or after any one is broadcasted")); throw new Exception(_("Content in linked shows cannot be changed while on air!"));
} }
} }
} }
@ -1091,7 +1091,7 @@ class Application_Model_Scheduler
try { try {
$this->validateRequest($scheduledItems); $this->validateRequest($scheduledItems, true);
$scheduledIds = array(); $scheduledIds = array();
foreach ($scheduledItems as $item) { foreach ($scheduledItems as $item) {