CC-5725: Changing a show's repeat type removes first instance from repeating series

This commit is contained in:
drigato 2014-03-06 11:18:13 -05:00
parent 51b5cc2052
commit 35fd639c1c
1 changed files with 17 additions and 9 deletions

View File

@ -1545,15 +1545,23 @@ SQL;
if (is_null($endDate) || $startDateTimeClone->getTimestamp() <= $endDateTime->getTimestamp()) {
if ($this->isUpdate) {
$showDay = CcShowDaysQuery::create()
->filterByDbShowId($showId)
->filterByDbRepeatType($this->origCcShowDay->getDbRepeatType())
->filterByDbDay($this->origCcShowDay->getDbDay())
->findOne();
if (!$showDay) {
//if no show day object was found it is because a new
//repeating day of the week was added
$showDay = new CcShowDays();
if ($this->repeatType >= 0) {
$showDay = CcShowDaysQuery::create()
->filterByDbShowId($showId)
->filterByDbRepeatType($this->repeatType)
->filterByDbDay($day)
->findOne();
if (!$showDay) {
//if no show day object was found it is because a new
//repeating day of the week was added
$showDay = new CcShowDays();
}
} else {
$showDay = CcShowDaysQuery::create()
->filterByDbShowId($showId)
->filterByDbRepeatType($this->origCcShowDay->getDbRepeatType())
->filterByDbDay($this->origCcShowDay->getDbDay())
->findOne();
}
} else {
$showDay = new CcShowDays();