mirror of
https://github.com/Combodo/iTop.git
synced 2026-02-13 15:34:12 +01:00
Revert "N°4911 - Mentions: Fix Person picture not displayed if marker configured on parent class (Contact)"
This reverts commit 106127e6b7.
As the image attribute can be different depending on the object finalclass, it cannot be added in the DBObjectSet::OptimizeColumnLoad(), which means that retrieving it within the loop might lead to a complete DBObject::Reload() of the object which can have a real impact on performances depending on the objects.
This commit is contained in:
@@ -2507,6 +2507,8 @@ EOF
|
||||
$sSearchMainClassName = $oSearch->GetClass();
|
||||
$sSearchMainClassAlias = $oSearch->GetClassAlias();
|
||||
|
||||
$sObjectImageAttCode = MetaModel::GetImageAttributeCode($sSearchMainClassName);
|
||||
|
||||
// Add condition to filter on the friendlyname
|
||||
$oSearch->AddConditionExpression(
|
||||
new BinaryExpression(new FieldExpression('friendlyname', $sSearchMainClassAlias), 'LIKE', new VariableExpression('needle'))
|
||||
@@ -2519,7 +2521,7 @@ EOF
|
||||
$oSet->SetShowObsoleteData(utils::ShowObsoleteData());
|
||||
|
||||
while ($oObject = $oSet->Fetch()) {
|
||||
// Note: $oObject finalclass might be different than $sMentionedClass
|
||||
// Note $oObject finalclass might be different than $sMentionedClass
|
||||
$sObjectClass = get_class($oObject);
|
||||
$iObjectId = $oObject->GetKey();
|
||||
$aMatch = [
|
||||
@@ -2528,8 +2530,7 @@ EOF
|
||||
'friendlyname' => $oObject->Get('friendlyname'),
|
||||
];
|
||||
|
||||
// Try to retrieve image for object (Don't do it outside of the loop as $oObject can be from different classes)
|
||||
$sObjectImageAttCode = MetaModel::GetImageAttributeCode($sObjectClass);
|
||||
// Try to retrieve image for contact
|
||||
if (!empty($sObjectImageAttCode)) {
|
||||
/** @var \ormDocument $oImage */
|
||||
$oImage = $oObject->Get($sObjectImageAttCode);
|
||||
|
||||
Reference in New Issue
Block a user