From 83b4ddc0cd07d565ed56dfc7a89c532aaed3fab3 Mon Sep 17 00:00:00 2001 From: Sylvain Legrand Date: Tue, 21 Nov 2023 23:20:20 +0100 Subject: [PATCH] New variable to accept a deposit invoice as available credit even unpaid (#26792) * New variable to accept a deposit invoice as available credit even unpaid In many activities, the final invoice must be issued while the requested deposit has not yet been paid. Often it is the payment deadlines which generate this situation (for example in the finishing work) * Update card.php * Update card.php --------- Co-authored-by: Laurent Destailleur --- htdocs/compta/facture/card.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index e4c4833005b..a9f862d5180 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -5780,8 +5780,8 @@ if ($action == 'create') { } // For down payment invoice (deposit) if ($object->type == Facture::TYPE_DEPOSIT && $usercancreate && $object->statut > Facture::STATUS_DRAFT && empty($discount->id)) { - if (price2num($object->total_ttc, 'MT') == price2num($sumofpaymentall, 'MT') || ($object->type == Facture::STATUS_ABANDONED && in_array($object->close_code, array('bankcharge', 'discount_vat', 'other')))) { - // We can close a down payment only if paid amount is same than amount of down payment (by definition) + // We can close a down payment only if paid amount is same than amount of down payment (by definition). We can bypass this if hidden and unstable option DEPOSIT_AS_CREDIT_AVAILABLE_EVEN_UNPAID is set. + if (price2num($object->total_ttc, 'MT') == price2num($sumofpaymentall, 'MT') || getDolGlobalInt('DEPOSIT_AS_CREDIT_AVAILABLE_EVEN_UNPAID') || ($object->type == Facture::STATUS_ABANDONED && in_array($object->close_code, array('bankcharge', 'discount_vat', 'other')))) { print ''.$langs->trans('ConvertToReduc').''; } else { print ''.$langs->trans('ConvertToReduc').'';