Fix object not defined

This commit is contained in:
Laurent Destailleur 2022-06-03 11:23:10 +02:00
parent b3d5258596
commit 303b6d6e9e

View File

@ -504,7 +504,7 @@ class EmailCollector extends CommonObject
*/
public function getNomUrl($withpicto = 0, $option = '', $notooltip = 0, $morecss = '', $save_lastsearch_value = -1)
{
global $conf, $langs, $hookmanager;
global $conf, $langs, $action, $hookmanager;
if (!empty($conf->dol_no_mouse_hover)) {
$notooltip = 1; // Force disable tooltips
@ -537,13 +537,6 @@ class EmailCollector extends CommonObject
}
$linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"';
$linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"';
/*
$hookmanager->initHooks(array('myobjectdao'));
$parameters=array('id'=>$this->id);
$reshook=$hookmanager->executeHooks('getnomurltooltip',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
if ($reshook > 0) $linkclose = $hookmanager->resPrint;
*/
} else {
$linkclose = ($morecss ? ' class="'.$morecss.'"' : '');
}
@ -562,7 +555,6 @@ class EmailCollector extends CommonObject
$result .= $linkend;
//if ($withpicto != 2) $result.=(($addlabel && $this->label) ? $sep . dol_trunc($this->label, ($addlabel > 1 ? $addlabel : 0)) : '');
global $action, $hookmanager;
$hookmanager->initHooks(array('emailcollectordao'));
$parameters = array('id'=>$this->id, 'getnomurl'=>$result);
$reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
@ -965,6 +957,7 @@ class EmailCollector extends CommonObject
public function doCollectOneCollector()
{
global $conf, $langs, $user;
global $hookmanager;
//$conf->global->SYSLOG_FILE = 'DOL_DATA_ROOT/dolibarr_mydedicatedlofile.log';
@ -2009,11 +2002,16 @@ class EmailCollector extends CommonObject
'object' => 'Mo'),
);
global $hookmanager;
if (!is_object($hookmanager)) {
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
$hookmanager = new HookManager($this->db);
}
$hookmanager->initHooks(array('emailcolector'));
$parameters = array('arrayobject' => $arrayobject);
$reshook = $hookmanager->executeHooks('addmoduletoeamailcollectorjoinpiece', $parameters); // Note that $action and $object may have been modified by some hooks
if ($reshook > 0) $arrayobject = $hookmanager->resArray;
if ($reshook > 0) {
$arrayobject = $hookmanager->resArray;
}
$resultobj = array();
@ -2365,8 +2363,6 @@ class EmailCollector extends CommonObject
} elseif (substr($operation['type'], 0, 4) == 'hook') {
// Create event specific on hook
// this code action is hook..... for support this call
global $hookmanager;
if (!is_object($hookmanager)) {
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
$hookmanager = new HookManager($this->db);
@ -2391,9 +2387,9 @@ class EmailCollector extends CommonObject
'header'=>$header,
'attachments'=>$attachments,
);
$res = $hookmanager->executeHooks('doCollectOneCollector', $parameters, $this, $operation['type']);
$reshook = $hookmanager->executeHooks('doCollectOneCollector', $parameters, $this, $operation['type']);
if ($res < 0) {
if ($reshook < 0) {
$errorforthisaction++;
$this->error = $hookmanager->resPrint;
}