From 1f483d7c28803bde08c133a9ff3e4e302c34943a Mon Sep 17 00:00:00 2001 From: jcp Date: Wed, 4 Nov 2020 11:15:41 +0100 Subject: [PATCH] Fix force payment mode to create withdrawal --- htdocs/core/class/commoninvoice.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/commoninvoice.class.php b/htdocs/core/class/commoninvoice.class.php index cb7ce67d923..10c2c906e04 100644 --- a/htdocs/core/class/commoninvoice.class.php +++ b/htdocs/core/class/commoninvoice.class.php @@ -784,7 +784,7 @@ abstract class CommonInvoice extends CommonObject if (!$error) { // Force payment mode of invoice to withdraw - $payment_mode_id = dol_getIdFromCode($this->db, 'PRE', 'c_paiement', 'code', 'id', 1); + $payment_mode_id = dol_getIdFromCode($this->db, ($type == 'bank-transfer' ? 'VIR' : 'PRE'), 'c_paiement', 'code', 'id', 1); if ($payment_mode_id > 0) { $result = $this->setPaymentMethods($payment_mode_id);