diff --git a/htdocs/categories/fiche.php b/htdocs/categories/fiche.php index 747b00ae536..b0fe9088b61 100644 --- a/htdocs/categories/fiche.php +++ b/htdocs/categories/fiche.php @@ -71,6 +71,7 @@ $urlfrom=isset($_REQUEST["urlfrom"])?$_REQUEST["urlfrom"]:''; * Actions */ +// Add action if ($_POST["action"] == 'add' && $user->rights->categorie->creer) { // Action ajout d'une categorie @@ -119,7 +120,7 @@ if ($_POST["action"] == 'add' && $user->rights->categorie->creer) $categorie->description = $_POST["description"]; $categorie->socid = ($_POST["socid"] ? $_POST["socid"] : 'null'); $categorie->visible = $_POST["visible"]; - $categorie->type = $_POST["type"]; + $categorie->type = $_POST["type"]; if($_POST['catMere'] != "-1") $categorie->id_mere = $_POST['catMere']; @@ -129,11 +130,6 @@ if ($_POST["action"] == 'add' && $user->rights->categorie->creer) $categorie->error = $langs->trans("ErrorFieldRequired",$langs->transnoentities("Ref")); $_GET["action"] = 'create'; } - else if (! $categorie->description) - { - $categorie->error = $langs->trans("ErrorFieldRequired",$langs->transnoentities("Description")); - $_GET["action"] = 'create'; - } // Create category in database if (! $categorie->error) @@ -147,6 +143,7 @@ if ($_POST["action"] == 'add' && $user->rights->categorie->creer) } } +// Confirm action if ($_POST["action"] == 'add' && $user->rights->categorie->creer) { // Action confirmation de creation categorie diff --git a/htdocs/categories/index.php b/htdocs/categories/index.php index afe41e82b13..e0952249a44 100644 --- a/htdocs/categories/index.php +++ b/htdocs/categories/index.php @@ -31,7 +31,7 @@ require("../main.inc.php"); require_once(DOL_DOCUMENT_ROOT."/categories/class/categorie.class.php"); require_once(DOL_DOCUMENT_ROOT."/lib/treeview.lib.php"); -$type=isset($_GET['type'])?$_GET['type']:$_POST['type']; +$type=isset($_GET['type'])?$_GET['type']:isset($_POST['type'])?$_POST['type']:0; if (!$user->rights->categorie->lire) accessforbidden(); @@ -122,7 +122,10 @@ print '
'; // Charge tableau des categories -$cate_arbo = $categstatic->get_full_arbo($_GET['type']); +$cate_arbo = $categstatic->get_full_arbo($type); + +// Define fulltree array +$fulltree=$cate_arbo; @@ -133,8 +136,6 @@ print ''.$langs->trans("Categories").'