CC-4961: Show linking
This commit is contained in:
parent
52655ab375
commit
a5264aac1e
|
@ -45,20 +45,25 @@ class Application_Model_Scheduler
|
||||||
$this->checkUserPermissions = $value;
|
$this->checkUserPermissions = $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function validateItemMove($itemsToMove, $afterItem)
|
private function validateItemMove($itemsToMove, $destination)
|
||||||
{
|
{
|
||||||
$afterInstanceId = $afterItem["instance"];
|
$destinationInstanceId = $destination["instance"];
|
||||||
|
$destinationCcShowInstance = CcShowInstancesQuery::create()
|
||||||
|
->findPk($destinationInstanceId);
|
||||||
|
$isDestinationLinked = $destinationCcShowInstance->getCcShow()->isLinked();
|
||||||
|
|
||||||
foreach ($itemsToMove as $itemToMove) {
|
foreach ($itemsToMove as $itemToMove) {
|
||||||
$ccShowInstance = CcShowInstancesQuery::create()
|
$ccShowInstance = CcShowInstancesQuery::create()
|
||||||
->findPk($itemToMove["instance"]);
|
->findPk($itemToMove["instance"]);
|
||||||
|
|
||||||
//does the item being moved belong to a linked show
|
//does the item being moved belong to a linked show
|
||||||
$linked = $ccShowInstance->getCcShow()->isLinked();
|
$isSourceLinked = $ccShowInstance->getCcShow()->isLinked();
|
||||||
|
|
||||||
if ($linked && $itemToMove["instance"] != $afterInstanceId) {
|
if ($isSourceLinked && $itemToMove["instance"] != $destinationInstanceId) {
|
||||||
throw new Exception(_("Linked items can only be moved within its own show"));
|
throw new Exception(_("Linked items can only be moved within its own show"));
|
||||||
}
|
} /*elseif ($isDestinationLinked && $isSourceLinked) {
|
||||||
|
throw new Exception(_("Items can only be moved to and from unlinked shows"));
|
||||||
|
}*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -555,10 +560,11 @@ class Application_Model_Scheduler
|
||||||
//need to keep same id for resources if we want REST.
|
//need to keep same id for resources if we want REST.
|
||||||
if (isset($file['sched_id'])) {
|
if (isset($file['sched_id'])) {
|
||||||
|
|
||||||
$sched = CcScheduleQuery::create()
|
/*$sched = CcScheduleQuery::create()
|
||||||
->filterByDbInstanceId($instance->getDbId())
|
->filterByDbInstanceId($instance->getDbId())
|
||||||
->filterByDbFileId($file["id"])
|
->filterByDbFileId($file["id"])
|
||||||
->findOne();
|
->findOne();*/
|
||||||
|
$sched = CcScheduleQuery::create()->findPk($file["sched_id"]);
|
||||||
|
|
||||||
$excludeIds[] = intval($sched->getDbId());
|
$excludeIds[] = intval($sched->getDbId());
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue