summaryrefslogtreecommitdiff
path: root/modules/organize/controllers/organize.php
diff options
context:
space:
mode:
Diffstat (limited to 'modules/organize/controllers/organize.php')
-rw-r--r--modules/organize/controllers/organize.php6
1 files changed, 6 insertions, 0 deletions
diff --git a/modules/organize/controllers/organize.php b/modules/organize/controllers/organize.php
index 2ded8a2e..82f74c9e 100644
--- a/modules/organize/controllers/organize.php
+++ b/modules/organize/controllers/organize.php
@@ -81,6 +81,12 @@ class Organize_Controller extends Controller {
$source = ORM::factory("item", $source_id);
access::required("edit", $source->parent());
+ if ($source->contains($new_parent) || $source->id == $new_parent->id) {
+ // Can't move an item into its own hierarchy. Silently skip this,
+ // since the UI shouldn't even allow this operation.
+ continue;
+ }
+
$source->parent_id = $new_parent->id;
$source->save();
}