Merge pull request #9045 from hregis/8.0_multicompany

Fix: check if multicompany object exists
This commit is contained in:
Laurent Destailleur 2018-07-06 14:23:59 +02:00 committed by GitHub
commit 67a831ad5f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -88,7 +88,7 @@ $user = new User($db);
$user->fetch(5);
$user->getrights();
if (! empty($conf->multicompany->enabled) && ! empty($conf->stripeconnect->enabled)) {
if (! empty($conf->multicompany->enabled) && ! empty($conf->stripeconnect->enabled) && is_object($mc)) {
$sql = "SELECT entity";
$sql.= " FROM ".MAIN_DB_PREFIX."oauth_token";
$sql.= " WHERE service = '".$db->escape($service)."' and tokenstring = '%".$db->escape($event->account)."%'";
@ -102,10 +102,12 @@ if (! empty($conf->multicompany->enabled) && ! empty($conf->stripeconnect->enabl
$obj = $db->fetch_object($result);
$key=$obj->entity;
}
else {$key=1;
else {
$key=1;
}
}
else {$key=1;
else {
$key=1;
}
$ret=$mc->switchEntity($key);
if (! $res && file_exists("../../main.inc.php")) $res=@include("../../main.inc.php");