浏览代码

Uniformize code with the new module builder framework

Laurent Destailleur 7 年之前
父节点
当前提交
43f8834b28
共有 44 个文件被更改,包括 108 次插入138 次删除
  1. 1 2
      htdocs/accountancy/admin/account.php
  2. 1 0
      htdocs/adherents/list.php
  3. 1 3
      htdocs/admin/accountant.php
  4. 2 2
      htdocs/admin/company.php
  5. 1 3
      htdocs/admin/ihm.php
  6. 2 2
      htdocs/comm/action/list.php
  7. 2 3
      htdocs/comm/propal/list.php
  8. 3 4
      htdocs/commande/list.php
  9. 1 4
      htdocs/compta/bank/bankentries_list.php
  10. 5 4
      htdocs/compta/bank/list.php
  11. 2 3
      htdocs/compta/facture/list.php
  12. 2 1
      htdocs/contact/list.php
  13. 3 4
      htdocs/contrat/list.php
  14. 3 3
      htdocs/contrat/services_list.php
  15. 5 4
      htdocs/core/tpl/extrafields_list_search_title.tpl.php
  16. 2 3
      htdocs/expedition/list.php
  17. 2 3
      htdocs/expensereport/list.php
  18. 3 4
      htdocs/fichinter/list.php
  19. 3 4
      htdocs/fourn/commande/list.php
  20. 3 6
      htdocs/fourn/facture/list.php
  21. 2 4
      htdocs/holiday/define_holiday.php
  22. 2 2
      htdocs/product/fournisseurs.php
  23. 1 1
      htdocs/product/list.php
  24. 8 9
      htdocs/product/stock/mouvement.php
  25. 1 1
      htdocs/product/stock/productlot_list.php
  26. 3 6
      htdocs/projet/list.php
  27. 2 3
      htdocs/projet/tasks/list.php
  28. 1 0
      htdocs/projet/tasks/time.php
  29. 4 4
      htdocs/resource/list.php
  30. 3 7
      htdocs/societe/list.php
  31. 1 4
      htdocs/societe/website.php
  32. 2 3
      htdocs/supplier_proposal/list.php
  33. 3 5
      htdocs/ticketsup/list.php
  34. 2 2
      htdocs/user/agenda_extsites.php
  35. 3 3
      htdocs/user/card.php
  36. 2 3
      htdocs/user/document.php
  37. 4 2
      htdocs/user/group/card.php
  38. 2 3
      htdocs/user/group/perms.php
  39. 3 2
      htdocs/user/home.php
  40. 4 4
      htdocs/user/index.php
  41. 2 2
      htdocs/user/ldap.php
  42. 2 2
      htdocs/user/note.php
  43. 2 2
      htdocs/user/param_ihm.php
  44. 2 2
      htdocs/user/perms.php

+ 1 - 2
htdocs/accountancy/admin/account.php

@@ -40,6 +40,7 @@ $action = GETPOST('action','aZ09');
 $cancel = GETPOST('cancel','alpha');
 $id = GETPOST('id', 'int');
 $rowid = GETPOST('rowid', 'int');
+$contextpage=GETPOST('contextpage','aZ')?GETPOST('contextpage','aZ'):'accountingaccountlist';   // To manage different context of search
 
 $search_account = GETPOST("search_account");
 $search_label = GETPOST("search_label");
