From 43f8834b28ac231e5dfc8115777e0b7106561a6f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 31 Mar 2018 18:48:27 +0200 Subject: [PATCH] Uniformize code with the new module builder framework --- htdocs/accountancy/admin/account.php | 3 +-- htdocs/adherents/list.php | 1 + htdocs/admin/accountant.php | 4 +--- htdocs/admin/company.php | 4 ++-- htdocs/admin/ihm.php | 4 +--- htdocs/comm/action/list.php | 4 ++-- htdocs/comm/propal/list.php | 5 ++--- htdocs/commande/list.php | 7 +++---- htdocs/compta/bank/bankentries_list.php | 5 +---- htdocs/compta/bank/list.php | 9 +++++---- htdocs/compta/facture/list.php | 5 ++--- htdocs/contact/list.php | 3 ++- htdocs/contrat/list.php | 7 +++---- htdocs/contrat/services_list.php | 6 +++--- .../tpl/extrafields_list_search_title.tpl.php | 9 +++++---- htdocs/expedition/list.php | 5 ++--- htdocs/expensereport/list.php | 5 ++--- htdocs/fichinter/list.php | 7 +++---- htdocs/fourn/commande/list.php | 7 +++---- htdocs/fourn/facture/list.php | 9 +++------ htdocs/holiday/define_holiday.php | 6 ++---- htdocs/product/fournisseurs.php | 4 ++-- htdocs/product/list.php | 2 +- htdocs/product/stock/mouvement.php | 17 ++++++++--------- htdocs/product/stock/productlot_list.php | 2 +- htdocs/projet/list.php | 9 +++------ htdocs/projet/tasks/list.php | 5 ++--- htdocs/projet/tasks/time.php | 1 + htdocs/resource/list.php | 8 ++++---- htdocs/societe/list.php | 10 +++------- htdocs/societe/website.php | 5 +---- htdocs/supplier_proposal/list.php | 5 ++--- htdocs/ticketsup/list.php | 8 +++----- htdocs/user/agenda_extsites.php | 4 ++-- htdocs/user/card.php | 6 +++--- htdocs/user/document.php | 5 ++--- htdocs/user/group/card.php | 6 ++++-- htdocs/user/group/perms.php | 5 ++--- htdocs/user/home.php | 5 +++-- htdocs/user/index.php | 8 ++++---- htdocs/user/ldap.php | 4 ++-- htdocs/user/note.php | 4 ++-- htdocs/user/param_ihm.php | 4 ++-- htdocs/user/perms.php | 4 ++-- 44 files changed, 108 insertions(+), 138 deletions(-) diff --git a/htdocs/accountancy/admin/account.php b/htdocs/accountancy/admin/account.php index 98ecd8e327c..2dd71e8e2e6 100644 --- a/htdocs/accountancy/admin/account.php +++ b/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'; /* diff --git a/htdocs/adherents/list.php b/htdocs/adherents/list.php index b048d6ed551..6ae8058c189 100644 --- a/htdocs/adherents/list.php +++ b/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); diff --git a/htdocs/admin/accountant.php b/htdocs/admin/accountant.php index e7733e64941..11fa5d68e64 100644 --- a/htdocs/admin/accountant.php +++ b/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 diff --git a/htdocs/admin/company.php b/htdocs/admin/company.php index 655a10f5735..0021cac68b4 100644 --- a/htdocs/admin/company.php +++ b/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 diff --git a/htdocs/admin/ihm.php b/htdocs/admin/ihm.php index 03f3d364cca..23cc0600705 100644 --- a/htdocs/admin/ihm.php +++ b/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); /* diff --git a/htdocs/comm/action/list.php b/htdocs/comm/action/list.php index 26c88b47ad3..a200c6571b2 100644 --- a/htdocs/comm/action/list.php +++ b/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( diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index de7715bdcf4..3e62d8d0298 100644 --- a/htdocs/comm/propal/list.php +++ b/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); diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index 784f44aad4c..fa5cdb15633 100644 --- a/htdocs/commande/list.php +++ b/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 diff --git a/htdocs/compta/bank/bankentries_list.php b/htdocs/compta/bank/bankentries_list.php index 8c234716bee..397d9fd5d7b 100644 --- a/htdocs/compta/bank/bankentries_list.php +++ b/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); diff --git a/htdocs/compta/bank/list.php b/htdocs/compta/bank/list.php index 6a39416342e..54e011d9db3 100644 --- a/htdocs/compta/bank/list.php +++ b/htdocs/compta/bank/list.php @@ -1,4 +1,6 @@ * Copyright (C) 2004-2016 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin @@ -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 diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index a3576a438aa..b96c1220f52 100644 --- a/htdocs/compta/facture/list.php +++ b/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); diff --git a/htdocs/contact/list.php b/htdocs/contact/list.php index e2ad6031937..92e3f72595e 100644 --- a/htdocs/contact/list.php +++ b/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 diff --git a/htdocs/contrat/list.php b/htdocs/contrat/list.php index 55dfacdf2c5..58fa3287c9a 100644 --- a/htdocs/contrat/list.php +++ b/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 diff --git a/htdocs/contrat/services_list.php b/htdocs/contrat/services_list.php index 108fb6d4403..f78ed639804 100644 --- a/htdocs/contrat/services_list.php +++ b/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 diff --git a/htdocs/core/tpl/extrafields_list_search_title.tpl.php b/htdocs/core/tpl/extrafields_list_search_title.tpl.php index 8b986b1e4e6..ae5f640828c 100644 --- a/htdocs/core/tpl/extrafields_list_search_title.tpl.php +++ b/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 ''; + else print getTitleFieldOfList($langs->trans($extralabels[$key]), 0, $_SERVER["PHP_SELF"], $sortonfield, "", $param, ($align?'align="'.$align.'"':''), $sortfield, $sortorder)."\n"; } } } \ No newline at end of file diff --git a/htdocs/expedition/list.php b/htdocs/expedition/list.php index d8e9925c08f..dd6fa84ec4b 100644 --- a/htdocs/expedition/list.php +++ b/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 diff --git a/htdocs/expensereport/list.php b/htdocs/expensereport/list.php index 097a912b6c1..b32bf62f394 100644 --- a/htdocs/expensereport/list.php +++ b/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); diff --git a/htdocs/fichinter/list.php b/htdocs/fichinter/list.php index 7fc7ca244de..f0028e0760a 100644 --- a/htdocs/fichinter/list.php +++ b/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 diff --git a/htdocs/fourn/commande/list.php b/htdocs/fourn/commande/list.php index 760c80737f4..cca33fb4862 100644 --- a/htdocs/fourn/commande/list.php +++ b/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 diff --git a/htdocs/fourn/facture/list.php b/htdocs/fourn/facture/list.php index efe029d7adf..2255722eed7 100644 --- a/htdocs/fourn/facture/list.php +++ b/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 ''; if (! $i) $totalarray['nbfield']++; } - + // Type if (! empty($arrayfields['f.type']['checked'])) { diff --git a/htdocs/holiday/define_holiday.php b/htdocs/holiday/define_holiday.php index 1620fa4733b..4dc1e92268e 100644 --- a/htdocs/holiday/define_holiday.php +++ b/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 ''; if ($canedit) print ''; print ''; - + // Button modify print ''; if (! empty($user->rights->holiday->define_holiday)) // Allowed to set the balance of any user diff --git a/htdocs/product/fournisseurs.php b/htdocs/product/fournisseurs.php index a2f79e4c402..ebb7f9753dc 100644 --- a/htdocs/product/fournisseurs.php +++ b/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')); diff --git a/htdocs/product/list.php b/htdocs/product/list.php index b11395eea5f..c6a7835158d 100644 --- a/htdocs/product/list.php +++ b/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); diff --git a/htdocs/product/stock/mouvement.php b/htdocs/product/stock/mouvement.php index 41c8f9ae1f0..0bed4022eb3 100644 --- a/htdocs/product/stock/mouvement.php +++ b/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 '  '; print ''; } - + // 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; diff --git a/htdocs/product/stock/productlot_list.php b/htdocs/product/stock/productlot_list.php index 76d70c1ad10..1d1f6a89478 100644 --- a/htdocs/product/stock/productlot_list.php +++ b/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); diff --git a/htdocs/projet/list.php b/htdocs/projet/list.php index 22887c5e42d..3da1d4fe566 100644 --- a/htdocs/projet/list.php +++ b/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); /* diff --git a/htdocs/projet/tasks/list.php b/htdocs/projet/tasks/list.php index 6ad2e51425f..a31ec6f57d4 100644 --- a/htdocs/projet/tasks/list.php +++ b/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 diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php index 44a2ed1b8a8..e61d3ceb8ce 100644 --- a/htdocs/projet/tasks/time.php +++ b/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); diff --git a/htdocs/resource/list.php b/htdocs/resource/list.php index 190659628f2..72c7945bf43 100644 --- a/htdocs/resource/list.php +++ b/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"; diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php index d56e5b1e22a..460a0143c05 100644 --- a/htdocs/societe/list.php +++ b/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 diff --git a/htdocs/societe/website.php b/htdocs/societe/website.php index 9e57176250a..1f3e69a674c 100644 --- a/htdocs/societe/website.php +++ b/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(); diff --git a/htdocs/supplier_proposal/list.php b/htdocs/supplier_proposal/list.php index 685e9531072..2f676f9d6fa 100644 --- a/htdocs/supplier_proposal/list.php +++ b/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); diff --git a/htdocs/ticketsup/list.php b/htdocs/ticketsup/list.php index 8eda9bfc454..364eab864e2 100644 --- a/htdocs/ticketsup/list.php +++ b/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")); diff --git a/htdocs/user/agenda_extsites.php b/htdocs/user/agenda_extsites.php index 5b9e62c21df..46ca99d3727 100644 --- a/htdocs/user/agenda_extsites.php +++ b/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 diff --git a/htdocs/user/card.php b/htdocs/user/card.php index 8eda5d47d97..3d63c308729 100644 --- a/htdocs/user/card.php +++ b/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'); diff --git a/htdocs/user/document.php b/htdocs/user/document.php index ff7fe9b5ab9..d77b30a4721 100644 --- a/htdocs/user/document.php +++ b/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'); /* diff --git a/htdocs/user/group/card.php b/htdocs/user/group/card.php index 97b1bfc028b..a8bc562d4a2 100644 --- a/htdocs/user/group/card.php +++ b/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 diff --git a/htdocs/user/group/perms.php b/htdocs/user/group/perms.php index 740b106c728..27170062198 100644 --- a/htdocs/user/group/perms.php +++ b/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'); /** diff --git a/htdocs/user/home.php b/htdocs/user/home.php index ac14f6b0243..64162d47a8f 100644 --- a/htdocs/user/home.php +++ b/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')); /* diff --git a/htdocs/user/index.php b/htdocs/user/index.php index 4d83903d0aa..964ac2df367 100644 --- a/htdocs/user/index.php +++ b/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 diff --git a/htdocs/user/ldap.php b/htdocs/user/ldap.php index 1b5f7c77b78..c9bee3dd47c 100644 --- a/htdocs/user/ldap.php +++ b/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')); /* diff --git a/htdocs/user/note.php b/htdocs/user/note.php index 55dd46e1129..0868c6435cf 100644 --- a/htdocs/user/note.php +++ b/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')); /* diff --git a/htdocs/user/param_ihm.php b/htdocs/user/param_ihm.php index 64913683276..7c59b3e8f34 100644 --- a/htdocs/user/param_ihm.php +++ b/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')); /* diff --git a/htdocs/user/perms.php b/htdocs/user/perms.php index 209bc2541a8..7c855e0c80f 100644 --- a/htdocs/user/perms.php +++ b/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')); /**