Two fixes:

1) Don't call ORM_MPTT::move_to() directly.  Use the new
   model-based-validation approach of changing the parent_id and saving.

2) Item_Model::parent() can return null; check for it.
This commit is contained in:
Bharat Mediratta
2010-01-20 23:49:10 -08:00
parent e2b6cfc2d9
commit 16ccda0f3d
+4 -2
View File
@@ -39,7 +39,8 @@ class item_Core {
}
}
$source->move_to($target);
$source->parent_id = $target->id;
$source->save();
// If the target has no cover item, make this it.
if ($target->album_cover_item_id == null) {
@@ -59,7 +60,8 @@ class item_Core {
$parent->save();
graphics::generate($parent);
$grand_parent = $parent->parent();
if (access::can("edit", $grand_parent) && $grand_parent->album_cover_item_id == null) {
if ($grand_parent && access::can("edit", $grand_parent) &&
$grand_parent->album_cover_item_id == null) {
item::make_album_cover($parent);
}
}