@@ -74,8 +75,6 @@ $arrayfields=array(
 
 $accounting = new AccountingAccount($db);
 
-// Initialize technical object to manage context to save list fields
-$contextpage=GETPOST('contextpage','aZ')?GETPOST('contextpage','aZ'):'accountingaccountlist';
 
 
 /*

+ 1 - 0
htdocs/adherents/list.php

@@ -79,6 +79,7 @@ if (! $sortorder) { $sortorder=($filter=='outofdate'?"DESC":"ASC"); }
 if (! $sortfield) { $sortfield=($filter=='outofdate'?"d.datefin":"d.lastname"); }
 
 // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
+$object = new Adherent($db);
 $hookmanager->initHooks(array('memberlist'));
 $extrafields = new ExtraFields($db);
 

+ 1 - 3
htdocs/admin/accountant.php

@@ -29,6 +29,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
 require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
 
 $action=GETPOST('action','aZ09');
+$contextpage=GETPOST('contextpage','aZ')?GETPOST('contextpage','aZ'):'adminaccoutant';   // To manage different context of search
 
 $langs->load("admin");
 $langs->load("companies");
@@ -37,9 +38,6 @@ if (! $user->admin) accessforbidden();
 
 $error=0;
 
-// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
-$contextpage=array('adminaccoutant','globaladmin');
-$hookmanager->initHooks($contextpage);
 
 /*
  * Actions

+ 2 - 2
htdocs/admin/company.php

@@ -38,6 +38,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
 require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
 
 $action=GETPOST('action','aZ09');
+$contextpage=GETPOST('contextpage','aZ')?GETPOST('contextpage','aZ'):'admincompany';   // To manage different context of search
 
 $langs->load("admin");
 $langs->load("companies");
@@ -47,8 +48,7 @@ if (! $user->admin) accessforbidden();
 $error=0;
 
 // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
-$contextpage=array('admincompany','globaladmin');
-$hookmanager->initHooks($contextpage);
+$hookmanager->initHooks(array('admincompany','globaladmin'));
 
 /*
  * Actions

+ 1 - 3
htdocs/admin/ihm.php

@@ -46,12 +46,10 @@ $langs->load("agenda");
 if (! $user->admin) accessforbidden();
 
 $action = GETPOST('action','aZ09');
+$contextpage=GETPOST('contextpage','aZ')?GETPOST('contextpage','aZ'):'adminihm';   // To manage different context of search
 
 if (! defined("MAIN_MOTD")) define("MAIN_MOTD","");
 
-// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
-$contextpage=array('adminihm','globaladmin');
-$hookmanager->initHooks($contextpage);
 
 
 /*

+ 2 - 2
htdocs/comm/action/list.php

@@ -35,6 +35,7 @@ include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php';
 $langs->loadLangs(array("users","companies","agenda","commercial"));
 
 $action=GETPOST('action','alpha');
+$contextpage=GETPOST('contextpage','aZ')?GETPOST('contextpage','aZ'):'actioncommlist';   // To manage different context of search
 $resourceid=GETPOST("resourceid","int");
 $year=GETPOST("year",'int');
 $month=GETPOST("month",'int');
@@ -68,8 +69,6 @@ $filtert = GETPOST("filtert","int",3);
 $usergroup = GETPOST("usergroup","int",3);
 $showbirthday = empty($conf->use_javascript_ajax)?GETPOST("showbirthday","int"):1;
 
-$contextpage='actioncommlist';
-
 $extrafields = new ExtraFields($db);
 // fetch optionals attributes and labels
 $extralabels = $extrafields->fetch_name_optionals_label('actioncomm');
@@ -114,6 +113,7 @@ if (! $user->rights->agenda->allactions->read || $filter=='mine')	// If no permi
 }
 
 // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
+$object = new ActionComm($db);
 $hookmanager->initHooks(array('agendalist'));
 
 $arrayfields=array(

+ 2 - 3
htdocs/comm/propal/list.php

@@ -53,6 +53,7 @@ $massaction=GETPOST('massaction','alpha');
 $show_files=GETPOST('show_files','int');
 $confirm=GETPOST('confirm','alpha');
 $toselect = GETPOST('toselect', 'array');
+$contextpage=GETPOST('contextpage','aZ')?GETPOST('contextpage','aZ'):'proposallist';
 
 $search_user=GETPOST('search_user','int');
 $search_sale=GETPOST('search_sale','int');
@@ -95,9 +96,6 @@ $pagenext = $page + 1;
 if (! $sortfield) $sortfield='p.ref';
 if (! $sortorder) $sortorder='DESC';
 
-// Initialize technical object to manage context to save list fields
-$contextpage=GETPOST('contextpage','aZ')?GETPOST('contextpage','aZ'):'proposallist';
-
 // Security check
 $module='propal';
 $dbtable='';
@@ -114,6 +112,7 @@ $result = restrictedArea($user, $module, $objectid, $dbtable);
 $diroutputmassaction=$conf->propal->multidir_output[$conf->entity] . '/temp/massgeneration/'.$user->id;
 
 // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
+$object = new Propal($db);
 $hookmanager->initHooks(array('propallist'));
 $extrafields = new ExtraFields($db);
 

+ 3 - 4
htdocs/commande/list.php

@@ -51,6 +51,7 @@ $massaction=GETPOST('massaction','alpha');
 $show_files=GETPOST('show_files','int');
 $confirm=GETPOST('confirm','alpha');
 $toselect = GETPOST('toselect', 'array');
+$contextpage=GETPOST('contextpage','aZ')?GETPOST('contextpage','aZ'):'orderlist';
 
 $search_orderyear=GETPOST("search_orderyear","int");
 $search_ordermonth=GETPOST("search_ordermonth","int");
@@ -95,11 +96,9 @@ $pagenext = $page + 1;
 if (! $sortfield) $sortfield='c.ref';
 if (! $sortorder) $sortorder='DESC';
 
-// Initialize technical object to manage context to save list fields
-$contextpage=GETPOST('contextpage','aZ')?GETPOST('contextpage','aZ'):'orderlist';
-
 // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
-$hookmanager->initHooks(array($contextpage));
+$object = new Commande($db);
+$hookmanager->initHooks(array('orderlist'));
 $extrafields = new ExtraFields($db);
 
 // fetch optionals attributes and labels

+ 1 - 4
htdocs/compta/bank/bankentries_list.php

@@ -54,6 +54,7 @@ $ref = GETPOST('ref','alpha');
 $action=GETPOST('action','alpha');
 $cancel=GETPOST('cancel','alpha');
 $confirm=GETPOST('confirm','alpha');
+$contextpage='banktransactionlist'.(empty($object->ref)?'':'-'.$object->id);
 
 // Security check
 $fieldvalue = (! empty($id) ? $id : (! empty($ref) ? $ref :''));
@@ -120,10 +121,6 @@ if ($id > 0 || ! empty($ref))
 }
 
 
-// Initialize technical object to manage context to save list fields
-$contextpage='banktransactionlist'.(empty($object->ref)?'':'-'.$object->id);
-//var_dump($contextpage);
-
 // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
 $hookmanager->initHooks(array('banktransactionlist', $contextpage));
 $extrafields = new ExtraFields($db);

+ 5 - 4
htdocs/compta/bank/list.php

@@ -1,4 +1,6 @@
 <?php
+use Stripe\BankAccount;
+
 /* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
  * Copyright (C) 2004-2016 Laurent Destailleur  <eldy@users.sourceforge.net>
  * Copyright (C) 2005-2012 Regis Houssin        <regis.houssin@capnetworks.com>
@@ -42,6 +44,7 @@ $massaction=GETPOST('massaction','alpha');
 $show_files=GETPOST('show_files','int');
 $confirm=GETPOST('confirm','alpha');
 $toselect = GETPOST('toselect', 'array');
+$contextpage= GETPOST('contextpage','aZ')?GETPOST('contextpage','aZ'):'bankaccountlist';   // To manage different context of search
 
 $search_ref=GETPOST('search_ref','alpha');
 $search_label=GETPOST('search_label','alpha');
@@ -66,11 +69,9 @@ $pagenext = $page + 1;
 if (! $sortfield) $sortfield='b.label';
 if (! $sortorder) $sortorder='ASC';
 
-// Initialize technical object to manage context to save list fields
-$contextpage='bankaccountlist';
-
 // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
-$hookmanager->initHooks(array($contextpage));
+$object = new Account($db);
+$hookmanager->initHooks(array('bankaccountlist'));
 $extrafields = new ExtraFields($db);
 
 // fetch optionals attributes and labels

+ 2 - 3
htdocs/compta/facture/list.php

@@ -66,6 +66,7 @@ $massaction=GETPOST('massaction','alpha');
 $show_files=GETPOST('show_files','int');
 $confirm=GETPOST('confirm','alpha');
 $toselect = GETPOST('toselect', 'array');
+$contextpage=GETPOST('contextpage','aZ')?GETPOST('contextpage','aZ'):'invoicelist';
 
 $lineid=GETPOST('lineid','int');
 $userid=GETPOST('userid','int');
@@ -114,9 +115,6 @@ if (! $sortfield) $sortfield='f.datef';
 $pageprev = $page - 1;
 $pagenext = $page + 1;
 
-// Initialize technical object to manage context to save list fields
-$contextpage=GETPOST('contextpage','aZ')?GETPOST('contextpage','aZ'):'invoicelist';
-
 // Security check
 $fieldid = (! empty($ref)?'facnumber':'rowid');
 if (! empty($user->societe_id)) $socid=$user->societe_id;
@@ -129,6 +127,7 @@ $object=new Facture($db);
 $now=dol_now();
 
 // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
+$object = new Facture($db);
 $hookmanager->initHooks(array('invoicelist'));
 $extrafields = new ExtraFields($db);
 

+ 2 - 1
htdocs/contact/list.php

@@ -121,7 +121,8 @@ else if ($type == "o")
 }
 
 // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
-$hookmanager->initHooks(array($contextpage));
+$object = new Contact($db);
+$hookmanager->initHooks(array('contactlist'));
 $extrafields = new ExtraFields($db);
 
 // fetch optionals attributes and labels

+ 3 - 4
htdocs/contrat/list.php

@@ -45,6 +45,7 @@ $massaction=GETPOST('massaction','alpha');
 $show_files=GETPOST('show_files','int');
 $confirm=GETPOST('confirm','alpha');
 $toselect = GETPOST('toselect', 'array');
+$contextpage= GETPOST('contextpage','aZ')?GETPOST('contextpage','aZ'):'contractlist';   // To manage different context of search
 
 $search_name=GETPOST('search_name');
 $search_email=GETPOST('search_email');
@@ -95,10 +96,8 @@ $staticcontratligne=new ContratLigne($db);
 if ($search_status == '') $search_status=1;
 
 // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
-$contextpage='contractlist';
-
-// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
-$hookmanager->initHooks(array($contextpage));
+$object = new Contrat($db);
+$hookmanager->initHooks(array('contractlist'));
 $extrafields = new ExtraFields($db);
 
 // fetch optionals attributes and labels

+ 3 - 3
htdocs/contrat/services_list.php

@@ -53,6 +53,7 @@ $search_status=GETPOST("search_status","alpha");
 $statut=GETPOST('statut')?GETPOST('statut'):1;
 $search_product_category=GETPOST('search_product_category','int');
 $socid=GETPOST('socid','int');
+$contextpage=GETPOST('contextpage','aZ')?GETPOST('contextpage','aZ'):'contractservicelist'.$mode;
 
 $opouvertureprevuemonth=GETPOST('opouvertureprevuemonth');
 $opouvertureprevueday=GETPOST('opouvertureprevueday');
@@ -74,11 +75,10 @@ $opclotureday=GETPOST('opclotureday');
 $opclotureyear=GETPOST('opclotureyear');
 $filter_opcloture=GETPOST('filter_opcloture');
 
-// Initialize context for list
-$contextpage=GETPOST('contextpage','aZ')?GETPOST('contextpage','aZ'):'contractservicelist'.$mode;
 
 // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
-$hookmanager->initHooks(array($contextpage));
+$object = new ContratLigne($db);
+$hookmanager->initHooks(array('contractservicelist'));
 $extrafields = new ExtraFields($db);
 
 // fetch optionals attributes and labels

+ 5 - 4
htdocs/core/tpl/extrafields_list_search_title.tpl.php

@@ -8,16 +8,17 @@ if (empty($conf) || ! is_object($conf))
 }
 
 // Loop to show all columns of extrafields for the title line
-if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
+if (is_array($extrafields->attributes[$object->element]['label']) && count($extrafields->attributes[$object->element]['label']))
 {
-	foreach($extrafields->attribute_label as $key => $val)
+	foreach($extrafields->attributes[$object->element]['label'] as $key => $val)
 	{
 		if (! empty($arrayfields["ef.".$key]['checked']))
 		{
 			$align=$extrafields->getAlignFlag($key);
 			$sortonfield = "ef.".$key;
-			if (! empty($extrafields->attribute_computed[$key])) $sortonfield='';
-			print getTitleFieldOfList($langs->trans($extralabels[$key]), 0, $_SERVER["PHP_SELF"], $sortonfield, "", $param, ($align?'align="'.$align.'"':''), $sortfield, $sortorder)."\n";
+			if (! empty($extrafields->attributes[$object->element]['computed'][$key])) $sortonfield='';
+			if ($extrafields->attributes[$object->element]['type'][$key] == 'separate') print '<th class="liste_titre thseparator"></th>';
+			else print getTitleFieldOfList($langs->trans($extralabels[$key]), 0, $_SERVER["PHP_SELF"], $sortonfield, "", $param, ($align?'align="'.$align.'"':''), $sortfield, $sortorder)."\n";
 		}
 	}
 }

+ 2 - 3
htdocs/expedition/list.php

@@ -32,6 +32,8 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
 
 $langs->loadLangs(array("sendings","deliveries",'companies','bills'));
 
+$contextpage= GETPOST('contextpage','aZ')?GETPOST('contextpage','aZ'):'shipmentlist';   // To manage different context of search
+
 $socid=GETPOST('socid','int');
 // Security check
 $expeditionid = GETPOST('id','int');
@@ -64,9 +66,6 @@ $offset = $limit * $page;
 $pageprev = $page - 1;
 $pagenext = $page + 1;
 
-// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
-$contextpage='shipmentlist';
-
 $viewstatut=GETPOST('viewstatut');
 
 // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context

+ 2 - 3
htdocs/expensereport/list.php

@@ -43,6 +43,7 @@ $massaction=GETPOST('massaction','alpha');
 $show_files=GETPOST('show_files','int');
 $confirm=GETPOST('confirm','alpha');
 $toselect = GETPOST('toselect', 'array');
+$contextpage=GETPOST('contextpage','aZ')?GETPOST('contextpage','aZ'):'expensereportlist';
 
 // Security check
 $socid = GETPOST('socid','int');
@@ -82,10 +83,8 @@ $optioncss    = GETPOST('optioncss','alpha');
 if ($search_status == '') $search_status=-1;
 if ($search_user == '') $search_user=-1;
 
-// Initialize technical object to manage context to save list fields
-$contextpage=GETPOST('contextpage','aZ')?GETPOST('contextpage','aZ'):'expensereportlist';
-
 // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
+$object = new ExpenseReport($db);
 $hookmanager->initHooks(array('expensereportlist'));
 $extrafields = new ExtraFields($db);
 

+ 3 - 4
htdocs/fichinter/list.php

@@ -41,6 +41,7 @@ $massaction=GETPOST('massaction','alpha');
 $show_files=GETPOST('show_files','int');
 $confirm=GETPOST('confirm','alpha');
 $toselect = GETPOST('toselect', 'array');
+$contextpage=GETPOST('contextpage','aZ')?GETPOST('contextpage','aZ'):'interventionlist';
 
 $search_ref=GETPOST('search_ref')?GETPOST('search_ref','alpha'):GETPOST('search_inter','alpha');
 $search_company=GETPOST('search_company','alpha');
@@ -72,9 +73,6 @@ if (! $sortfield)
  	else $sortfield="f.ref";
 }
 
-// Initialize technical object to manage context to save list fields
-$contextpage=GETPOST('contextpage','aZ')?GETPOST('contextpage','aZ'):'interventionlist';
-
 $sall=trim((GETPOST('search_all', 'alphanohtml')!='')?GETPOST('search_all', 'alphanohtml'):GETPOST('sall', 'alphanohtml'));
 $search_ref=GETPOST('search_ref')?GETPOST('search_ref','alpha'):GETPOST('search_inter','alpha');
 $search_company=GETPOST('search_company','alpha');
@@ -83,7 +81,8 @@ $search_status=GETPOST('search_status');
 $optioncss = GETPOST('optioncss','alpha');
 
 // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
-$hookmanager->initHooks(array($contextpage));
+$object = new Fichinter($db);
+$hookmanager->initHooks(array('interventionlist'));
 $extrafields = new ExtraFields($db);
 
 // fetch optionals attributes and labels

+ 3 - 4
htdocs/fourn/commande/list.php

@@ -53,6 +53,7 @@ $massaction=GETPOST('massaction','alpha');
 $show_files=GETPOST('show_files','int');
 $confirm=GETPOST('confirm','alpha');
 $toselect = GETPOST('toselect', 'array');
+$contextpage=GETPOST('contextpage','aZ')?GETPOST('contextpage','aZ'):'supplierorderlist';
 
 $orderyear=GETPOST("orderyear","int");
 $ordermonth=GETPOST("ordermonth","int");
@@ -109,11 +110,9 @@ if (! $sortorder) $sortorder='DESC';
 
 if ($search_status == '') $search_status=-1;
 
-// Initialize technical object to manage context to save list fields
-$contextpage=GETPOST('contextpage','aZ')?GETPOST('contextpage','aZ'):'supplierorderlist';
-
 // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
-$hookmanager->initHooks(array($contextpage));
+$object = new CommandeFournisseur($db);
+$hookmanager->initHooks(array('supplierorderlist'));
 $extrafields = new ExtraFields($db);
 
 // fetch optionals attributes and labels

+ 3 - 6
htdocs/fourn/facture/list.php

@@ -55,6 +55,7 @@ $show_files=GETPOST('show_files','int');
 $confirm=GETPOST('confirm','alpha');
 $toselect = GETPOST('toselect', 'array');
 $optioncss = GETPOST('optioncss','alpha');
+$contextpage=GETPOST('contextpage','aZ')?GETPOST('contextpage','aZ'):'supplierinvoicelist';
 
 $socid = GETPOST('socid','int');
 
@@ -118,16 +119,12 @@ $pagenext = $page + 1;
 if (! $sortorder) $sortorder="DESC";
 if (! $sortfield) $sortfield="f.datef,f.rowid";
 
-// Initialize technical object to manage context to save list fields
-$contextpage=GETPOST('contextpage','aZ')?GETPOST('contextpage','aZ'):'supplierinvoicelist';
-
 $diroutputmassaction=$conf->fournisseur->facture->dir_output . '/temp/massgeneration/'.$user->id;
 
-$object=new FactureFournisseur($db);
-
 $now=dol_now();
 
 // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
+$object = new FactureFournisseur($db);
 $hookmanager->initHooks(array('supplierinvoicelist'));
 $extrafields = new ExtraFields($db);
 
@@ -877,7 +874,7 @@ if ($resql)
 				print '</td>';
 				if (! $i) $totalarray['nbfield']++;
 			}
-			
+
 			// Type
 			if (! empty($arrayfields['f.type']['checked']))
 			{

+ 2 - 4
htdocs/holiday/define_holiday.php

@@ -34,6 +34,7 @@ $langs->load('users');
 $langs->load('hrm');
 
 $action=GETPOST('action','aZ09');
+$contextpage=GETPOST('contextpage','aZ')?GETPOST('contextpage','aZ'):'defineholidaylist';
 
 $search_name=GETPOST('search_name', 'alpha');
 $search_supervisor=GETPOST('search_supervisor', 'int');
@@ -58,9 +59,6 @@ if ($user->societe_id > 0) accessforbidden();
 if (!$user->rights->holiday->read) accessforbidden();
 
 
-// Initialize technical object to manage context to save list fields
-$contextpage=GETPOST('contextpage','aZ')?GETPOST('contextpage','aZ'):'defineholidaylist';
-
 // Initialize technical object to manage hooks. Note that conf->hooks_modules contains array
 $hookmanager->initHooks(array('defineholidaylist'));
 $extrafields = new ExtraFields($db);
@@ -357,7 +355,7 @@ else
         print '<td>';
         if ($canedit) print '<input type="text"'.($canedit?'':' disabled="disabled"').' class="maxwidthonsmartphone" value="" name="note_holiday['.$users['rowid'].']" size="30"/>';
         print '</td>';
-        
+
         // Button modify
         print '<td>';
         if (! empty($user->rights->holiday->define_holiday))	// Allowed to set the balance of any user

+ 2 - 2
htdocs/product/fournisseurs.php

@@ -47,6 +47,8 @@ $ref = GETPOST('ref', 'alpha');
 $rowid=GETPOST('rowid','int');
 $action=GETPOST('action', 'alpha');
 $cancel=GETPOST('cancel', 'alpha');
+$contextpage=GETPOST('contextpage','aZ')?GETPOST('contextpage','aZ'):'pricesuppliercard';
+
 $socid=GETPOST('socid', 'int');
 $cost_price=GETPOST('cost_price', 'alpha');
 $backtopage=GETPOST('backtopage','alpha');
@@ -79,8 +81,6 @@ $pagenext = $page + 1;
 if (! $sortfield) $sortfield="s.nom";
 if (! $sortorder) $sortorder="ASC";
 
-$contextpage='pricesuppliercard';
-
 // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
 $hookmanager->initHooks(array('pricesuppliercard','globalcard'));
 

+ 1 - 1
htdocs/product/list.php

@@ -95,7 +95,7 @@ if ((string) $type == '0') { $contextpage='productlist'; if ($search_type=='') $
 
 // Initialize technical object to manage hooks. Note that conf->hooks_modules contains array of hooks
 $object=new Product($db);
-$hookmanager->initHooks(array($contextpage));
+$hookmanager->initHooks(array('productservicelist'));
 $extrafields = new ExtraFields($db);
 $form=new Form($db);
 

+ 8 - 9
htdocs/product/stock/mouvement.php

@@ -53,6 +53,8 @@ $msid=GETPOST('msid','int');
 $product_id=GETPOST("product_id");
 $action=GETPOST('action','aZ09');
 $cancel=GETPOST('cancel','alpha');
+$contextpage=GETPOST('contextpage','aZ')?GETPOST('contextpage','aZ'):'movementlist';
+
 $idproduct = GETPOST('idproduct','int');
 $year = GETPOST("year");
 $month = GETPOST("month");
@@ -77,11 +79,9 @@ if (! $sortorder) $sortorder="DESC";
 
 $pdluoid=GETPOST('pdluoid','int');
 
-// Initialize context for list
-$contextpage=GETPOST('contextpage','aZ')?GETPOST('contextpage','aZ'):'movementlist';
-
 // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
-$hookmanager->initHooks(array($contextpage));
+$object = new MouvementStock($db);
+$hookmanager->initHooks(array('movementlist'));
 $extrafields = new ExtraFields($db);
 
 // fetch optionals attributes and labels
@@ -107,7 +107,6 @@ $arrayfields=array(
     //'m.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500)
 );
 
-$object = new MouvementStock($db);	// To be passed as parameter of executeHooks that need
 
 
 /*
@@ -818,10 +817,10 @@ if ($resql)
     	print '&nbsp; ';
     	print '</td>';
     }
-	
+
     // Extra fields
     include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
-  
+
 	// Fields from hook
 	$parameters=array('arrayfields'=>$arrayfields);
 	$reshook=$hookmanager->executeHooks('printFieldListOption',$parameters);    // Note that $action and $object may have been modified by hook
@@ -860,7 +859,7 @@ if ($resql)
     if (! empty($arrayfields['origin']['checked']))             print_liste_field_titre($arrayfields['origin']['label'],$_SERVER["PHP_SELF"], "","",$param,"",$sortfield,$sortorder);
     if (! empty($arrayfields['m.value']['checked']))            print_liste_field_titre($arrayfields['m.value']['label'],$_SERVER["PHP_SELF"], "m.value","",$param,'align="right"',$sortfield,$sortorder);
     if (! empty($arrayfields['m.price']['checked']))            print_liste_field_titre($arrayfields['m.price']['label'],$_SERVER["PHP_SELF"], "m.price","",$param,'align="right"',$sortfield,$sortorder);
-    
+
     // Extra fields
     include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
 
@@ -891,7 +890,7 @@ if ($resql)
         $productstatic->label=$objp->produit;
         $productstatic->type=$objp->type;
         $productstatic->entity=$objp->entity;
-        $productstatic->status_batch=$objp->tobatch; 
+        $productstatic->status_batch=$objp->tobatch;
 
         $productlot->id = $objp->lotid;
         $productlot->batch= $objp->batch;

+ 1 - 1
htdocs/product/stock/productlot_list.php

@@ -81,6 +81,7 @@ if ($user->societe_id > 0)
 }
 
 // Initialize technical object to manage hooks. Note that conf->hooks_modules contains array
+$object = new Productlot($db);
 $hookmanager->initHooks(array('product_lotlist'));
 $extrafields = new ExtraFields($db);
 
@@ -119,7 +120,6 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab
 }
 
 // Load object if id or ref is provided as parameter
-$object=new Productlot($db);
 if (($id > 0 || ! empty($ref)) && $action != 'add')
 {
 	$result=$object->fetch($id,$ref);

+ 3 - 6
htdocs/projet/list.php

@@ -39,6 +39,7 @@ $massaction=GETPOST('massaction','alpha');
 $show_files=GETPOST('show_files','int');
 $confirm=GETPOST('confirm','alpha');
 $toselect = GETPOST('toselect', 'array');
+$contextpage=GETPOST('contextpage','aZ')?GETPOST('contextpage','aZ'):'projectlist';
 
 $title = $langs->trans("Projects");
 
@@ -95,12 +96,9 @@ $search_eyear	= GETPOST('search_eyear','int');
 
 if ($search_status == '') $search_status=-1;	// -1 or 1
 
-
-// Initialize context for list
-$contextpage=GETPOST('contextpage','aZ')?GETPOST('contextpage','aZ'):'projectlist';
-
 // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
-$hookmanager->initHooks(array($contextpage));
+$object = new Project($db);
+$hookmanager->initHooks(array('projectlist'));
 $extrafields = new ExtraFields($db);
 
 // fetch optionals attributes and labels
@@ -141,7 +139,6 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab
    }
 }
 
-$object = new Project($db);
 
 
 /*

+ 2 - 3
htdocs/projet/tasks/list.php

@@ -71,7 +71,8 @@ $search_eyear	= GETPOST('search_eyear','int');
 $contextpage=GETPOST('contextpage','aZ')?GETPOST('contextpage','aZ'):'tasklist';
 
 // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
-$hookmanager->initHooks(array($contextpage));
+$object = new Task($db);
+$hookmanager->initHooks(array('tasklist'));
 $extrafields = new ExtraFields($db);
 
 // fetch optionals attributes and labels
@@ -131,8 +132,6 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab
 	}
 }
 
-$object = new Task($db);
-
 
 /*
  * Actions

+ 1 - 0
htdocs/projet/tasks/time.php

@@ -72,6 +72,7 @@ if (! $sortfield) $sortfield='t.task_date,t.task_datehour,t.rowid';
 if (! $sortorder) $sortorder='DESC';
 
 // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
+//$object = new TaskTime($db);
 $hookmanager->initHooks(array('projecttaskcard','globalcard'));
 
 $object = new Task($db);

+ 4 - 4
htdocs/resource/list.php

@@ -17,8 +17,8 @@
 
 /**
  *      \file       resource/index.php
- *              \ingroup    resource
- *              \brief      Page to manage resource objects
+ *      \ingroup    resource
+ *      \brief      Page to manage resource objects
  */
 
 
@@ -43,8 +43,8 @@ $sortfield      = GETPOST('sortfield','alpha');
 // Initialize context for list
 $contextpage=GETPOST('contextpage','aZ')?GETPOST('contextpage','aZ'):'resourcelist';
 
+// Initialize technical objects
 $object = new Dolresource($db);
-
 $extrafields = new ExtraFields($db);
 
 // fetch optionals attributes and labels
@@ -84,7 +84,7 @@ foreach ($search_array_options as $key => $val)
 if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
 
 
-$hookmanager->initHooks(array('resource_list'));
+$hookmanager->initHooks(array('resourcelist'));
 
 if (empty($sortorder)) $sortorder="ASC";
 if (empty($sortfield)) $sortfield="t.ref";

+ 3 - 7
htdocs/societe/list.php

@@ -45,6 +45,7 @@ $massaction=GETPOST('massaction','alpha');
 $show_files=GETPOST('show_files','int');
 $confirm=GETPOST('confirm','alpha');
 $toselect = GETPOST('toselect', 'array');
+$contextpage=GETPOST('contextpage','aZ')?GETPOST('contextpage','aZ'):'thirdpartylist';
 
 // Security check
 $socid = GETPOST('socid','int');
@@ -106,18 +107,13 @@ $offset = $limit * $page;
 $pageprev = $page - 1;
 $pagenext = $page + 1;
 
-// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
-$contextpage='thirdpartylist';
-/*if ($search_type == '1,3') { $contextpage='customerlist'; $type='c'; }
-if ($search_type == '2,3') { $contextpage='prospectlist'; $type='p'; }
-if ($search_type == '4') { $contextpage='supplierlist'; $type='f'; }
-*/
 if ($type == 'c') { $contextpage='customerlist'; if ($search_type=='') $search_type='1,3'; }
 if ($type == 'p') { $contextpage='prospectlist'; if ($search_type=='') $search_type='2,3'; }
 if ($type == 'f') { $contextpage='supplierlist'; if ($search_type=='') $search_type='4'; }
 
 // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
-$hookmanager->initHooks(array($contextpage));
+$object = new Societe($db);
+$hookmanager->initHooks(array('thirdpartylist'));
 $extrafields = new ExtraFields($db);
 
 // fetch optionals attributes and labels

+ 1 - 4
htdocs/societe/website.php

@@ -59,16 +59,13 @@ $object=new Societe($db);
 $objectwebsiteaccount=new WebsiteAccount($db);
 $extrafields = new ExtraFields($db);
 $diroutputmassaction=$conf->website->dir_output . '/temp/massgeneration/'.$user->id;
-$hookmanager->initHooks(array('websiteaccountlist'));     // Note that conf->hooks_modules contains array
+$hookmanager->initHooks(array('websitethirdpartylist'));     // Note that conf->hooks_modules contains array
 // Fetch optionals attributes and labels
 $extralabels = $extrafields->fetch_name_optionals_label('websiteaccount');
 $search_array_options=$extrafields->getOptionalsFromPost($extralabels,'','search_');
 
 unset($objectwebsiteaccount->fields['fk_soc']);		// Remove this field, we are already on the thirdparty
 
-// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
-$hookmanager->initHooks(array('websitethirdparty'));
-
 // Initialize array of search criterias
 $search_all=trim(GETPOST("search_all",'alpha'));
 $search=array();

+ 2 - 3
htdocs/supplier_proposal/list.php

@@ -57,6 +57,7 @@ $massaction=GETPOST('massaction','alpha');
 $show_files=GETPOST('show_files','int');
 $confirm=GETPOST('confirm','alpha');
 $toselect = GETPOST('toselect', 'array');
+$contextpage=GETPOST('contextpage','aZ')?GETPOST('contextpage','aZ'):'supplierproposallist';
 
 $search_user=GETPOST('search_user','int');
 $search_sale=GETPOST('search_sale','int');
@@ -97,9 +98,6 @@ if ($object_statut != '') $search_status=$object_statut;
 // Nombre de ligne pour choix de produit/service predefinis
 $NBLINES=4;
 
-// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
-$contextpage='supplierproposallist';
-
 // Security check
 $module='supplier_proposal';
 $dbtable='';
@@ -116,6 +114,7 @@ $result = restrictedArea($user, $module, $objectid, $dbtable);
 $diroutputmassaction=$conf->supplier_proposal->dir_output . '/temp/massgeneration/'.$user->id;
 
 // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
+$object = new SupplierProposal($db);
 $hookmanager->initHooks(array('supplier_proposallist'));
 $extrafields = new ExtraFields($db);
 

+ 3 - 5
htdocs/ticketsup/list.php

@@ -27,11 +27,9 @@ require_once DOL_DOCUMENT_ROOT . '/core/class/html.formticketsup.class.php';
 require_once DOL_DOCUMENT_ROOT . '/core/lib/functions2.lib.php';
 require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php';
 require_once DOL_DOCUMENT_ROOT . '/user/class/user.class.php';
-if (!empty($conf->projet->enabled)) {
-    include_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php';
-    include_once DOL_DOCUMENT_ROOT . '/core/class/html.formprojet.class.php';
-    include_once DOL_DOCUMENT_ROOT . '/core/lib/project.lib.php';
-}
+include_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php';
+include_once DOL_DOCUMENT_ROOT . '/core/class/html.formprojet.class.php';
+include_once DOL_DOCUMENT_ROOT . '/core/lib/project.lib.php';
 
 // Load traductions files requiredby by page
 $langs->loadLangs(array("ticketsup","companies","other","projects"));

+ 2 - 2
htdocs/user/agenda_extsites.php

@@ -40,6 +40,7 @@ $langs->load("other");
 $def = array();
 $actiontest=GETPOST('test','alpha');
 $actionsave=GETPOST('save','alpha');
+$contextpage= GETPOST('contextpage','aZ')?GETPOST('contextpage','aZ'):'useragenda';   // To manage different context of search
 
 if (empty($conf->global->AGENDA_EXT_NB)) $conf->global->AGENDA_EXT_NB=5;
 $MAXAGENDA=$conf->global->AGENDA_EXT_NB;
@@ -68,8 +69,7 @@ if (($object->id != $user->id) && (! $user->rights->user->user->lire))
   accessforbidden();
 
 // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
-$contextpage=array('usercard','useragenda','globalcard');
-$hookmanager->initHooks($contextpage);
+$hookmanager->initHooks(array('usercard','useragenda','globalcard');
 
 /*
  * Actions

+ 3 - 3
htdocs/user/card.php

@@ -50,10 +50,11 @@ if (! empty($conf->categorie->enabled)) require_once DOL_DOCUMENT_ROOT.'/categor
 $id			= GETPOST('id','int');
 $action		= GETPOST('action','aZ09');
 $mode		= GETPOST('mode','alpha');
-$confirm		= GETPOST('confirm','alpha');
+$confirm	= GETPOST('confirm','alpha');
 $subaction	= GETPOST('subaction','alpha');
 $group		= GETPOST("group","int",3);
 $cancel		= GETPOST('cancel','alpha');
+$contextpage= GETPOST('contextpage','aZ')?GETPOST('contextpage','aZ'):'useracard';   // To manage different context of search
 
 // Define value to know what current user can do on users
 $canadduser=(! empty($user->admin) || $user->rights->user->user->creer);
@@ -101,8 +102,7 @@ $extrafields = new ExtraFields($db);
 $extralabels=$extrafields->fetch_name_optionals_label($object->table_element);
 
 // Initialize technical object to manage hooks. Note that conf->hooks_modules contains array
-$contextpage=array('usercard','globalcard');
-$hookmanager->initHooks($contextpage);
+$hookmanager->initHooks(array('usercard','globalcard');
 
 
 

+ 2 - 3
htdocs/user/document.php

@@ -34,11 +34,11 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
 $langs->load("users");
 $langs->load('other');
 
-
 $action=GETPOST('action','aZ09');
 $confirm=GETPOST('confirm');
 $id=(GETPOST('userid','int') ? GETPOST('userid','int') : GETPOST('id','int'));
 $ref = GETPOST('ref', 'alpha');
+$contextpage= GETPOST('contextpage','aZ')?GETPOST('contextpage','aZ'):'userdoc';   // To manage different context of search
 
 // Define value to know what current user can do on users
 $canadduser=(! empty($user->admin) || $user->rights->user->user->creer);
@@ -94,8 +94,7 @@ if ($id > 0 || ! empty($ref))
 }
 
 // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
-$contextpage=array('usercard','userdoc','globalcard');
-$hookmanager->initHooks($contextpage);
+$hookmanager->initHooks(array('usercard','userdoc','globalcard');
 
 
 /*

+ 4 - 2
htdocs/user/group/card.php

@@ -49,6 +49,7 @@ $id=GETPOST('id', 'int');
 $action=GETPOST('action', 'alpha');
 $confirm=GETPOST('confirm', 'alpha');
 $userid=GETPOST('user', 'int');
+$contextpage=GETPOST('contextpage','aZ')?GETPOST('contextpage','aZ'):'groupcard';   // To manage different context of search
 
 // Security check
 $result = restrictedArea($user, 'user', $id, 'usergroup&usergroup', 'user');
@@ -71,8 +72,9 @@ $extrafields = new ExtraFields($db);
 $extralabels=$extrafields->fetch_name_optionals_label($object->table_element);
 
 // Initialize technical object to manage hooks. Note that conf->hooks_modules contains array
-$contextpage=array('groupcard','globalcard');
-$hookmanager->initHooks($contextpage);
+$hookmanager->initHooks(array('groupcard','globalcard'));
+
+
 
 /**
  * Actions

+ 2 - 3
htdocs/user/group/perms.php

@@ -37,7 +37,7 @@ $action=GETPOST('action', 'alpha');
 $confirm=GETPOST('confirm', 'alpha');
 $module=GETPOST('module', 'alpha');
 $rights=GETPOST('rights', 'int');
-
+$contextpage= GETPOST('contextpage','aZ')?GETPOST('contextpage','aZ'):'groupperms';   // To manage different context of search
 
 // Defini si peux lire les permissions
 $canreadperms=($user->admin || $user->rights->user->user->lire);
@@ -60,8 +60,7 @@ $object->fetch($id);
 $entity=$conf->entity;
 
 // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
-$contextpage=array('groupcard','globalcard');
-$hookmanager->initHooks($contextpage);
+$hookmanager->initHooks('groupperms','globalcard');
 
 
 /**

+ 3 - 2
htdocs/user/home.php

@@ -24,6 +24,8 @@
 require '../main.inc.php';
 require_once DOL_DOCUMENT_ROOT.'/user/class/usergroup.class.php';
 
+$contextpage=GETPOST('contextpage','aZ')?GETPOST('contextpage','aZ'):'userhome';   // To manage different context of search
+
 if (! $user->rights->user->user->lire && ! $user->admin)
 {
 	// Redirection vers la page de l'utilisateur
@@ -47,8 +49,7 @@ $companystatic = new Societe($db);
 $fuserstatic = new User($db);
 
 // Initialize technical object to manage hooks. Note that conf->hooks_modules contains array
-$contextpage=array('userhome');
-$hookmanager->initHooks($contextpage);
+$hookmanager->initHooks(array('userhome'));
 
 
 /*

+ 4 - 4
htdocs/user/index.php

@@ -34,6 +34,8 @@ $langs->load("users");
 $langs->load("companies");
 $langs->load('hrm');
 
+$contextpage=GETPOST('contextpage','aZ')?GETPOST('contextpage','aZ'):'userlist';   // To manage different context of search
+
 // Security check (for external users)
 $socid=0;
 if ($user->societe_id > 0)
@@ -54,11 +56,9 @@ $pagenext = $page + 1;
 if (! $sortfield) $sortfield="u.login";
 if (! $sortorder) $sortorder="ASC";
 
-// Initialize context for list
-$contextpage=GETPOST('contextpage','aZ')?GETPOST('contextpage','aZ'):'userlist';
-
 // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
-$hookmanager->initHooks(array($contextpage));
+$object = new User($db);
+$hookmanager->initHooks(array('userlist'));
 $extrafields = new ExtraFields($db);
 
 // fetch optionals attributes and labels

+ 2 - 2
htdocs/user/ldap.php

@@ -33,6 +33,7 @@ $langs->load("companies");
 $langs->load("ldap");
 
 $id = GETPOST('id', 'int');
+$contextpage=GETPOST('contextpage','aZ')?GETPOST('contextpage','aZ'):'userldap';   // To manage different context of search
 
 // Security check
 $socid=0;
@@ -46,8 +47,7 @@ $object->fetch($id, '', '', 1);
 $object->getrights();
 
 // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
-$contextpage=array('usercard','userldap','globalcard');
-$hookmanager->initHooks($contextpage);
+$hookmanager->initHooks(array('usercard','userldap','globalcard'));
 
 
 /*

+ 2 - 2
htdocs/user/note.php

@@ -29,6 +29,7 @@ require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
 
 $id = GETPOST('id','int');
 $action = GETPOST('action','aZ09');
+$contextpage=GETPOST('contextpage','aZ')?GETPOST('contextpage','aZ'):'usernote';   // To manage different context of search
 
 $langs->load("companies");
 $langs->load("members");
@@ -50,8 +51,7 @@ if ($user->id == $id) $feature2=''; // A user can always read its own card
 $result = restrictedArea($user, 'user', $id, 'user&user', $feature2);
 
 // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
-$contextpage=array('usercard','usernote','globalcard');
-$hookmanager->initHooks($contextpage);
+$hookmanager->initHooks(array('usercard','usernote','globalcard'));
 
 
 /*

+ 2 - 2
htdocs/user/param_ihm.php

@@ -40,6 +40,7 @@ $canreaduser=($user->admin || $user->rights->user->user->lire);
 
 $id = GETPOST('id','int');
 $action = GETPOST('action','alpha');
+$contextpage=GETPOST('contextpage','aZ')?GETPOST('contextpage','aZ'):'userihm';   // To manage different context of search
 
 if ($id)
 {
@@ -79,8 +80,7 @@ $form = new Form($db);
 $formadmin=new FormAdmin($db);
 
 // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
-$contextpage=array('usercard','userihm','globalcard');
-$hookmanager->initHooks($contextpage);
+$hookmanager->initHooks(array('usercard','userihm','globalcard'));
 
 
 /*

+ 2 - 2
htdocs/user/perms.php

@@ -38,6 +38,7 @@ $action=GETPOST('action', 'alpha');
 $confirm=GETPOST('confirm', 'alpha');
 $module=GETPOST('module', 'alpha');
 $rights=GETPOST('rights', 'int');
+$contextpage=GETPOST('contextpage','aZ')?GETPOST('contextpage','aZ'):'userperms';   // To manage different context of search
 
 if (! isset($id) || empty($id)) accessforbidden();
 
@@ -73,8 +74,7 @@ $object->getrights();
 $entity=$conf->entity;
 
 // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
-$contextpage=array('usercard','userperms','globalcard');
-$hookmanager->initHooks($contextpage);
+$hookmanager->initHooks(array('usercard','userperms','globalcard'));
 
 
 /**