From 29ee5dffc43f31f19093f0a9fe1535e1755033c8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 4 Jun 2018 12:55:55 +0200 Subject: [PATCH] Clean code --- htdocs/comm/action/class/actioncomm.class.php | 11 +------- htdocs/contact/class/contact.class.php | 25 ++++++------------- htdocs/core/lib/functions.lib.php | 12 +++++++-- htdocs/langs/en_US/accountancy.lang | 2 +- htdocs/langs/en_US/errors.lang | 2 +- htdocs/langs/en_US/mails.lang | 2 +- htdocs/langs/en_US/stripe.lang | 4 +-- .../template/class/myobject.class.php | 16 +++++++++++- htdocs/product/class/product.class.php | 11 +------- htdocs/projet/class/project.class.php | 16 +++--------- htdocs/societe/class/societe.class.php | 11 +------- htdocs/theme/eldy/style.css.php | 8 +++--- htdocs/user/class/user.class.php | 22 ++++++---------- htdocs/user/class/usergroup.class.php | 22 ++++++---------- 14 files changed, 63 insertions(+), 101 deletions(-) diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index be9c6f98489f6..5b0c4388d06f4 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -1258,11 +1258,7 @@ function getNomUrl($withpicto=0, $maxlength=0, $classname='', $option='', $overw $linkclose.=' title="'.dol_escape_htmltag($tooltip, 1).'"'; $linkclose.=' class="'.$classname.' classfortooltip"'; - /*if (! is_object($hookmanager)) - { - include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; - $hookmanager=new HookManager($this->db); - } + /* $hookmanager->initHooks(array('actiondao')); $parameters=array('id'=>$this->id); $reshook=$hookmanager->executeHooks('getnomurltooltip',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks @@ -1321,11 +1317,6 @@ function getNomUrl($withpicto=0, $maxlength=0, $classname='', $option='', $overw $result.=$linkend; global $action; - if (! is_object($hookmanager)) - { - include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; - $hookmanager=new HookManager($this->db); - } $hookmanager->initHooks(array('actiondao')); $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 diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index 5053e07212f2d..410f199b88697 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -1111,7 +1111,6 @@ function getNomUrl($withpicto=0, $option='', $maxlen=0, $moreparam='', $save_las $url .= $moreparam; - $linkstart = 'global->MAIN_OPTIMIZEFORTEXTBROWSER)) @@ -1121,20 +1120,17 @@ function getNomUrl($withpicto=0, $option='', $maxlen=0, $moreparam='', $save_las } $linkclose.= ' title="'.dol_escape_htmltag($label, 1).'"'; $linkclose.= ' class="classfortooltip"'; - } - $linkclose.='>'; - /*if (! is_object($hookmanager)) - { - include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; - $hookmanager=new HookManager($this->db); + /* + $hookmanager->initHooks(array('contactdao')); + $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; + */ } - $hookmanager->initHooks(array('contactdao')); - $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;*/ - $linkstart.=$linkclose; + $linkstart = ''; $linkend=''; if ($option == 'xxx') @@ -1149,11 +1145,6 @@ function getNomUrl($withpicto=0, $option='', $maxlen=0, $moreparam='', $save_las $result.=$linkend; global $action; - if (! is_object($hookmanager)) - { - include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; - $hookmanager=new HookManager($this->db); - } $hookmanager->initHooks(array('contactdao')); $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 diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 70c8edcc19004..f61490b89e823 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -1008,6 +1008,14 @@ function dol_syslog($message, $level = LOG_INFO, $ident = 0, $suffixinfilename=' // If syslog module enabled if (empty($conf->syslog->enabled)) return; + if ($ident < 0) + { + foreach ($conf->loghandlers as $loghandlerinstance) + { + $loghandlerinstance->setIdent($ident); + } + } + if (! empty($message)) { // Test log level @@ -1060,7 +1068,7 @@ function dol_syslog($message, $level = LOG_INFO, $ident = 0, $suffixinfilename=' unset($data); } - if (! empty($ident)) + if ($ident > 0) { foreach ($conf->loghandlers as $loghandlerinstance) { @@ -4296,7 +4304,7 @@ function print_fleche_navigation($page, $file, $options='', $nextpage=0, $betwee print '