From 06fb8925e9a8cb328ebd71f5dba63b084d2618da Mon Sep 17 00:00:00 2001 From: tDidierjean Date: Thu, 1 Mar 2012 13:28:21 +0000 Subject: [PATCH] // fix bug with wrong positions when changing parent of tab --- classes/Tab.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/classes/Tab.php b/classes/Tab.php index 4b6dd2e17..4b4316537 100644 --- a/classes/Tab.php +++ b/classes/Tab.php @@ -445,4 +445,20 @@ class TabCore extends ObjectModel $tabs = Tab::recursiveTab($admin_tab['id_parent'], $tabs); return $tabs; } + + /** + * Overrides update to set position to last when changing parent tab + * + * @see ObjectModel::update + * @param bool $null_values + * @return bool + */ + public function update($null_values = false) + { + $current_tab = new Tab($this->id); + if ($current_tab->id_parent != $this->id_parent) + $this->position = Tab::getNewLastPosition($this->id_parent); + + return parent::update($null_values); + } }