From d49131db48479056250e443c1edc824682c1dc55 Mon Sep 17 00:00:00 2001
From: drigato <denise.rigato@sourcefabric.org>
Date: Tue, 3 Dec 2013 14:39:53 -0500
Subject: [PATCH] CC-5593: Overlapping Show Bug

Need to check if the show instance has been deleted
---
 airtime_mvc/application/models/Schedule.php | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/airtime_mvc/application/models/Schedule.php b/airtime_mvc/application/models/Schedule.php
index 231733828..3d82756ba 100644
--- a/airtime_mvc/application/models/Schedule.php
+++ b/airtime_mvc/application/models/Schedule.php
@@ -1281,6 +1281,15 @@ SQL;
     public static function checkOverlappingShows($show_start, $show_end,
         $update=false, $instanceId=null, $showId=null)
     {
+        //if the show instance does not exist or was deleted, return false
+        $ccShowInstance = CcShowInstancesQuery::create()
+            ->filterByDbShowId($showId)
+            ->filterByDbStarts($show_start->format("Y-m-d H:i:s"))
+            ->findOne();
+        if (!$ccShowInstance || $ccShowInstance->getDbModifiedInstance() == true) {
+            return false;
+        }
+
         $overlapping = false;
 
         $params = array(