CC-3094: Rebroadcast editing problems

-Fixed
This commit is contained in:
Martin Konecny 2011-11-26 00:06:17 -05:00
parent 757b2cac4f
commit 317bed8643
2 changed files with 32 additions and 7 deletions

View File

@ -1524,21 +1524,42 @@ class Application_Model_Show {
return $event;
}
public function setShowFirstShow($s_date){
/* Takes in a UTC DateTime object.
* Converts this to local time, since cc_show days
* requires local time. */
public function setShowFirstShow($p_dt){
//clone object since we are modifying it and it was passed by reference.
$dt = clone $p_dt;
$dt->setTimezone(new DateTimeZone(date_default_timezone_get()));
$showDay = CcShowDaysQuery::create()
->filterByDbShowId($this->_showId)
->findOne();
$showDay->setDbFirstShow($s_date)
$showDay->setDbFirstShow($dt)
->save();
}
public function setShowLastShow($e_date){
/* Takes in a UTC DateTime object
* Converts this to local time, since cc_show days
* requires local time. */
public function setShowLastShow($p_dt){
//clone object since we are modifying it and it was passed by reference.
$dt = clone $p_dt;
$dt->setTimezone(new DateTimeZone(date_default_timezone_get()));
//add one day since the Last Show date in CcShowDays is non-inclusive.
$dt->add(new DateInterval("P1D"));
$showDay = CcShowDaysQuery::create()
->filterByDbShowId($this->_showId)
->findOne();
$showDay->setDbLastShow($e_date)
$showDay->setDbLastShow($dt)
->save();
}

View File

@ -29,6 +29,10 @@ class Application_Model_ShowInstance {
return new Application_Model_Show($this->getShowId());
}
/* This function is weird. It should return a boolean, but instead returns
* an integer if it is a rebroadcast, or returns null if it isn't. You can convert
* it to boolean by using is_null(isRebroadcast), where true means isn't and false
* means that it is. */
public function isRebroadcast()
{
return $this->_showInstance->getDbOriginalShow();
@ -231,9 +235,9 @@ class Application_Model_ShowInstance {
$this->correctScheduleStartTimes();
$show = new Application_Model_Show($this->getShowId());
if(!$show->isRepeating()){
$show->setShowFirstShow($new_starts);
$show->setShowLastShow($new_ends);
if(!$show->isRepeating() && is_null($this->isRebroadcast())){
$show->setShowFirstShow($newStartsDateTime);
$show->setShowLastShow($newEndsDateTime);
}
Application_Model_RabbitMq::PushSchedule();