Fix avoid sql error
This commit is contained in:
parent
55bd7a33a4
commit
ef5f56ddf4
1 changed files with 21 additions and 7 deletions
|
|
@ -123,14 +123,28 @@ if (empty($reshook)) {
|
|||
$separate_auxiliary_account = GETPOST('separate_auxiliary_account', 'aZ09');
|
||||
$generate_bookkeeping_records = GETPOST('generate_bookkeeping_records', 'aZ09');
|
||||
|
||||
$result = $object->closeFiscalPeriod($current_fiscal_period['id'], $new_fiscal_period_id, $separate_auxiliary_account, $generate_bookkeeping_records);
|
||||
if ($result < 0) {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
} else {
|
||||
setEventMessages($langs->trans("AccountancyClosureCloseSuccessfully"), null, 'mesgs');
|
||||
$error = 0;
|
||||
if ($generate_bookkeeping_records) {
|
||||
if (!getDolGlobalString('ACCOUNTING_CLOSURE_ACCOUNTING_GROUPS_USED_FOR_BALANCE_SHEET_ACCOUNT')) {
|
||||
$error++;
|
||||
setEventMessages($langs->trans("ErrorSetupNotComplete"), null, 'errors');
|
||||
}
|
||||
if (!getDolGlobalString('ACCOUNTING_CLOSURE_ACCOUNTING_GROUPS_USED_FOR_INCOME_STATEMENT')) {
|
||||
$error++;
|
||||
setEventMessages($langs->trans("ErrorSetupNotComplete"), null, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
header("Location: " . $_SERVER['PHP_SELF'] . (isset($current_fiscal_period) ? '?fiscal_period_id=' . $current_fiscal_period['id'] : ''));
|
||||
exit;
|
||||
if (!$error) {
|
||||
$result = $object->closeFiscalPeriod($current_fiscal_period['id'], $new_fiscal_period_id, $separate_auxiliary_account, $generate_bookkeeping_records);
|
||||
if ($result < 0) {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
} else {
|
||||
setEventMessages($langs->trans("AccountancyClosureCloseSuccessfully"), null, 'mesgs');
|
||||
|
||||
header("Location: " . $_SERVER['PHP_SELF'] . (isset($current_fiscal_period) ? '?fiscal_period_id=' . $current_fiscal_period['id'] : ''));
|
||||
exit;
|
||||
}
|
||||
}
|
||||
} elseif ($action == 'confirm_step_3' && $confirm == "yes") {
|
||||
$inventory_journal_id = GETPOST('inventory_journal_id', 'int');
|
||||
|
|
|
|||
Loading…
Reference in a new issue