Merge pull request #24177 from ATM-Consulting/FIX_16.0_expensereport_add_ndf

Fix expensereport add ndf
This commit is contained in:
Laurent Destailleur 2023-03-10 14:46:17 +01:00 committed by GitHub
commit 0028ca6fb6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -198,9 +198,9 @@ class ExpenseReportIk extends CommonObject
$default_range = (int) $userauthor->default_range; // if not defined, then 0
$ranges = $this->getRangesByCategory($fk_c_exp_tax_cat);
// prevent out of range -1 indice
$indice = $default_range > 0 ? $default_range - 1 : 0;
$indice = $default_range - 1;
// substract 1 because array start from 0
if (empty($ranges) || !isset($ranges[$indice])) {
if (empty($ranges) || $indice < 0 || !isset($ranges[$indice])) {
return false;
} else {
return $ranges[$indice];