diff --git a/htdocs/categories/categorie.class.php b/htdocs/categories/categorie.class.php index 885b8708e3d..062e551801c 100644 --- a/htdocs/categories/categorie.class.php +++ b/htdocs/categories/categorie.class.php @@ -110,8 +110,8 @@ class Categorie return -1; } - $sql = "INSERT INTO ".MAIN_DB_PREFIX."categorie (label, description) "; - $sql .= "VALUES ('".str_replace("'","''",$this->label)."', '".str_replace("'","''",$this->description)."')"; + $sql = "INSERT INTO ".MAIN_DB_PREFIX."categorie (label, description, visible) "; + $sql .= "VALUES ('".str_replace("'","''",$this->label)."', '".str_replace("'","''",$this->description)."', '".$this->visible."')"; $res = $this->db->query ($sql); @@ -172,11 +172,15 @@ class Categorie return -1; } } - $sql = "UPDATE ".MAIN_DB_PREFIX."categorie"; + $sql = "UPDATE ".MAIN_DB_PREFIX."categorie"; $sql.= " SET label = '".trim(str_replace("'","''",$this->label))."'"; - + if (strlen (trim($this->description)) > 0) - $sql .= ", description = '".trim(str_replace("'","''",$this->description))."'"; + { + $sql .= ", description = '".trim(str_replace("'","''",$this->description))."'"; + } + + $sql .= ", visible = '".$this->visible."'"; $sql .= " WHERE rowid = ".$this->id; if ($this->db->query($sql)) diff --git a/htdocs/categories/edit.php b/htdocs/categories/edit.php index b730d79b408..f51ddba2e87 100644 --- a/htdocs/categories/edit.php +++ b/htdocs/categories/edit.php @@ -40,6 +40,7 @@ if ($_POST["action"] == 'update' && $user->rights->categorie->creer) $categorie->label = $_POST["nom"]; $categorie->description = $_POST["description"]; + $categorie->visible = $_POST["visible"]; if($_POST['catMere'] != "-1") $categorie->id_mere = $_POST['catMere']; else @@ -91,6 +92,10 @@ print ''; trans ("AddIn"); ?> select_all_categories($categorie->id_mere);?> + + trans ("ContentsVisibleByAll"); ?> + selectyesnonum("visible",$categorie->visible);?> + diff --git a/htdocs/categories/fiche.php b/htdocs/categories/fiche.php index cfecbba58e1..1663bbb6660 100644 --- a/htdocs/categories/fiche.php +++ b/htdocs/categories/fiche.php @@ -58,6 +58,7 @@ if ($_POST["action"] == 'add' && $user->rights->categorie->creer) $categorie->label = $_POST["nom"]; $categorie->description = $_POST["description"]; + $categorie->visible = $_POST["visible"]; if($_POST['catMere'] != "-1") $categorie->id_mere = $_POST['catMere']; @@ -133,6 +134,9 @@ if ($user->rights->produit->creer) print ''.$langs->trans ("AddIn").''; print $html->select_all_categories(); print ''; + print ''.$langs->trans ("ContentsVisibleByAll").''; + print $html->selectyesnonum("visible",$categorie->visible); + print ''; print ''; print ''; print ''; diff --git a/htdocs/langs/en_US/categories.lang b/htdocs/langs/en_US/categories.lang index 23e517fdbe0..6559f4e6502 100644 --- a/htdocs/langs/en_US/categories.lang +++ b/htdocs/langs/en_US/categories.lang @@ -34,4 +34,5 @@ ImpossibleAssociateCategory=Impossible to associate the category to WasAddedSuccessfully=was added successfully. ProductIsInCategories=Product/Service is in following categories ClassifyInCategory=Classify in category -ReturnInProduct=Return in product/service card \ No newline at end of file +ReturnInProduct=Return in product/service card +ContentsVisibleByAll=The contents will be visible by all \ No newline at end of file diff --git a/htdocs/langs/fr_FR/categories.lang b/htdocs/langs/fr_FR/categories.lang index 7c2a99bc7a2..012efb98a63 100644 --- a/htdocs/langs/fr_FR/categories.lang +++ b/htdocs/langs/fr_FR/categories.lang @@ -37,3 +37,4 @@ ClassifyInCategory=Classer dans la cat NoneCategory=Aucune CategoryExistsAtSameLevel=Cette catégorie existe déjà au même endroit ReturnInProduct=Retour sur la fiche produit/service +ContentsVisibleByAll=Le contenu sera visible par tous