Merge pull request #18548 from henrynopo/patch-17

Fix error of SUPPLIER_INVOICE_ALLOW_REUSE_OF_CREDIT_WHEN_PARTIALLY_REFUNDED
This commit is contained in:
Laurent Destailleur 2021-09-01 18:17:37 +02:00 committed by GitHub
commit f0a68d728a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View File

@ -834,7 +834,7 @@ if (empty($reshook)) {
}
// If some payments were already done, we change the amount to pay using same prorate
if (!empty($conf->global->INVOICE_ALLOW_REUSE_OF_CREDIT_WHEN_PARTIALLY_REFUNDED)) {
if (!empty($conf->global->INVOICE_ALLOW_REUSE_OF_CREDIT_WHEN_PARTIALLY_REFUNDED) && $object->type == Facture::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);

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);