It is better to let the caller decide which mode (live or not) to take
This commit is contained in:
parent
9408a98c52
commit
490acd96dc
@ -93,25 +93,18 @@ class Stripe extends CommonObject
|
|||||||
* getStripeCustomerAccount
|
* getStripeCustomerAccount
|
||||||
*
|
*
|
||||||
* @param int $id Id of third party
|
* @param int $id Id of third party
|
||||||
|
* @param int $status Status
|
||||||
* @return string Stripe customer ref 'cu_xxxxxxxxxxxxx'
|
* @return string Stripe customer ref 'cu_xxxxxxxxxxxxx'
|
||||||
*/
|
*/
|
||||||
public function getStripeCustomerAccount($id)
|
public function getStripeCustomerAccount($id, $status=0)
|
||||||
{
|
{
|
||||||
global $conf;
|
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 = "SELECT sa.key_account as key_account, sa.entity";
|
||||||
$sql.= " FROM " . MAIN_DB_PREFIX . "llx_societe_account 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 sa.site = 'stripe' AND sa.status = ".$mode;
|
$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);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user