diff options
author | Bharat Mediratta <bharat@menalto.com> | 2010-01-20 23:49:10 -0800 |
---|---|---|
committer | Bharat Mediratta <bharat@menalto.com> | 2010-01-20 23:49:10 -0800 |
commit | 16ccda0f3d63b5db43c5eaee551ecc62c42becf5 (patch) | |
tree | 04c204d878ce1561931b282228b36b5d1dbf3040 /modules/gallery/helpers | |
parent | e2b6cfc2d9a0c0a5c6cf3c530b2a22d763b76970 (diff) |
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.
Diffstat (limited to 'modules/gallery/helpers')
-rw-r--r-- | modules/gallery/helpers/item.php | 6 |
1 files changed, 4 insertions, 2 deletions
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); } } |