mirror of
https://github.com/Combodo/iTop.git
synced 2026-02-13 07:24:13 +01:00
Improved the column load optimization which was causing object reloads in various circumstances (impact can be important when loading lists with many lines):
1) When changing column settings (menu "Configure this list") 2) When a plugin was systematically reading some data (e.g. Highlighting late tickets requires to read tto/trr/status/start_date!) SVN:trunk[2925]
This commit is contained in:
@@ -818,9 +818,6 @@ abstract class cmdbAbstractObject extends CMDBObject implements iDisplay
|
||||
$sClassAlias = $oSet->GetClassAlias();
|
||||
$bDisplayLimit = isset($aExtraParams['display_limit']) ? $aExtraParams['display_limit'] : true;
|
||||
|
||||
// Load only the requested columns
|
||||
$oSet->OptimizeColumnLoad(array($sClassAlias => $aList));
|
||||
|
||||
$sTableId = isset($aExtraParams['table_id']) ? $aExtraParams['table_id'] : null;
|
||||
$aClassAliases = array( $sClassAlias => $sClassName);
|
||||
$oDataTable = new DataTable($iListId, $oSet, $aClassAliases, $sTableId);
|
||||
@@ -920,16 +917,6 @@ abstract class cmdbAbstractObject extends CMDBObject implements iDisplay
|
||||
}
|
||||
}
|
||||
}
|
||||
// Load only the requested columns
|
||||
$aAttToLoad = array(); // attributes to load
|
||||
foreach($aAuthorizedClasses as $sAlias => $sClassName)
|
||||
{
|
||||
foreach($aList[$sAlias] as $sAttCode)
|
||||
{
|
||||
$aAttToLoad[$sAlias][] = $sAttCode;
|
||||
}
|
||||
}
|
||||
$oSet->OptimizeColumnLoad($aAttToLoad);
|
||||
|
||||
$sSelectMode = 'none';
|
||||
|
||||
|
||||
@@ -75,7 +75,35 @@ class DataTable
|
||||
$this->oSet->SetLimit($oCustomSettings->iDefaultPageSize);
|
||||
}
|
||||
$this->oSet->SetOrderBy($oCustomSettings->GetSortOrder());
|
||||
|
||||
|
||||
// Load only the requested columns
|
||||
$aColumnsToLoad = array();
|
||||
foreach($oCustomSettings->aColumns as $sAlias => $aColumnsInfo)
|
||||
{
|
||||
foreach($aColumnsInfo as $sAttCode => $aData)
|
||||
{
|
||||
if ($sAttCode != '_key_')
|
||||
{
|
||||
if ($aData['checked'])
|
||||
{
|
||||
$aColumnsToLoad[$sAlias][] = $sAttCode;
|
||||
}
|
||||
else
|
||||
{
|
||||
// See if this column is a must to load
|
||||
$sClass = $this->aClassAliases[$sAlias];
|
||||
$oAttDef = MetaModel::GetAttributeDef($sClass, $sAttCode);
|
||||
if ($oAttDef->alwaysLoadInTables())
|
||||
{
|
||||
$aColumnsToLoad[$sAlias][] = $sAttCode;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$this->oSet->OptimizeColumnLoad($aColumnsToLoad);
|
||||
|
||||
|
||||
$bToolkitMenu = true;
|
||||
if (isset($aExtraParams['toolkit_menu']))
|
||||
{
|
||||
|
||||
@@ -210,6 +210,7 @@ abstract class AttributeDefinition
|
||||
public function IsExternalField() {return false;}
|
||||
public function IsWritable() {return false;}
|
||||
public function LoadInObject() {return true;}
|
||||
public function AlwaysLoadInTables() {return $this->GetOptional('always_load_in_tables', false);}
|
||||
public function GetValue($oHostObject){return null;} // must return the value if LoadInObject returns false
|
||||
public function IsNullAllowed() {return true;}
|
||||
public function GetCode() {return $this->m_sCode;}
|
||||
|
||||
@@ -37,6 +37,7 @@
|
||||
</properties>
|
||||
<fields>
|
||||
<field id="status" xsi:type="AttributeEnum">
|
||||
<always_load_in_tables>true</always_load_in_tables>
|
||||
<values>
|
||||
<value>new</value>
|
||||
<value>assigned</value>
|
||||
@@ -163,6 +164,7 @@
|
||||
<goal/>
|
||||
</field>
|
||||
<field id="tto" xsi:type="AttributeStopWatch">
|
||||
<always_load_in_tables>true</always_load_in_tables>
|
||||
<states>
|
||||
<state id="new"/>
|
||||
<state id="escalated_tto"/>
|
||||
@@ -189,6 +191,7 @@
|
||||
</thresholds>
|
||||
</field>
|
||||
<field id="ttr" xsi:type="AttributeStopWatch">
|
||||
<always_load_in_tables>true</always_load_in_tables>
|
||||
<states>
|
||||
<state id="new"/>
|
||||
<state id="escalated_tto"/>
|
||||
|
||||
@@ -37,6 +37,7 @@
|
||||
</properties>
|
||||
<fields>
|
||||
<field id="status" xsi:type="AttributeEnum">
|
||||
<always_load_in_tables>true</always_load_in_tables>
|
||||
<values>
|
||||
<value>new</value>
|
||||
<value>waiting_for_approval</value>
|
||||
@@ -188,6 +189,7 @@
|
||||
<goal/>
|
||||
</field>
|
||||
<field id="tto" xsi:type="AttributeStopWatch">
|
||||
<always_load_in_tables>true</always_load_in_tables>
|
||||
<states>
|
||||
<state id="new"/>
|
||||
<state id="escalated_tto"/>
|
||||
@@ -214,6 +216,7 @@
|
||||
</thresholds>
|
||||
</field>
|
||||
<field id="ttr" xsi:type="AttributeStopWatch">
|
||||
<always_load_in_tables>true</always_load_in_tables>
|
||||
<states>
|
||||
<state id="new"/>
|
||||
<state id="escalated_tto"/>
|
||||
|
||||
@@ -37,6 +37,7 @@
|
||||
</properties>
|
||||
<fields>
|
||||
<field id="status" xsi:type="AttributeEnum">
|
||||
<always_load_in_tables>true</always_load_in_tables>
|
||||
<values>
|
||||
<value>new</value>
|
||||
<value>waiting_for_approval</value>
|
||||
@@ -194,6 +195,7 @@
|
||||
<goal/>
|
||||
</field>
|
||||
<field id="tto" xsi:type="AttributeStopWatch">
|
||||
<always_load_in_tables>true</always_load_in_tables>
|
||||
<states>
|
||||
<state id="new"/>
|
||||
<state id="escalated_tto"/>
|
||||
@@ -220,6 +222,7 @@
|
||||
</thresholds>
|
||||
</field>
|
||||
<field id="ttr" xsi:type="AttributeStopWatch">
|
||||
<always_load_in_tables>true</always_load_in_tables>
|
||||
<states>
|
||||
<state id="new"/>
|
||||
<state id="escalated_tto"/>
|
||||
|
||||
@@ -99,6 +99,7 @@
|
||||
<is_null_allowed>false</is_null_allowed>
|
||||
</field>
|
||||
<field id="start_date" xsi:type="AttributeDateTime">
|
||||
<always_load_in_tables>true</always_load_in_tables>
|
||||
<sql>start_date</sql>
|
||||
<default_value/>
|
||||
<is_null_allowed>true</is_null_allowed>
|
||||
|
||||
@@ -878,6 +878,7 @@ EOF;
|
||||
$aParameters['height'] = $this->GetPropNumber($oField, 'height');
|
||||
$aParameters['digits'] = $this->GetPropNumber($oField, 'digits');
|
||||
$aParameters['decimals'] = $this->GetPropNumber($oField, 'decimals');
|
||||
$aParameters['always_load_in_tables'] = $this->GetPropBoolean($oField, 'always_load_in_tables', false);
|
||||
$sTrackingLevel = $oField->GetChildText('tracking_level');
|
||||
if (!is_null($sTrackingLevel))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user