From 426b75b63570c31b0edaf5f01c75a31c9984fc3e Mon Sep 17 00:00:00 2001 From: drigato Date: Wed, 5 Mar 2014 14:37:07 -0500 Subject: [PATCH] CC-5724: Changing start date of a repeating show will update content incorrectly --- airtime_mvc/application/services/ShowService.php | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/airtime_mvc/application/services/ShowService.php b/airtime_mvc/application/services/ShowService.php index e3bec88bf..d03820a53 100644 --- a/airtime_mvc/application/services/ShowService.php +++ b/airtime_mvc/application/services/ShowService.php @@ -221,12 +221,15 @@ class Application_Service_ShowService $this->delegateInstanceCreation($daysAdded); if ($this->isUpdate) { - /* Set the show's start date to the start date of the first instance. - * We need to do this so we get the correct time diff for - * updating show content. CC-5696 + + /* If the show is repeating and the start date changes we need + * to ignore that difference when re-calculating schedule start times. + * Otherwise it might calculate a difference of a week, for example. */ - //$showData["add_show_start_date"] = $this->ccShow->getFirstCcShowDay()->getDbFirstShow(); - //$showData["add_show_start_time"] = $this->ccShow->getFirstCcShowDay()->getDbStartTime(); + if ($this->ccShow->isRepeating() && + $this->origCcShowDay->getLocalStartDateAndTime()->format("Y-m-d") != $showData["add_show_start_date"]) { + $showData["add_show_start_date"] = $this->origCcShowDay->getLocalStartDateAndTime()->format("Y-m-d"); + } $this->adjustSchedule($showData); }