diff --git a/datamodels/2.x/itop-portal-base/portal/src/Controller/BrowseBrickController.php b/datamodels/2.x/itop-portal-base/portal/src/Controller/BrowseBrickController.php index 8654a6f03..2c7c95389 100644 --- a/datamodels/2.x/itop-portal-base/portal/src/Controller/BrowseBrickController.php +++ b/datamodels/2.x/itop-portal-base/portal/src/Controller/BrowseBrickController.php @@ -16,8 +16,6 @@ * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License - * - * */ namespace Combodo\iTop\Portal\Controller; @@ -384,6 +382,7 @@ class BrowseBrickController extends BrickController $aColumnAttrs[$sTmpClassAlias] = $aTmpColumnAttrs; } } + // Note: $aColumnAttrs already contains array of aliases => attcodes $oSet->OptimizeColumnLoad($aColumnAttrs); // Setting specified column sort, setting default datamodel one otherwise diff --git a/datamodels/2.x/itop-portal-base/portal/src/Controller/ManageBrickController.php b/datamodels/2.x/itop-portal-base/portal/src/Controller/ManageBrickController.php index 6bb4e599f..a0f81202d 100644 --- a/datamodels/2.x/itop-portal-base/portal/src/Controller/ManageBrickController.php +++ b/datamodels/2.x/itop-portal-base/portal/src/Controller/ManageBrickController.php @@ -16,8 +16,6 @@ * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License - * - * */ namespace Combodo\iTop\Portal\Controller; @@ -491,7 +489,7 @@ class ManageBrickController extends BrickController // - Check how many records there is. // - Update $sDataLoading with its new value regarding the number of record and the threshold $oCountSet = new DBObjectSet($oQuery); - $oCountSet->OptimizeColumnLoad(array()); + $oCountSet->OptimizeColumnLoad(array($oQuery->GetClassAlias() => array())); $fThreshold = (float)MetaModel::GetModuleSetting($sPortalId, 'lazy_loading_threshold'); $sDataLoading = ($oCountSet->Count() > $fThreshold) ? AbstractBrick::ENUM_DATA_LOADING_LAZY : AbstractBrick::ENUM_DATA_LOADING_FULL; @@ -555,6 +553,7 @@ class ManageBrickController extends BrickController } } } + // Note: $aColumnToLoad already contains array of aliases => attcodes $oSet->OptimizeColumnLoad($aColumnsToLoad); $oSecurityHelper->PreloadForCache($oSet->GetFilter(), diff --git a/datamodels/2.x/itop-portal-base/portal/src/Controller/ObjectController.php b/datamodels/2.x/itop-portal-base/portal/src/Controller/ObjectController.php index e23d90b03..d63065ace 100644 --- a/datamodels/2.x/itop-portal-base/portal/src/Controller/ObjectController.php +++ b/datamodels/2.x/itop-portal-base/portal/src/Controller/ObjectController.php @@ -16,8 +16,6 @@ * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License - * - * */ namespace Combodo\iTop\Portal\Controller; @@ -1245,7 +1243,7 @@ class ObjectController extends BrickController $oSearch->AllowAllData(); } $oSet = new DBObjectSet($oSearch, array(), $aParams); - $oSet->OptimizeColumnLoad($aObjectAttCodes); + $oSet->OptimizeColumnLoad(array($oSearch->GetClassAlias() => $aObjectAttCodes)); // Retrieving objects while ($oObject = $oSet->Fetch()) diff --git a/datamodels/2.x/itop-portal-base/portal/src/Helper/NavigationRuleHelper.php b/datamodels/2.x/itop-portal-base/portal/src/Helper/NavigationRuleHelper.php index a80eb5413..03b365b52 100644 --- a/datamodels/2.x/itop-portal-base/portal/src/Helper/NavigationRuleHelper.php +++ b/datamodels/2.x/itop-portal-base/portal/src/Helper/NavigationRuleHelper.php @@ -614,7 +614,7 @@ class NavigationRuleHelper { $oSearch = DBSearch::FromOQL($aRuleDef['properties']['oql']); $oSet = new DBObjectSet($oSearch, array(), array('this' => $oCurrentObject)); - $oSet->OptimizeColumnLoad(array()); + $oSet->OptimizeColumnLoad(array($oSearch => array())); $oTargetObject = $oSet->Fetch(); } // - Build URL diff --git a/datamodels/2.x/itop-portal-base/portal/src/Helper/SecurityHelper.php b/datamodels/2.x/itop-portal-base/portal/src/Helper/SecurityHelper.php index 3c869f256..9140ea359 100644 --- a/datamodels/2.x/itop-portal-base/portal/src/Helper/SecurityHelper.php +++ b/datamodels/2.x/itop-portal-base/portal/src/Helper/SecurityHelper.php @@ -1,21 +1,22 @@ +/** + * Copyright (C) 2013-2019 Combodo SARL + * + * This file is part of iTop. + * + * iTop is free software; you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * iTop is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + */ namespace Combodo\iTop\Portal\Helper; @@ -288,7 +289,7 @@ class SecurityHelper // Preparing object set $oScopeSet = new DBObjectSet($oScopeQuery); - $oScopeSet->OptimizeColumnLoad(array()); + $oScopeSet->OptimizeColumnLoad(array($oScopeQuery->GetClassAlias() => array())); // Checking objects status $aScopeObjectIds = $aObjectIds;