From b682fe728c5a85e39bb05ed7ff87f3a8d23206b2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 8 Mar 2023 03:16:59 +0100 Subject: [PATCH] Fix direct debit sql request --- htdocs/core/class/commoninvoice.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/commoninvoice.class.php b/htdocs/core/class/commoninvoice.class.php index e7e31cc9398..c7a59c80057 100644 --- a/htdocs/core/class/commoninvoice.class.php +++ b/htdocs/core/class/commoninvoice.class.php @@ -916,10 +916,10 @@ abstract class CommonInvoice extends CommonObject $sql = "SELECT rowid, date_demande, amount, fk_facture, fk_facture_fourn, fk_prelevement_bons"; $sql .= " FROM ".$this->db->prefix()."prelevement_demande"; $sql .= " WHERE rowid = ".((int) $did); - if ($type != 'direct-debit') { + if ($type != 'bank-transfer' && $type != 'credit-transfer') { $sql .= " AND fk_facture = ".((int) $this->id); // Add a protection to not pay another invoice than current one } - if ($type != 'credit-transfer') { + if ($type != 'direct-debit') { $sql .= " AND fk_facture_fourn = ".((int) $this->id); // Add a protection to not pay another invoice than current one } $sql .= " AND traite = 0"; // Add a protection to not process twice