From 5d4c959d2eadd3f1c18e44f4f14f355623b91efb Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Thu, 31 Mar 2016 12:18:26 +0200 Subject: [PATCH 1/2] Add hook parameters on New search Box --- htdocs/core/ajax/selectsearchbox.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/ajax/selectsearchbox.php b/htdocs/core/ajax/selectsearchbox.php index 6c91974b4a4..1bb2aa47003 100644 --- a/htdocs/core/ajax/selectsearchbox.php +++ b/htdocs/core/ajax/selectsearchbox.php @@ -113,7 +113,7 @@ if (! empty($conf->expensereport->enabled) && empty($conf->global->MAIN_SEARCHFO } -/* Do we really need this. We already have a select for users, and we should be able to filter into user list on employee flag +/* Do we really need this. We already have a select for users, and we should be able to filter into user list on employee flag if (! empty($conf->hrm->enabled) && ! empty($conf->global->MAIN_SEARCHFORM_EMPLOYEE) && $user->rights->hrm->employee->read) { $langs->load("hrm"); @@ -122,7 +122,7 @@ if (! empty($conf->hrm->enabled) && ! empty($conf->global->MAIN_SEARCHFORM_EMPLO */ // Execute hook addSearchEntry -$parameters=array(); +$parameters=array('search_boxvalue'=>$search_boxvalue); $reshook=$hookmanager->executeHooks('addSearchEntry',$parameters); if (empty($reshook)) { From f567a2a0ce3fb46c2e3b97ce451023c0938a233e Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Thu, 31 Mar 2016 12:50:40 +0200 Subject: [PATCH 2/2] Search box hook --- htdocs/core/ajax/selectsearchbox.php | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/htdocs/core/ajax/selectsearchbox.php b/htdocs/core/ajax/selectsearchbox.php index 1bb2aa47003..a5f9edde28e 100644 --- a/htdocs/core/ajax/selectsearchbox.php +++ b/htdocs/core/ajax/selectsearchbox.php @@ -34,6 +34,8 @@ if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1'); $res=@include '../../main.inc.php'; include_once DOL_DOCUMENT_ROOT.'/core/lib/json.lib.php'; +//global $hookmanager; +$hookmanager->initHooks(array('searchform')); $search_boxvalue=GETPOST('q'); @@ -120,7 +122,6 @@ if (! empty($conf->hrm->enabled) && ! empty($conf->global->MAIN_SEARCHFORM_EMPLO $searchform.=printSearchForm(DOL_URL_ROOT.'/hrm/employee/list.php', DOL_URL_ROOT.'/hrm/employee/list.php', $langs->trans("Employees"), 'employee', 'search_all', 'M', 'searchleftemployee', img_object('','user')); } */ - // Execute hook addSearchEntry $parameters=array('search_boxvalue'=>$search_boxvalue); $reshook=$hookmanager->executeHooks('addSearchEntry',$parameters); @@ -131,13 +132,6 @@ if (empty($reshook)) else $arrayresult=$hookmanager->resArray; - - - - - - - print json_encode($arrayresult); if (is_object($db)) $db->close();