From 5983f08d731b52c69e10e1870f1650647bb886b9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 22 Aug 2019 12:52:30 +0200 Subject: [PATCH] Update stripe.class.php --- htdocs/stripe/class/stripe.class.php | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/htdocs/stripe/class/stripe.class.php b/htdocs/stripe/class/stripe.class.php index d24a51cdb03..5dda24a763e 100644 --- a/htdocs/stripe/class/stripe.class.php +++ b/htdocs/stripe/class/stripe.class.php @@ -81,7 +81,7 @@ class Stripe extends CommonObject * @param int $fk_soc Id of thirdparty * @return string Stripe account 'acc_....' or '' if no OAuth token found */ - public function getStripeAccount($mode = 'StripeTest', $fk_soc = null) + public function getStripeAccount($mode = 'StripeTest', $fk_soc = 0) { global $conf; @@ -89,10 +89,13 @@ class Stripe extends CommonObject $sql.= " FROM ".MAIN_DB_PREFIX."oauth_token"; $sql.= " WHERE entity = ".$conf->entity; $sql.= " AND service = '".$mode."'"; - if ($fk_soc) { - $sql.= " AND fk_soc = '".$fk_soc."'"; - } else { $sql.= " AND ISNULL(fk_soc)"; } - $sql.= " AND ISNULL(fk_user) AND ISNULL(fk_adherent)"; + if ($fk_soc > 0) { + $sql.= " AND fk_soc = ".$fk_soc; + } + else { + $sql.= " AND fk_soc IS NULL"; + } + $sql.= " AND fk_user IS NULL AND fk_adherent IS NULL"; dol_syslog(get_class($this) . "::fetch", LOG_DEBUG); $result = $this->db->query($sql);