CC-5405: When editing a single show instance from a repeating series, should not create a new cc_show
Create a new cc_show_day rule instead of a new cc_show
This commit is contained in:
parent
f571000657
commit
6f9254e655
|
@ -183,6 +183,7 @@ class ScheduleController extends Zend_Controller_Action
|
||||||
$deltaDay = $this->_getParam('day');
|
$deltaDay = $this->_getParam('day');
|
||||||
$deltaMin = $this->_getParam('min');
|
$deltaMin = $this->_getParam('min');
|
||||||
$showId = $this->_getParam('showId');
|
$showId = $this->_getParam('showId');
|
||||||
|
$instanceId = $this->_getParam('instanceId');
|
||||||
|
|
||||||
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
|
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
|
||||||
$user = new Application_Model_User($userInfo->id);
|
$user = new Application_Model_User($userInfo->id);
|
||||||
|
@ -195,7 +196,7 @@ class ScheduleController extends Zend_Controller_Action
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
$error = $show->resizeShow($deltaDay, $deltaMin);
|
$error = $show->resizeShow($deltaDay, $deltaMin, $instanceId);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($error)) {
|
if (isset($error)) {
|
||||||
|
|
|
@ -172,16 +172,16 @@ SQL;
|
||||||
$show->delete();
|
$show->delete();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function resizeShow($deltaDay, $deltaMin)
|
public function resizeShow($deltaDay, $deltaMin, $instanceId)
|
||||||
{
|
{
|
||||||
$con = Propel::getConnection();
|
$con = Propel::getConnection();
|
||||||
|
|
||||||
if ($deltaDay > 0) {
|
if ($deltaDay > 0) {
|
||||||
return _("Shows can have a max length of 24 hours.");
|
return _("Shows can have a max length of 24 hours.");
|
||||||
}
|
}
|
||||||
|
|
||||||
$utc = new DateTimeZone("UTC");
|
$utc = new DateTimeZone("UTC");
|
||||||
|
|
||||||
$nowDateTime = new DateTime("now", $utc);
|
$nowDateTime = new DateTime("now", $utc);
|
||||||
|
|
||||||
$showInstances = CcShowInstancesQuery::create()
|
$showInstances = CcShowInstancesQuery::create()
|
||||||
|
|
|
@ -15,8 +15,20 @@
|
||||||
*/
|
*/
|
||||||
class CcShow extends BaseCcShow {
|
class CcShow extends BaseCcShow {
|
||||||
|
|
||||||
public function getCcShowDays(){
|
/*
|
||||||
return CcShowDaysQuery::create()->filterByDbShowId($this->getDbId())->find();
|
* Returns all cc_show_day rules that belong to a cc_show and that are
|
||||||
|
* repeating.
|
||||||
|
* We do this because editing a single instance from a repeating sequence
|
||||||
|
* creates a new rule in cc_show_days with the same cc_show id and a repeat
|
||||||
|
* type of -1 (non-repeating).
|
||||||
|
* So when the entire cc_show is updated after that, the single edited
|
||||||
|
* instance can remain separate from the rest of the instances
|
||||||
|
*/
|
||||||
|
public function getRepeatingCcShowDays(){
|
||||||
|
return CcShowDaysQuery::create()
|
||||||
|
->filterByDbShowId($this->id)
|
||||||
|
->filterByDbRepeatType(-1, Criteria::NOT_EQUAL)
|
||||||
|
->find();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -54,6 +66,49 @@ class CcShow extends BaseCcShow {
|
||||||
return $this->collCcShowDayss[0];
|
return $this->collCcShowDayss[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* A repeating show may have a rule in cc_show_days with a repeat type
|
||||||
|
* of -1 (not repeating). This happens when a single instances was edited
|
||||||
|
* from the repeating sequence.
|
||||||
|
*
|
||||||
|
* When the repeating show gets edited in this case, we want to exclude all
|
||||||
|
* the edited instances from the update. We do this by not returning any of
|
||||||
|
* the cc_show_day rules with a -1 repeat type.
|
||||||
|
*/
|
||||||
|
public function getFirstRepeatingCcShowDay()
|
||||||
|
{
|
||||||
|
return CcShowDaysQuery::create()
|
||||||
|
->filterByDbShowId($this->id)
|
||||||
|
->filterByDbRepeatType(-1, Criteria::NOT_EQUAL)
|
||||||
|
->orderByDbFirstShow()
|
||||||
|
->findOne();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* In order to determine if a show is repeating we need to check each
|
||||||
|
* cc_show_day entry and check if there are any non -1 repeat types.
|
||||||
|
* Because editing a single instances creates a new cc_show_day rule
|
||||||
|
* with a -1 (non repeating) repeat type we need to check all cc_show_day
|
||||||
|
* entries
|
||||||
|
*/
|
||||||
|
public function isRepeating()
|
||||||
|
{
|
||||||
|
//get ALL cc_show_day entries
|
||||||
|
$ccShowDays = CcShowDaysQuery::create()
|
||||||
|
->filterByDbShowId($this->id)
|
||||||
|
->find();
|
||||||
|
|
||||||
|
foreach ($ccShowDays as $day) {
|
||||||
|
if ($day->getDbRepeatType() >= 0) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets an array of CcShowInstances objects which contain a foreign key that references this object.
|
* Gets an array of CcShowInstances objects which contain a foreign key that references this object.
|
||||||
*
|
*
|
||||||
|
|
|
@ -124,7 +124,11 @@ class Application_Service_ShowFormService
|
||||||
|
|
||||||
private function populateFormWhen($form)
|
private function populateFormWhen($form)
|
||||||
{
|
{
|
||||||
$ccShowDay = $this->ccShow->getFirstCcShowDay();
|
if ($this->ccShow->isRepeating()) {
|
||||||
|
$ccShowDay = $this->ccShow->getFirstRepeatingCcShowDay();
|
||||||
|
} else {
|
||||||
|
$ccShowDay = $this->ccShow->getFirstCcShowDay();
|
||||||
|
}
|
||||||
|
|
||||||
$showStart = $ccShowDay->getLocalStartDateAndTime();
|
$showStart = $ccShowDay->getLocalStartDateAndTime();
|
||||||
$showEnd = $ccShowDay->getLocalEndDateAndTime($showStart);
|
$showEnd = $ccShowDay->getLocalEndDateAndTime($showStart);
|
||||||
|
@ -198,7 +202,11 @@ class Application_Service_ShowFormService
|
||||||
*/
|
*/
|
||||||
private function populateFormRepeats($form, $nextFutureShowStart)
|
private function populateFormRepeats($form, $nextFutureShowStart)
|
||||||
{
|
{
|
||||||
$ccShowDays = $this->ccShow->getCcShowDays();
|
if ($this->ccShow->isRepeating()) {
|
||||||
|
$ccShowDays = $this->ccShow->getRepeatingCcShowDays();
|
||||||
|
} else {
|
||||||
|
$ccShowDays = $this->ccShow->getCcShowDayss();
|
||||||
|
}
|
||||||
|
|
||||||
$days = array();
|
$days = array();
|
||||||
foreach ($ccShowDays as $ccShowDay) {
|
foreach ($ccShowDays as $ccShowDay) {
|
||||||
|
|
|
@ -55,11 +55,13 @@ class Application_Service_ShowService
|
||||||
throw new Exception("Permission denied");
|
throw new Exception("Permission denied");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$showId = $showData["add_show_id"];
|
||||||
|
|
||||||
/****** UPDATE SCHEDULE START TIME ******/
|
/****** UPDATE SCHEDULE START TIME ******/
|
||||||
//get the ccShow object to which this instance belongs
|
//get the ccShow object to which this instance belongs
|
||||||
//so we can get the original start date and time
|
//so we can get the original start date and time
|
||||||
$oldCcShow = CcShowQuery::create()
|
$this->ccShow = CcShowQuery::create()
|
||||||
->findPk($showData["add_show_id"]);
|
->findPk($showId);
|
||||||
|
|
||||||
//DateTime in shows's local time
|
//DateTime in shows's local time
|
||||||
$newStartDateTime = new DateTime($showData["add_show_start_date"]." ".
|
$newStartDateTime = new DateTime($showData["add_show_start_date"]." ".
|
||||||
|
@ -68,52 +70,78 @@ class Application_Service_ShowService
|
||||||
|
|
||||||
$ccShowInstanceOrig = CcShowInstancesQuery::create()
|
$ccShowInstanceOrig = CcShowInstancesQuery::create()
|
||||||
->findPk($showData["add_show_instance_id"]);
|
->findPk($showData["add_show_instance_id"]);
|
||||||
$diff = $this->calculateShowStartDiff($newStartDateTime,
|
|
||||||
$ccShowInstanceOrig->getLocalStartDateTime());
|
|
||||||
|
|
||||||
if ($diff > 0) {
|
//convert original start time into the show's local timezone
|
||||||
|
$origLocalStartDateTime = $ccShowInstanceOrig->getLocalStartDateTime();
|
||||||
|
|
||||||
|
$diff = $this->calculateShowStartDiff($newStartDateTime,
|
||||||
|
$origLocalStartDateTime);
|
||||||
|
|
||||||
|
if ($diff != 0) {
|
||||||
Application_Service_SchedulerService::updateScheduleStartTime(
|
Application_Service_SchedulerService::updateScheduleStartTime(
|
||||||
array($showData["add_show_instance_id"]), $diff);
|
array($showData["add_show_instance_id"]), $diff);
|
||||||
}
|
}
|
||||||
/****** UPDATE SCHEDULE START TIME ENDS******/
|
/****** UPDATE SCHEDULE START TIME ENDS******/
|
||||||
|
|
||||||
$this->setCcShow($showData);
|
/*
|
||||||
|
* Set the new cc_show_day record
|
||||||
|
* Associates it with the current show_id and sets it to non-repeating
|
||||||
|
*/
|
||||||
$this->setCcShowDays($showData);
|
$this->setCcShowDays($showData);
|
||||||
$this->setCcShowHosts($showData);
|
|
||||||
$this->delegateInstanceCreation();
|
|
||||||
|
|
||||||
//get the new instance id
|
/*
|
||||||
$ccShowInstance = CcShowInstancesQuery::create()
|
* In the case where an instance is being edited for a second
|
||||||
->filterByDbShowId($this->ccShow->getDbId())
|
* (or third, fourth, etc.) time we need to delete the old
|
||||||
|
* cc_show_day record
|
||||||
|
*
|
||||||
|
* Since we don't store the cc_show_day ids we need to use the
|
||||||
|
* original start time from cc_show_instances, convert it to the show's
|
||||||
|
* local timezone, and find the record in cc_show_days
|
||||||
|
*
|
||||||
|
* *** There is a flaw here: We have to assume the show timezone has
|
||||||
|
* *** not changed (make timezone readonly??)
|
||||||
|
*/
|
||||||
|
$origCcShowDay = CcShowDaysQuery::create()
|
||||||
|
->filterByDbShowId($showId)
|
||||||
|
->filterByDbRepeatType(-1)
|
||||||
|
->filterByDbFirstShow($origLocalStartDateTime->format("Y-m-d"))
|
||||||
|
->filterByDbStartTime($origLocalStartDateTime->format("H:i:s"))
|
||||||
|
->delete();
|
||||||
|
|
||||||
|
// DO WE NEED THIS?
|
||||||
|
$this->setCcShowHosts($showData);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* We need to find the new show day rule we just created by passing
|
||||||
|
* in the first show and start time in case multiple single
|
||||||
|
* instances have been edited out of the repeating sequence.
|
||||||
|
*/
|
||||||
|
$showDay = CcShowDaysQuery::create()
|
||||||
|
->filterByDbShowId($showId)
|
||||||
|
->filterByDbRepeatType(-1)
|
||||||
|
->filterByDbFirstShow($showData["add_show_start_date"])
|
||||||
|
->filterByDbStartTime($showData["add_show_start_time"])
|
||||||
->findOne();
|
->findOne();
|
||||||
|
|
||||||
$newInstanceId = $ccShowInstance->getDbId();
|
$ccShowInstance = $this->createNonRepeatingInstance($showDay,
|
||||||
|
$this->getPopulateShowUntilDateTIme());
|
||||||
|
|
||||||
//update cc_schedule with the new instance id
|
//update cc_schedule with the new instance id
|
||||||
$ccSchedules = CcScheduleQuery::create()
|
|
||||||
->filterByDbInstanceId($showData["add_show_instance_id"])
|
|
||||||
->find();
|
|
||||||
|
|
||||||
foreach ($ccSchedules as $ccSchedule) {
|
|
||||||
$ccSchedule->setDbInstanceId($newInstanceId);
|
|
||||||
$ccSchedule->save();
|
|
||||||
}
|
|
||||||
|
|
||||||
$con = Propel::getConnection(CcShowInstancesPeer::DATABASE_NAME);
|
$con = Propel::getConnection(CcShowInstancesPeer::DATABASE_NAME);
|
||||||
|
$selectCriteria = new Criteria();
|
||||||
|
$selectCriteria->add(CcSchedulePeer::INSTANCE_ID, $showData["add_show_instance_id"]);
|
||||||
|
$updateCriteria = new Criteria();
|
||||||
|
$updateCriteria->add(CcSchedulePeer::INSTANCE_ID, $ccShowInstance->getDbId());
|
||||||
|
BasePeer::doUpdate($selectCriteria, $updateCriteria, $con);
|
||||||
|
|
||||||
|
$ccShowInstance
|
||||||
|
->setDbLastScheduled(gmdate("Y-m-d H:i:s"))
|
||||||
|
->save();
|
||||||
$ccShowInstance->updateDbTimeFilled($con);
|
$ccShowInstance->updateDbTimeFilled($con);
|
||||||
|
|
||||||
//delete the edited instance from the repeating sequence
|
//delete the edited instance from the repeating sequence
|
||||||
$ccShowInstanceOrig->setDbModifiedInstance(true)->save();
|
$ccShowInstanceOrig->setDbModifiedInstance(true)->save();
|
||||||
|
|
||||||
$service_showForm = new Application_Service_ShowFormService($showData["add_show_id"]);
|
|
||||||
list($start, $end) = $service_showForm->getNextFutureRepeatShowTime();
|
|
||||||
$oldCcShowDay = $oldCcShow->getFirstCcShowDay();
|
|
||||||
$oldCcShowDay
|
|
||||||
->setDbFirstShow(
|
|
||||||
$start->setTimezone(new DateTimeZone(
|
|
||||||
$oldCcShowDay->getDbTimezone()))->format("Y-m-d"))
|
|
||||||
->save();
|
|
||||||
|
|
||||||
$con->commit();
|
$con->commit();
|
||||||
Application_Model_RabbitMq::PushSchedule();
|
Application_Model_RabbitMq::PushSchedule();
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
|
@ -131,7 +159,7 @@ class Application_Service_ShowService
|
||||||
*/
|
*/
|
||||||
private function storeOrigLocalShowInfo()
|
private function storeOrigLocalShowInfo()
|
||||||
{
|
{
|
||||||
$this->origCcShowDay = $this->ccShow->getFirstCcShowDay();
|
$this->origCcShowDay = $this->ccShow->getFirstRepeatingCcShowDay();
|
||||||
|
|
||||||
$this->oldShowTimezone = $this->origCcShowDay->getDbTimezone();
|
$this->oldShowTimezone = $this->origCcShowDay->getDbTimezone();
|
||||||
|
|
||||||
|
@ -165,7 +193,7 @@ class Application_Service_ShowService
|
||||||
|
|
||||||
$this->deleteRebroadcastInstances();
|
$this->deleteRebroadcastInstances();
|
||||||
|
|
||||||
$this->deleteCcShowDays();
|
//$this->deleteCcShowDays();
|
||||||
$this->deleteCcShowHosts();
|
$this->deleteCcShowHosts();
|
||||||
if ($this->isRebroadcast) {
|
if ($this->isRebroadcast) {
|
||||||
//delete entry in cc_show_rebroadcast
|
//delete entry in cc_show_rebroadcast
|
||||||
|
@ -225,7 +253,11 @@ class Application_Service_ShowService
|
||||||
if (is_null($this->ccShow)) {
|
if (is_null($this->ccShow)) {
|
||||||
$ccShowDays = $this->getShowDaysInRange($populateUntil, $end);
|
$ccShowDays = $this->getShowDaysInRange($populateUntil, $end);
|
||||||
} else {
|
} else {
|
||||||
$ccShowDays = $this->ccShow->getCcShowDays();
|
if ($this->ccShow->isRepeating()) {
|
||||||
|
$ccShowDays = $this->ccShow->getRepeatingCcShowDays();
|
||||||
|
} else {
|
||||||
|
$ccShowDays = $this->ccShow->getCcShowDayss();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!is_null($end)) {
|
if (!is_null($end)) {
|
||||||
|
@ -372,7 +404,7 @@ SQL;
|
||||||
$daysAdded = array();
|
$daysAdded = array();
|
||||||
|
|
||||||
//CcShowDay object
|
//CcShowDay object
|
||||||
$currentShowDay = $this->ccShow->getFirstCcShowDay();
|
$currentShowDay = $this->ccShow->getFirstRepeatingCcShowDay();
|
||||||
|
|
||||||
//new end date in users' local time
|
//new end date in users' local time
|
||||||
$endDateTime = $this->calculateEndDate($showData);
|
$endDateTime = $this->calculateEndDate($showData);
|
||||||
|
@ -420,7 +452,12 @@ SQL;
|
||||||
//repeat type is the same, check if the days of the week are the same
|
//repeat type is the same, check if the days of the week are the same
|
||||||
$repeatingDaysChanged = false;
|
$repeatingDaysChanged = false;
|
||||||
|
|
||||||
$ccShowDays = $this->ccShow->getCcShowDays();
|
if ($this->ccShow->isRepeating()) {
|
||||||
|
$ccShowDays = $this->ccShow->getRepeatingCcShowDays();
|
||||||
|
} else {
|
||||||
|
$ccShowDays = $this->ccShow->getCcShowDayss();
|
||||||
|
}
|
||||||
|
|
||||||
$showDays = array();
|
$showDays = array();
|
||||||
foreach ($ccShowDays as $day) {
|
foreach ($ccShowDays as $day) {
|
||||||
$showDays[] = $day->getDbDay();
|
$showDays[] = $day->getDbDay();
|
||||||
|
@ -710,6 +747,7 @@ SQL;
|
||||||
$ccShowDay = CcShowDaysQuery::create()
|
$ccShowDay = CcShowDaysQuery::create()
|
||||||
->filterByDbShowId($showId)
|
->filterByDbShowId($showId)
|
||||||
->filterByDbDay($dayOfWeek)
|
->filterByDbDay($dayOfWeek)
|
||||||
|
->filterByDbRepeatType(-1, Criteria::NOT_EQUAL)
|
||||||
->findOne();
|
->findOne();
|
||||||
|
|
||||||
if (isset($ccShowDay)) {
|
if (isset($ccShowDay)) {
|
||||||
|
@ -725,10 +763,10 @@ SQL;
|
||||||
}
|
}
|
||||||
|
|
||||||
//remove the old repeating deleted instances.
|
//remove the old repeating deleted instances.
|
||||||
CcShowInstancesQuery::create()
|
/*CcShowInstancesQuery::create()
|
||||||
->filterByDbShowId($showId)
|
->filterByDbShowId($showId)
|
||||||
->filterByDbModifiedInstance(true)
|
->filterByDbModifiedInstance(true)
|
||||||
->delete();
|
->delete();*/
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -915,6 +953,7 @@ SQL;
|
||||||
$this->createRebroadcastInstances($showDay, $start, $ccShowInstance->getDbId());
|
$this->createRebroadcastInstances($showDay, $start, $ccShowInstance->getDbId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return $ccShowInstance;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -971,6 +1010,9 @@ SQL;
|
||||||
if ($this->isUpdate) {
|
if ($this->isUpdate) {
|
||||||
if ($this->hasInstance($utcStartDateTime)) {
|
if ($this->hasInstance($utcStartDateTime)) {
|
||||||
$ccShowInstance = $this->getInstance($utcStartDateTime);
|
$ccShowInstance = $this->getInstance($utcStartDateTime);
|
||||||
|
if ($ccShowInstance->getDbModifiedInstance()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
$newInstance = false;
|
$newInstance = false;
|
||||||
$updateScheduleStatus = true;
|
$updateScheduleStatus = true;
|
||||||
} else {
|
} else {
|
||||||
|
@ -1259,12 +1301,13 @@ SQL;
|
||||||
$temp = clone($starts);
|
$temp = clone($starts);
|
||||||
$temp->setTimezone(new DateTimeZone($this->oldShowTimezone));
|
$temp->setTimezone(new DateTimeZone($this->oldShowTimezone));
|
||||||
$temp->setTime($this->localShowStartHour, $this->localShowStartMin);
|
$temp->setTime($this->localShowStartHour, $this->localShowStartMin);
|
||||||
|
|
||||||
$temp->setTimezone(new DateTimeZone("UTC"));
|
$temp->setTimezone(new DateTimeZone("UTC"));
|
||||||
|
|
||||||
$ccShowInstance = CcShowInstancesQuery::create()
|
$ccShowInstance = CcShowInstancesQuery::create()
|
||||||
->filterByDbStarts($temp->format("Y-m-d H:i:s"), Criteria::EQUAL)
|
->filterByDbStarts($temp->format("Y-m-d H:i:s"), Criteria::EQUAL)
|
||||||
->filterByDbShowId($this->ccShow->getDbId(), Criteria::EQUAL)
|
->filterByDbShowId($this->ccShow->getDbId(), Criteria::EQUAL)
|
||||||
->filterByDbModifiedInstance(false, Criteria::EQUAL)
|
//->filterByDbModifiedInstance(false, Criteria::EQUAL)
|
||||||
->filterByDbRebroadcast(0, Criteria::EQUAL)
|
->filterByDbRebroadcast(0, Criteria::EQUAL)
|
||||||
->limit(1)
|
->limit(1)
|
||||||
->find();
|
->find();
|
||||||
|
@ -1369,7 +1412,16 @@ SQL;
|
||||||
|
|
||||||
// Don't set day for monthly repeat type, it's invalid
|
// Don't set day for monthly repeat type, it's invalid
|
||||||
if ($showData['add_show_repeats'] && $showData['add_show_repeat_type'] == 2) {
|
if ($showData['add_show_repeats'] && $showData['add_show_repeat_type'] == 2) {
|
||||||
$showDay = new CcShowDays();
|
|
||||||
|
if ($this->isUpdate) {
|
||||||
|
$showDay = CcShowDaysQuery::create()
|
||||||
|
->filterByDbShowId($showId)
|
||||||
|
->filterByDbRepeatType($showData['add_show_repeat_type'])
|
||||||
|
->findOne();
|
||||||
|
} else {
|
||||||
|
$showDay = new CcShowDays();
|
||||||
|
}
|
||||||
|
|
||||||
$showDay->setDbFirstShow($startDateTime->format("Y-m-d"));
|
$showDay->setDbFirstShow($startDateTime->format("Y-m-d"));
|
||||||
$showDay->setDbLastShow($endDate);
|
$showDay->setDbLastShow($endDate);
|
||||||
$showDay->setDbStartTime($startDateTime->format("H:i:s"));
|
$showDay->setDbStartTime($startDateTime->format("H:i:s"));
|
||||||
|
@ -1395,7 +1447,22 @@ SQL;
|
||||||
$startDateTimeClone->add(new DateInterval("P".$daysAdd."D"));
|
$startDateTimeClone->add(new DateInterval("P".$daysAdd."D"));
|
||||||
}
|
}
|
||||||
if (is_null($endDate) || $startDateTimeClone->getTimestamp() <= $endDateTime->getTimestamp()) {
|
if (is_null($endDate) || $startDateTimeClone->getTimestamp() <= $endDateTime->getTimestamp()) {
|
||||||
$showDay = new CcShowDays();
|
|
||||||
|
if ($this->isUpdate) {
|
||||||
|
$showDay = CcShowDaysQuery::create()
|
||||||
|
->filterByDbShowId($showId)
|
||||||
|
->filterByDbRepeatType($showData['add_show_repeat_type'])
|
||||||
|
->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 = new CcShowDays();
|
||||||
|
}
|
||||||
|
|
||||||
$showDay->setDbFirstShow($startDateTimeClone->format("Y-m-d"));
|
$showDay->setDbFirstShow($startDateTimeClone->format("Y-m-d"));
|
||||||
$showDay->setDbLastShow($endDate);
|
$showDay->setDbLastShow($endDate);
|
||||||
$showDay->setDbStartTime($startDateTimeClone->format("H:i"));
|
$showDay->setDbStartTime($startDateTimeClone->format("H:i"));
|
||||||
|
@ -1562,6 +1629,7 @@ SQL;
|
||||||
$repeatInfo = CcShowDaysQuery::create()
|
$repeatInfo = CcShowDaysQuery::create()
|
||||||
->filterByDbShowId($showId)
|
->filterByDbShowId($showId)
|
||||||
->filterByDbDay($day)
|
->filterByDbDay($day)
|
||||||
|
->filterByDbRepeatType(-1, Criteria::NOT_EQUAL)
|
||||||
->findOne();
|
->findOne();
|
||||||
|
|
||||||
$repeatInfo->setDbNextPopDate($nextInfo[0])
|
$repeatInfo->setDbNextPopDate($nextInfo[0])
|
||||||
|
|
|
@ -332,7 +332,7 @@ function eventResize( event, dayDelta, minuteDelta, revertFunc, jsEvent, ui, vie
|
||||||
var url = baseUrl+'Schedule/resize-show/format/json';
|
var url = baseUrl+'Schedule/resize-show/format/json';
|
||||||
|
|
||||||
$.post(url,
|
$.post(url,
|
||||||
{day: dayDelta, min: minuteDelta, showId: event.showId},
|
{day: dayDelta, min: minuteDelta, showId: event.showId, instanceId: event.id},
|
||||||
function(json){
|
function(json){
|
||||||
if(json.show_error == true){
|
if(json.show_error == true){
|
||||||
alertShowErrorAndReload();
|
alertShowErrorAndReload();
|
||||||
|
|
Loading…
Reference in New Issue