Skip to content

Commit

Permalink
FIX Removed error when no error on accounting setup page
Browse files Browse the repository at this point in the history
  • Loading branch information
eldy committed Apr 7, 2018
1 parent 304adff commit aad99bd
Showing 1 changed file with 14 additions and 31 deletions.
45 changes: 14 additions & 31 deletions htdocs/accountancy/admin/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down Expand Up @@ -65,39 +64,23 @@
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');
}
}

Expand Down

0 comments on commit aad99bd

Please sign in to comment.