Fix edit of categories
This commit is contained in:
parent
3f7b705674
commit
291a0d46e6
@ -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
|
||||||
|
|||||||
@ -224,7 +224,7 @@ if (empty($reshook))
|
|||||||
$action = 'create';
|
$action = 'create';
|
||||||
} else {
|
} else {
|
||||||
// Categories association
|
// Categories association
|
||||||
$contcats = GETPOST( 'contcats', 'array' );
|
$contcats = GETPOST( 'contcats', 'array');
|
||||||
$object->setCategories($contcats);
|
$object->setCategories($contcats);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -383,7 +383,7 @@ if (empty($reshook))
|
|||||||
$db->query( $sql );
|
$db->query( $sql );
|
||||||
|
|
||||||
// Then we add the associated categories
|
// Then we add the associated categories
|
||||||
$categories = GETPOST( 'contcats', 'array' );
|
$categories = GETPOST( 'contcats', 'array');
|
||||||
$object->setCategories($categories);
|
$object->setCategories($categories);
|
||||||
|
|
||||||
$object->old_lastname='';
|
$object->old_lastname='';
|
||||||
|
|||||||
@ -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';
|
||||||
|
|||||||
@ -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)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -490,7 +490,7 @@ if (empty($reshook))
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Customer categories association
|
// Customer categories association
|
||||||
$custcats = GETPOST( 'custcats', 'array' );
|
$custcats = GETPOST('custcats', 'array');
|
||||||
$object->setCategories($custcats, 'customer');
|
$object->setCategories($custcats, 'customer');
|
||||||
|
|
||||||
// Supplier categories association
|
// Supplier categories association
|
||||||
@ -607,7 +607,7 @@ if (empty($reshook))
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Customer categories association
|
// Customer categories association
|
||||||
$categories = GETPOST( 'custcats', 'array' );
|
$categories = GETPOST('custcats', 'array');
|
||||||
$object->setCategories($categories, 'customer');
|
$object->setCategories($categories, 'customer');
|
||||||
|
|
||||||
// Supplier categories association
|
// Supplier categories association
|
||||||
|
|||||||
@ -260,7 +260,7 @@ if (empty($reshook)) {
|
|||||||
}
|
}
|
||||||
if (! empty($conf->categorie->enabled)) {
|
if (! empty($conf->categorie->enabled)) {
|
||||||
// Categories association
|
// Categories association
|
||||||
$usercats = GETPOST( 'usercats', 'array' );
|
$usercats = GETPOST('usercats', 'array');
|
||||||
$object->setCategories($usercats);
|
$object->setCategories($usercats);
|
||||||
}
|
}
|
||||||
$db->commit();
|
$db->commit();
|
||||||
@ -478,7 +478,7 @@ if (empty($reshook)) {
|
|||||||
if (! $error && ! count($object->errors))
|
if (! $error && ! count($object->errors))
|
||||||
{
|
{
|
||||||
// Then we add the associated categories
|
// Then we add the associated categories
|
||||||
$categories = GETPOST( 'usercats', 'array' );
|
$categories = GETPOST('usercats', 'array');
|
||||||
$object->setCategories($categories);
|
$object->setCategories($categories);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user