From f117c64551f3d8c114267091729ef2e69e84e970 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Mon, 23 Jan 2012 20:11:43 +0100 Subject: [PATCH] Fix: use current entity if not defined --- htdocs/core/ajaxconstantonoff.php | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/htdocs/core/ajaxconstantonoff.php b/htdocs/core/ajaxconstantonoff.php index bb77112f910..7f4747e5624 100644 --- a/htdocs/core/ajaxconstantonoff.php +++ b/htdocs/core/ajaxconstantonoff.php @@ -46,17 +46,21 @@ top_httphead(); print ''."\n"; // Registering the location of boxes -if((isset($_GET['action']) && ! empty($_GET['action'])) && (isset($_GET['name']) && ! empty($_GET['name'])) ) +if ((isset($_GET['action']) && ! empty($_GET['action'])) && (isset($_GET['name']) && ! empty($_GET['name'])) ) { + $entity = (GETPOST('entity','int') ? GETPOST('entity','int') : $conf->entity); + $action = GETPOST('action', 'alpha'); + $name = GETPOST('name', 'alpha'); + if ($user->admin) { - if ($_GET['action'] == 'set') + if ($action == 'set') { - dolibarr_set_const($db, $_GET['name'], 1, 'chaine', 0, '', $conf->entity); + dolibarr_set_const($db, $name, 1, 'chaine', 0, '', $entity); } - else if ($_GET['action'] == 'del') + else if ($action == 'del') { - dolibarr_del_const($db, $_GET['name'], $conf->entity); + dolibarr_del_const($db, $name, $entity); } } }