|
@@ -27,9 +27,8 @@
|
|
|
* \ingroup Advanced accountancy
|
|
|
* \brief Setup page to configure accounting expert module
|
|
|
*/
|
|
|
-require '../../main.inc.php';
|
|
|
|
|
|
-// Class
|
|
|
+require '../../main.inc.php';
|
|
|
require_once DOL_DOCUMENT_ROOT . '/core/lib/admin.lib.php';
|
|
|
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
|
|
|
|
|
@@ -65,39 +64,23 @@ $accounting_mode = empty($conf->global->ACCOUNTING_MODE) ? 'RECETTES-DEPENSES' :
|
|
|
if ($action == 'update') {
|
|
|
$error = 0;
|
|
|
|
|
|
- $accounting_modes = array (
|
|
|
- 'RECETTES-DEPENSES',
|
|
|
- 'CREANCES-DETTES'
|
|
|
- );
|
|
|
-
|
|
|
- $accounting_mode = GETPOST('accounting_mode', 'alpha');
|
|
|
-
|
|
|
- if (in_array($accounting_mode, $accounting_modes)) {
|
|
|
-
|
|
|
- if (! dolibarr_set_const($db, 'ACCOUNTING_MODE', $accounting_mode, 'chaine', 0, '', $conf->entity)) {
|
|
|
- $error ++;
|
|
|
- }
|
|
|
- } else {
|
|
|
- $error ++;
|
|
|
+ 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');
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
- if ($error) {
|
|
|
- setEventMessages($langs->trans("Error"), null, 'errors');
|
|
|
- }
|
|
|
-
|
|
|
- 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("SetupSaved"), null, 'mesgs');
|
|
|
- } else {
|
|
|
- setEventMessages($langs->trans("Error"), null, 'errors');
|
|
|
}
|
|
|
}
|
|
|
|