fix:Handle constant MAIN_SHOW_SOCIETE2EXTERN in checkUserAccessToObject

This commit is contained in:
abb 2021-02-14 17:59:12 +01:00
parent 50797bf892
commit e6d35039c9

View File

@ -584,7 +584,8 @@ function checkUserAccessToObject($user, $featuresarray, $objectid = 0, $tableand
}
} elseif (!in_array($feature, $nocheck)) { // By default (case of $checkdefault), we check on object entity + link to third party on field $dbt_keyfield
// If external user: Check permission for external users
if ($user->socid > 0) {
if ($user->socid > 0 && empty($conf->global->MAIN_SHOW_SOCIETE2EXTERN))
{
if (empty($dbt_keyfield)) dol_print_error('', 'Param dbt_keyfield is required but not defined');
$sql = "SELECT COUNT(dbt.".$dbt_keyfield.") as nb";
$sql .= " FROM ".MAIN_DB_PREFIX.$dbtablename." as dbt";