26if (!isset($usedbyinclude) || empty($usedbyinclude)) {
27 if (!defined(
'NOTOKENRENEWAL')) {
28 define(
'NOTOKENRENEWAL', 1);
30 if (!defined(
'NOREQUIREMENU')) {
31 define(
'NOREQUIREMENU',
'1');
33 if (!defined(
'NOREQUIREHTML')) {
34 define(
'NOREQUIREHTML',
'1');
36 if (!defined(
'NOREQUIREAJAX')) {
37 define(
'NOREQUIREAJAX',
'1');
39 if (!defined(
'NOREDIRECTBYMAINTOLOGIN')) {
41 define(
'NOREDIRECTBYMAINTOLOGIN',
'1');
44 $res = @include
'../../main.inc.php';
51 if ($res ==
'ERROR_NOT_LOGGED') {
52 $langs->load(
"other");
53 $arrayresult = array();
54 $arrayresult[
'jumptologin'] = array(
'img' =>
'object_generic',
'label' => $langs->trans(
"JumpToLogin"),
'text' =>
'<span class="fa fa-sign-in"></span> '.$langs->trans(
"JumpToLogin"),
'url' => DOL_URL_ROOT.
'/index.php');
55 print json_encode($arrayresult);
63include_once DOL_DOCUMENT_ROOT.
'/core/lib/json.lib.php';
65$hookmanager->initHooks(array(
'searchform'));
67$search_boxvalue =
GETPOST(
'q',
'restricthtml');
69$arrayresult = array();
73if (isModEnabled(
'member') && !
getDolGlobalString(
'MAIN_SEARCHFORM_ADHERENT_DISABLED') && $user->hasRight(
'adherent',
'lire')) {
74 $arrayresult[
'searchintomember'] = array(
'position' => 8,
'shortcut' =>
'M',
'img' =>
'object_member',
'label' => $langs->trans(
"SearchIntoMembers", $search_boxvalue),
'text' =>
img_picto(
'',
'object_member',
'class="pictofixedwidth"').
' '.$langs->trans(
"SearchIntoMembers", $search_boxvalue),
'url' => DOL_URL_ROOT.
'/adherents/list.php'.($search_boxvalue ?
'?search_all='.urlencode($search_boxvalue) :
''));
77if (((isModEnabled(
'societe') && (!
getDolGlobalString(
'SOCIETE_DISABLE_PROSPECTS') || !
getDolGlobalString(
'SOCIETE_DISABLE_CUSTOMERS'))) || isModEnabled(
'supplier_order') || isModEnabled(
'supplier_invoice') || isModEnabled(
'supplier_proposal')) && !
getDolGlobalString(
'MAIN_SEARCHFORM_SOCIETE_DISABLED') && $user->hasRight(
'societe',
'lire')) {
78 $arrayresult[
'searchintothirdparty'] = array(
'position' => 10,
'shortcut' =>
'T',
'img' =>
'object_company',
'label' => $langs->trans(
"SearchIntoThirdparties", $search_boxvalue),
'text' =>
img_picto(
'',
'object_company',
'class="pictofixedwidth"').
' '.$langs->trans(
"SearchIntoThirdparties", $search_boxvalue),
'url' => DOL_URL_ROOT.
'/societe/list.php'.($search_boxvalue ?
'?search_all='.urlencode($search_boxvalue) :
''));
81if (isModEnabled(
'societe') && !
getDolGlobalString(
'MAIN_SEARCHFORM_CONTACT_DISABLED') && $user->hasRight(
'societe',
'lire')) {
82 $arrayresult[
'searchintocontact'] = array(
'position' => 15,
'shortcut' =>
'A',
'img' =>
'object_contact',
'label' => $langs->trans(
"SearchIntoContacts", $search_boxvalue),
'text' =>
img_picto(
'',
'object_contact',
'class="pictofixedwidth"').
' '.$langs->trans(
"SearchIntoContacts", $search_boxvalue),
'url' => DOL_URL_ROOT.
'/contact/list.php'.($search_boxvalue ?
'?search_all='.urlencode($search_boxvalue) :
''));
85if (((isModEnabled(
'product') && $user->hasRight(
'product',
'read')) || (isModEnabled(
'service') && $user->hasRight(
'service',
'read'))) && !
getDolGlobalString(
'MAIN_SEARCHFORM_PRODUITSERVICE_DISABLED')) {
86 $arrayresult[
'searchintoproduct'] = array(
'position' => 30,
'shortcut' =>
'P',
'img' =>
'object_product',
'label' => $langs->trans(
"SearchIntoProductsOrServices", $search_boxvalue),
'text' =>
img_picto(
'',
'object_product',
'class="pictofixedwidth"').
' '.$langs->trans(
"SearchIntoProductsOrServices", $search_boxvalue),
'url' => DOL_URL_ROOT.
'/product/list.php'.($search_boxvalue ?
'?search_all='.urlencode($search_boxvalue) :
''));
88 if (isModEnabled(
'productbatch')) {
89 $arrayresult[
'searchintobatch'] = array(
'position' => 32,
'shortcut' =>
'B',
'img' =>
'object_lot',
'label' => $langs->trans(
"SearchIntoBatch", $search_boxvalue),
'text' =>
img_picto(
'',
'object_lot',
'class="pictofixedwidth"').
' '.$langs->trans(
"SearchIntoBatch", $search_boxvalue),
'url' => DOL_URL_ROOT.
'/product/stock/productlot_list.php'.($search_boxvalue ?
'?search_all='.urlencode($search_boxvalue) :
''));
93if (isModEnabled(
'mrp') && $user->hasRight(
'mrp',
'read') && !
getDolGlobalString(
'MAIN_SEARCHFORM_MRP_DISABLED')) {
94 $arrayresult[
'searchintomo'] = array(
'position' => 35,
'shortcut' =>
'',
'img' =>
'object_mrp',
'label' => $langs->trans(
"SearchIntoMO", $search_boxvalue),
'text' =>
img_picto(
'',
'object_mrp',
'class="pictofixedwidth"').
' '.$langs->trans(
"SearchIntoMO", $search_boxvalue),
'url' => DOL_URL_ROOT.
'/mrp/mo_list.php'.($search_boxvalue ?
'?search_all='.urlencode($search_boxvalue) :
''));
96if (isModEnabled(
'project') && !
getDolGlobalString(
'MAIN_SEARCHFORM_PROJECT_DISABLED') && $user->hasRight(
'projet',
'lire')) {
97 $arrayresult[
'searchintoprojects'] = array(
'position' => 40,
'shortcut' =>
'Q',
'img' =>
'object_project',
'label' => $langs->trans(
"SearchIntoProjects", $search_boxvalue),
'text' =>
img_picto(
'',
'object_project',
'class="pictofixedwidth"').
' '.$langs->trans(
"SearchIntoProjects", $search_boxvalue),
'url' => DOL_URL_ROOT.
'/projet/list.php'.($search_boxvalue ?
'?search_all='.urlencode($search_boxvalue) :
''));
100 $arrayresult[
'searchintotasks'] = array(
'position' => 45,
'img' =>
'object_projecttask',
'label' => $langs->trans(
"SearchIntoTasks", $search_boxvalue),
'text' =>
img_picto(
'',
'object_projecttask',
'class="pictofixedwidth"').
' '.$langs->trans(
"SearchIntoTasks", $search_boxvalue),
'url' => DOL_URL_ROOT.
'/projet/tasks/list.php'.($search_boxvalue ?
'?search_all='.urlencode($search_boxvalue) :
''));
103if (isModEnabled(
'propal') && !
getDolGlobalString(
'MAIN_SEARCHFORM_CUSTOMER_PROPAL_DISABLED') && $user->hasRight(
'propal',
'lire')) {
104 $arrayresult[
'searchintopropal'] = array(
'position' => 60,
'img' =>
'object_propal',
'label' => $langs->trans(
"SearchIntoCustomerProposals", $search_boxvalue),
'text' =>
img_picto(
'',
'object_propal',
'class="pictofixedwidth"').
' '.$langs->trans(
"SearchIntoCustomerProposals", $search_boxvalue),
'url' => DOL_URL_ROOT.
'/comm/propal/list.php'.($search_boxvalue ?
'?search_all='.urlencode($search_boxvalue) :
''));
106if (isModEnabled(
'order') && !
getDolGlobalString(
'MAIN_SEARCHFORM_CUSTOMER_ORDER_DISABLED') && $user->hasRight(
'commande',
'lire')) {
107 $arrayresult[
'searchintoorder'] = array(
'position' => 70,
'img' =>
'object_order',
'label' => $langs->trans(
"SearchIntoCustomerOrders", $search_boxvalue),
'text' =>
img_picto(
'',
'object_order',
'class="pictofixedwidth"').
' '.$langs->trans(
"SearchIntoCustomerOrders", $search_boxvalue),
'url' => DOL_URL_ROOT.
'/commande/list.php'.($search_boxvalue ?
'?search_all='.urlencode($search_boxvalue) :
''));
109if (isModEnabled(
'shipping') && !
getDolGlobalString(
'MAIN_SEARCHFORM_CUSTOMER_SHIPMENT_DISABLED') && $user->hasRight(
'expedition',
'lire')) {
110 $arrayresult[
'searchintoshipment'] = array(
'position' => 80,
'img' =>
'object_shipment',
'label' => $langs->trans(
"SearchIntoCustomerShipments", $search_boxvalue),
'text' =>
img_picto(
'',
'object_shipment',
'class="pictofixedwidth"').
' '.$langs->trans(
"SearchIntoCustomerShipments", $search_boxvalue),
'url' => DOL_URL_ROOT.
'/expedition/list.php'.($search_boxvalue ?
'?search_all='.urlencode($search_boxvalue) :
''));
112if (isModEnabled(
'invoice') && !
getDolGlobalString(
'MAIN_SEARCHFORM_CUSTOMER_INVOICE_DISABLED') && $user->hasRight(
'facture',
'lire')) {
113 $arrayresult[
'searchintoinvoice'] = array(
'position' => 90,
'img' =>
'object_bill',
'label' => $langs->trans(
"SearchIntoCustomerInvoices", $search_boxvalue),
'text' =>
img_picto(
'',
'object_bill',
'class="pictofixedwidth"').
' '.$langs->trans(
"SearchIntoCustomerInvoices", $search_boxvalue),
'url' => DOL_URL_ROOT.
'/compta/facture/list.php'.($search_boxvalue ?
'?search_all='.urlencode($search_boxvalue) :
''));
116if (isModEnabled(
'supplier_proposal') && !
getDolGlobalString(
'MAIN_SEARCHFORM_SUPPLIER_PROPAL_DISABLED') && $user->hasRight(
'supplier_proposal',
'lire')) {
117 $arrayresult[
'searchintosupplierpropal'] = array(
'position' => 100,
'img' =>
'object_supplier_proposal',
'label' => $langs->trans(
"SearchIntoSupplierProposals", $search_boxvalue),
'text' =>
img_picto(
'',
'object_supplier_proposal',
'class="pictofixedwidth"').
' '.$langs->trans(
"SearchIntoSupplierProposals", $search_boxvalue),
'url' => DOL_URL_ROOT.
'/supplier_proposal/list.php'.($search_boxvalue ?
'?search_all='.urlencode($search_boxvalue) :
''));
119if (((isModEnabled(
'fournisseur') && !
getDolGlobalString(
'MAIN_USE_NEW_SUPPLIERMOD') && $user->hasRight(
'fournisseur',
'commande',
'lire')) || (isModEnabled(
'supplier_order') && $user->hasRight(
'supplier_order',
'lire'))) && !
getDolGlobalString(
'MAIN_SEARCHFORM_SUPPLIER_ORDER_DISABLED')) {
120 $arrayresult[
'searchintosupplierorder'] = array(
'position' => 110,
'img' =>
'object_supplier_order',
'label' => $langs->trans(
"SearchIntoSupplierOrders", $search_boxvalue),
'text' =>
img_picto(
'',
'object_supplier_order',
'class="pictofixedwidth"').
' '.$langs->trans(
"SearchIntoSupplierOrders", $search_boxvalue),
'url' => DOL_URL_ROOT.
'/fourn/commande/list.php'.($search_boxvalue ?
'?search_all='.urlencode($search_boxvalue) :
''));
122if (isModEnabled(
'reception') && !
getDolGlobalString(
'MAIN_SEARCHFORM_SUPPLIER_RECEPTION_DISABLED') && $user->hasRight(
'reception',
'lire')) {
123 $arrayresult[
'searchintoreception'] = array(
'position'=>115,
'img'=>
'object_reception',
'label'=>$langs->trans(
"SearchIntoSupplierReceptions", $search_boxvalue),
'text'=>
img_picto(
'',
'object_reception',
'class="pictofixedwidth"').
' '.$langs->trans(
"SearchIntoSupplierReceptions", $search_boxvalue),
'url'=>DOL_URL_ROOT.
'/reception/list.php'.($search_boxvalue ?
'?search_all='.urlencode($search_boxvalue) :
''));
125if (((isModEnabled(
'fournisseur') && !
getDolGlobalString(
'MAIN_USE_NEW_SUPPLIERMOD') && $user->hasRight(
'fournisseur',
'facture',
'lire')) || (isModEnabled(
'supplier_invoice') && $user->hasRight(
'supplier_invoice',
'lire'))) && !
getDolGlobalString(
'MAIN_SEARCHFORM_SUPPLIER_INVOICE_DISABLED')) {
126 $arrayresult[
'searchintosupplierinvoice'] = array(
'position' => 120,
'img' =>
'object_supplier_invoice',
'label' => $langs->trans(
"SearchIntoSupplierInvoices", $search_boxvalue),
'text' =>
img_picto(
'',
'object_supplier_invoice',
'class="pictofixedwidth"').
' '.$langs->trans(
"SearchIntoSupplierInvoices", $search_boxvalue),
'url' => DOL_URL_ROOT.
'/fourn/facture/list.php'.($search_boxvalue ?
'?search_all='.urlencode($search_boxvalue) :
''));
130if (isModEnabled(
'invoice') && !
getDolGlobalString(
'MAIN_SEARCHFORM_CUSTOMER_INVOICE_DISABLED') && $user->hasRight(
'facture',
'lire')) {
131 $arrayresult[
'searchintocustomerpayments'] = array(
133 'img' =>
'object_payment',
134 'label' => $langs->trans(
"SearchIntoCustomerPayments", $search_boxvalue),
135 'text' =>
img_picto(
'',
'object_payment',
'class="pictofixedwidth"').
' '.$langs->trans(
"SearchIntoCustomerPayments", $search_boxvalue),
136 'url' => DOL_URL_ROOT.
'/compta/paiement/list.php?leftmenu=customers_bills_payment'.($search_boxvalue ?
'&search_all='.urlencode($search_boxvalue) :
''));
140if (((isModEnabled(
'fournisseur') && !
getDolGlobalString(
'MAIN_USE_NEW_SUPPLIERMOD') && $user->hasRight(
'fournisseur',
'facture',
'lire')) || (isModEnabled(
'supplier_invoice') && $user->hasRight(
'supplier_invoice',
'lire'))) && !
getDolGlobalString(
'MAIN_SEARCHFORM_SUPPLIER_INVOICE_DISABLED')) {
141 $arrayresult[
'searchintovendorpayments'] = array(
143 'img' =>
'object_payment',
144 'label' => $langs->trans(
"SearchIntoVendorPayments", $search_boxvalue),
145 'text' =>
img_picto(
'',
'object_payment',
'class="pictofixedwidth"').
' '.$langs->trans(
"SearchIntoVendorPayments", $search_boxvalue),
146 'url' => DOL_URL_ROOT.
'/fourn/paiement/list.php?leftmenu=suppliers_bills_payment'.($search_boxvalue ?
'&search_all='.urlencode($search_boxvalue) :
''));
150if (isModEnabled(
'bank') && !
getDolGlobalString(
'MAIN_SEARCHFORM_MISC_PAYMENTS_DISABLED') && $user->hasRight(
'banque',
'lire')) {
151 $arrayresult[
'searchintomiscpayments'] = array(
153 'img' =>
'object_payment',
154 'label' => $langs->trans(
"SearchIntoMiscPayments", $search_boxvalue),
155 'text' =>
img_picto(
'',
'object_payment',
'class="pictofixedwidth"').
' '.$langs->trans(
"SearchIntoMiscPayments", $search_boxvalue),
156 'url' => DOL_URL_ROOT.
'/compta/bank/various_payment/list.php?leftmenu=tax_various'.($search_boxvalue ?
'&search_all='.urlencode($search_boxvalue) :
''));
159if (isModEnabled(
'contract') && !
getDolGlobalString(
'MAIN_SEARCHFORM_CONTRACT_DISABLED') && $user->hasRight(
'contrat',
'lire')) {
160 $arrayresult[
'searchintocontract'] = array(
'position' => 130,
'img' =>
'object_contract',
'label' => $langs->trans(
"SearchIntoContracts", $search_boxvalue),
'text' =>
img_picto(
'',
'object_contract',
'class="pictofixedwidth"').
' '.$langs->trans(
"SearchIntoContracts", $search_boxvalue),
'url' => DOL_URL_ROOT.
'/contrat/list.php'.($search_boxvalue ?
'?search_all='.urlencode($search_boxvalue) :
''));
162if (isModEnabled(
'intervention') && !
getDolGlobalString(
'MAIN_SEARCHFORM_FICHINTER_DISABLED') && $user->hasRight(
'ficheinter',
'lire')) {
163 $arrayresult[
'searchintointervention'] = array(
'position' => 140,
'img' =>
'object_intervention',
'label' => $langs->trans(
"SearchIntoInterventions", $search_boxvalue),
'text' =>
img_picto(
'',
'object_intervention',
'class="pictofixedwidth"').
' '.$langs->trans(
"SearchIntoInterventions", $search_boxvalue),
'url' => DOL_URL_ROOT.
'/fichinter/list.php'.($search_boxvalue ?
'?search_all='.urlencode($search_boxvalue) :
''));
165if (isModEnabled(
'knowledgemanagement') && !
getDolGlobalString(
'MAIN_SEARCHFORM_KNOWLEDGEMANAGEMENT_DISABLED') && $user->hasRight(
'knowledgemanagement',
'knowledgerecord',
'read')) {
166 $arrayresult[
'searchintoknowledgemanagement'] = array(
'position' => 145,
'img' =>
'object_knowledgemanagement',
'label' => $langs->trans(
"SearchIntoKM", $search_boxvalue),
'text' =>
img_picto(
'',
'object_knowledgemanagement',
'class="pictofixedwidth"').
' '.$langs->trans(
"SearchIntoKM", $search_boxvalue),
'url' => DOL_URL_ROOT.
'/knowledgemanagement/knowledgerecord_list.php?mainmenu=ticket'.($search_boxvalue ?
'&search_all='.urlencode($search_boxvalue) :
''));
168if (isModEnabled(
'ticket') && !
getDolGlobalString(
'MAIN_SEARCHFORM_TICKET_DISABLED') && $user->hasRight(
'ticket',
'read')) {
169 $arrayresult[
'searchintotickets'] = array(
'position' => 146,
'img' =>
'object_ticket',
'label' => $langs->trans(
"SearchIntoTickets", $search_boxvalue),
'text' =>
img_picto(
'',
'object_ticket',
'class="pictofixedwidth"').
' '.$langs->trans(
"SearchIntoTickets", $search_boxvalue),
'url' => DOL_URL_ROOT.
'/ticket/list.php?mainmenu=ticket'.($search_boxvalue ?
'&search_all='.urlencode($search_boxvalue) :
''));
173if (isModEnabled(
'user') && !
getDolGlobalString(
'MAIN_SEARCHFORM_USER_DISABLED') && $user->hasRight(
'user',
'user',
'lire')) {
174 $arrayresult[
'searchintouser'] = array(
'position' => 200,
'shortcut' =>
'U',
'img' =>
'object_user',
'label' => $langs->trans(
"SearchIntoUsers", $search_boxvalue),
'text' =>
img_picto(
'',
'object_user',
'class="pictofixedwidth"').
' '.$langs->trans(
"SearchIntoUsers", $search_boxvalue),
'url' => DOL_URL_ROOT.
'/user/list.php'.($search_boxvalue ?
'?search_all='.urlencode($search_boxvalue) :
''));
176if (isModEnabled(
'expensereport') && !
getDolGlobalString(
'MAIN_SEARCHFORM_EXPENSEREPORT_DISABLED') && $user->hasRight(
'expensereport',
'lire')) {
177 $arrayresult[
'searchintoexpensereport'] = array(
'position' => 210,
'img' =>
'object_trip',
'label' => $langs->trans(
"SearchIntoExpenseReports", $search_boxvalue),
'text' =>
img_picto(
'',
'object_trip',
'class="pictofixedwidth"').
' '.$langs->trans(
"SearchIntoExpenseReports", $search_boxvalue),
'url' => DOL_URL_ROOT.
'/expensereport/list.php?mainmenu=hrm'.($search_boxvalue ?
'&search_all='.urlencode($search_boxvalue) :
''));
179if (isModEnabled(
'holiday') && !
getDolGlobalString(
'MAIN_SEARCHFORM_HOLIDAY_DISABLED') && $user->hasRight(
'holiday',
'read')) {
180 $arrayresult[
'searchintoleaves'] = array(
'position' => 220,
'img' =>
'object_holiday',
'label' => $langs->trans(
"SearchIntoLeaves", $search_boxvalue),
'text' =>
img_picto(
'',
'object_holiday',
'class="pictofixedwidth"').
' '.$langs->trans(
"SearchIntoLeaves", $search_boxvalue),
'url' => DOL_URL_ROOT.
'/holiday/list.php?mainmenu=hrm'.($search_boxvalue ?
'&search_all='.urlencode($search_boxvalue) :
''));
184$parameters = array(
'search_boxvalue' => $search_boxvalue,
'arrayresult' => $arrayresult);
185$reshook = $hookmanager->executeHooks(
'addSearchEntry', $parameters);
186if (empty($reshook)) {
187 $arrayresult = array_merge($arrayresult, $hookmanager->resArray);
189 $arrayresult = $hookmanager->resArray;
195 if (array_key_exists($key, $arrayresult)) {
196 $arrayresult[$key][
'position'] = -1000;
204if (!isset($usedbyinclude) || empty($usedbyinclude)) {
205 print json_encode($arrayresult);
206 if (is_object($db)) {
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
dol_sort_array(&$array, $index, $order='asc', $natsort=0, $case_sensitive=0, $keepindex=0)
Advanced sort array by the value of a given key, which produces ascending (default) or descending out...
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
if(!defined( 'NOREQUIREMENU')) if(!empty(GETPOST('seteventmessages', 'alpha'))) if(!function_exists("llxHeader")) top_httphead($contenttype='text/html', $forcenocache=0)
Show HTTP header.