diff --git a/airtime_mvc/application/services/ShowService.php b/airtime_mvc/application/services/ShowService.php index f0c547ff5..de134f2fa 100644 --- a/airtime_mvc/application/services/ShowService.php +++ b/airtime_mvc/application/services/ShowService.php @@ -20,6 +20,7 @@ class Application_Service_ShowService private $localShowStartHour; private $localShowStartMin; private $origCcShowDay; + private $origShowRepeatStatus; private $instanceIdsForScheduleUpdates; public function __construct($showId=null, $showData=null, $isUpdate=false) @@ -158,8 +159,10 @@ class Application_Service_ShowService { if ($this->ccShow->isRepeating()) { $this->origCcShowDay = clone $this->ccShow->getFirstRepeatingCcShowDay(); + $this->origShowRepeatStatus = true; } else { $this->origCcShowDay = clone $this->ccShow->getFirstCcShowDay(); + $this->origShowRepeatStatus = false; } $this->oldShowTimezone = $this->origCcShowDay->getDbTimezone(); @@ -1565,6 +1568,10 @@ SQL; if ($this->origCcShowDay->getDbRepeatType() == 2 || $this->origCcShowDay->getDbRepeatType() == 3) { $day = null; + } else if (!$this->origShowRepeatStatus) { + //keep current show day to use for updating cc_show_day rule + $keepDay = $day; + $day = $this->origCcShowDay->getDbDay(); } $showDay = CcShowDaysQuery::create() ->filterByDbShowId($showId) @@ -1577,6 +1584,10 @@ SQL; //type has changed $showDay = new CcShowDays(); } + + if (isset($keepDay)) { + $day = $keepDay; + } } else { $showDay = new CcShowDays(); } diff --git a/airtime_mvc/tests/application/services/database/ShowServiceDbTest.php b/airtime_mvc/tests/application/services/database/ShowServiceDbTest.php index 0531bbbe0..0cb424778 100644 --- a/airtime_mvc/tests/application/services/database/ShowServiceDbTest.php +++ b/airtime_mvc/tests/application/services/database/ShowServiceDbTest.php @@ -611,7 +611,7 @@ class ShowServiceDbTest extends Zend_Test_PHPUnit_DatabaseTestCase $data = ShowServiceData::getWeeklyRepeatNoEndNoRRData(); $data["add_show_start_date"] = "2016-01-29"; - $data["add_show_day_check"] = array(5); + $data["add_show_day_check"] = array(5, 6); $data["add_show_linked"] = 1; $showService = new Application_Service_ShowService(null, $data); $showService->addUpdateShow($data);