Merge branch '2.4.x' into 2.4.x-saas

This commit is contained in:
denise 2013-07-29 16:01:06 -04:00
commit 59721ccb51
2 changed files with 38 additions and 29 deletions

View file

@ -248,22 +248,24 @@ class Application_Service_SchedulerService
} }
} //foreach linked instance } //foreach linked instance
$insert_sql = "INSERT INTO cc_schedule (starts, ends, ". if (!empty($values)) {
"clip_length, fade_in, fade_out, cue_in, cue_out, ". $insert_sql = "INSERT INTO cc_schedule (starts, ends, ".
"file_id, stream_id, instance_id, position) VALUES ". "clip_length, fade_in, fade_out, cue_in, cue_out, ".
implode($values, ","); "file_id, stream_id, instance_id, position) VALUES ".
implode($values, ",");
Application_Common_Database::prepareAndExecute( Application_Common_Database::prepareAndExecute(
$insert_sql, array(), Application_Common_Database::EXECUTE); $insert_sql, array(), Application_Common_Database::EXECUTE);
//update time_filled in cc_show_instances //update time_filled in cc_show_instances
$now = gmdate("Y-m-d H:i:s"); $now = gmdate("Y-m-d H:i:s");
$update_sql = "UPDATE cc_show_instances SET ". $update_sql = "UPDATE cc_show_instances SET ".
"time_filled = '{$timeFilled}', ". "time_filled = '{$timeFilled}', ".
"last_scheduled = '{$now}' ". "last_scheduled = '{$now}' ".
"WHERE show_id = {$ccShow->getDbId()}"; "WHERE show_id = {$ccShow->getDbId()}";
Application_Common_Database::prepareAndExecute( Application_Common_Database::prepareAndExecute(
$update_sql, array(), Application_Common_Database::EXECUTE); $update_sql, array(), Application_Common_Database::EXECUTE);
}
} //if at least one linked instance has content } //if at least one linked instance has content
} }

View file

@ -655,15 +655,16 @@ SQL;
->filterByDbDay($dayOfWeek) ->filterByDbDay($dayOfWeek)
->findOne(); ->findOne();
$lastShowStartDT->setTimeZone(new DateTimeZone( if (isset($ccShowDay)) {
$ccShowDay->getDbTimezone())); $lastShowStartDT->setTimeZone(new DateTimeZone(
$lastShowEndDT = Application_Service_CalendarService::addDeltas( $ccShowDay->getDbTimezone()));
$lastShowStartDT, 1, 0); $lastShowEndDT = Application_Service_CalendarService::addDeltas(
$lastShowStartDT, 1, 0);
$ccShowDay $ccShowDay
->setDbLastShow($lastShowEndDT->format("Y-m-d")) ->setDbLastShow($lastShowEndDT->format("Y-m-d"))
->save(); ->save();
}
} }
//remove the old repeating deleted instances. //remove the old repeating deleted instances.
@ -872,6 +873,7 @@ SQL;
private function createWeeklyRepeatInstances($showDay, $populateUntil, private function createWeeklyRepeatInstances($showDay, $populateUntil,
$repeatType, $repeatInterval, $daysAdded=null) $repeatType, $repeatInterval, $daysAdded=null)
{ {
$show_id = $showDay->getDbShowId(); $show_id = $showDay->getDbShowId();
$first_show = $showDay->getDbFirstShow(); //non-UTC $first_show = $showDay->getDbFirstShow(); //non-UTC
$last_show = $showDay->getDbLastShow(); //non-UTC $last_show = $showDay->getDbLastShow(); //non-UTC
@ -894,10 +896,8 @@ SQL;
$utcLastShowDateTime = $last_show ? $utcLastShowDateTime = $last_show ?
Application_Common_DateHelper::ConvertToUtcDateTime($last_show, $timezone) : null; Application_Common_DateHelper::ConvertToUtcDateTime($last_show, $timezone) : null;
$utcStartDateTime = new DateTime("now");
$previousDate = clone $start; $previousDate = clone $start;
foreach ($datePeriod as $date) { foreach ($datePeriod as $date) {
list($utcStartDateTime, $utcEndDateTime) = $this->createUTCStartEndDateTime( list($utcStartDateTime, $utcEndDateTime) = $this->createUTCStartEndDateTime(
$date, $duration); $date, $duration);
/* /*
@ -954,12 +954,19 @@ SQL;
$previousDate = clone $date; $previousDate = clone $date;
} }
/* Set UTC to local time before setting the next repeat date. If we don't /* We need to set the next populate date for repeat shows so when a user
* the next repeat date might be scheduled for the following day * moves forward in the calendar we know when to start generating new
* show instances.
* If $utcStartDateTime is not set then we know zero new shows were
* created and we shouldn't update the next populate date.
*/ */
$utcStartDateTime->setTimezone(new DateTimeZone(Application_Model_Preference::GetTimezone())); if (isset($utcStartDateTime)) {
$nextDate = $utcStartDateTime->add($repeatInterval); /* Set UTC to local time before setting the next repeat date. If we don't
$this->setNextRepeatingShowDate($nextDate->format("Y-m-d"), $day, $show_id); * the next repeat date might be scheduled for the following day */
$utcStartDateTime->setTimezone(new DateTimeZone(Application_Model_Preference::GetTimezone()));
$nextDate = $utcStartDateTime->add($repeatInterval);
$this->setNextRepeatingShowDate($nextDate->format("Y-m-d"), $day, $show_id);
}
} }
private function createMonthlyRepeatInstances($showDay, $populateUntil) private function createMonthlyRepeatInstances($showDay, $populateUntil)