Fix #39327 add an option to refuse payment on any abandoned invoice - #39735
Open
pixodeo wants to merge 3 commits into
Open
Fix #39327 add an option to refuse payment on any abandoned invoice#39735pixodeo wants to merge 3 commits into
pixodeo wants to merge 3 commits into
Conversation
…nvoice The guard merged in Dolibarr#39713 refuses the online payment only when the invoice was closed as replaced, so a customer who still wants to pay an invoice abandoned for another reason can do it. That is the right default, but it does not fit every jurisdiction: once a receivable has been written off or sent to collections, some legislations no longer allow the creditor to collect it, so the link has to die whatever the close code. ONLINE_PAYMENT_REFUSE_ABANDONED_INVOICE extends the refusal to every abandoned invoice. It is off by default, so the behaviour merged in Signed-off-by: Dolicraft <contact@dolicraft.com> Dolibarr#39713 is unchanged unless an admin opts in.
The Travis build errored during its own environment setup, failing on "service apache2 restart" with exit code 5 before running any test. Signed-off-by: Dolicraft <contact@dolicraft.com>
eldy
reviewed
Aug 28, 2026
| } elseif ($source == 'invoice' && $object->paye) { | ||
| print '<br><br><div class="amountpaymentcomplete size12x wrapimp">'.$langs->trans("InvoicePaid").'</div>'; | ||
| } elseif ($source == 'invoice' && $object->status == Facture::STATUS_ABANDONED && $object->close_code == Facture::CLOSECODE_REPLACED) { | ||
| } elseif ($source == 'invoice' && $object->status == Facture::STATUS_ABANDONED && ($object->close_code == Facture::CLOSECODE_REPLACED || getDolGlobalString('ONLINE_PAYMENT_REFUSE_ABANDONED_INVOICE'))) { |
Member
There was a problem hiding this comment.
Option must start with name of module.
Can you rename it
INVOICE_ONLINE_PAYMENT_REFUSED_WHATEVER_IS_ABANDON_REASON
Contributor
Author
There was a problem hiding this comment.
Renamed to INVOICE_ONLINE_PAYMENT_REFUSED_WHATEVER_IS_ABANDON_REASON, pushed. The constant was only referenced in this one spot, so nothing else to update.
…ON_REASON Prefix the constant with the module name, as asked in review. Signed-off-by: Dolicraft <contact@dolicraft.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #39713, requested by @meuchels on the issue: "in our state if an invoice goes to collections you are no longer authorized to collect on it. therefore abandon the invoice should kill the link. maybe it should be optional??"
The guard merged in #39713 refuses the payment only when close_code is 'replaced', which is the right default and what @aspangaro asked for: a customer determined to pay an invoice abandoned as a bad debt is a good outcome, so the link stays usable. But in jurisdictions where a written off or collections-bound receivable may no longer be collected by the creditor, the link has to die whatever the close code.
ONLINE_PAYMENT_REFUSE_ABANDONED_INVOICE extends the refusal to every abandoned invoice, off by default.
So nothing changes for anyone who does not set it, and both readings of the law are supported. No new translation key, the existing Abandoned string of bills.lang is reused as in #39713.