N°2272 Fix call to DBObjectSet::OptimizeColumnLoad() in the portal (doesn't support "id" attribute anymore)

This commit is contained in:
Molkobain
2019-12-03 10:08:08 +01:00
parent 9abcf40df7
commit e1ffdea172

View File

@@ -1231,12 +1231,6 @@ class ObjectController extends BrickController
throw new HttpException(Response::HTTP_INTERNAL_SERVER_ERROR, 'Invalid request data, some information are missing');
}
// Checking that id is in the AttCodes
if (!in_array('id', $aObjectAttCodes))
{
$aObjectAttCodes = array_merge(array('id'), $aObjectAttCodes);
}
// Building the search
$bIgnoreSilos = $oScopeValidator->IsAllDataAllowedForScope(UserRights::ListProfiles(), $sObjectClass);
$aParams = array('objects_id' => $aObjectIds);
@@ -1248,6 +1242,13 @@ class ObjectController extends BrickController
$oSet = new DBObjectSet($oSearch, array(), $aParams);
$oSet->OptimizeColumnLoad(array($oSearch->GetClassAlias() => $aObjectAttCodes));
// Checking that id is in the AttCodes
// Note: We do that AFTER the array is used in OptimizeColumnLoad() because the function doesn't support this anymore.
if (!in_array('id', $aObjectAttCodes))
{
$aObjectAttCodes = array_merge(array('id'), $aObjectAttCodes);
}
// Retrieving objects
while ($oObject = $oSet->Fetch())
{