Skip to content

Commit

Permalink
Clean code
Browse files Browse the repository at this point in the history
  • Loading branch information
eldy committed Jun 4, 2018
1 parent a6104d1 commit 29ee5df
Show file tree
Hide file tree
Showing 14 changed files with 63 additions and 101 deletions.
11 changes: 1 addition & 10 deletions htdocs/comm/action/class/actioncomm.class.php
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
25 changes: 8 additions & 17 deletions htdocs/contact/class/contact.class.php
Expand Up @@ -1111,7 +1111,6 @@ function getNomUrl($withpicto=0, $option='', $maxlen=0, $moreparam='', $save_las

$url .= $moreparam;

$linkstart = '<a href="'.$url.'"';
$linkclose="";
if (empty($notooltip)) {
if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER))
Expand All @@ -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 = '<a href="'.$url.'"';
$linkstart.=$linkclose.'>';
$linkend='</a>';

if ($option == 'xxx')
Expand All @@ -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
Expand Down
12 changes: 10 additions & 2 deletions htdocs/core/lib/functions.lib.php
Expand Up @@ -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
Expand Down Expand Up @@ -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)
{
Expand Down Expand Up @@ -4296,7 +4304,7 @@ function print_fleche_navigation($page, $file, $options='', $nextpage=0, $betwee
print '<div class="pagination"><ul>';
if ((int) $limit >= 0 && empty($hideselectlimit))
{
$pagesizechoices='10:10,20:20,30:30,40:40,50:50,100:100,250:250,500:500,1000:1000,5000:5000';
$pagesizechoices='10:10,15:15,20:20,30:30,40:40,50:50,100:100,250:250,500:500,1000:1000,5000:5000';
//$pagesizechoices.=',0:'.$langs->trans("All"); // Not yet supported
//$pagesizechoices.=',2:2';
if (! empty($conf->global->MAIN_PAGESIZE_CHOICES)) $pagesizechoices=$conf->global->MAIN_PAGESIZE_CHOICES;
Expand Down
2 changes: 1 addition & 1 deletion htdocs/langs/en_US/accountancy.lang
Expand Up @@ -40,7 +40,7 @@ AccountWithNonZeroValues=Accounts with non zero values
ListOfAccounts=List of accounts

MainAccountForCustomersNotDefined=Main accounting account for customers not defined in setup
MainAccountForSuppliersNotDefined=Main accounting account for veo not defined in setup
MainAccountForSuppliersNotDefined=Main accounting account for vendors not defined in setup
MainAccountForUsersNotDefined=Main accounting account for users not defined in setup
MainAccountForVatPaymentNotDefined=Main accounting account for VAT payment not defined in setup

Expand Down
2 changes: 1 addition & 1 deletion htdocs/langs/en_US/errors.lang
Expand Up @@ -32,7 +32,7 @@ ErrorBarCodeRequired=Bar code required
ErrorCustomerCodeAlreadyUsed=Customer code already used
ErrorBarCodeAlreadyUsed=Bar code already used
ErrorPrefixRequired=Prefix required
ErrorBadSupplierCodeSyntax=Bad syntax for endor code
ErrorBadSupplierCodeSyntax=Bad syntax for vendor code
ErrorSupplierCodeRequired=Vendor code required
ErrorSupplierCodeAlreadyUsed=Vendor code already used
ErrorBadParameters=Bad parameters
Expand Down
2 changes: 1 addition & 1 deletion htdocs/langs/en_US/mails.lang
Expand Up @@ -166,4 +166,4 @@ InGoingEmailSetup=Incoming email setup
OutGoingEmailSetupForEmailing=Outgoing email setup (for mass emailing)
DefaultOutgoingEmailSetup=Default outgoing email setup
Information=Information
ContactsWithThirdpartyFilter=Contact avec filtre client
ContactsWithThirdpartyFilter=Contacts avec filtre client
4 changes: 2 additions & 2 deletions htdocs/langs/en_US/stripe.lang
Expand Up @@ -58,8 +58,8 @@ NameOnCard=Name on card
CardNumber=Card Number
ExpiryDate=Expiry Date
CVN=CVN
DeleteACard=Delete Card record
ConfirmDeleteCard=Are you sure you want to delete this Card record?
DeleteACard=Delete Card
ConfirmDeleteCard=Are you sure you want to delete this Credit or Debit card?
CreateCustomerOnStripe=Create customer on Stripe
CreateCardOnStripe=Create card on Stripe
ShowInStripe=Show in Stripe
16 changes: 15 additions & 1 deletion htdocs/modulebuilder/template/class/myobject.class.php
Expand Up @@ -285,7 +285,7 @@ public function delete(User $user, $notrigger = false)
*/
function getNomUrl($withpicto=0, $option='', $notooltip=0, $morecss='', $save_lastsearch_value=-1)
{
global $db, $conf, $langs;
global $db, $conf, $langs, $hoomanager;
global $dolibarr_main_authentication, $dolibarr_main_demo;
global $menumanager;

Expand Down Expand Up @@ -318,6 +318,13 @@ function getNomUrl($withpicto=0, $option='', $notooltip=0, $morecss='', $save_la
}
$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.'"':'');

Expand All @@ -331,6 +338,13 @@ function getNomUrl($withpicto=0, $option='', $notooltip=0, $morecss='', $save_la
$result .= $linkend;
//if ($withpicto != 2) $result.=(($addlabel && $this->label) ? $sep . dol_trunc($this->label, ($addlabel > 1 ? $addlabel : 0)) : '');

global $action;
$hookmanager->initHooks(array('myobjectdao'));
$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
if ($reshook > 0) $result = $hookmanager->resPrint;
else $result .= $hookmanager->resPrint;

return $result;
}

Expand Down
11 changes: 1 addition & 10 deletions htdocs/product/class/product.class.php
Expand Up @@ -3599,11 +3599,7 @@ function getNomUrl($withpicto=0, $option='', $maxlength=0, $save_lastsearch_valu
$linkclose.= ' title="'.dol_escape_htmltag($label, 1, 1).'"';
$linkclose.= ' class="classfortooltip"';

/*if (! is_object($hookmanager))
{
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('getnomurltooltip',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
Expand Down Expand Up @@ -3642,11 +3638,6 @@ function getNomUrl($withpicto=0, $option='', $maxlength=0, $save_lastsearch_valu
$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('productdao'));
$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
Expand Down
16 changes: 4 additions & 12 deletions htdocs/projet/class/project.class.php
Expand Up @@ -940,7 +940,7 @@ function LibStatut($statut, $mode=0)
*/
function getNomUrl($withpicto=0, $option='', $addlabel=0, $moreinpopup='', $sep=' - ', $notooltip=0, $save_lastsearch_value=-1)
{
global $conf, $langs, $user;
global $conf, $langs, $user, $hookmanager;

if (! empty($conf->dol_no_mouse_hover)) $notooltip=1; // Force disable tooltips

Expand Down Expand Up @@ -989,10 +989,7 @@ function getNomUrl($withpicto=0, $option='', $addlabel=0, $moreinpopup='', $sep=
$linkclose.=' title="'.dol_escape_htmltag($label, 1).'"';
$linkclose.=' class="classfortooltip"';

/*if (! is_object($hookmanager)) {
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
$hookmanager=new HookManager($this->db);
}
/*
$hookmanager->initHooks(array('projectdao'));
$parameters=array('id'=>$this->id);
// Note that $action and $object may have been modified by some hooks
Expand All @@ -1016,11 +1013,6 @@ function getNomUrl($withpicto=0, $option='', $addlabel=0, $moreinpopup='', $sep=
if ($withpicto != 2) $result.=(($addlabel && $this->title) ? $sep . dol_trunc($this->title, ($addlabel > 1 ? $addlabel : 0)) : '');

global $action;
if (! is_object($hookmanager))
{
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
$hookmanager=new HookManager($this->db);
}
$hookmanager->initHooks(array('projectdao'));
$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
Expand Down Expand Up @@ -1727,7 +1719,7 @@ function load_board($user)
//$socid=$user->societe_id;

if (! $user->rights->projet->all->lire) $projectsListId = $this->getProjectsAuthorizedForUser($user,0,1,$socid);

$sql = "SELECT p.rowid, p.fk_statut as status, p.fk_opp_status, p.datee as datee";
$sql.= " FROM (".MAIN_DB_PREFIX."projet as p";
$sql.= ")";
Expand All @@ -1741,7 +1733,7 @@ function load_board($user)
//if ($socid || ! $user->rights->societe->client->voir) $sql.= " AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc = ".$socid.")";
// For external user, no check is done on company permission because readability is managed by public status of project and assignement.
//if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND ((s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id.") OR (s.rowid IS NULL))";

//print $sql;
$resql=$this->db->query($sql);
if ($resql)
Expand Down
11 changes: 1 addition & 10 deletions htdocs/societe/class/societe.class.php
Expand Up @@ -2098,11 +2098,7 @@ function getNomUrl($withpicto=0, $option='', $maxlen=0, $notooltip=0, $save_last
$linkclose.= ' title="'.dol_escape_htmltag($label, 1).'"';
$linkclose.=' class="classfortooltip refurl"';

/*if (! is_object($hookmanager))
{
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
$hookmanager=new HookManager($this->db);
}
/*
$hookmanager->initHooks(array('thirdpartydao'));
$parameters=array('id'=>$this->id);
$reshook=$hookmanager->executeHooks('getnomurltooltip',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
Expand All @@ -2125,11 +2121,6 @@ function getNomUrl($withpicto=0, $option='', $maxlen=0, $notooltip=0, $save_last
$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('thirdpartydao'));
$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
Expand Down
8 changes: 4 additions & 4 deletions htdocs/theme/eldy/style.css.php
Expand Up @@ -44,8 +44,8 @@
$colorbacktabactive='234,234,234';
$colorbacklineimpair1='255,255,255'; // line impair
$colorbacklineimpair2='255,255,255'; // line impair
$colorbacklinepair1='246,246,246'; // line pair
$colorbacklinepair2='246,246,246'; // line pair
$colorbacklinepair1='250,250,250'; // line pair
$colorbacklinepair2='250,250,250'; // line pair
$colorbacklinepairhover='238,246,252'; // line pair
$colorbacklinebreak='214,218,220'; // line break
$colorbackbody='255,255,255';
Expand Down Expand Up @@ -3103,7 +3103,7 @@
/* Prepare to remove class pair - impair */

.noborder > tbody > tr:nth-child(even):not(.liste_titre), .liste > tbody > tr:nth-child(even):not(.liste_titre),
.border > tbody > tr:nth-of-type(even):not(.liste_titre), .liste > tbody > tr:nth-of-type(even):not(.liste_titre) {
div:not(.fichecenter):not(.fichehalfleft):not(.ficheaddleft) > .border > tbody > tr:nth-of-type(even):not(.liste_titre), .liste > tbody > tr:nth-of-type(even):not(.liste_titre) {
background: linear-gradient(bottom, rgb(<?php echo $colorbacklineimpair1; ?>) 85%, rgb(<?php echo $colorbacklineimpair2; ?>) 100%);
background: -o-linear-gradient(bottom, rgb(<?php echo $colorbacklineimpair1; ?>) 85%, rgb(<?php echo $colorbacklineimpair2; ?>) 100%);
background: -moz-linear-gradient(bottom, rgb(<?php echo $colorbacklineimpair1; ?>) 85%, rgb(<?php echo $colorbacklineimpair2; ?>) 100%);
Expand All @@ -3115,7 +3115,7 @@
}

.noborder > tbody > tr:nth-child(odd):not(.liste_titre), .liste > tbody > tr:nth-child(odd):not(.liste_titre),
.border > tbody > tr:nth-of-type(odd):not(.liste_titre), .liste > tbody > tr:nth-of-type(odd):not(.liste_titre)
div:not(.fichecenter):not(.fichehalfleft):not(.ficheaddleft) > .border > tbody > tr:nth-of-type(odd):not(.liste_titre), .liste > tbody > tr:nth-of-type(odd):not(.liste_titre)
{
background: linear-gradient(bottom, rgb(<?php echo $colorbacklinepair1; ?>) 85%, rgb(<?php echo $colorbacklinepair2; ?>) 100%);
background: -o-linear-gradient(bottom, rgb(<?php echo $colorbacklinepair1; ?>) 85%, rgb(<?php echo $colorbacklinepair2; ?>) 100%);
Expand Down
22 changes: 7 additions & 15 deletions htdocs/user/class/user.class.php
Expand Up @@ -2200,17 +2200,14 @@ function getNomUrl($withpictoimg=0, $option='', $infologin=0, $notooltip=0, $max
}
$linkclose.= ' title="'.dol_escape_htmltag($label, 1).'"';
$linkclose.= ' class="classfortooltip'.($morecss?' '.$morecss:'').'"';

/*
$hookmanager->initHooks(array('userdao'));
$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;
*/
}
/*if (! is_object($hookmanager))
{
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
$hookmanager=new HookManager($this->db);
}
$hookmanager->initHooks(array('userdao'));
$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.'>';
$linkend='</a>';
Expand Down Expand Up @@ -2240,11 +2237,6 @@ function getNomUrl($withpictoimg=0, $option='', $infologin=0, $notooltip=0, $max
$result.=$companylink;

global $action;
if (! is_object($hookmanager))
{
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
$hookmanager=new HookManager($this->db);
}
$hookmanager->initHooks(array('userdao'));
$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
Expand Down
22 changes: 7 additions & 15 deletions htdocs/user/class/usergroup.class.php
Expand Up @@ -835,17 +835,14 @@ function getNomUrl($withpicto=0, $option='', $notooltip=0, $morecss='', $save_la
}
$linkclose.= ' title="'.dol_escape_htmltag($label, 1, 1).'"';
$linkclose.= ' class="classfortooltip'.($morecss?' '.$morecss:'').'"';

/*
$hookmanager->initHooks(array('groupdao'));
$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;
*/
}
/*if (! is_object($hookmanager))
{
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
$hookmanager=new HookManager($this->db);
}
$hookmanager->initHooks(array('groupdao'));
$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 = '<a href="'.$url.'"';
$linkstart.=$linkclose.'>';
Expand All @@ -857,11 +854,6 @@ function getNomUrl($withpicto=0, $option='', $notooltip=0, $morecss='', $save_la
$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('groupdao'));
$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
Expand Down

0 comments on commit 29ee5df

Please sign in to comment.