diff --git a/htdocs/accountancy/admin/index.php b/htdocs/accountancy/admin/index.php
index 833923415b9..34345a692ca 100644
--- a/htdocs/accountancy/admin/index.php
+++ b/htdocs/accountancy/admin/index.php
@@ -176,78 +176,102 @@ if ($action == 'updatemode') {
}
}
-if ($action == 'update2') {
+if ($action == 'update') {
$error = 0;
- if (!$error) {
- foreach ($list as $constname) {
- $constvalue = GETPOST($constname, 'alpha');
- if (!dolibarr_set_const($db, $constname, $constvalue, 'chaine', 0, '', $conf->entity)) {
- $error++;
- }
- }
- if ($error) {
- setEventMessages($langs->trans("Error"), null, 'errors');
- }
+ foreach ($list as $constname) {
+ $constvalue = GETPOST($constname, 'alpha');
- // option in section binding
- foreach ($list_binding as $constname) {
- $constvalue = GETPOST($constname, 'alpha');
-
- if ($constname == 'ACCOUNTING_DATE_START_BINDING') {
- $constvalue = dol_mktime(0, 0, 0, GETPOSTINT($constname.'month'), GETPOSTINT($constname.'day'), GETPOSTINT($constname.'year'));
- }
-
- if (!dolibarr_set_const($db, $constname, $constvalue, 'chaine', 0, '', $conf->entity)) {
- $error++;
- }
- }
-
- // options in section other
- if (GETPOSTISSET('ACCOUNTING_LETTERING_NBLETTERS')) {
- if (!dolibarr_set_const($db, 'ACCOUNTING_LETTERING_NBLETTERS', GETPOST('ACCOUNTING_LETTERING_NBLETTERS'), 'chaine', 0, '', $conf->entity)) {
- $error++;
- }
- }
-
- // Export options
- $modelcsv = GETPOSTINT('ACCOUNTING_EXPORT_MODELCSV');
-
- if (!empty($modelcsv)) {
- if (!dolibarr_set_const($db, 'ACCOUNTING_EXPORT_MODELCSV', $modelcsv, 'chaine', 0, '', $conf->entity)) {
- $error++;
- }
- //if ($modelcsv==AccountancyExport::$EXPORT_TYPE_QUADRATUS || $modelcsv==AccountancyExport::$EXPORT_TYPE_CIEL) {
- // dolibarr_set_const($db, 'ACCOUNTING_EXPORT_FORMAT', 'txt', 'chaine', 0, '', $conf->entity);
- //}
- } else {
+ if (!dolibarr_set_const($db, $constname, $constvalue, 'chaine', 0, '', $conf->entity)) {
$error++;
}
+ }
- foreach ($main_option as $constname) {
- $constvalue = GETPOST($constname, 'alpha');
+ if (!$error) {
+ setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
+ } else {
+ setEventMessages($langs->trans("Error"), null, 'errors');
+ }
+}
- if (!dolibarr_set_const($db, $constname, $constvalue, 'chaine', 0, '', $conf->entity)) {
+if ($action == 'update_binding') {
+ $error = 0;
+
+ foreach ($list_binding as $constname) {
+ $constvalue = GETPOST($constname, 'alpha');
+
+ if ($constname == 'ACCOUNTING_DATE_START_BINDING') {
+ $constvalue = dol_mktime(0, 0, 0, GETPOSTINT($constname.'month'), GETPOSTINT($constname.'day'), GETPOSTINT($constname.'year'));
+ }
+
+ if (!dolibarr_set_const($db, $constname, $constvalue, 'chaine', 0, '', $conf->entity)) {
+ $error++;
+ }
+ }
+
+ if (!$error) {
+ setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
+ } else {
+ setEventMessages($langs->trans("Error"), null, 'errors');
+ }
+}
+
+if ($action == 'update_advanced') {
+ $error = 0;
+
+ if (GETPOSTISSET('ACCOUNTING_LETTERING_NBLETTERS')) {
+ if (!dolibarr_set_const($db, 'ACCOUNTING_LETTERING_NBLETTERS', GETPOST('ACCOUNTING_LETTERING_NBLETTERS'), 'chaine', 0, '', $conf->entity)) {
+ $error++;
+ }
+ }
+
+ if (!$error) {
+ setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
+ } else {
+ setEventMessages($langs->trans("Error"), null, 'errors');
+ }
+}
+
+if ($action == 'update_export') {
+ $error = 0;
+
+ // Export options
+ $modelcsv = GETPOSTINT('ACCOUNTING_EXPORT_MODELCSV');
+
+ if (!$error) {
+ // reload
+ $configuration = $accountancyexport->getTypeConfig();
+ $listparam = $configuration['param'];
+ }
+
+ if (!empty($modelcsv)) {
+ if (!dolibarr_set_const($db, 'ACCOUNTING_EXPORT_MODELCSV', $modelcsv, 'chaine', 0, '', $conf->entity)) {
+ $error++;
+ }
+ //if ($modelcsv==AccountancyExport::$EXPORT_TYPE_QUADRATUS || $modelcsv==AccountancyExport::$EXPORT_TYPE_CIEL) {
+ // dolibarr_set_const($db, 'ACCOUNTING_EXPORT_FORMAT', 'txt', 'chaine', 0, '', $conf->entity);
+ //}
+ } else {
+ $error++;
+ }
+
+ foreach ($main_option as $constname) {
+ $constvalue = GETPOST($constname, 'alpha');
+
+ if (!dolibarr_set_const($db, $constname, $constvalue, 'chaine', 0, '', $conf->entity)) {
+ $error++;
+ }
+ }
+
+ foreach ($listparam[$modelcsv] as $key => $value) {
+ $constante = $key;
+
+ if (strpos($constante, 'ACCOUNTING') !== false) {
+ $constvalue = GETPOST($key, 'alpha');
+ if (!dolibarr_set_const($db, $constante, $constvalue, 'chaine', 0, '', $conf->entity)) {
$error++;
}
}
-
- foreach ($listparam[$modelcsv] as $key => $value) {
- $constante = $key;
-
- if (strpos($constante, 'ACCOUNTING') !== false) {
- $constvalue = GETPOST($key, 'alpha');
- if (!dolibarr_set_const($db, $constante, $constvalue, 'chaine', 0, '', $conf->entity)) {
- $error++;
- }
- }
- }
-
- if (!$error) {
- // reload
- $configuration = $accountancyexport->getTypeConfig();
- $listparam = $configuration['param'];
- }
}
if (!$error) {
@@ -456,19 +480,19 @@ if (getDolGlobalInt('MAIN_FEATURES_LEVEL') >= 1) {
print '';
- print '
';
+ print '
';
}
// Show form main options
print $formSetup->generateOutput(true);
-print '
';
+print '
';
print '