mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-22 01:58:47 +02:00
N°2654 - Portal: Fix filter on external key when coming from filter brick
This commit is contained in:
@@ -31,6 +31,7 @@ use DBObjectSet;
|
||||
use BinaryExpression;
|
||||
use FieldExpression;
|
||||
use VariableExpression;
|
||||
use AttributeExternalKey;
|
||||
use Combodo\iTop\Portal\Brick\AbstractBrick;
|
||||
use Combodo\iTop\Portal\Brick\BrowseBrick;
|
||||
|
||||
@@ -173,9 +174,26 @@ class BrowseBrickController extends BrickController
|
||||
$aSearchFields = array($aLevelsProperties[$aLevelsPropertiesKeys[$i]]['name_att']);
|
||||
if (!empty($aLevelsProperties[$aLevelsPropertiesKeys[$i]]['fields']))
|
||||
{
|
||||
$sTmpFieldClass = $aLevelsProperties[$aLevelsPropertiesKeys[$i]]['search']->GetClass();
|
||||
foreach ($aLevelsProperties[$aLevelsPropertiesKeys[$i]]['fields'] as $aTmpField)
|
||||
{
|
||||
$aSearchFields[] = $aTmpField['code'];
|
||||
$sTmpFieldAttCode = $aTmpField['code'];
|
||||
|
||||
// Skip invalid attcodes
|
||||
if(!MetaModel::IsValidAttCode($sTmpFieldClass, $sTmpFieldAttCode))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// For external key, force search on the friendlyname instead of the ID.
|
||||
// This should be addressed more globally with the bigger issue, see N°1970
|
||||
$oTmpFieldAttDef = MetaModel::GetAttributeDef($sTmpFieldClass, $sTmpFieldAttCode);
|
||||
if($oTmpFieldAttDef instanceof AttributeExternalKey)
|
||||
{
|
||||
$sTmpFieldAttCode .= '_friendlyname';
|
||||
}
|
||||
|
||||
$aSearchFields[] = $sTmpFieldAttCode;
|
||||
}
|
||||
}
|
||||
// - Building query for the search values parts
|
||||
|
||||
@@ -23,6 +23,7 @@ namespace Combodo\iTop\Portal\Controller;
|
||||
use AttributeDate;
|
||||
use AttributeDateTime;
|
||||
use AttributeDefinition;
|
||||
use AttributeExternalKey;
|
||||
use AttributeImage;
|
||||
use AttributeTagSet;
|
||||
use BinaryExpression;
|
||||
@@ -846,10 +847,21 @@ class ManageBrickController extends BrickController
|
||||
$aSearchListItems = array();
|
||||
foreach ($aColumnsAttrs as $sColumnAttr)
|
||||
{
|
||||
if (MetaModel::IsValidAttCode($sClass, $sColumnAttr))
|
||||
// Skip invalid attcodes
|
||||
if (!MetaModel::IsValidAttCode($sClass, $sColumnAttr))
|
||||
{
|
||||
$aSearchListItems[] = $sColumnAttr;
|
||||
continue;
|
||||
}
|
||||
|
||||
// For external key, force search on the friendlyname instead of the ID.
|
||||
// This should be addressed more globally with the bigger issue, see N°1970
|
||||
$oAttDef = MetaModel::GetAttributeDef($sClass, $sColumnAttr);
|
||||
if($oAttDef instanceof AttributeExternalKey)
|
||||
{
|
||||
$sColumnAttr .= '_friendlyname';
|
||||
}
|
||||
|
||||
$aSearchListItems[] = $sColumnAttr;
|
||||
}
|
||||
|
||||
$oFullBinExpr = null;
|
||||
|
||||
Reference in New Issue
Block a user