From 771974433b636166195235b794c9801b8564e144 Mon Sep 17 00:00:00 2001 From: denise Date: Thu, 5 Jul 2012 11:01:48 -0400 Subject: [PATCH] CC-4071: Prevent shows from overlapping on drag and drop in calendar -done --- airtime_mvc/application/models/Schedule.php | 2 +- airtime_mvc/application/models/ShowInstance.php | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/airtime_mvc/application/models/Schedule.php b/airtime_mvc/application/models/Schedule.php index a4f27eda6..a315478e0 100644 --- a/airtime_mvc/application/models/Schedule.php +++ b/airtime_mvc/application/models/Schedule.php @@ -913,7 +913,7 @@ class Application_Model_Schedule { } } - public static function checkOverlappingShows($show_start, $show_end, $update=false, $instanceId=false) { + public static function checkOverlappingShows($show_start, $show_end, $update=false, $instanceId=null) { global $CC_CONFIG; $overlapping = false; diff --git a/airtime_mvc/application/models/ShowInstance.php b/airtime_mvc/application/models/ShowInstance.php index 9e7c82327..e3134a527 100644 --- a/airtime_mvc/application/models/ShowInstance.php +++ b/airtime_mvc/application/models/ShowInstance.php @@ -256,6 +256,12 @@ class Application_Model_ShowInstance { if ($today_timestamp > $newStartsDateTime->getTimestamp()) { return "Can't move show into past"; } + + //check if show is overlapping + $overlapping = Application_Model_Schedule::checkOverlappingShows($newStartsDateTime, $newEndsDateTime, true, $this->getShowInstanceId()); + if ($overlapping) { + return "Cannot schedule overlapping shows"; + } if ($this->isRecorded()) {