Update stripe.class.php

This commit is contained in:
ptibogxiv 2019-08-21 17:09:26 +02:00 committed by GitHub
parent e43d996780
commit 074ea37664
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -78,9 +78,10 @@ class Stripe extends CommonObject
* Return main company OAuth Connect stripe account
*
* @param string $mode 'StripeTest' or 'StripeLive'
* @param int $fk_soc Id of thirdparty
* @return string Stripe account 'acc_....' or '' if no OAuth token found
*/
public function getStripeAccount($mode = 'StripeTest')
public function getStripeAccount($mode = 'StripeTest', $fk_soc = null)
{
global $conf;
@ -88,6 +89,10 @@ 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)";
dol_syslog(get_class($this) . "::fetch", LOG_DEBUG);
$result = $this->db->query($sql);