Avoid to get a random result.

This commit is contained in:
Laurent Destailleur 2020-10-01 16:43:56 +02:00
parent aaad3c3b75
commit 2f89d526eb

View File

@ -90,11 +90,13 @@ class Stripe extends CommonObject
global $conf;
$sql = "SELECT tokenstring";
$sql .= " FROM ".MAIN_DB_PREFIX."oauth_token WHERE";
$sql .= " FROM ".MAIN_DB_PREFIX."oauth_token";
$sql .= " WHERE service = '".$this->db->escape($mode)."'";
if (empty($fk_soc)) $sql .= " entity = ".$conf->entity. " AND";
$sql .= " service = '".$mode."'";
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";