diff --git a/htdocs/compta/paiement/card.php b/htdocs/compta/paiement/card.php
index bc62064dc82..a90a52c4e20 100644
--- a/htdocs/compta/paiement/card.php
+++ b/htdocs/compta/paiement/card.php
@@ -443,11 +443,13 @@ if ($resql)
print '
'.$invoice->getLibStatut(5, $alreadypayed).' | ';
print "\n";
- if ($objp->paye == 1) // If at least one invoice is paid, disable delete
- {
+
+ // If at least one invoice is paid, disable delete. INVOICE_CAN_DELETE_PAYMENT_EVEN_IF_INVOICE_CLOSED Can be use for maintenance purpose. Never use this in production
+ if ($objp->paye == 1 && empty($conf->global->INVOICE_CAN_DELETE_PAYMENT_EVEN_IF_INVOICE_CLOSED)) {
$disable_delete = 1;
$title_button = dol_escape_htmltag($langs->transnoentitiesnoconv("CantRemovePaymentWithOneInvoicePaid"));
}
+
$total = $total + $objp->amount;
$i++;
}