début restructuration du code
This commit is contained in:
parent
39c87f9695
commit
5b89eaf13d
@ -54,18 +54,25 @@ if ($_POST["action"] == 'add' && $user->rights->produit->creer)
|
|||||||
$categorie->label = stripslashes($_POST["nom"]);
|
$categorie->label = stripslashes($_POST["nom"]);
|
||||||
$categorie->description = stripslashes($_POST["description"]);
|
$categorie->description = stripslashes($_POST["description"]);
|
||||||
$cats_meres = isset($_POST['catsMeres']) ? $_POST['catsMeres'] : array();
|
$cats_meres = isset($_POST['catsMeres']) ? $_POST['catsMeres'] : array();
|
||||||
|
$ok = true;
|
||||||
|
|
||||||
if (!$categorie->label || !$categorie->description)
|
if (!$categorie->label || !$categorie->description)
|
||||||
{
|
{
|
||||||
$_GET["action"] = 'create';
|
$_GET["action"] = 'create';
|
||||||
|
$ok = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($ok)
|
||||||
|
{
|
||||||
if (sizeof($cats_meres) > 1 && sizeof(array_unique($cats_meres)) != sizeof($cats_meres))
|
if (sizeof($cats_meres) > 1 && sizeof(array_unique($cats_meres)) != sizeof($cats_meres))
|
||||||
{ // alors il y a des valeurs en double
|
{ // alors il y a des valeurs en double
|
||||||
print '<p>'.$langs->trans("ErrSameCatSelected").'</p>';
|
print '<p>'.$langs->trans("ErrSameCatSelected").'</p>';
|
||||||
$_GET["action"] = 'create';
|
$_GET["action"] = 'create';
|
||||||
|
$ok = false;
|
||||||
}
|
}
|
||||||
else
|
}
|
||||||
|
|
||||||
|
if ($ok)
|
||||||
{
|
{
|
||||||
$res = $categorie->create();
|
$res = $categorie->create();
|
||||||
if ($res < 0)
|
if ($res < 0)
|
||||||
@ -129,7 +136,7 @@ if ($user->rights->produit->creer)
|
|||||||
print $categorie->description.'</textarea></td></tr>';
|
print $categorie->description.'</textarea></td></tr>';
|
||||||
print '<tr><td>';
|
print '<tr><td>';
|
||||||
print $langs->trans("AddIn").' ';
|
print $langs->trans("AddIn").' ';
|
||||||
print $html->select_nombre_sous_categorie($nbcats,"cats_meres").' ';
|
print $html->select_nombre_sous_categorie($nbcats,"choix").' ';
|
||||||
print $langs->trans("categories");
|
print $langs->trans("categories");
|
||||||
print '</td><td>';
|
print '</td><td>';
|
||||||
print '<input type="submit" class="button" value="'.$langs->trans("modify").'" name="choicenbcats" id="choicenbcats"/>';
|
print '<input type="submit" class="button" value="'.$langs->trans("modify").'" name="choicenbcats" id="choicenbcats"/>';
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user