Fix edit of categories

This commit is contained in:
Laurent Destailleur 2017-09-18 01:39:39 +02:00
parent 3f7b705674
commit 291a0d46e6
6 changed files with 12 additions and 12 deletions

View File

@ -145,7 +145,7 @@ if ($action == 'add')
if ($id > 0) if ($id > 0)
{ {
// Category association // Category association
$categories = GETPOST('categories'); $categories = GETPOST('categories', 'array');
$object->setCategories($categories); $object->setCategories($categories);
$_GET["id"]=$id; // Force chargement page en mode visu $_GET["id"]=$id; // Force chargement page en mode visu
@ -239,7 +239,7 @@ if ($action == 'update')
if ($result >= 0) if ($result >= 0)
{ {
// Category association // Category association
$categories = GETPOST('categories'); $categories = GETPOST('categories', 'array');
$object->setCategories($categories); $object->setCategories($categories);
$_GET["id"]=$_POST["id"]; // Force chargement page en mode visu $_GET["id"]=$_POST["id"]; // Force chargement page en mode visu

View File

@ -340,7 +340,7 @@ if (empty($reshook))
if ($id > 0) if ($id > 0)
{ {
// Category association // Category association
$categories = GETPOST('categories'); $categories = GETPOST('categories', 'array');
$object->setCategories($categories); $object->setCategories($categories);
header("Location: ".$_SERVER['PHP_SELF']."?id=".$id); header("Location: ".$_SERVER['PHP_SELF']."?id=".$id);
@ -444,7 +444,7 @@ if (empty($reshook))
if ($object->update($object->id, $user) > 0) if ($object->update($object->id, $user) > 0)
{ {
// Category association // Category association
$categories = GETPOST('categories'); $categories = GETPOST('categories', 'array');
$object->setCategories($categories); $object->setCategories($categories);
$action = 'view'; $action = 'view';

View File

@ -187,7 +187,7 @@ if (empty($reshook))
if (! $error && !empty($object->id) > 0) if (! $error && !empty($object->id) > 0)
{ {
// Category association // Category association
$categories = GETPOST('categories'); $categories = GETPOST('categories', 'array');
$result=$object->setCategories($categories); $result=$object->setCategories($categories);
if ($result<0) { if ($result<0) {
$langs->load("errors"); $langs->load("errors");
@ -282,7 +282,7 @@ if (empty($reshook))
else setEventMessages($object->error, $object->errors, 'errors'); else setEventMessages($object->error, $object->errors, 'errors');
}else { }else {
// Category association // Category association
$categories = GETPOST('categories'); $categories = GETPOST('categories', 'array');
$result=$object->setCategories($categories); $result=$object->setCategories($categories);
if ($result < 0) if ($result < 0)
{ {