From e4b454834987d55c91be43422f13eba9007daf45 Mon Sep 17 00:00:00 2001 From: lLefevre Date: Wed, 16 Nov 2011 17:48:48 +0000 Subject: [PATCH] // fix bug method addGroupsIfNoExist() in class Category --- classes/Category.php | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/classes/Category.php b/classes/Category.php index e45977eca..24a6e84f8 100644 --- a/classes/Category.php +++ b/classes/Category.php @@ -971,13 +971,10 @@ class CategoryCore extends ObjectModel public function addGroupsIfNoExist($id_group) { $groups = $this->getGroups(); - foreach ($groups as $group) - { - if ($group == $id_group) - return false; - else - return $this->addGroups(array((int)$id_group)); - } + if (!in_array((int)$id_group, $groups)) + return $this->addGroups(array((int)$id_group)); + else + return false; } /**