From f3eec7582ee281fb59a2659e8154854d6651434a Mon Sep 17 00:00:00 2001 From: BadPixxel Date: Tue, 30 Sep 2014 16:00:04 +0200 Subject: [PATCH 1/7] Minor BugFix : Wrong variable reference in getNomUrl Display of Category Url was incompete due to reference to "$ref" instead of "$label" --- htdocs/categories/class/categorie.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index f9c4a96dcaa..59d2ff4a766 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -1271,7 +1271,7 @@ class Categorie extends CommonObject if ($withpicto) $result.=($lien.img_object($label,$picto).$lienfin); if ($withpicto && $withpicto != 2) $result.=' '; - if ($withpicto != 2) $result.=$lien.dol_trunc($this->ref,$maxlength).$lienfin; + if ($withpicto != 2) $result.=$lien.dol_trunc($this->label,$maxlength).$lienfin; return $result; } From 820e6e5d95fb879776dd51dfa64797401a29fff9 Mon Sep 17 00:00:00 2001 From: BadPixxel Date: Tue, 30 Sep 2014 19:01:43 +0200 Subject: [PATCH 2/7] Minor BugFix : Compatibility of function getNomUrl Using Ref & Label for Category Name display is necessary for compatibility --- htdocs/categories/class/categorie.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index 59d2ff4a766..51308174112 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -1263,7 +1263,7 @@ class Categorie extends CommonObject $result=''; $lien = ''; - $label=$langs->trans("ShowCategory").': '.$this->label; + $label=$langs->trans("ShowCategory").': '. ($this->ref?$this->ref:$this->label); $lienfin=''; $picto='category'; @@ -1271,7 +1271,7 @@ class Categorie extends CommonObject if ($withpicto) $result.=($lien.img_object($label,$picto).$lienfin); if ($withpicto && $withpicto != 2) $result.=' '; - if ($withpicto != 2) $result.=$lien.dol_trunc($this->label,$maxlength).$lienfin; + if ($withpicto != 2) $result.=$lien.dol_trunc(($this->ref?$this->ref:$this->label),$maxlength).$lienfin; return $result; } From 12e6d1bf6c2d253ee3f051cc5577670bd94581fc Mon Sep 17 00:00:00 2001 From: BadPixxel Date: Tue, 30 Sep 2014 19:09:59 +0200 Subject: [PATCH 3/7] Missing Key for getNomUrl function --- htdocs/langs/fr_FR/categories.lang | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/langs/fr_FR/categories.lang b/htdocs/langs/fr_FR/categories.lang index 6570eec5638..90e8c086d43 100644 --- a/htdocs/langs/fr_FR/categories.lang +++ b/htdocs/langs/fr_FR/categories.lang @@ -111,3 +111,4 @@ ExtraFieldsCategories=Attributs supplémentaires CategoriesSetup=Configuration du module catégories CategorieRecursiv=Lier avec les catégories parentes CategorieRecursivHelp=Si activer, quand un élément est ajouté dans une catégorie, ajouter aussi l'élément dans toutes les catégories parentes +ShowCategory=Afficher la catégorie From cf2ba78fc1be4a46a0d443fc8d510d8eca2ad20b Mon Sep 17 00:00:00 2001 From: BadPixxel Date: Tue, 30 Sep 2014 19:11:01 +0200 Subject: [PATCH 4/7] Missing Key for getNomUrl function --- htdocs/langs/en_US/categories.lang | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/langs/en_US/categories.lang b/htdocs/langs/en_US/categories.lang index fb9ad8a3b6d..1cfccd75d5d 100644 --- a/htdocs/langs/en_US/categories.lang +++ b/htdocs/langs/en_US/categories.lang @@ -111,3 +111,4 @@ ExtraFieldsCategories=Complementary attributes CategoriesSetup=Categories setup CategorieRecursiv=Link with parent category automatically CategorieRecursivHelp=If activated, product will also linked to parent category when adding into a subcategory +ShowCategory=Show category From d6c8f65dad43bc0734b0b4b69dd3f9f14318055f Mon Sep 17 00:00:00 2001 From: BadPixxel Date: Tue, 30 Sep 2014 19:37:13 +0200 Subject: [PATCH 5/7] Minor BugFix : Missing thumbs folder in Category Images List Sub-folder for thumbs was missing in category image list, url was wrong.... --- htdocs/categories/class/categorie.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index 51308174112..af16ca2d28e 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -1369,7 +1369,7 @@ class Categorie extends CommonObject // Objet $obj=array(); $obj['photo']=$photo; - if ($photo_vignette && is_file($dirthumb.$photo_vignette)) $obj['photo_vignette']=$photo_vignette; + if ($photo_vignette && is_file($dirthumb.$photo_vignette)) $obj['photo_vignette']='thumbs/' . $photo_vignette; else $obj['photo_vignette']=""; $tabobj[$nbphoto-1]=$obj; From f178aa65ca86984817dcfb04ff1c4b8765a95af9 Mon Sep 17 00:00:00 2001 From: BadPixxel Date: Tue, 30 Sep 2014 19:43:21 +0200 Subject: [PATCH 6/7] removed "thumb\" subdir addition Category Image Thumb sub-folder now directly added by function liste_photos --- htdocs/categories/photos.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/categories/photos.php b/htdocs/categories/photos.php index 69a8bb97eab..c54d7d889b2 100644 --- a/htdocs/categories/photos.php +++ b/htdocs/categories/photos.php @@ -241,7 +241,7 @@ if ($object->id) // Si fichier vignette disponible, on l'utilise, sinon on utilise photo origine if ($obj['photo_vignette']) { - $filename='thumbs/'.$obj['photo_vignette']; + $filename=$obj['photo_vignette']; } else { From 8fc5faf4a843d801e3517399b70ea4e7b17cd125 Mon Sep 17 00:00:00 2001 From: BadPixxel Date: Mon, 10 Nov 2014 16:29:05 +0100 Subject: [PATCH 7/7] Minor BugFix : Missing delete Category Multilangual fields Delete of Multilangual fields was missing, impossible to delete category. Fixed Error : Cannot delete or update a parent row: a foreign key constraint fails (`Dol-3.6`.`llx_categorie_lang`, CONSTRAINT `fk_category_lang_fk_category` FOREIGN KEY (`fk_category`) REFERENCES `llx_categorie` (`rowid`)) --- htdocs/categories/class/categorie.class.php | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index af16ca2d28e..a504b71b42e 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -408,7 +408,18 @@ class Categorie extends CommonObject $error++; } } - + if (! $error) + { + $sql = "DELETE FROM ".MAIN_DB_PREFIX."categorie_lang"; + $sql .= " WHERE fk_category = ".$this->id; + if (!$this->db->query($sql)) + { + $this->error=$this->db->lasterror(); + dol_syslog("Error sql=".$sql." ".$this->error, LOG_ERR); + $error++; + } + } + // Delete category if (! $error) {