From 28d73264daac4c2669f6564555e26884c67a7bd8 Mon Sep 17 00:00:00 2001 From: drigato Date: Wed, 19 Jun 2013 01:17:32 -0400 Subject: [PATCH] CC-5240: Overnight Linked Shows, newly generated not getting content --- .../application/services/ShowService.php | 23 +++++++++++++------ 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/airtime_mvc/application/services/ShowService.php b/airtime_mvc/application/services/ShowService.php index 85de4b543..3efe45e0f 100644 --- a/airtime_mvc/application/services/ShowService.php +++ b/airtime_mvc/application/services/ShowService.php @@ -179,9 +179,6 @@ class Application_Service_ShowService if (is_null($this->ccShow)) { $ccShowDays = $this->getShowDaysInRange($populateUntil, $end); - if (count($ccShowDays) > 0) { - $this->ccShow = $ccShowDays[0]->getCcShow(); - } } else { $ccShowDays = $this->ccShow->getCcShowDays(); } @@ -190,7 +187,18 @@ class Application_Service_ShowService $populateUntil = $end; } + /* In case the user is moving forward in the calendar and there are + * linked shows in the schedule we need to keep track of each cc_show + * so we know which shows need to be filled with content + */ + $ccShows = array(); + foreach ($ccShowDays as $day) { + $this->ccShow = $day->getCcShow(); + if (!isset($ccShows[$day->getDbShowId()])) { + $ccShows[$day->getDbShowId()] = $day->getccShow(); + } + switch ($day->getDbRepeatType()) { case NO_REPEAT: $this->createNonRepeatingInstance($day, $populateUntil); @@ -212,9 +220,10 @@ class Application_Service_ShowService } } - if (isset($this->ccShow) && ($this->isUpdate || $fillInstances) && - $this->ccShow->isLinked()) { - Application_Service_SchedulerService::fillNewLinkedInstances($this->ccShow); + foreach ($ccShows as $ccShow) { + if (($this->isUpdate || $fillInstances) && $ccShow->isLinked()) { + Application_Service_SchedulerService::fillNewLinkedInstances($ccShow); + } } if (isset($this->linkedShowContent)) { @@ -1499,4 +1508,4 @@ SQL; $repeatInfo->setDbNextPopDate($nextInfo[0]) ->save(); } -} \ No newline at end of file +}