CC-5076: Calendar -> Context menu -> Remove all content doesn't remove content from linked instances
This commit is contained in:
parent
ff2fde0173
commit
0362f24a4e
2 changed files with 41 additions and 10 deletions
|
@ -204,4 +204,40 @@ class Application_Service_SchedulerService
|
|||
} //if at least one linked instance has content
|
||||
}
|
||||
}
|
||||
|
||||
public function emptyShowContent($instanceId)
|
||||
{
|
||||
try {
|
||||
$ccShowInstance = CcShowInstancesQuery::create()->findPk($instanceId);
|
||||
|
||||
$instances = array();
|
||||
|
||||
if ($ccShowInstance->getCcShow()->isLinked()) {
|
||||
$instanceIds = array();
|
||||
foreach ($ccShowInstance->getCcShow()->getCcShowInstancess() as $instance) {
|
||||
$instanceIds[] = $instance->getDbId();
|
||||
$instances[] = $instance;
|
||||
}
|
||||
CcScheduleQuery::create()
|
||||
->filterByDbInstanceId($instanceIds, Criteria::IN)
|
||||
->delete();
|
||||
} else {
|
||||
$instances[] = $ccShowInstance;
|
||||
CcScheduleQuery::create()
|
||||
->filterByDbInstanceId($ccShowInstance->getDbId())
|
||||
->delete();
|
||||
}
|
||||
|
||||
Application_Model_RabbitMq::PushSchedule();
|
||||
$con = Propel::getConnection(CcShowInstancesPeer::DATABASE_NAME);
|
||||
foreach ($instances as $instance) {
|
||||
$instance->updateDbTimeFilled($con);
|
||||
}
|
||||
|
||||
return true;
|
||||
} catch (Exception $e) {
|
||||
Logging::info($e->getMessage());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue