diff --git a/htdocs/categories/domodif.php b/htdocs/categories/domodif.php
new file mode 100644
index 00000000000..0e609bfa99c
--- /dev/null
+++ b/htdocs/categories/domodif.php
@@ -0,0 +1,112 @@
+
+ *
+ * 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 (!isset ($_REQUEST["id"]) || !isset ($_REQUEST["nom"]) || !isset ($_REQUEST["description"]))
+ accessforbidden();
+
+
+/**
+ * Affichage page accueil
+ */
+
+llxHeader("","",$langs->trans("Categories"));
+
+print_titre($langs->trans("CatCreated"));
+
+print '
';
+
+print '| ';
+
+$cat = new Categorie ($db, $_REQUEST['id']);
+
+$cat->label = $_REQUEST["nom"];
+$cat->description = $_REQUEST["description"];
+
+$new_cats_meres = isset ($_REQUEST['cats_meres']) ? $_REQUEST['cats_meres'] : array ();
+ // tableau d'id de catégories
+
+$old_objs_meres = $cat->get_meres ();
+ // tableau d'objets catégorie
+
+$old_cats_meres = array ();
+foreach ($old_objs_meres as $old_obj_mere)
+ { // transformation en tableau d'id
+ $old_cats_meres[] = $old_obj_mere->id;
+ }
+
+$asupprimer = array (); // tableaux des catégories mères
+$aajouter = array (); // à ajouter ou à supprimer
+
+foreach ($old_cats_meres as $old_cat)
+ {
+ if (!in_array ($old_cat, $new_cats_meres))
+ {
+ $asupprimer[] = new Categorie ($db, $old_cat);
+ }
+ }
+
+foreach ($new_cats_meres as $new_cat)
+ {
+ if (!in_array ($new_cat, $old_cats_meres))
+ {
+ $aajouter[] = new Categorie ($db, $new_cat);
+ }
+ }
+
+$res = $cat->update ();
+if ($res < 0)
+ {
+ print " Impossible de modifier la catégorie ".$cat->label.". ";
+ }
+else
+ {
+ print "La catégorie ".$cat->label." a été modifiée avec succès. ";
+
+ foreach ($asupprimer as $old_mere)
+ {
+ $res = $old_mere->del_fille ($cat);
+ if ($res < 0)
+ {
+ print "Impossible d'enlever la catégorie de \"".$old_mere->label."\" ($res). \n";
+ }
+ else
+ {
+ print "La catégorie ne fait plus partie de ".$old_mere->label.". \n";
+ }
+ }
+
+ foreach ($aajouter as $new_mere)
+ {
+ $res = $new_mere->add_fille ($cat);
+ if ($res < 0)
+ {
+ print "Impossible d'ajouter la catégorie à \"".$new_mere->label."\" ($res). ";
+ }
+ else
+ {
+ print "La catégorie fait maintenant partie de ".$new_mere->label.". \n";
+ }
+ }
+ }
+
+print ' |
';
+
+$db->close();
+?>
diff --git a/htdocs/categories/pre.inc.php b/htdocs/categories/pre.inc.php
new file mode 100644
index 00000000000..5f733328aed
--- /dev/null
+++ b/htdocs/categories/pre.inc.php
@@ -0,0 +1,57 @@
+
+ * Copyright (C) 2005 Davoleau Brice
+ * Copyright (C) 2005 Rodolphe Quiedeville
+ *
+ * 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.
+ *
+ * $Id$
+ * $Source$
+ *
+ */
+
+/*!
+ \file htdocs/categories/pre.inc.php
+ \ingroup product,service
+ \brief Fichier gestionnaire du menu gauche des produits et services
+ \version $Revision$
+*/
+
+require "../main.inc.php";
+require_once DOL_DOCUMENT_ROOT."/categories/categorie.class.php";
+
+$langs->load("categories");
+$user->getrights("categorie");
+
+function llxHeader ($head = "", $urlp = "", $title="")
+{
+ global $user, $conf, $langs;
+
+
+ top_menu($head, $title);
+
+ $menu = new Menu();
+
+ if ($conf->categorie->enabled)
+ {
+ $menu->add(DOL_URL_ROOT."/categories/index.php", $langs->trans("Categories"));
+ $menu->add_submenu(DOL_URL_ROOT."/categories/liste.php", $langs->trans("List"));
+ $menu->add_submenu(DOL_URL_ROOT."/categories/create.php", $langs->trans("NewCat"));
+ }
+
+ $menu->add(DOL_URL_ROOT."/categories/stats/", $langs->trans("CatStatistics"));
+ left_menu($menu->liste);
+}
+?>
diff --git a/mysql/tables/llx_categorie.sql b/mysql/tables/llx_categorie.sql
new file mode 100644
index 00000000000..0a068d819d2
--- /dev/null
+++ b/mysql/tables/llx_categorie.sql
@@ -0,0 +1,29 @@
+-- ============================================================================
+-- Copyright (C) 2005 Brice Davoleau
+-- Copyright (C) 2005 Matthieu Valleton
+--
+-- 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.
+--
+-- $Id$
+-- $Source$
+--
+-- ============================================================================
+
+create table llx_categorie
+(
+ rowid integer AUTO_INCREMENT PRIMARY KEY,
+ label VARCHAR(255),
+ description text
+)type=innodb;
diff --git a/mysql/tables/llx_categorie_association.key.sql b/mysql/tables/llx_categorie_association.key.sql
new file mode 100644
index 00000000000..4d93f12bbf2
--- /dev/null
+++ b/mysql/tables/llx_categorie_association.key.sql
@@ -0,0 +1,25 @@
+-- ============================================================================
+-- Copyright (C) 2005 Brice Davoleau
+-- Copyright (C) 2005 Matthieu Valleton
+--
+-- 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.
+--
+-- ============================================================================
+
+ALTER TABLE llx_categorie_association ADD INDEX (fk_categorie_mere);
+ALTER TABLE llx_categorie_association ADD INDEX (fk_categorie_fille);
+
+ALTER TABLE llx_categorie_association ADD FOREIGN KEY (fk_categorie_mere) REFERENCES llx_categorie (rowid);
+ALTER TABLE llx_categorie_association ADD FOREIGN KEY (fk_categorie_fille) REFERENCES llx_categorie (rowid);
diff --git a/mysql/tables/llx_categorie_association.sql b/mysql/tables/llx_categorie_association.sql
new file mode 100644
index 00000000000..47bb7fde87e
--- /dev/null
+++ b/mysql/tables/llx_categorie_association.sql
@@ -0,0 +1,25 @@
+-- ============================================================================
+-- Copyright (C) 2005 Brice Davoleau
+-- Copyright (C) 2005 Matthieu Valleton
+--
+-- 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.
+--
+-- ============================================================================
+
+create table llx_categorie_association
+(
+ fk_categorie_mere integer NOT NULL,
+ fk_categorie_fille integer NOT NULL
+)type=innodb;