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

those sources for now.
This commit is contained in:
Bharat Mediratta
2011-01-06 08:17:01 -08:00
parent 56c4997663
commit 84f287865e

View File

@@ -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();
}