diff --git a/htdocs/categories/fiche.php b/htdocs/categories/fiche.php
index eb264ac5f77..e5368919f4e 100644
--- a/htdocs/categories/fiche.php
+++ b/htdocs/categories/fiche.php
@@ -53,7 +53,32 @@ if ($_POST["action"] == 'add' && $user->rights->produit->creer)
$categorie->description = stripslashes($_POST["description"]);
$cats_meres = isset($_POST['cats_meres']) ? $_POST['cats_meres'] : array();
- $_GET["action"] = 'confirmed';
+ if (!$categorie->label || !$categorie->description)
+ {
+ $_GET["action"] = 'create';
+ }
+ else
+ {
+ $res = $categorie->create();
+ if ($res < 0)
+ {
+ $_error = 3
+ }
+ else
+ {
+ foreach ($cats_meres as $id)
+ {
+ $mere = new Categorie($db, $id);
+ $res = $mere->add_fille($categorie);
+ if ($res < 0)
+ {
+ $_error = 2
+ }
+ }
+ }
+ $_GET["action"] = 'confirmed';
+ $_POST["addcat"] = '';
+ }
}
@@ -75,15 +100,15 @@ if ($user->rights->produit->creer)
print '