From 6e9fab849c2666bfdc55f05828ee4632badb640f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eric=20Espi=C3=A9?= Date: Thu, 29 Mar 2018 09:18:40 +0000 Subject: [PATCH] Advanced Search: add target_class for the external keys SVN:b1162[5569] --- .../application/search/searchform.class.inc.php | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/sources/application/search/searchform.class.inc.php b/sources/application/search/searchform.class.inc.php index e2d23790f2..2cf17be9a8 100644 --- a/sources/application/search/searchform.class.inc.php +++ b/sources/application/search/searchform.class.inc.php @@ -323,7 +323,7 @@ class SearchForm $oSet = new DBObjectSet($oSearch); if ($oSet->Count() > MetaModel::GetConfig()->Get('max_combo_length')) { - return array('autocomplete' => true); + return array('autocomplete' => true, 'target_class' => $sTargetClass); } } else @@ -333,7 +333,17 @@ class SearchForm $oSet = $oAttrDef->GetAllowedValuesAsObjectSet(); 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); } } }