diff --git a/pages/UI.php b/pages/UI.php index 12c356f75..39d272832 100644 --- a/pages/UI.php +++ b/pages/UI.php @@ -465,50 +465,46 @@ try /////////////////////////////////////////////////////////////////////////////////////////// case 'search_oql': // OQL query + $oSearchContext = new ContextTag(ContextTag::TAG_OBJECT_SEARCH); $sOQLClass = utils::ReadParam('oql_class', '', false, 'class'); $sBaseClass = utils::ReadParam('base_class', $sOQLClass, false, 'class'); $sOQLClause = utils::ReadParam('oql_clause', '', false, 'raw_data'); $sFormat = utils::ReadParam('format', ''); $bSearchForm = utils::ReadParam('search_form', true); $sTitle = utils::ReadParam('title', 'UI:SearchResultsPageTitle'); - if (empty($sOQLClass)) - { + if (empty($sOQLClass)) { throw new ApplicationException(Dict::Format('UI:Error:1ParametersMissing', 'oql_class')); } $oP->set_title(Dict::S($sTitle)); $oP->add('

'.Dict::S($sTitle).'

'); $sOQL = "SELECT $sOQLClass $sOQLClause"; - try - { + try { $oFilter = DBObjectSearch::FromOQL($sOQL); DisplaySearchSet($oP, $oFilter, $bSearchForm, $sBaseClass, $sFormat); } - catch(CoreException $e) - { + catch(CoreException $e) { $oFilter = new DBObjectSearch($sOQLClass); $oSet = new DBObjectSet($oFilter); - if ($bSearchForm) - { + if ($bSearchForm) { $oBlock = new DisplayBlock($oFilter, 'search', false); $oBlock->Display($oP, 0, array('table_id' => 'search-widget-result-outer')); } $oP->add('

'.Dict::Format('UI:Error:IncorrectOQLQuery_Message', $e->getHtmlDesc()).'

'); } - catch(Exception $e) - { + catch(Exception $e) { $oP->P(''.Dict::Format('UI:Error:AnErrorOccuredWhileRunningTheQuery_Message', $e->getMessage()).''); } - break; + break; /////////////////////////////////////////////////////////////////////////////////////////// case 'search_form': // Search form + $oSearchContext = new ContextTag(ContextTag::TAG_OBJECT_SEARCH); $sClass = utils::ReadParam('class', '', false, 'class'); $sFormat = utils::ReadParam('format', 'html'); $bSearchForm = utils::ReadParam('search_form', true); $bDoSearch = utils::ReadParam('do_search', true); - if (empty($sClass)) - { + if (empty($sClass)) { throw new ApplicationException(Dict::Format('UI:Error:1ParametersMissing', 'class')); } $oP->set_title(Dict::S('UI:SearchResultsPageTitle')); diff --git a/pages/tagadmin.php b/pages/tagadmin.php index 751b551c4..ed2171a6b 100644 --- a/pages/tagadmin.php +++ b/pages/tagadmin.php @@ -98,6 +98,8 @@ try if (!empty($oFilter)) { + $oSearchContext = new ContextTag(ContextTag::TAG_OBJECT_SEARCH); + $oSet = new CMDBObjectSet($oFilter); $oBlock = new DisplayBlock($oFilter, 'search', false); $aExtraParams = $oAppContext->GetAsHash();