From 9bbc3cf71378bce4d5fbc555cc5b9f6ea5b00e3f Mon Sep 17 00:00:00 2001 From: drigato Date: Thu, 12 Dec 2013 11:48:00 -0500 Subject: [PATCH 1/3] CC-5633: Can schedule overlapping shows The overlapping show check was returning false too early --- airtime_mvc/application/models/Schedule.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/airtime_mvc/application/models/Schedule.php b/airtime_mvc/application/models/Schedule.php index 39f45ea07..fca242f8f 100644 --- a/airtime_mvc/application/models/Schedule.php +++ b/airtime_mvc/application/models/Schedule.php @@ -1005,7 +1005,7 @@ SQL; ->filterByDbId($instanceId) ->findOne(); } - if ($update && (!$ccShowInstance || $ccShowInstance->getDbModifiedInstance() == true)) { + if ($update && ($ccShowInstance && $ccShowInstance->getDbModifiedInstance() == true)) { return false; } From fb793ff3e1fc69781351c31b60d0fcd10547a6b6 Mon Sep 17 00:00:00 2001 From: drigato Date: Thu, 12 Dec 2013 13:01:33 -0500 Subject: [PATCH 2/3] CC-5634: Can add/remove content to a linked show while one instance is currently playing Fixed by removing option from context menu --- .../application/services/CalendarService.php | 28 +++++++++++++------ 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/airtime_mvc/application/services/CalendarService.php b/airtime_mvc/application/services/CalendarService.php index 04cf9776b..1591fe4b3 100644 --- a/airtime_mvc/application/services/CalendarService.php +++ b/airtime_mvc/application/services/CalendarService.php @@ -82,15 +82,25 @@ class Application_Service_CalendarService // Show content can be modified from the calendar if: // the user is admin or hosting the show, // the show is not recorded - - if ($now < $end && ($isAdminOrPM || $isHostOfShow) && - !$this->ccShowInstance->isRecorded() ) { - - $menu["schedule"] = array( - "name"=> _("Add / Remove Content"), - "icon" => "add-remove-content", - "url" => $baseUrl."showbuilder/builder-dialog/"); - + $currentShow = Application_Model_Show::getCurrentShow(); + $showIsLinked = $this->ccShow->isLinked(); + if ($now < $end && ($isAdminOrPM || $isHostOfShow) && !$this->ccShowInstance->isRecorded()) { + //if the show is not linked the user can add/remove content + if (!$showIsLinked) { + + $menu["schedule"] = array( + "name"=> _("Add / Remove Content"), + "icon" => "add-remove-content", + "url" => $baseUrl."showbuilder/builder-dialog/"); + //if the show is linked and it's not currently playing the user can add/remove content + } elseif ($showIsLinked && (count($currentShow) > 0 && $currentShow[0]["id"] != $this->ccShow->getDbId())) { + + $menu["schedule"] = array( + "name"=> _("Add / Remove Content"), + "icon" => "add-remove-content", + "url" => $baseUrl."showbuilder/builder-dialog/"); + } + } if ($now < $start && ($isAdminOrPM || $isHostOfShow) && From f37b9a3796b7d97526e5affbf4bc8e7712900d94 Mon Sep 17 00:00:00 2001 From: drigato Date: Thu, 12 Dec 2013 13:23:20 -0500 Subject: [PATCH 3/3] CC-5634: Can add/remove content to a linked show while one instance is currently playing small logic fix --- airtime_mvc/application/services/CalendarService.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/airtime_mvc/application/services/CalendarService.php b/airtime_mvc/application/services/CalendarService.php index 1591fe4b3..41ad7c17c 100644 --- a/airtime_mvc/application/services/CalendarService.php +++ b/airtime_mvc/application/services/CalendarService.php @@ -83,6 +83,7 @@ class Application_Service_CalendarService // the user is admin or hosting the show, // the show is not recorded $currentShow = Application_Model_Show::getCurrentShow(); + $currentShowId = count($currentShow) == 1 ? $currentShow[0]["id"] : null; $showIsLinked = $this->ccShow->isLinked(); if ($now < $end && ($isAdminOrPM || $isHostOfShow) && !$this->ccShowInstance->isRecorded()) { //if the show is not linked the user can add/remove content @@ -93,7 +94,7 @@ class Application_Service_CalendarService "icon" => "add-remove-content", "url" => $baseUrl."showbuilder/builder-dialog/"); //if the show is linked and it's not currently playing the user can add/remove content - } elseif ($showIsLinked && (count($currentShow) > 0 && $currentShow[0]["id"] != $this->ccShow->getDbId())) { + } elseif ($showIsLinked && $currentShowId != $this->ccShow->getDbId()) { $menu["schedule"] = array( "name"=> _("Add / Remove Content"),