diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php
index 62fd1db45e6..905bb4a150c 100644
--- a/htdocs/core/class/html.form.class.php
+++ b/htdocs/core/class/html.form.class.php
@@ -4127,7 +4127,7 @@ class Form
public function select_conditions_paiements($selected = 0, $htmlname = 'condid', $filtertype = -1, $addempty = 0, $noinfoadmin = 0, $morecss = '', $deposit_percent = -1)
{
// phpcs:enable
- print $this->getSelectConditionsPaiements($selected, $htmlname, $filtertype, $addempty, $noinfoadmin, $morecss, $deposit_percent = -1);
+ print $this->getSelectConditionsPaiements($selected, $htmlname, $filtertype, $addempty, $noinfoadmin, $morecss, $deposit_percent);
}
diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php
index 15e959b9736..e33044603c6 100644
--- a/htdocs/fourn/facture/card.php
+++ b/htdocs/fourn/facture/card.php
@@ -885,8 +885,12 @@ if (empty($reshook)) {
$totalcreditnotes = $facture_source->getSumCreditNotesUsed();
$totaldeposits = $facture_source->getSumDepositsUsed();
$remain_to_pay = abs($facture_source->total_ttc - $totalpaid - $totalcreditnotes - $totaldeposits);
+ $desc = $langs->trans('invoiceAvoirLineWithPaymentRestAmount');
+ $retAddLine = $object->addline($desc, $remain_to_pay, 0, 0, 0, 1, 0, 0, '', '', 0, '', 'TTC');
- $object->addline($langs->trans('invoiceAvoirLineWithPaymentRestAmount'), $remain_to_pay, 0, 0, 0, 1, 0, 0, '', '', 'TTC');
+ if ($retAddLine < 0) {
+ $error++;
+ }
}
}
}