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 ''; + +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 '
'; +?> +
+ + + + + + + + + + + + + + + + + get_all_categories ();//on récupère toutes les catégories et leurs attributs + + for ($i = 0 ; $i < $nbcats ; $i++) + { + print "\n"; + } + + ?> + + + +
trans("Label"); ?> : +
trans("Description"); ?> :
+ trans("In"); ?> + + trans("categories"); ?> + + " name="ok" id="ok" /> +
"; + print $langs->trans("Categorie")." ".($i+1)."
+
+ + 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 + ?> +
+

trans("ValidateFields"); ?> ?

+ + + + + $cat_mere) + { + echo ""; + } + ?> +
+
'; + +$db->close(); +?> diff --git a/htdocs/categories/liste.php b/htdocs/categories/liste.php new file mode 100644 index 00000000000..c754cc8f3c4 --- /dev/null +++ b/htdocs/categories/liste.php @@ -0,0 +1,58 @@ + + * + * 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"; + + +llxHeader ("","",$langs->trans("Categories")); + +print_titre ($langs->trans ("CatList")); +?> + +
+get_all_categories (); + + +if ($cats != -1) +{ + print ''; + print ''; + + foreach ($cats as $cat) + { + $i = !$i; + print "\t\n"; + print "\t\t\n"; + print "\t\t\n"; + print "\t\n"; + } + print "
'.$langs->trans("AllCats").'
".$cat->label."".$cat->description."
"; +} +else +{ + dolibarr_print_error(); +} + +print '
'; + +$db->close(); + +llxFooter("Dernière modification $Date$ révision $Revision$"); +?>