$selection = GETPOST('selection', 'int'); // Security check if (!$user->admin) { accessforbidden(); } //Objects $price_globals = new PriceGlobalVariable($db); if ($action == 'edit_variable') { $res = $price_globals->fetch($selection); if ($res < 1) { setEventMessage($price_globals->error, 'errors'); } } $price_updaters = new PriceGlobalVariableUpdater($db); if ($action == 'edit_updater') { $res = $price_updaters->fetch($selection); if ($res < 1) { setEventMessage($price_updaters->error, 'errors'); } } /* * Actions */ if (!empty($action) && empty($cancel)) { //Global variable actions if ($action == 'create_variable' || $action == 'edit_variable') { $price_globals->code = isset($_POST['code']) ? GETPOST('code', 'alpha') : $price_globals->code; $price_globals->description = isset($_POST['description']) ? GETPOST('description', 'alpha') : $price_globals->description; $price_globals->value = isset($_POST['value']) ? GETPOST('value', 'int') : $price_globals->value; //Check if record already exists only when saving if (!empty($save)) {