Skip to content

Fix/support/da028241/situation ratio denominator#748

Merged
ATM-NicolasV merged 2 commits into
21.0_louktafrom
FIX/SUPPORT/DA028241/situation-ratio-denominator
Jun 19, 2026
Merged

Fix/support/da028241/situation ratio denominator#748
ATM-NicolasV merged 2 commits into
21.0_louktafrom
FIX/SUPPORT/DA028241/situation-ratio-denominator

Conversation

@atm-jonathan

@atm-jonathan atm-jonathan commented Jun 18, 2026

Copy link
Copy Markdown

https://doliboard.atm-consulting.fr/ticket/messaging.php?track_id=548mpbb2cau5wra2

Contexte

DA028241 — Facture de situation FA2605-0251 (client Loukta) : montants de lignes incorrects dans le PDF en mode 1 cumulatif (INVOICE_USE_SITUATION = 1).


Commit

FIX : DA028241 - FactureLigne::getSituationRatio() - wrong denominator in mode 1 situation invoices

Dans getSituationRatio() (factureligne.class.php), le calcul du ratio de la situation courante en mode 1 utilisait 100 comme dénominateur au lieu de situation_percent.

Formule incorrecte :

return ($this->situation_percent - $prev_progress) / 100;

Formule corrigée :

return ($this->situation_percent - $prev_progress) / $this->situation_percent;

Résultat de la régression : pdf_getlinetotalexcltax() retournait un montant HT de ligne erroné (sous-évalué), provoquant des totaux incohérents dans le PDF de la facture de situation.


Test plan

  • Facture de situation mode 1 : montant HT de chaque ligne = valeur correcte dans le PDF
  • Facture de situation mode 1 : total HT / TVA / TTC du PDF cohérents avec les totaux de l'en-tête facture
  • Facture de situation mode 2 : pas de régression (getSituationRatio retourne 1 en mode 2, non impacté)

…r in mode 1 situation invoices

In INVOICE_USE_SITUATION=1 (legacy cumulative mode), total_ht is stored as
subprice * qty * situation_percent / 100. The ratio to extract the period delta
must therefore be (sp - pp) / sp, not (sp - pp) / 100. The wrong denominator
caused pdf_getlinetotalexcltax() to display incorrect values in the
'Total HT sit. n°X' column for lines where situation_percent != 100.
@ATM-NicolasV
ATM-NicolasV merged commit 38ccbe6 into 21.0_loukta Jun 19, 2026
5 of 7 checks passed
ATM-NicolasV added a commit that referenced this pull request Jun 19, 2026
…ation of getSituationRatio()

Make explicit, in the getSituationRatio() docblock and in ChangeLog_loukta,
two things flagged during PR #748 review:
- O3 (core debt): this method + its consumers in core/lib/pdf.lib.php are a
  Loukta-local backport of upstream PR Dolibarr#36503 and will be overwritten
  on the next core upgrade; drop them once Dolibarr#36503 lands upstream.
- O4 (scope): the fix only corrects the mode-1 denominator and does NOT handle
  credit notes (get_prev_progress() still adds credit-note percents), so a
  situation cycle containing a credit note may still yield a wrong/negative delta.

Documentation only, no logic change.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
ATM-NicolasV added a commit that referenced this pull request Jun 19, 2026
…kers

Bracket the whole getSituationRatio() method (added as a Loukta-local core
backport of upstream PR Dolibarr#36503) with:
  // LOUKTA DA028241 - START ... // LOUKTA DA028241 - END
so the local core patch can be located and removed in one block on the next
Dolibarr core upgrade. The markers also cover the previously-merged PR #748
denominator change, which was not wrapped.

Comment-only, no logic change. Committed with --no-verify (claudemd gate
blocks on missing root CLAUDE.md; bypass authorized by user).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
ATM-NicolasV added a commit that referenced this pull request Jun 19, 2026
…ation-ratio-denominator

DOC : DA028241 - getSituationRatio() core-patch debt + credit-note scope limit (suivi #748)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants