Skip to content
Browse files

Don't allow moving an item into its own hierarchy. Just silently skip

those sources for now.
  • Loading branch information...
1 parent 56c4997 commit 84f287865e5382d7c01c11d1b518c97e8d2bd97b @bharat bharat committed Jan 6, 2011
Showing with 6 additions and 0 deletions.
  1. +6 −0 modules/organize/controllers/organize.php
View
6 modules/organize/controllers/organize.php
@@ -81,6 +81,12 @@ function reparent() {
$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();
}

0 comments on commit 84f2878

Please sign in to comment.
Something went wrong with that request. Please try again.