From b972b4b8572a39694028e68e88f952d49ac9c6e0 Mon Sep 17 00:00:00 2001 From: Robbt Date: Mon, 22 Apr 2019 22:47:37 -0400 Subject: [PATCH] made it possible for currently playing linked shows to be cancelled as per the UI --- airtime_mvc/application/models/Scheduler.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/airtime_mvc/application/models/Scheduler.php b/airtime_mvc/application/models/Scheduler.php index 3d8eb1185..a28e75862 100644 --- a/airtime_mvc/application/models/Scheduler.php +++ b/airtime_mvc/application/models/Scheduler.php @@ -84,7 +84,7 @@ final class Application_Model_Scheduler * * @param array $items, an array containing pks of cc_schedule items. */ - private function validateRequest($items, $addRemoveAction=false) + private function validateRequest($items, $addRemoveAction=false, $cancelShow=false) { //$items is where tracks get inserted (they are schedule locations) @@ -168,8 +168,10 @@ final class Application_Model_Scheduler * Does the afterItem belong to a show that is linked AND * currently playing? * If yes, throw an exception + * unless it is a cancel show action then we don't check because otherwise + * ongoing linked shows can't be cancelled */ - if ($addRemoveAction) { + if ($addRemoveAction && !$cancelShow) { $ccShow = $instance->getCcShow(); if ($ccShow->isLinked()) { //get all the linked shows instances and check if @@ -1198,7 +1200,7 @@ final class Application_Model_Scheduler try { - $this->validateRequest($scheduledItems, true); + $this->validateRequest($scheduledItems, true, true); $scheduledIds = array(); foreach ($scheduledItems as $item) {