Update card.php

This commit is contained in:
henrynopo 2021-08-30 15:33:26 +08:00 committed by GitHub
parent 74ad0586a9
commit 7bf6daaca7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -538,7 +538,7 @@ if (empty($reshook)) {
}
// If some payments were already done, we change the amount to pay using same prorate
if (!empty($conf->global->SUPPLIER_INVOICE_ALLOW_REUSE_OF_CREDIT_WHEN_PARTIALLY_REFUNDED)) {
if (!empty($conf->global->SUPPLIER_INVOICE_ALLOW_REUSE_OF_CREDIT_WHEN_PARTIALLY_REFUNDED) && $object->type == FactureFournisseur::TYPE_CREDIT_NOTE) {
$alreadypaid = $object->getSommePaiement(); // This can be not 0 if we allow to create credit to reuse from credit notes partially refunded.
if ($alreadypaid && abs($alreadypaid) < abs($object->total_ttc)) {
$ratio = abs(($object->total_ttc - $alreadypaid) / $object->total_ttc);