--- /tmp/dsg/dolibarr/htdocs/variants/admin/github_19.0.3_admin.php +++ /tmp/dsg/dolibarr/htdocs/variants/admin/client_admin.php @@ -19 +18,0 @@ -// Load Dolibarr environment @@ -26 +25,3 @@ -$action = GETPOST('action', 'alphanohtml'); +// Security check +if (!$user->admin || (empty($conf->product->enabled) && empty($conf->service->enabled))) + accessforbidden(); @@ -28,3 +29,14 @@ -// Security check -if (!$user->admin || !isModEnabled('variants')) { - accessforbidden(); +if ($_POST) { + $value = GETPOST('PRODUIT_ATTRIBUTES_HIDECHILD'); + + if (dolibarr_set_const($db, 'PRODUIT_ATTRIBUTES_HIDECHILD', $value, 'chaine', 0, '', $conf->entity)) { + setEventMessages($langs->trans('RecordSaved'), null, 'mesgs'); + } else { + setEventMessages($langs->trans('CoreErrorMessage'), null, 'errors'); + } + + if (dolibarr_set_const($db, 'PRODUIT_ATTRIBUTES_SEPARATOR', GETPOST('PRODUIT_ATTRIBUTES_SEPARATOR'), 'chaine', 0, '', $conf->entity)) { + setEventMessages($langs->trans('RecordSaved'), null, 'mesgs'); + } else { + setEventMessages($langs->trans('CoreErrorMessage'), null, 'errors'); + } @@ -33,26 +45 @@ -$error = 0; - - -/* - * Actions - */ - -if ($action) { - $value = GETPOST('PRODUIT_ATTRIBUTES_HIDECHILD'); - - if (!dolibarr_set_const($db, 'PRODUIT_ATTRIBUTES_HIDECHILD', $value, 'chaine', 0, '', $conf->entity)) { - setEventMessages($langs->trans('CoreErrorMessage'), null, 'errors'); - $error++; - } - - if (!dolibarr_set_const($db, 'PRODUIT_ATTRIBUTES_SEPARATOR', GETPOST('PRODUIT_ATTRIBUTES_SEPARATOR'), 'chaine', 0, '', $conf->entity)) { - setEventMessages($langs->trans('CoreErrorMessage'), null, 'errors'); - $error++; - } - - if (!$error) { - setEventMessages($langs->trans('RecordSaved'), null, 'mesgs'); - } -} - -$title = $langs->trans('ModuleSetup').' '.$langs->trans('Module610Name'); +$title = $langs->trans('ModuleSetup').' '.$langs->trans('ProductAttributes'); @@ -64,3 +51 @@ -print '