From 16ccda0f3d63b5db43c5eaee551ecc62c42becf5 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Wed, 20 Jan 2010 23:49:10 -0800 Subject: 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. --- modules/gallery/helpers/item.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'modules') diff --git a/modules/gallery/helpers/item.php b/modules/gallery/helpers/item.php index 7821e628..41d49ce9 100644 --- a/modules/gallery/helpers/item.php +++ b/modules/gallery/helpers/item.php @@ -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); } } -- cgit v1.2.3