mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-24 11:08:45 +02:00
Advanced Search: add target_class for the external keys
SVN:b1162[5570]
This commit is contained in:
@@ -323,7 +323,7 @@ class SearchForm
|
|||||||
$oSet = new DBObjectSet($oSearch);
|
$oSet = new DBObjectSet($oSearch);
|
||||||
if ($oSet->Count() > MetaModel::GetConfig()->Get('max_combo_length'))
|
if ($oSet->Count() > MetaModel::GetConfig()->Get('max_combo_length'))
|
||||||
{
|
{
|
||||||
return array('autocomplete' => true, 'target_class' => $sTargetClass);
|
return array('autocomplete' => true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -333,17 +333,7 @@ class SearchForm
|
|||||||
$oSet = $oAttrDef->GetAllowedValuesAsObjectSet();
|
$oSet = $oAttrDef->GetAllowedValuesAsObjectSet();
|
||||||
if ($oSet->Count() > MetaModel::GetConfig()->Get('max_combo_length'))
|
if ($oSet->Count() > MetaModel::GetConfig()->Get('max_combo_length'))
|
||||||
{
|
{
|
||||||
|
return array('autocomplete' => true);
|
||||||
if (method_exists($oAttrDef, 'GetTargetClass'))
|
|
||||||
{
|
|
||||||
$sTargetClass = $oAttrDef->GetTargetClass();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$sTargetClass = $oAttrDef->GetHostClass();
|
|
||||||
}
|
|
||||||
|
|
||||||
return array('autocomplete' => true, 'target_class' => $sTargetClass);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -429,10 +419,20 @@ class SearchForm
|
|||||||
{
|
{
|
||||||
$sLabel = $oAttDef->GetLabel();
|
$sLabel = $oAttDef->GetLabel();
|
||||||
|
|
||||||
|
if (method_exists($oAttDef, 'GetTargetClass'))
|
||||||
|
{
|
||||||
|
$sTargetClass = $oAttDef->GetTargetClass();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$sTargetClass = $oAttDef->GetHostClass();
|
||||||
|
}
|
||||||
|
|
||||||
$aField = array();
|
$aField = array();
|
||||||
$aField['code'] = $sFilterCode;
|
$aField['code'] = $sFilterCode;
|
||||||
$aField['class'] = $sClass;
|
$aField['class'] = $sClass;
|
||||||
$aField['class_alias'] = $sClassAlias;
|
$aField['class_alias'] = $sClassAlias;
|
||||||
|
$aField['target_class'] = $sTargetClass;
|
||||||
$aField['label'] = $sLabel;
|
$aField['label'] = $sLabel;
|
||||||
$aField['widget'] = $oAttDef->GetSearchType();
|
$aField['widget'] = $oAttDef->GetSearchType();
|
||||||
$aField['allowed_values'] = self::GetFieldAllowedValues($oAttDef);
|
$aField['allowed_values'] = self::GetFieldAllowedValues($oAttDef);
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ class SearchFormTest extends ItopDataTestCase
|
|||||||
{
|
{
|
||||||
return array(
|
return array(
|
||||||
array("SELECT Contact", 8, 'zlist'),
|
array("SELECT Contact", 8, 'zlist'),
|
||||||
array("SELECT Contact AS C WHERE C.status = 'active'", 5, 'others'),
|
array("SELECT Contact AS C WHERE C.status = 'active'", 2, 'others'),
|
||||||
array("SELECT Person", 12, 'zlist'),
|
array("SELECT Person", 12, 'zlist'),
|
||||||
array(
|
array(
|
||||||
"SELECT Person AS p JOIN UserRequest AS u ON u.agent_id = p.id WHERE u.status != 'closed'",
|
"SELECT Person AS p JOIN UserRequest AS u ON u.agent_id = p.id WHERE u.status != 'closed'",
|
||||||
|
|||||||
Reference in New Issue
Block a user