début ajout possibilité de déterminer si le contenu d'une catégorie sera visible ou

non dans la liste des produits/services, ceci afin de pouvoir cacher les sous-produits
 par exemple.
This commit is contained in:
Regis Houssin 2006-03-29 16:55:10 +00:00
parent af7beb0544
commit 8090967a7f
5 changed files with 21 additions and 6 deletions

View File

@ -110,8 +110,8 @@ class Categorie
return -1; return -1;
} }
$sql = "INSERT INTO ".MAIN_DB_PREFIX."categorie (label, description) "; $sql = "INSERT INTO ".MAIN_DB_PREFIX."categorie (label, description, visible) ";
$sql .= "VALUES ('".str_replace("'","''",$this->label)."', '".str_replace("'","''",$this->description)."')"; $sql .= "VALUES ('".str_replace("'","''",$this->label)."', '".str_replace("'","''",$this->description)."', '".$this->visible."')";
$res = $this->db->query ($sql); $res = $this->db->query ($sql);
@ -172,11 +172,15 @@ class Categorie
return -1; return -1;
} }
} }
$sql = "UPDATE ".MAIN_DB_PREFIX."categorie"; $sql = "UPDATE ".MAIN_DB_PREFIX."categorie";
$sql.= " SET label = '".trim(str_replace("'","''",$this->label))."'"; $sql.= " SET label = '".trim(str_replace("'","''",$this->label))."'";
if (strlen (trim($this->description)) > 0) 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; $sql .= " WHERE rowid = ".$this->id;
if ($this->db->query($sql)) if ($this->db->query($sql))

View File

@ -40,6 +40,7 @@ if ($_POST["action"] == 'update' && $user->rights->categorie->creer)
$categorie->label = $_POST["nom"]; $categorie->label = $_POST["nom"];
$categorie->description = $_POST["description"]; $categorie->description = $_POST["description"];
$categorie->visible = $_POST["visible"];
if($_POST['catMere'] != "-1") if($_POST['catMere'] != "-1")
$categorie->id_mere = $_POST['catMere']; $categorie->id_mere = $_POST['catMere'];
else else
@ -91,6 +92,10 @@ print '<tr><td valign="top" width="30%">';
<tr><td><?php print $langs->trans ("AddIn"); ?></td><td> <tr><td><?php print $langs->trans ("AddIn"); ?></td><td>
<?php print $html->select_all_categories($categorie->id_mere);?> <?php print $html->select_all_categories($categorie->id_mere);?>
</td></tr> </td></tr>
<tr><td><?php print $langs->trans ("ContentsVisibleByAll"); ?></td><td>
<?php print $html->selectyesnonum("visible",$categorie->visible);?>
</td></tr>
<tr> <tr>

View File

@ -58,6 +58,7 @@ if ($_POST["action"] == 'add' && $user->rights->categorie->creer)
$categorie->label = $_POST["nom"]; $categorie->label = $_POST["nom"];
$categorie->description = $_POST["description"]; $categorie->description = $_POST["description"];
$categorie->visible = $_POST["visible"];
if($_POST['catMere'] != "-1") if($_POST['catMere'] != "-1")
$categorie->id_mere = $_POST['catMere']; $categorie->id_mere = $_POST['catMere'];
@ -133,6 +134,9 @@ if ($user->rights->produit->creer)
print '<tr><td>'.$langs->trans ("AddIn").'</td><td>'; print '<tr><td>'.$langs->trans ("AddIn").'</td><td>';
print $html->select_all_categories(); print $html->select_all_categories();
print '</td></tr>'; print '</td></tr>';
print '<tr><td>'.$langs->trans ("ContentsVisibleByAll").'</td><td>';
print $html->selectyesnonum("visible",$categorie->visible);
print '</td></tr>';
print '<tr><td colspan="2" align="center">'; print '<tr><td colspan="2" align="center">';
print '<input type="submit" class="button" value="'.$langs->trans("CreateThisCat").'" name="creation" id="creation"/>'; print '<input type="submit" class="button" value="'.$langs->trans("CreateThisCat").'" name="creation" id="creation"/>';
print '</td></tr></form>'; print '</td></tr></form>';

View File

@ -34,4 +34,5 @@ ImpossibleAssociateCategory=Impossible to associate the category to
WasAddedSuccessfully=was added successfully. WasAddedSuccessfully=was added successfully.
ProductIsInCategories=Product/Service is in following categories ProductIsInCategories=Product/Service is in following categories
ClassifyInCategory=Classify in category ClassifyInCategory=Classify in category
ReturnInProduct=Return in product/service card ReturnInProduct=Return in product/service card
ContentsVisibleByAll=The contents will be visible by all

View File

@ -37,3 +37,4 @@ ClassifyInCategory=Classer dans la cat
NoneCategory=Aucune NoneCategory=Aucune
CategoryExistsAtSameLevel=Cette catégorie existe déjà au même endroit CategoryExistsAtSameLevel=Cette catégorie existe déjà au même endroit
ReturnInProduct=Retour sur la fiche produit/service ReturnInProduct=Retour sur la fiche produit/service
ContentsVisibleByAll=Le contenu sera visible par tous