mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-02-20 13:46:52 +01:00
New: hookmanager class is used frequently and is a factory object, so we
can move it during init of environment and use it globally.
This commit is contained in:
parent
1cc949777f
commit
56e11e52fa
|
|
@ -394,7 +394,7 @@ class Adherent extends CommonObject
|
|||
*/
|
||||
function update($user,$notrigger=0,$nosyncuser=0,$nosyncuserpass=0,$nosyncthirdparty=0,$action='update')
|
||||
{
|
||||
global $conf, $langs;
|
||||
global $conf, $langs, $hookmanager;
|
||||
|
||||
$nbrowsaffected=0;
|
||||
$error=0;
|
||||
|
|
@ -462,8 +462,6 @@ class Adherent extends CommonObject
|
|||
$nbrowsaffected+=$this->db->affected_rows($resql);
|
||||
|
||||
// Actions on extra fields (by external module)
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
|
||||
$hookmanager=new HookManager($this->db);
|
||||
$hookmanager->initHooks(array('memberdao'));
|
||||
$parameters=array('id'=>$this->id);
|
||||
$action='';
|
||||
|
|
|
|||
|
|
@ -98,6 +98,8 @@ class AdherentType extends CommonObject
|
|||
*/
|
||||
function update($user)
|
||||
{
|
||||
global $hookmanager;
|
||||
|
||||
$this->libelle=trim($this->libelle);
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."adherent_type ";
|
||||
|
|
@ -114,8 +116,6 @@ class AdherentType extends CommonObject
|
|||
if ($result)
|
||||
{
|
||||
// Actions on extra fields (by external module or standard code)
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
|
||||
$hookmanager=new HookManager($this->db);
|
||||
$hookmanager->initHooks(array('membertypedao'));
|
||||
$parameters=array('membertype'=>$this->id);
|
||||
$reshook=$hookmanager->executeHooks('insertExtraFields',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
|
||||
|
|
|
|||
|
|
@ -107,8 +107,6 @@ if ($rowid)
|
|||
}
|
||||
|
||||
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
|
||||
$hookmanager=new HookManager($db);
|
||||
$hookmanager->initHooks(array('membercard'));
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -67,8 +67,6 @@ if (GETPOST('button_removefilter'))
|
|||
|
||||
|
||||
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
|
||||
$hookmanager=new HookManager($db);
|
||||
$hookmanager->initHooks(array('membertypecard'));
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -64,8 +64,6 @@ $pageprev = $page - 1;
|
|||
$pagenext = $page + 1;
|
||||
|
||||
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
|
||||
$hookmanager=new HookManager($db);
|
||||
$hookmanager->initHooks(array('admin'));
|
||||
|
||||
// This page is a generic page to edit dictionnaries
|
||||
|
|
|
|||
|
|
@ -86,8 +86,6 @@ if ($user->societe_id) $socid=$user->societe_id;
|
|||
$result = restrictedArea($user,$objecttype,$objectid,$dbtablename,'','',$fieldid);
|
||||
|
||||
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
|
||||
$hookmanager=new HookManager($db);
|
||||
$hookmanager->initHooks(array('categorycard'));
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -106,8 +106,8 @@ class ActionComm extends CommonObject
|
|||
*/
|
||||
function add($user,$notrigger=0)
|
||||
{
|
||||
global $langs,$conf;
|
||||
|
||||
global $langs,$conf,$hookmanager;
|
||||
|
||||
$error=0;
|
||||
$now=dol_now();
|
||||
|
||||
|
|
@ -210,8 +210,6 @@ class ActionComm extends CommonObject
|
|||
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."actioncomm","id");
|
||||
|
||||
// Actions on extra fields (by external module or standard code)
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
|
||||
$hookmanager=new HookManager($this->db);
|
||||
$hookmanager->initHooks(array('actioncommdao'));
|
||||
$parameters=array('actcomm'=>$this->id);
|
||||
$reshook=$hookmanager->executeHooks('insertExtraFields',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
|
||||
|
|
@ -430,7 +428,7 @@ class ActionComm extends CommonObject
|
|||
*/
|
||||
function update($user,$notrigger=0)
|
||||
{
|
||||
global $langs,$conf;
|
||||
global $langs,$conf,$hookmanager;
|
||||
|
||||
$error=0;
|
||||
|
||||
|
|
@ -482,8 +480,6 @@ class ActionComm extends CommonObject
|
|||
{
|
||||
|
||||
// Actions on extra fields (by external module or standard code)
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
|
||||
$hookmanager=new HookManager($this->db);
|
||||
$hookmanager->initHooks(array('actioncommdao'));
|
||||
$parameters=array('actcomm'=>$this->id);
|
||||
$reshook=$hookmanager->executeHooks('insertExtraFields',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
|
||||
|
|
|
|||
|
|
@ -66,8 +66,6 @@ $extrafields = new ExtraFields($db);
|
|||
//var_dump($_POST);
|
||||
|
||||
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
|
||||
$hookmanager=new HookManager($db);
|
||||
$hookmanager->initHooks(array('actioncard'));
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -46,8 +46,6 @@ $origin=GETPOST('origin','alpha');
|
|||
$originid=GETPOST('originid','int');
|
||||
|
||||
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
|
||||
$hookmanager=new HookManager($db);
|
||||
$hookmanager->initHooks(array('propalcard'));
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -58,8 +58,6 @@ $search_categ = GETPOST("search_categ",'int');
|
|||
$catid = GETPOST("catid",'int');
|
||||
|
||||
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
|
||||
$hookmanager=new HookManager($db);
|
||||
$hookmanager->initHooks(array('customerlist'));
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -47,8 +47,6 @@ $result=$object->fetch($id);
|
|||
$extrafields = new ExtraFields($db);
|
||||
|
||||
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
|
||||
$hookmanager=new HookManager($db);
|
||||
$hookmanager->initHooks(array('mailingcard'));
|
||||
|
||||
// Tableau des substitutions possibles
|
||||
|
|
|
|||
|
|
@ -99,8 +99,6 @@ else
|
|||
}
|
||||
|
||||
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
|
||||
$hookmanager=new HookManager($db);
|
||||
$hookmanager->initHooks(array('propalcard'));
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -77,8 +77,6 @@ $result = restrictedArea($user, $module, $objectid, $dbtable);
|
|||
|
||||
|
||||
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
|
||||
$hookmanager=new HookManager($db);
|
||||
$hookmanager->initHooks(array('propalcard'));
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -148,8 +148,6 @@ $sts = array(-1,0,1,2,3);
|
|||
|
||||
|
||||
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
|
||||
$hookmanager=new HookManager($db);
|
||||
$hookmanager->initHooks(array('prospectlist'));
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -880,8 +880,7 @@ class Commande extends CommonOrder
|
|||
*/
|
||||
function createFromProposal($object)
|
||||
{
|
||||
global $conf,$user,$langs;
|
||||
global $hookmanager;
|
||||
global $conf,$user,$langs,$hookmanager;
|
||||
|
||||
$error=0;
|
||||
|
||||
|
|
@ -945,11 +944,6 @@ class Commande extends CommonOrder
|
|||
if ($ret > 0)
|
||||
{
|
||||
// Actions hooked (by external module)
|
||||
if (! is_object($hookmanager))
|
||||
{
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
|
||||
$hookmanager=new HookManager($this->db);
|
||||
}
|
||||
$hookmanager->initHooks(array('orderdao'));
|
||||
|
||||
$parameters=array('objFrom'=>$object);
|
||||
|
|
|
|||
|
|
@ -84,8 +84,6 @@ if ($id > 0 || ! empty($ref))
|
|||
}
|
||||
|
||||
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
|
||||
$hookmanager=new HookManager($db);
|
||||
$hookmanager->initHooks(array('ordercard'));
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -49,8 +49,6 @@ $mesg = '';
|
|||
$object = new Deplacement($db);
|
||||
|
||||
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
|
||||
$hookmanager=new HookManager($db);
|
||||
$hookmanager->initHooks(array('tripsandexpensescard'));
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -50,8 +50,6 @@ $donation_date=dol_mktime(12, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOS
|
|||
$result = restrictedArea($user, 'don', $id);
|
||||
|
||||
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
|
||||
$hookmanager=new HookManager($db);
|
||||
$hookmanager->initHooks(array('doncard'));
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -95,8 +95,6 @@ if ($id > 0 || ! empty($ref))
|
|||
}
|
||||
|
||||
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
|
||||
$hookmanager=new HookManager($db);
|
||||
$hookmanager->initHooks(array('invoicecard'));
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -637,7 +637,7 @@ class Facture extends CommonInvoice
|
|||
*/
|
||||
function createFromOrder($object)
|
||||
{
|
||||
global $conf,$user,$langs;
|
||||
global $conf,$user,$langs,$hookmanager;
|
||||
|
||||
$error=0;
|
||||
|
||||
|
|
@ -701,8 +701,6 @@ class Facture extends CommonInvoice
|
|||
if ($ret > 0)
|
||||
{
|
||||
// Actions hooked (by external module)
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
|
||||
$hookmanager=new HookManager($this->db);
|
||||
$hookmanager->initHooks(array('invoicedao'));
|
||||
|
||||
$parameters=array('objFrom'=>$object);
|
||||
|
|
|
|||
|
|
@ -97,8 +97,6 @@ $usehm=(! empty($conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE)?$conf->global->MA
|
|||
$object=new Facture($db);
|
||||
|
||||
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
|
||||
$hookmanager=new HookManager($db);
|
||||
$hookmanager->initHooks(array('invoicecard'));
|
||||
|
||||
$now=dol_now();
|
||||
|
|
|
|||
|
|
@ -41,8 +41,6 @@ if ($user->societe_id) $socid=$user->societe_id;
|
|||
$result = restrictedArea($user, 'tax', '', '', 'charges');
|
||||
|
||||
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
|
||||
$hookmanager=new HookManager($db);
|
||||
$hookmanager->initHooks(array('taxvatcard'));
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -210,7 +210,7 @@ class Contact extends CommonObject
|
|||
*/
|
||||
function update($id, $user=0, $notrigger=0, $action='update')
|
||||
{
|
||||
global $conf, $langs;
|
||||
global $conf, $langs, $hookmanager;
|
||||
|
||||
$error=0;
|
||||
|
||||
|
|
@ -266,8 +266,6 @@ class Contact extends CommonObject
|
|||
unset($this->state);
|
||||
|
||||
// Actions on extra fields (by external module or standard code)
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
|
||||
$hookmanager=new HookManager($this->db);
|
||||
$hookmanager->initHooks(array('contactdao'));
|
||||
$parameters=array('socid'=>$this->id);
|
||||
$reshook=$hookmanager->executeHooks('insertExtraFields',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
|
||||
|
|
|
|||
|
|
@ -65,8 +65,6 @@ if (! empty($canvas))
|
|||
$result = restrictedArea($user, 'contact', $id, 'socpeople&societe', '', '', '', $objcanvas); // If we create a contact with no company (shared contacts), no check on write permission
|
||||
|
||||
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
|
||||
$hookmanager=new HookManager($db);
|
||||
$hookmanager->initHooks(array('contactcard'));
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -59,8 +59,6 @@ $result=restrictedArea($user,'contrat',$id);
|
|||
$usehm=(! empty($conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE)?$conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE:0);
|
||||
|
||||
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
|
||||
$hookmanager=new HookManager($db);
|
||||
$hookmanager->initHooks(array('contractcard'));
|
||||
|
||||
$object = new Contrat($db);
|
||||
|
|
|
|||
|
|
@ -2468,16 +2468,12 @@ abstract class CommonObject
|
|||
*/
|
||||
function showLinkedObjectBlock($hookmanager=false)
|
||||
{
|
||||
global $conf,$langs,$bc;
|
||||
global $conf,$langs,$hookmanager;
|
||||
global $bc;
|
||||
|
||||
$this->fetchObjectLinked();
|
||||
|
||||
// Bypass the default method
|
||||
if (! is_object($hookmanager))
|
||||
{
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
|
||||
$hookmanager=new HookManager($this->db);
|
||||
}
|
||||
$hookmanager->initHooks(array('commonobject'));
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('showLinkedObjectBlock',$parameters,$this,$action); // Note that $action and $object may have been modified by hook
|
||||
|
|
|
|||
|
|
@ -590,18 +590,10 @@ class FormFile
|
|||
*/
|
||||
function list_of_documents($filearray,$object,$modulepart,$param='',$forcedownload=0,$relativepath='',$permtodelete=1,$useinecm=0,$textifempty='',$maxlength=0,$title='',$url='')
|
||||
{
|
||||
global $user, $conf, $langs;
|
||||
global $bc, $hookmanager;
|
||||
global $user, $conf, $langs, $hookmanager;
|
||||
global $bc;
|
||||
global $sortfield, $sortorder, $maxheightmini;
|
||||
|
||||
if (! is_object($hookmanager))
|
||||
{
|
||||
if (! class_exists('HookManager')) {
|
||||
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
|
||||
require DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
|
||||
$hookmanager=new HookManager($this->db);
|
||||
}
|
||||
}
|
||||
$hookmanager->initHooks(array('formfile'));
|
||||
|
||||
$parameters=array(
|
||||
|
|
|
|||
|
|
@ -216,20 +216,11 @@ class FormMail
|
|||
*/
|
||||
function get_form($addfileaction='addfile',$removefileaction='removefile')
|
||||
{
|
||||
global $conf, $langs, $user;
|
||||
global $hookmanager;
|
||||
global $conf, $langs, $user, $hookmanager;
|
||||
|
||||
$langs->load("other");
|
||||
$langs->load("mails");
|
||||
|
||||
if (! is_object($hookmanager))
|
||||
{
|
||||
if (! class_exists('HookManager')) {
|
||||
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
|
||||
require DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
|
||||
$hookmanager=new HookManager($this->db);
|
||||
}
|
||||
}
|
||||
$hookmanager->initHooks(array('formmail'));
|
||||
|
||||
$parameters=array(
|
||||
|
|
|
|||
|
|
@ -65,15 +65,8 @@ function dol_dir_list($path, $types="all", $recursive=0, $filter="", $excludefil
|
|||
$path=preg_replace('/([\\/]+)$/i','',$path);
|
||||
$newpath=dol_osencode($path);
|
||||
|
||||
if (! $nohook) {
|
||||
if (! is_object($hookmanager))
|
||||
{
|
||||
if (! class_exists('HookManager')) {
|
||||
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
|
||||
require DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
|
||||
$hookmanager=new HookManager($db);
|
||||
}
|
||||
}
|
||||
if (! $nohook)
|
||||
{
|
||||
$hookmanager->initHooks(array('fileslib'));
|
||||
|
||||
$parameters=array(
|
||||
|
|
@ -653,14 +646,6 @@ function dol_move_uploaded_file($src_file, $dest_file, $allowoverwrite, $disable
|
|||
return -2;
|
||||
}
|
||||
|
||||
if (! is_object($hookmanager))
|
||||
{
|
||||
if (! class_exists('HookManager')) {
|
||||
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
|
||||
require DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
|
||||
}
|
||||
$hookmanager=new HookManager($db);
|
||||
}
|
||||
$hookmanager->initHooks(array('fileslib'));
|
||||
|
||||
$parameters=array('filename' => $file_name, 'varfiles' => $varfiles, 'allowoverwrite' => $allowoverwrite);
|
||||
|
|
@ -722,14 +707,6 @@ function dol_delete_file($file,$disableglob=0,$nophperrors=0,$nohook=0,$object=n
|
|||
|
||||
if (empty($nohook))
|
||||
{
|
||||
if (! is_object($hookmanager))
|
||||
{
|
||||
if (! class_exists('HookManager')) {
|
||||
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
|
||||
require DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
|
||||
$hookmanager=new HookManager($db);
|
||||
}
|
||||
}
|
||||
$hookmanager->initHooks(array('fileslib'));
|
||||
|
||||
$parameters=array(
|
||||
|
|
|
|||
|
|
@ -131,11 +131,6 @@ function dol_loginfunction($langs,$conf,$mysoc)
|
|||
global $smartphone,$hookmanager;
|
||||
|
||||
// Instantiate hooks of thirdparty module only if not already define
|
||||
if (! is_object($hookmanager))
|
||||
{
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
|
||||
$hookmanager=new HookManager($db);
|
||||
}
|
||||
$hookmanager->initHooks(array('mainloginpage'));
|
||||
|
||||
$langcode=(GETPOST('lang')?((is_object($langs)&&$langs->defaultlang)?$langs->defaultlang:'auto'):GETPOST('lang'));
|
||||
|
|
|
|||
|
|
@ -59,8 +59,6 @@ if ($user->societe_id) $socid=$user->societe_id;
|
|||
$result=restrictedArea($user, $origin, $origin_id);
|
||||
|
||||
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
|
||||
$hookmanager=new HookManager($db);
|
||||
$hookmanager->initHooks(array('expeditioncard'));
|
||||
|
||||
$action = GETPOST('action','alpha');
|
||||
|
|
|
|||
|
|
@ -60,8 +60,6 @@ if ($user->societe_id) $socid=$user->societe_id;
|
|||
$result = restrictedArea($user, 'ficheinter', $id, 'fichinter');
|
||||
|
||||
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
|
||||
$hookmanager=new HookManager($db);
|
||||
$hookmanager->initHooks(array('interventioncard'));
|
||||
|
||||
$object = new Fichinter($db);
|
||||
|
|
|
|||
|
|
@ -70,8 +70,6 @@ if ($user->societe_id) $socid=$user->societe_id;
|
|||
$result = restrictedArea($user, 'commande_fournisseur', $id,'');
|
||||
|
||||
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
|
||||
$hookmanager=new HookManager($db);
|
||||
$hookmanager->initHooks(array('ordersuppliercard'));
|
||||
|
||||
$object = new CommandeFournisseur($db);
|
||||
|
|
|
|||
|
|
@ -61,8 +61,6 @@ if (! empty($user->societe_id)) $socid=$user->societe_id;
|
|||
$result = restrictedArea($user, 'fournisseur', $id, 'facture_fourn', 'facture');
|
||||
|
||||
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
|
||||
$hookmanager=new HookManager($db);
|
||||
$hookmanager->initHooks(array('invoicesuppliercard'));
|
||||
|
||||
$object=new FactureFournisseur($db);
|
||||
|
|
|
|||
|
|
@ -57,8 +57,6 @@ if (! $sortorder) $sortorder="ASC";
|
|||
if (! $sortfield) $sortfield="nom";
|
||||
|
||||
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
|
||||
$hookmanager=new HookManager($db);
|
||||
$hookmanager->initHooks(array('supplierlist'));
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -34,8 +34,6 @@ $_GET['mainmenu']=GETPOST('mainmenu', 'alpha')?GETPOST('mainmenu', 'alpha'):'hom
|
|||
$action=GETPOST('action');
|
||||
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
|
||||
$hookmanager=new HookManager($db);
|
||||
$hookmanager->initHooks(array('index'));
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -603,8 +603,6 @@ if (! defined('NOLOGIN'))
|
|||
|
||||
// Hooks on successfull login
|
||||
$action='';
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
|
||||
$hookmanager=new HookManager($db);
|
||||
$hookmanager->initHooks(array('login'));
|
||||
$parameters=array('dol_authmode'=>$dol_authmode);
|
||||
$reshook=$hookmanager->executeHooks('afterLogin',$parameters,$user,$action); // Note that $action and $object may have been modified by some hooks
|
||||
|
|
@ -1194,12 +1192,7 @@ function top_menu($head, $title='', $target='', $disablejs=0, $disablehead=0, $a
|
|||
global $dolibarr_main_authentication;
|
||||
global $hookmanager,$menumanager;
|
||||
|
||||
// Instantiate hooks of thirdparty module only if not already define
|
||||
if (! is_object($hookmanager))
|
||||
{
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
|
||||
$hookmanager=new HookManager($db);
|
||||
}
|
||||
// Instantiate hooks of thirdparty module
|
||||
$hookmanager->initHooks(array('toprightmenu'));
|
||||
|
||||
$toprightmenu='';
|
||||
|
|
@ -1426,11 +1419,6 @@ function left_menu($menu_array_before, $helppagename='', $moresearchform='', $me
|
|||
$bookmarks='';
|
||||
|
||||
// Instantiate hooks of thirdparty module
|
||||
if (! is_object($hookmanager))
|
||||
{
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
|
||||
$hookmanager=new HookManager($db);
|
||||
}
|
||||
$hookmanager->initHooks(array('searchform','leftblock'));
|
||||
|
||||
if (empty($_SESSION['dol_hide_leftmenu']))
|
||||
|
|
|
|||
|
|
@ -186,9 +186,7 @@ if (! empty($conf->global->MAIN_ONLY_LOGIN_ALLOWED))
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Create object $mysoc (A thirdparty object that contains properties of companies managed by Dolibarr.
|
||||
*/
|
||||
// Create object $mysoc (A thirdparty object that contains properties of companies managed by Dolibarr.
|
||||
if (! defined('NOREQUIREDB') && ! defined('NOREQUIRESOC'))
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT .'/societe/class/societe.class.php';
|
||||
|
|
@ -207,6 +205,12 @@ if (! defined('NOREQUIRETRAN'))
|
|||
$langs->setDefaultLang((! empty($conf->global->MAIN_LANG_DEFAULT)?$conf->global->MAIN_LANG_DEFAULT:''));
|
||||
}
|
||||
|
||||
|
||||
// Create the global $hookmanager object
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
|
||||
$hookmanager=new HookManager($db);
|
||||
|
||||
|
||||
if (! defined('MAIN_LABEL_MENTION_NPR') ) define('MAIN_LABEL_MENTION_NPR','NPR');
|
||||
|
||||
// We force feature to help debug
|
||||
|
|
|
|||
|
|
@ -418,7 +418,7 @@ class Product extends CommonObject
|
|||
*/
|
||||
function update($id, $user, $notrigger=false, $action='update')
|
||||
{
|
||||
global $langs, $conf;
|
||||
global $langs, $conf, $hookmanager;
|
||||
|
||||
$error=0;
|
||||
|
||||
|
|
@ -500,8 +500,6 @@ class Product extends CommonObject
|
|||
}
|
||||
|
||||
// Actions on extra fields (by external module or standard code)
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
|
||||
$hookmanager=new HookManager($this->db);
|
||||
$hookmanager->initHooks(array('productdao'));
|
||||
$parameters=array('id'=>$this->id);
|
||||
$reshook=$hookmanager->executeHooks('insertExtraFields',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
|
||||
|
|
|
|||
|
|
@ -78,8 +78,6 @@ $fieldtype = (! empty($ref) ? 'ref' : 'rowid');
|
|||
$result=restrictedArea($user,'produit|service',$fieldvalue,'product&product','','',$fieldtype,$objcanvas);
|
||||
|
||||
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
|
||||
$hookmanager=new HookManager($db);
|
||||
$hookmanager->initHooks(array('productcard'));
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -59,8 +59,6 @@ if ($user->societe_id) $socid=$user->societe_id;
|
|||
$result=restrictedArea($user,'produit|service&fournisseur',$fieldvalue,'product&product','','',$fieldtype);
|
||||
|
||||
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
|
||||
$hookmanager=new HookManager($db);
|
||||
$hookmanager->initHooks(array('pricesuppliercard'));
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -50,8 +50,6 @@ if ($user->societe_id > 0) $socid=$user->societe_id;
|
|||
$result = restrictedArea($user, 'projet', $id);
|
||||
|
||||
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
|
||||
$hookmanager=new HookManager($db);
|
||||
$hookmanager->initHooks(array('projectcard'));
|
||||
|
||||
$object = new Project($db);
|
||||
|
|
|
|||
|
|
@ -55,8 +55,6 @@ if ($user->societe_id > 0) $socid = $user->societe_id;
|
|||
$result = restrictedArea($user, 'projet', $id);
|
||||
|
||||
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
|
||||
$hookmanager=new HookManager($db);
|
||||
$hookmanager->initHooks(array('projecttaskcard'));
|
||||
|
||||
$progress=GETPOST('progress', 'int');
|
||||
|
|
|
|||
|
|
@ -42,8 +42,6 @@ if ($user->societe_id > 0) $socid = $user->societe_id;
|
|||
if (! $user->rights->projet->lire) accessforbidden();
|
||||
|
||||
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
|
||||
$hookmanager=new HookManager($db);
|
||||
$hookmanager->initHooks(array('projecttaskcard'));
|
||||
|
||||
$object = new Task($db);
|
||||
|
|
|
|||
|
|
@ -38,8 +38,6 @@ global $dolibarr_main_demo;
|
|||
if (empty($dolibarr_main_demo)) accessforbidden('Parameter dolibarr_main_demo must be defined in conf file with value "default login,default pass" to enable the demo entry page',1,1,1);
|
||||
|
||||
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
|
||||
$hookmanager=new HookManager($db);
|
||||
$hookmanager->initHooks(array('demo'));
|
||||
|
||||
$demoprofiles=array(
|
||||
|
|
|
|||
|
|
@ -38,8 +38,6 @@ if ($user->societe_id) $socid=$user->societe_id;
|
|||
$result = restrictedArea($user, 'societe', $socid, '&societe');
|
||||
|
||||
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
|
||||
$hookmanager=new HookManager($db);
|
||||
$hookmanager->initHooks(array('agendathirdparty'));
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -380,7 +380,7 @@ class Societe extends CommonObject
|
|||
*/
|
||||
function update($id, $user='', $call_trigger=1, $allowmodcodeclient=0, $allowmodcodefournisseur=0, $action='update', $nosyncmember=1)
|
||||
{
|
||||
global $langs,$conf;
|
||||
global $langs,$conf,$hookmanager;
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||
|
||||
$error=0;
|
||||
|
|
@ -612,8 +612,6 @@ class Societe extends CommonObject
|
|||
$this->AddFournisseurInCategory($this->fournisseur_categorie);
|
||||
|
||||
// Actions on extra fields (by external module or standard code)
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
|
||||
$hookmanager=new HookManager($this->db);
|
||||
$hookmanager->initHooks(array('thirdpartydao'));
|
||||
$parameters=array('socid'=>$this->id);
|
||||
$reshook=$hookmanager->executeHooks('insertExtraFields',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
|
||||
|
|
@ -1064,8 +1062,6 @@ class Societe extends CommonObject
|
|||
if (! $error)
|
||||
{
|
||||
// Additionnal action by hooks
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
|
||||
$hookmanager=new HookManager($this->db);
|
||||
$hookmanager->initHooks(array('thirdpartydao'));
|
||||
$parameters=array(); $action='delete';
|
||||
$reshook=$hookmanager->executeHooks('deleteThirdparty',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
|
||||
|
|
|
|||
|
|
@ -38,8 +38,6 @@ if ($user->societe_id) $socid=$user->societe_id;
|
|||
$result = restrictedArea($user, 'societe', $socid, '&societe');
|
||||
|
||||
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
|
||||
$hookmanager=new HookManager($db);
|
||||
$hookmanager->initHooks(array('infothirdparty'));
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -70,8 +70,6 @@ if (! empty($canvas))
|
|||
$result = restrictedArea($user, 'societe', $socid, '&societe', '', 'fk_soc', 'rowid', $objcanvas);
|
||||
|
||||
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
|
||||
$hookmanager=new HookManager($db);
|
||||
$hookmanager->initHooks(array('thirdpartycard'));
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1079,7 +1079,7 @@ class User extends CommonObject
|
|||
*/
|
||||
function update($user,$notrigger=0,$nosyncmember=0,$nosyncmemberpass=0)
|
||||
{
|
||||
global $conf, $langs;
|
||||
global $conf, $langs, $hookmanager;
|
||||
|
||||
$nbrowsaffected=0;
|
||||
$error=0;
|
||||
|
|
@ -1218,8 +1218,6 @@ class User extends CommonObject
|
|||
}
|
||||
|
||||
// Actions on extra fields (by external module or standard code)
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
|
||||
$hookmanager=new HookManager($this->db);
|
||||
$hookmanager->initHooks(array('userdao'));
|
||||
$parameters=array('socid'=>$this->id);
|
||||
$reshook=$hookmanager->executeHooks('insertExtraFields',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
|
||||
|
|
|
|||
|
|
@ -84,8 +84,6 @@ $object = new User($db);
|
|||
$extrafields = new ExtraFields($db);
|
||||
|
||||
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
|
||||
$hookmanager=new HookManager($db);
|
||||
$hookmanager->initHooks(array('usercard'));
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -52,11 +52,6 @@ $passwordmd5 = GETPOST('passwordmd5');
|
|||
$conf->entity = (GETPOST('entity') ? GETPOST('entity') : 1);
|
||||
|
||||
// Instantiate hooks of thirdparty module only if not already define
|
||||
if (! is_object($hookmanager))
|
||||
{
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
|
||||
$hookmanager=new HookManager($db);
|
||||
}
|
||||
$hookmanager->initHooks(array('passwordforgottenpage'));
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user