CC-5151: Calendar -> Remove all content -> Does not update scheduled flag in library
This commit is contained in:
parent
9ad42b2b2c
commit
254ebb709e
|
@ -289,23 +289,39 @@ class Application_Service_SchedulerService
|
||||||
$ccShowInstance = CcShowInstancesQuery::create()->findPk($instanceId);
|
$ccShowInstance = CcShowInstancesQuery::create()->findPk($instanceId);
|
||||||
|
|
||||||
$instances = array();
|
$instances = array();
|
||||||
|
$instanceIds = array();
|
||||||
|
|
||||||
if ($ccShowInstance->getCcShow()->isLinked()) {
|
if ($ccShowInstance->getCcShow()->isLinked()) {
|
||||||
$instanceIds = array();
|
|
||||||
foreach ($ccShowInstance->getCcShow()->getCcShowInstancess() as $instance) {
|
foreach ($ccShowInstance->getCcShow()->getCcShowInstancess() as $instance) {
|
||||||
$instanceIds[] = $instance->getDbId();
|
$instanceIds[] = $instance->getDbId();
|
||||||
$instances[] = $instance;
|
$instances[] = $instance;
|
||||||
}
|
}
|
||||||
CcScheduleQuery::create()
|
|
||||||
->filterByDbInstanceId($instanceIds, Criteria::IN)
|
|
||||||
->delete();
|
|
||||||
} else {
|
} else {
|
||||||
|
$instanceIds[] = $ccShowInstance->getDbId();
|
||||||
$instances[] = $ccShowInstance;
|
$instances[] = $ccShowInstance;
|
||||||
CcScheduleQuery::create()
|
|
||||||
->filterByDbInstanceId($ccShowInstance->getDbId())
|
|
||||||
->delete();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Update the is_scheduled flag in cc_files to false
|
||||||
|
* We need to do this before we delete the scheduled items
|
||||||
|
*/
|
||||||
|
$ccSchedules = CcScheduleQuery::create()
|
||||||
|
->filterByDbInstanceId($instanceIds, Criteria::IN)
|
||||||
|
->find();
|
||||||
|
$fileIds = array();
|
||||||
|
foreach ($ccSchedules as $ccSchedule) {
|
||||||
|
$fileIds[] = $ccSchedule->getDbFileId();
|
||||||
|
}
|
||||||
|
$selectCriteria = new Criteria();
|
||||||
|
$selectCriteria->add(CcFilesPeer::ID, $fileIds, Criteria::IN);
|
||||||
|
$updateCriteria = new Criteria();
|
||||||
|
$updateCriteria->add(CcFilesPeer::IS_SCHEDULED, false);
|
||||||
|
BasePeer::doUpdate($selectCriteria, $updateCriteria, Propel::getConnection());
|
||||||
|
|
||||||
|
/* Clear out the schedule */
|
||||||
|
CcScheduleQuery::create()
|
||||||
|
->filterByDbInstanceId($instanceIds, Criteria::IN)
|
||||||
|
->delete();
|
||||||
|
|
||||||
Application_Model_RabbitMq::PushSchedule();
|
Application_Model_RabbitMq::PushSchedule();
|
||||||
$con = Propel::getConnection(CcShowInstancesPeer::DATABASE_NAME);
|
$con = Propel::getConnection(CcShowInstancesPeer::DATABASE_NAME);
|
||||||
foreach ($instances as $instance) {
|
foreach ($instances as $instance) {
|
||||||
|
|
Loading…
Reference in New Issue