From e60a23aab44619356a52893c9b08d65c56032a56 Mon Sep 17 00:00:00 2001 From: denise Date: Fri, 12 Oct 2012 15:34:42 -0400 Subject: [PATCH] CC-4555: Can create overlapping shows with a repeating show if another show is on the last repeating day -fixed --- airtime_mvc/application/forms/AddShowWhen.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/airtime_mvc/application/forms/AddShowWhen.php b/airtime_mvc/application/forms/AddShowWhen.php index 870e79183..bf1f1c83d 100644 --- a/airtime_mvc/application/forms/AddShowWhen.php +++ b/airtime_mvc/application/forms/AddShowWhen.php @@ -163,7 +163,8 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm } elseif (!$formData["add_show_no_end"]) { $popUntil = $formData["add_show_end_date"]." ".$formData["add_show_end_time"]; - $populateUntilDateTime = new DateTime($popUntil, new DateTimeZone('UTC')); + $populateUntilDateTime = new DateTime($popUntil); + $populateUntilDateTime->setTimezone(new DateTimeZone('UTC')); } //get repeat interval @@ -198,8 +199,12 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm $repeatShowStart->add(new DateInterval("P".$daysAdd."D")); $repeatShowEnd->add(new DateInterval("P".$daysAdd."D")); } + /* Here we are checking each repeating show by + * the show day. + * (i.e: every wednesday, then every thursday) + */ while ($repeatShowStart->getTimestamp() < $populateUntilDateTime->getTimestamp()) { - if (!$formData['add_show_id']) { + if ($formData['add_show_id'] == -1) { //this is a new show $overlapping = Application_Model_Schedule::checkOverlappingShows( $repeatShowStart, $repeatShowEnd);