Skip to content

Fix #39327 add an option to refuse payment on any abandoned invoice - #39735

Open
pixodeo wants to merge 3 commits into
Dolibarr:23.0from
Dolicraft:fix/39327-optional-block-all-abandoned
Open

Fix #39327 add an option to refuse payment on any abandoned invoice#39735
pixodeo wants to merge 3 commits into
Dolibarr:23.0from
Dolicraft:fix/39327-optional-block-all-abandoned

Conversation

@pixodeo

@pixodeo pixodeo commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

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.

invoice default, unchanged with the constant
validated form shown form shown
abandoned, replaced refused refused
abandoned, bad customer form shown refused
abandoned, abandon form shown refused
abandoned, other form shown refused
closed and paid refused refused

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.

…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>
Comment thread htdocs/public/payment/newpayment.php Outdated
} 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'))) {

@eldy eldy Aug 28, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Option must start with name of module.
Can you rename it
INVOICE_ONLINE_PAYMENT_REFUSED_WHATEVER_IS_ABANDON_REASON

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@eldy eldy added the PR to fix - Conflict or CI error to solve The PHP unit tests return something wrong. Check details to know what to fix or solve the conflicts. label Aug 28, 2026
…ON_REASON

Prefix the constant with the module name, as asked in review.

Signed-off-by: Dolicraft <contact@dolicraft.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

PR to fix - Conflict or CI error to solve The PHP unit tests return something wrong. Check details to know what to fix or solve the conflicts.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants