Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions ChangeLog_loukta
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
***** ChangeLog for loukta *****
- FIX DA028241 - FactureLigne::getSituationRatio() - wrong denominator (100 instead of situation_percent) in mode 1 caused incorrect line amounts in situation invoice PDFs. - *18/06/2026*
- FIX DA027405 - merging PR Dolibarr#36503 in advance for Loukta: PDF for situation invoices uses legacy calculations
(cumulative) instead of the new algorithm (delta). Once the community PR is merged, this specific code can be discarded
and replaced with the community equivalent. - *03/12/2025*
Expand Down
11 changes: 7 additions & 4 deletions htdocs/compta/facture/class/factureligne.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -996,12 +996,15 @@ public function getAllPrevProgress($invoiceid, $include_credit_note = true)
public function getSituationRatio()
{
if (getDolGlobalInt('INVOICE_USE_SITUATION') === 1) {
// in legacy mode, the situation invoice line stores the (cumulative) state of the
// cycle at the current situation. To get the delta, we need to subtract the
// state at the previous situation (if applicable).
// Legacy mode: line stores the cumulative state (e.g. 70%). To get the delta ratio
// we divide by situation_percent, not by 100 — because total_ht is already scaled
// by situation_percent/100, so the multiplier must cancel that factor out.
if (empty($this->situation_percent)) {
return 0;
}
$prevProgress = $this->get_prev_progress($this->fk_facture);

return ($this->situation_percent - $prevProgress) / 100;
return ($this->situation_percent - $prevProgress) / $this->situation_percent;
}
// new mode (INVOICE_USE_SITUATION == 2):
// no ratio needed (data stored on line is already a delta)
Expand Down
Loading