From 9408a98c52af9befdfc1828e240c5a1145a4f9ef Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Tue, 13 Mar 2018 00:26:09 +0100 Subject: [PATCH] Fix SQL and ADD support LIVE/TEST mode --- htdocs/stripe/class/stripe.class.php | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/htdocs/stripe/class/stripe.class.php b/htdocs/stripe/class/stripe.class.php index 801d0e17057..3a9c8646686 100644 --- a/htdocs/stripe/class/stripe.class.php +++ b/htdocs/stripe/class/stripe.class.php @@ -98,12 +98,20 @@ class Stripe extends CommonObject public function getStripeCustomerAccount($id) { global $conf; - + if (empty($conf->global->STRIPECONNECT_LIVE)) { + $mode = 0; + } else { + if (empty($conf->global->STRIPE_LIVE)) { + $mode = 0; + } else { + $mode = $conf->global->STRIPE_LIVE; + } + } $sql = "SELECT sa.key_account as key_account, sa.entity"; - $sql.= " FROM " . MAIN_DB_PREFIX . "llx_societe_accounts as sa"; + $sql.= " FROM " . MAIN_DB_PREFIX . "llx_societe_account as sa"; $sql.= " WHERE sa.fk_soc = " . $id; $sql.= " AND sa.entity IN (".getEntity('societe').")"; - $sql.= " AND site = 'stripe'"; + $sql.= " AND sa.site = 'stripe' AND sa.status = ".$mode; dol_syslog(get_class($this) . "::fetch", LOG_DEBUG); $result = $this->db->query($sql);