From 35fd639c1c8c2740738e9b142de159b1b4591c75 Mon Sep 17 00:00:00 2001 From: drigato Date: Thu, 6 Mar 2014 11:18:13 -0500 Subject: [PATCH] CC-5725: Changing a show's repeat type removes first instance from repeating series --- .../application/services/ShowService.php | 26 ++++++++++++------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/airtime_mvc/application/services/ShowService.php b/airtime_mvc/application/services/ShowService.php index 379a3f526..e004e07bf 100644 --- a/airtime_mvc/application/services/ShowService.php +++ b/airtime_mvc/application/services/ShowService.php @@ -1545,15 +1545,23 @@ SQL; if (is_null($endDate) || $startDateTimeClone->getTimestamp() <= $endDateTime->getTimestamp()) { if ($this->isUpdate) { - $showDay = CcShowDaysQuery::create() - ->filterByDbShowId($showId) - ->filterByDbRepeatType($this->origCcShowDay->getDbRepeatType()) - ->filterByDbDay($this->origCcShowDay->getDbDay()) - ->findOne(); - if (!$showDay) { - //if no show day object was found it is because a new - //repeating day of the week was added - $showDay = new CcShowDays(); + if ($this->repeatType >= 0) { + $showDay = CcShowDaysQuery::create() + ->filterByDbShowId($showId) + ->filterByDbRepeatType($this->repeatType) + ->filterByDbDay($day) + ->findOne(); + if (!$showDay) { + //if no show day object was found it is because a new + //repeating day of the week was added + $showDay = new CcShowDays(); + } + } else { + $showDay = CcShowDaysQuery::create() + ->filterByDbShowId($showId) + ->filterByDbRepeatType($this->origCcShowDay->getDbRepeatType()) + ->filterByDbDay($this->origCcShowDay->getDbDay()) + ->findOne(); } } else { $showDay = new CcShowDays();