CC-5405: When editing a single show instance from a repeating series, should not create a new cc_show

- Fixed resizing repeating shows to not include edited instances
- Fixed context menu on repeating shows with edited instances
- Fixed populated the show form when editing a single instance
This commit is contained in:
drigato 2013-12-02 07:19:31 -05:00
parent a465b5a770
commit ef8af1b724
4 changed files with 146 additions and 27 deletions

View file

@ -109,6 +109,44 @@ class CcShow extends BaseCcShow {
return false;
}
/**
* Returns all cc_show_instances that have been edited out of
* a repeating sequence
*/
public function getEditedRepeatingInstanceIds()
{
//get cc_show_days that have been edited (not repeating)
$ccShowDays = CcShowDaysQuery::create()
->filterByDbShowId($this->id)
->filterByDbRepeatType(-1)
->find();
$startsUTC = array();
$utc = new DateTimeZone("UTC");
foreach ($ccShowDays as $day) {
//convert to UTC
$starts = new DateTime(
$day->getDbFirstShow()." ".$day->getDbStartTime(),
new DateTimeZone($day->getDbTimezone())
);
$starts->setTimezone($utc);
array_push($startsUTC, $starts->format("Y-m-d H:i:s"));
}
$excludeInstances = CcShowInstancesQuery::create()
->filterByDbShowId($this->id)
->filterByDbStarts($startsUTC, criteria::IN)
->find();
$excludeIds = array();
foreach ($excludeInstances as $instance) {
array_push($excludeIds, $instance->getDbId());
}
return $excludeIds;
}
/**
* Gets an array of CcShowInstances objects which contain a foreign key that references this object.
*