From 82a6fa058eea53ed9fe080b5093462e8212c8e64 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 2 Feb 2009 23:27:15 +0000 Subject: [PATCH] Add protection against bad entries in llx_categorie_association --- htdocs/categories/categorie.class.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/htdocs/categories/categorie.class.php b/htdocs/categories/categorie.class.php index 766c7ae06b8..a0c9afb2055 100644 --- a/htdocs/categories/categorie.class.php +++ b/htdocs/categories/categorie.class.php @@ -583,7 +583,7 @@ class Categorie } /** - * \brief For category id_categ and its child available in this->cats, define property fullpath + * \brief For category id_categ and its child available in this->cats, define property fullpath and fulllabel * \param id_categ id_categ entry to update * \param protection Deep counter to avoid infinite loop */ @@ -591,7 +591,14 @@ class Categorie { dolibarr_syslog("Categorie::build_path_from_id_categ id_categ=".$id_categ." protection=".$protection, LOG_DEBUG); - // Defini fullpath + if (! empty($this->cats[$id_categ]['fullpath'])) + { + // Already defined + dolibarr_syslog("Categorie::build_path_from_id_categ fullpath and fulllabel already defined", LOG_WARNING); + return; + } + + // Define fullpath and fulllabel if (isset($this->cats[$id_categ]['id_mere'])) { $this->cats[$id_categ]['fullpath'] =$this->cats[$this->cats[$id_categ]['id_mere']]['fullpath'];