diff options
author | Tim Almdal <tnalmdal@shaw.ca> | 2010-05-18 06:16:47 -0700 |
---|---|---|
committer | Tim Almdal <tnalmdal@shaw.ca> | 2010-05-18 06:16:47 -0700 |
commit | 73c7ec53102c24de248d1424fdf8d5ba347c2200 (patch) | |
tree | dd2a275436764f36cfc089f02d7bfa65c87e64e1 | |
parent | 83ce637ce3171a012515b2e20e8592d22e9929f8 (diff) |
Save the item before updating the order of the children. Also always increment the weight count (even if it is equal to the weight of the current child)
-rw-r--r-- | modules/gallery/helpers/item_rest.php | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/modules/gallery/helpers/item_rest.php b/modules/gallery/helpers/item_rest.php index 36d2ca62..298c2f4a 100644 --- a/modules/gallery/helpers/item_rest.php +++ b/modules/gallery/helpers/item_rest.php @@ -126,18 +126,19 @@ class item_rest_Core { } } } + $item->save(); - $weight = 0; if (isset($request->params->members)) { + $weight = 0; foreach ($request->params->members as $url) { $child = rest::resolve($url); if ($child->parent_id == $item->id && $child->weight != $weight) { - $child->weight = $weight++; + $child->weight = $weight; $child->save(); } + $weight++; } } - $item->save(); } static function post($request) { |