From 1012da6d4754095c499d9aab4acc20a5d1521272 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 9 Sep 2022 16:38:24 +0200 Subject: [PATCH] Fix sql --- 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 190e3a3fc62..fed9c810573 100644 --- a/htdocs/core/class/commoninvoice.class.php +++ b/htdocs/core/class/commoninvoice.class.php @@ -856,7 +856,7 @@ abstract class CommonInvoice extends CommonObject $sql = 'SELECT count(*)'; $sql .= ' FROM '.MAIN_DB_PREFIX.'prelevement_facture_demande'; - $sql .= ' WHERE fk_facture = '.$this->id; + $sql .= ' WHERE fk_facture = '.((int) $this->id); $sql .= ' AND ext_payment_id IS NULL'; // To exclude record done for some online payments $sql .= ' AND traite = 0'; @@ -1039,7 +1039,7 @@ abstract class CommonInvoice extends CommonObject // if (!$error && empty($nocancelifpaymenterror)) { // If we are not in a mode that ask to avoid cancelation, we cancel payment. // // Test if last AC_PAYMENT_STRIPE_KO event is an old error lower than $nbhoursbetweentries hours. // $recentfailedpayment = false; - // $sqlonevents = 'SELECT COUNT(*) as nb FROM ' . MAIN_DB_PREFIX . 'actioncomm WHERE fk_soc = ' . $thirdparty->id . " AND code ='AC_PAYMENT_STRIPE_KO' AND datep > '" . $this->db->idate($now - ($nbhoursbetweentries * 3600)) . "'"; + // $sqlonevents = 'SELECT COUNT(*) as nb FROM ' . MAIN_DB_PREFIX . 'actioncomm WHERE fk_soc = ' . ((int) $thirdparty->id) . " AND code ='AC_PAYMENT_STRIPE_KO' AND datep > '" . $this->db->idate($now - ($nbhoursbetweentries * 3600)) . "'"; // $resqlonevents = $this->db->query($sqlonevents); // if ($resqlonevents) { // $obj = $this->db->fetch_object($resqlonevents);