Fix: Error in creating categories

This commit is contained in:
Laurent Destailleur 2010-07-29 13:13:41 +00:00
parent 3852527ee4
commit ded13125c8
2 changed files with 8 additions and 10 deletions

View File

@ -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

View File

@ -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 '<br>';
// 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 '<tr class="liste_titre"><td>'.$langs->trans("Categories").'</td><td colsp
$section=isset($_GET["section"])?$_GET["section"]:$_POST['section'];
if (! $section) $section=0;
// Define fulltree array
$fulltree=$cate_arbo;
// ----- This section will show a tree from a fulltree array -----