Merge branch 'NEW/ExpenseReport_ik_add' of github.com:atm-jpb/dolibarr into NEW/ExpenseReport_ik_add

This commit is contained in:
jpb 2022-05-24 09:07:25 +02:00
commit a4c5ba7239
2 changed files with 3 additions and 8 deletions

View File

@ -90,7 +90,7 @@ if (empty($fk_expense) || $fk_expense < 0) {
} else {
$expense = new ExpenseReport($db);
$result = $expense->fetch($fk_expense);
if ($result){
if ($result) {
$result = $expense->computeTotalKm($fk_c_exp_tax_cat, $qty, $vatrate);
if ($result < 0) {
$rep->error = $result;
@ -101,7 +101,6 @@ if (empty($fk_expense) || $fk_expense < 0) {
$rep->response_status = 'success';
}
}
}
}
}

View File

@ -2604,9 +2604,7 @@ class ExpenseReport extends CommonObject
$result = $this->db->query($sql);
if ($result) {
if ($conf->global->EXPENSEREPORT_CALCULATE_MILEAGE_EXPENSE_COEFFICIENT_ON_CURRENT_YEAR){
if ($conf->global->EXPENSEREPORT_CALCULATE_MILEAGE_EXPENSE_COEFFICIENT_ON_CURRENT_YEAR) {
$arrayDate = dol_getdate(dol_now());
$sql = " SELECT count(n.qty) as cumul FROM ".MAIN_DB_PREFIX."expensereport_det n";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."expensereport e ON e.rowid = n.fk_expensereport";
@ -2618,12 +2616,11 @@ class ExpenseReport extends CommonObject
$resql = $this->db->query($sql);
if ($resql){
if ($resql) {
$obj = $this->db->fetch_object($resql);
$cumulYearQty = $obj->cumul;
}
$qty = $cumulYearQty + $qty;
}
$num = $this->db->num_rows($result);
@ -2638,7 +2635,6 @@ class ExpenseReport extends CommonObject
for ($i = 0; $i < $num; $i++) {
if ($i < ($num - 1)) {
if ($qty > $ranges[$i]->range_ik && $qty < $ranges[$i+1]->range_ik) {
$coef = $ranges[$i]->coef;
$offset = $ranges[$i]->offset;