Merge pull request #8365 from ptibogxiv/patch-11

Fix SQL and ADD support LIVE/TEST mode
This commit is contained in:
Laurent Destailleur 2018-03-13 09:38:22 +01:00 committed by GitHub
commit b34e176060
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -93,17 +93,18 @@ class Stripe extends CommonObject
* getStripeCustomerAccount * getStripeCustomerAccount
* *
* @param int $id Id of third party * @param int $id Id of third party
* @return string Stripe customer ref 'cu_xxxxxxxxxxxxx' * @param int $status Status
* @return string Stripe customer ref 'cu_xxxxxxxxxxxxx'
*/ */
public function getStripeCustomerAccount($id) public function getStripeCustomerAccount($id, $status=0)
{ {
global $conf; global $conf;
$sql = "SELECT sa.key_account as key_account, sa.entity"; $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.= " WHERE sa.fk_soc = " . $id;
$sql.= " AND sa.entity IN (".getEntity('societe').")"; $sql.= " AND sa.entity IN (".getEntity('societe').")";
$sql.= " AND site = 'stripe'"; $sql.= " AND sa.site = 'stripe' AND sa.status = ".((int) $status);
dol_syslog(get_class($this) . "::fetch", LOG_DEBUG); dol_syslog(get_class($this) . "::fetch", LOG_DEBUG);
$result = $this->db->query($sql); $result = $this->db->query($sql);