mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-15 05:53:13 +00:00
Port PHRAS-1381 to 4.1
This commit is contained in:
@@ -110,6 +110,9 @@ class MoveCollectionController extends Controller
|
||||
return $this->app->json($datas);
|
||||
}
|
||||
|
||||
/** @var \collection[] $trashCollectionsBySbasId */
|
||||
$trashCollectionsBySbasId = [];
|
||||
|
||||
foreach ($records as $record) {
|
||||
$record->move_to_collection($collection, $this->getApplicationBox());
|
||||
|
||||
@@ -121,6 +124,33 @@ class MoveCollectionController extends Controller
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$sbasId = $record->getDatabox()->get_sbas_id();
|
||||
if (!array_key_exists($sbasId, $trashCollectionsBySbasId)) {
|
||||
$trashCollectionsBySbasId[$sbasId] = $record->getDatabox()->getTrashCollection();
|
||||
}
|
||||
if ($trashCollectionsBySbasId[$sbasId] !== null) {
|
||||
if ($record->getCollection()->get_coll_id() == $trashCollectionsBySbasId[$sbasId]->get_coll_id() && $collection->get_coll_id() !== $trashCollectionsBySbasId[$sbasId]->get_coll_id()) {
|
||||
// record is already in trash so active it
|
||||
foreach ($record->get_subdefs() as $subdef) {
|
||||
if (($pl = $subdef->get_permalink())) {
|
||||
$pl->set_is_activated(true);
|
||||
}
|
||||
}
|
||||
if ($request->request->get("chg_coll_son") == "1") {
|
||||
/** @var \record_adapter $child */
|
||||
foreach ($record->getChildren() as $child) {
|
||||
if ($this->getAclForUser()->has_right_on_base($child->getBaseId(), \ACL::CANDELETERECORD)) {
|
||||
foreach ($child->get_subdefs() as $childSubdef) {
|
||||
if (($childPl = $childSubdef->get_permalink())) {
|
||||
$childPl->set_is_activated(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$ret = [
|
||||
|
Reference in New Issue
Block a user