From ec2f36efa8441befd1b8ab11b91ea6fbf0296fe1 Mon Sep 17 00:00:00 2001 From: denise Date: Tue, 30 Apr 2013 15:54:04 -0400 Subject: [PATCH] CC-5077: Calendar -> Context menu -> Show Content -> shows incorrect time filled on edited repeat instances - We weren't updating the time_filled column in cc_show_instances when creating the new show --- .../application/services/ShowFormService.php | 24 +++++++------------ .../application/services/ShowService.php | 3 +++ 2 files changed, 12 insertions(+), 15 deletions(-) diff --git a/airtime_mvc/application/services/ShowFormService.php b/airtime_mvc/application/services/ShowFormService.php index 2494b9c0d..e9cb8c5ea 100644 --- a/airtime_mvc/application/services/ShowFormService.php +++ b/airtime_mvc/application/services/ShowFormService.php @@ -343,22 +343,16 @@ class Application_Service_ShowFormService */ public function getNextFutureRepeatShowTime() { - $sql = << now() at time zone 'UTC' -AND show_id = :showId -AND modified_instance = FALSE -ORDER BY starts -LIMIT 1 -SQL; - $result = Application_Common_Database::prepareAndExecute( $sql, - array( 'showId' => $this->ccShow->getDbId() ), 'all' ); - - foreach ($result as $r) { - $starts = new DateTime($r["starts"], new DateTimeZone('UTC')); - $ends = new DateTime($r["ends"], new DateTimeZone('UTC')); - } + $ccShowInstance = CcShowInstancesQuery::create() + ->filterByDbShowId($this->ccShow->getDbId()) + ->filterByDbModifiedInstance(false) + ->filterByDbEnds(gmdate("Y-m-d H:i:s"), Criteria::GREATER_THAN) + ->orderByDbStarts() + ->limit(1) + ->findOne(); + $starts = new DateTime($ccShowInstance->getDbStarts(), new DateTimeZone("UTC")); + $ends = new DateTime($ccShowInstance->getDbEnds(), new DateTimeZone("UTC")); $userTimezone = Application_Model_Preference::GetTimezone(); $starts->setTimezone(new DateTimeZone($userTimezone)); diff --git a/airtime_mvc/application/services/ShowService.php b/airtime_mvc/application/services/ShowService.php index f737cf3b6..b5806a638 100644 --- a/airtime_mvc/application/services/ShowService.php +++ b/airtime_mvc/application/services/ShowService.php @@ -91,6 +91,9 @@ class Application_Service_ShowService $ccSchedule->save(); } + $con = Propel::getConnection(CcShowInstancesPeer::DATABASE_NAME); + $ccShowInstance->updateDbTimeFilled($con); + //delete the edited instance from the repeating sequence $ccShowInstanceOrig->setDbModifiedInstance(true)->save();