diff --git a/htdocs/categories/edit.php b/htdocs/categories/edit.php new file mode 100644 index 00000000000..61434f8f40c --- /dev/null +++ b/htdocs/categories/edit.php @@ -0,0 +1,185 @@ + + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +require "./pre.inc.php"; + + +if (false && (!isset ($_REQUEST['id']) || !$user->rights->categories->lire)) + accessforbidden(); +// toujours pas trouvé comment mettre les droits qui vont bien + +llxHeader("","",$langs->trans("Categories")); + +print_titre($langs->trans("ModifCat")); + +print '
| '; + + +$c = new Categorie ($db, $_REQUEST['id']); + +if (isset ($_REQUEST['cats_meres'])) +{ + $cats_meres = $_REQUEST['cats_meres']; +} +else +{ + $cats_meres = array (); + foreach ($c->get_meres () as $mere) + { + $cats_meres[] = $mere->id; + } +} +$label = isset ($_REQUEST['nom']) ? $_REQUEST['nom'] : $c->label; +$description = isset ($_REQUEST['description']) ? $_REQUEST['description'] : $c->description; +$nbcats = isset ($_REQUEST['choix']) ? $_REQUEST['choix'] : sizeof ($cats_meres); + +print ' |
| ';
+?>
+
+
+ 1 && sizeof (array_unique ($cats_meres)) != sizeof ($cats_meres))
+ { // alors il y a des valeurs en double
+ echo " ".$langs->trans ("ErrSameCatSelected")." "; + $OK = false; + } + + // vérification des champs renseignés par l'utilisateur: si il y a un problème, on affiche un message d'erreur + if (sizeof ($cats_meres) > 0) foreach ($cats_meres as $nb => $cat_mere) + { + if ($cat_mere == -1) + { + echo "".$langs->trans ("ErrForgotCat")." "; + $OK = false; + } + } + + // si les champs de description sont mal renseignés + if ($label == '') + { + echo "".$langs->trans ("ErrForgotField")." "; + $OK = false; + } + + // vérification pour savoir si tous les champs sont corrects + if ($OK) + { + // creation de champs caches pour etre appele dans la classe de traitement + ?> + + |
+get_all_categories ();
+
+
+if ($cats != -1)
+{
+ print '
| ||||