mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2026-02-08 00:52:01 +01:00
Merge branch '13.0' of https://github.com/Dolibarr/dolibarr into 13.0_fix_sellist_add_order_by_option
This commit is contained in:
@@ -3177,12 +3177,17 @@ abstract class CommonObject
|
||||
}
|
||||
$sqlfix = "UPDATE ".MAIN_DB_PREFIX.$this->table_element_line." SET ".$fieldtva." = ".($obj->total_tva - $diff).", total_ttc = ".($obj->total_ttc - $diff)." WHERE rowid = ".$obj->rowid;
|
||||
dol_syslog('We found a difference of '.$diff.' for line rowid = '.$obj->rowid.". We fix the total_vat and total_ttc of line by running sqlfix = ".$sqlfix);
|
||||
$resqlfix = $this->db->query($sqlfix);
|
||||
if (!$resqlfix) dol_print_error($this->db, 'Failed to update line');
|
||||
$this->total_tva -= $diff;
|
||||
$this->total_ttc -= $diff;
|
||||
$total_tva_by_vats[$obj->vatrate] -= $diff;
|
||||
$total_ttc_by_vats[$obj->vatrate] -= $diff;
|
||||
|
||||
$resqlfix = $this->db->query($sqlfix);
|
||||
|
||||
if (!$resqlfix) {
|
||||
dol_print_error($this->db, 'Failed to update line');
|
||||
}
|
||||
|
||||
$this->total_tva = (float) price2num($this->total_tva - $diff, '', 1);
|
||||
$this->total_ttc = (float) price2num($this->total_ttc - $diff, '', 1);
|
||||
$total_tva_by_vats[$obj->vatrate] = (float) price2num($total_tva_by_vats[$obj->vatrate] - $diff, '', 1);
|
||||
$total_ttc_by_vats[$obj->vatrate] = (float) price2num($total_ttc_by_vats[$obj->vatrate] - $diff, '', 1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3210,6 +3215,13 @@ abstract class CommonObject
|
||||
}
|
||||
}
|
||||
|
||||
// Clean total
|
||||
$this->total_ht = (float) price2num($this->total_ht);
|
||||
$this->total_tva = (float) price2num($this->total_tva);
|
||||
$this->total_localtax1 = (float) price2num($this->total_localtax1);
|
||||
$this->total_localtax2 = (float) price2num($this->total_localtax2);
|
||||
$this->total_ttc = (float) price2num($this->total_ttc);
|
||||
|
||||
$this->db->free($resql);
|
||||
|
||||
// Now update global field total_ht, total_ttc and tva
|
||||
|
||||
Reference in New Issue
Block a user