Uniformize code

This commit is contained in:
Laurent Destailleur 2016-10-25 10:53:25 +02:00
parent 384abd8462
commit 6ef74b33c9
12 changed files with 293 additions and 140 deletions

View File

@ -454,33 +454,49 @@ class Skeleton_Class extends CommonObject
* @param integer $notooltip 1=Disable tooltip * @param integer $notooltip 1=Disable tooltip
* @param int $maxlen Max length of visible user name * @param int $maxlen Max length of visible user name
* @param string $morecss Add more css on link * @param string $morecss Add more css on link
* @param int $notooltip 1=Disable tooltip
* @return string String with URL * @return string String with URL
*/ */
function getNomUrl($withpicto=0, $option='', $notooltip=0, $maxlen=24, $morecss='') function getNomUrl($withpicto=0, $option='', $notooltip=0, $maxlen=24, $morecss='', $notooltip=0)
{ {
global $langs, $conf, $db; global $db, $conf, $langs;
global $dolibarr_main_authentication, $dolibarr_main_demo; global $dolibarr_main_authentication, $dolibarr_main_demo;
global $menumanager; global $menumanager;
if (! empty($conf->dol_no_mouse_hover)) $notooltip=1; // Force disable tooltips
$result = ''; $result = '';
$companylink = ''; $companylink = '';
$label = '<u>' . $langs->trans("MyModule") . '</u>'; $label = '<u>' . $langs->trans("MyModule") . '</u>';
$label.= '<div width="100%">'; $label.= '<br>';
$label.= '<b>' . $langs->trans('Ref') . ':</b> ' . $this->ref; $label.= '<b>' . $langs->trans('Ref') . ':</b> ' . $this->ref;
$link = '<a href="'.DOL_URL_ROOT.'/mymodule/'.$this->table_name.'_card.php?id='.$this->id.'"'; $url = DOL_URL_ROOT.'/mymodule/'.$this->table_name.'_card.php?id='.$this->id;
$link.= ($notooltip?'':' title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip'.($morecss?' '.$morecss:'').'"');
$link.= '>'; $linkclose='';
if (empty($notooltip))
{
if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER))
{
$label=$langs->trans("ShowProject");
$linkclose.=' alt="'.dol_escape_htmltag($label, 1).'"';
}
$linkclose.=' title="'.dol_escape_htmltag($label, 1).'"';
$linkclose.=' class="classfortooltip'.($morecss?' '.$morecss:'').'"';
}
else $linkclose = ($morecss?' class="'.$morecss.'"':'');
$linkstart = '<a href="'.$url.'"';
$linkstart.=$linkclose.'>';
$linkend='</a>'; $linkend='</a>';
if ($withpicto) if ($withpicto)
{ {
$result.=($link.img_object(($notooltip?'':$label), 'label', ($notooltip?'':'class="classfortooltip"')).$linkend); $result.=($linkstart.img_object(($notooltip?'':$label), 'label', ($notooltip?'':'class="classfortooltip"')).$linkend);
if ($withpicto != 2) $result.=' '; if ($withpicto != 2) $result.=' ';
} }
$result.= $link . $this->ref . $linkend; $result.= $linkstart . $this->ref . $linkend;
return $result; return $result;
} }

View File

@ -1102,13 +1102,17 @@ class ActionComm extends CommonObject
* @param string $classname Force style class on a link * @param string $classname Force style class on a link
* @param string $option ''=Link to action, 'birthday'=Link to contact * @param string $option ''=Link to action, 'birthday'=Link to contact
* @param int $overwritepicto 1=Overwrite picto * @param int $overwritepicto 1=Overwrite picto
* @param int $notooltip 1=Disable tooltip
* @return string Chaine avec URL * @return string Chaine avec URL
*/ */
function getNomUrl($withpicto=0,$maxlength=0,$classname='',$option='',$overwritepicto=0) function getNomUrl($withpicto=0,$maxlength=0,$classname='',$option='',$overwritepicto=0, $notooltip=0)
{ {
global $conf,$langs, $hookmanager; global $conf, $langs, $user, $hookmanager;
if (! empty($conf->dol_no_mouse_hover)) $notooltip=1; // Force disable tooltips
$result=''; $result='';
$tooltip = '<u>' . $langs->trans('ShowAction'.$objp->code) . '</u>'; $tooltip = '<u>' . $langs->trans('ShowAction'.$objp->code) . '</u>';
if (! empty($this->ref)) if (! empty($this->ref))
$tooltip .= '<br><b>' . $langs->trans('Ref') . ':</b> ' . $this->ref; $tooltip .= '<br><b>' . $langs->trans('Ref') . ':</b> ' . $this->ref;
@ -1119,10 +1123,19 @@ class ActionComm extends CommonObject
if (! empty($this->location)) if (! empty($this->location))
$tooltip .= '<br><b>' . $langs->trans('Location') . ':</b> ' . $this->location; $tooltip .= '<br><b>' . $langs->trans('Location') . ':</b> ' . $this->location;
$linkclose='';
if (! empty($conf->global->AGENDA_USE_EVENT_TYPE) && $this->type_color) if (! empty($conf->global->AGENDA_USE_EVENT_TYPE) && $this->type_color)
$linkclose = ' style="background-color:#'.$this->type_color.'" class="'.$classname.' classfortooltip" title="'.dol_escape_htmltag($tooltip, 1).'">'; $linkclose = ' style="background-color:#'.$this->type_color.'"';
else
$linkclose = ' class="'.$classname.' classfortooltip" title="'.dol_escape_htmltag($tooltip, 1).'">'; if (empty($notooltip) && $user->rights->propal->lire)
{
if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER))
{
$label=$langs->trans("ShowSupplierProposal");
$linkclose.=' alt="'.dol_escape_htmltag($tooltip, 1).'"';
}
$linkclose.=' title="'.dol_escape_htmltag($tooltip, 1).'"';
$linkclose.=' class="'.$classname.' classfortooltip"';
if (! is_object($hookmanager)) if (! is_object($hookmanager))
{ {
@ -1133,12 +1146,19 @@ class ActionComm extends CommonObject
$parameters=array('id'=>$this->id); $parameters=array('id'=>$this->id);
$reshook=$hookmanager->executeHooks('getnomurltooltip',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks $reshook=$hookmanager->executeHooks('getnomurltooltip',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
$linkclose = ($hookmanager->resPrint ? $hookmanager->resPrint : $linkclose); $linkclose = ($hookmanager->resPrint ? $hookmanager->resPrint : $linkclose);
}
else $linkclose.=' class="'.$classname.'"';
$url='';
if ($option=='birthday') if ($option=='birthday')
$link = '<a href="'.DOL_URL_ROOT.'/contact/perso.php?id='.$this->id.'"'.$linkclose; $url = DOL_URL_ROOT.'/contact/perso.php?id='.$this->id;
else else
$link = '<a href="'.DOL_URL_ROOT.'/comm/action/card.php?id='.$this->id.'"'.$linkclose; $url = DOL_URL_ROOT.'/comm/action/card.php?id='.$this->id;
$linkstart = '<a href="'.$url.'"';
$linkstart.=$linkclose.'>';
$linkend='</a>'; $linkend='</a>';
//print 'rrr'.$this->libelle.'-'.$withpicto; //print 'rrr'.$this->libelle.'-'.$withpicto;
if ($withpicto == 2) if ($withpicto == 2)
@ -1161,10 +1181,10 @@ class ActionComm extends CommonObject
{ {
$libelle.=(($this->type_code && $libelle!=$langs->transnoentities("Action".$this->type_code) && $langs->transnoentities("Action".$this->type_code)!="Action".$this->type_code)?' ('.$langs->transnoentities("Action".$this->type_code).')':''); $libelle.=(($this->type_code && $libelle!=$langs->transnoentities("Action".$this->type_code) && $langs->transnoentities("Action".$this->type_code)!="Action".$this->type_code)?' ('.$langs->transnoentities("Action".$this->type_code).')':'');
} }
$result.=$link.img_object($langs->trans("ShowAction").': '.$libelle, ($overwritepicto?$overwritepicto:'action'), 'class="classfortooltip"').$linkend; $result.=$linkstart.img_object(($notooltip?'':$langs->trans("ShowAction").': '.$libelle), ($overwritepicto?$overwritepicto:'action'), ($notooltip?'':'class="classfortooltip"')).$linkend;
} }
if ($withpicto==1) $result.=' '; if ($withpicto==1) $result.=' ';
$result.=$link.$libelleshort.$linkend; $result.=$linkstart.$libelleshort.$linkend;
return $result; return $result;
} }

View File

@ -3214,13 +3214,21 @@ class Propal extends CommonObject
* @param int $withpicto Add picto into link * @param int $withpicto Add picto into link
* @param string $option Where point the link ('expedition', 'document', ...) * @param string $option Where point the link ('expedition', 'document', ...)
* @param string $get_params Parametres added to url * @param string $get_params Parametres added to url
* @param int $notooltip 1=Disable tooltip
* @return string String with URL * @return string String with URL
*/ */
function getNomUrl($withpicto=0,$option='', $get_params='') function getNomUrl($withpicto=0,$option='', $get_params='', $notooltip=0)
{ {
global $langs, $conf; global $langs, $conf, $user;
if (! empty($conf->dol_no_mouse_hover)) $notooltip=1; // Force disable tooltips
$result=''; $result='';
$label='';
$url='';
if ($user->rights->propal->lire)
{
$label = '<u>' . $langs->trans("ShowPropal") . '</u>'; $label = '<u>' . $langs->trans("ShowPropal") . '</u>';
if (! empty($this->ref)) if (! empty($this->ref))
$label.= '<br><b>'.$langs->trans('Ref').':</b> '.$this->ref; $label.= '<br><b>'.$langs->trans('Ref').':</b> '.$this->ref;
@ -3232,26 +3240,41 @@ class Propal extends CommonObject
$label.= '<br><b>' . $langs->trans('VAT') . ':</b> ' . price($this->total_tva, 0, $langs, 0, -1, -1, $conf->currency); $label.= '<br><b>' . $langs->trans('VAT') . ':</b> ' . price($this->total_tva, 0, $langs, 0, -1, -1, $conf->currency);
if (! empty($this->total_ttc)) if (! empty($this->total_ttc))
$label.= '<br><b>' . $langs->trans('AmountTTC') . ':</b> ' . price($this->total_ttc, 0, $langs, 0, -1, -1, $conf->currency); $label.= '<br><b>' . $langs->trans('AmountTTC') . ':</b> ' . price($this->total_ttc, 0, $langs, 0, -1, -1, $conf->currency);
$linkclose = '" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
if ($option == '') { if ($option == '') {
$link = '<a href="'.DOL_URL_ROOT.'/comm/propal/card.php?id='.$this->id. $get_params .$linkclose; $url = DOL_URL_ROOT.'/comm/propal/card.php?id='.$this->id. $get_params;
} }
if ($option == 'compta') { // deprecated if ($option == 'compta') { // deprecated
$link = '<a href="'.DOL_URL_ROOT.'/comm/propal/card.php?id='.$this->id. $get_params .$linkclose; $url = DOL_URL_ROOT.'/comm/propal/card.php?id='.$this->id. $get_params;
} }
if ($option == 'expedition') { if ($option == 'expedition') {
$link = '<a href="'.DOL_URL_ROOT.'/expedition/propal.php?id='.$this->id. $get_params .$linkclose; $url = DOL_URL_ROOT.'/expedition/propal.php?id='.$this->id. $get_params;
} }
if ($option == 'document') { if ($option == 'document') {
$link = '<a href="'.DOL_URL_ROOT.'/comm/propal/document.php?id='.$this->id. $get_params .$linkclose; $url = DOL_URL_ROOT.'/comm/propal/document.php?id='.$this->id. $get_params;
} }
}
$linkclose='';
if (empty($notooltip) && $user->rights->propal->lire)
{
if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER))
{
$label=$langs->trans("ShowPropal");
$linkclose.=' alt="'.dol_escape_htmltag($label, 1).'"';
}
$linkclose.= ' title="'.dol_escape_htmltag($label, 1).'"';
$linkclose.=' class="classfortooltip"';
}
$linkstart = '<a href="'.$url.'"';
$linkstart.=$linkclose.'>';
$linkend='</a>'; $linkend='</a>';
if ($withpicto) if ($withpicto)
$result.=($link.img_object($label, $this->picto, 'class="classfortooltip"').$linkend); $result.=($linkstart.img_object(($notooltip?'':$label), $this->picto, ($notooltip?'':'class="classfortooltip"')).$linkend);
if ($withpicto && $withpicto != 2) if ($withpicto && $withpicto != 2)
$result.=' '; $result.=' ';
$result.=$link.$this->ref.$linkend; $result.=$linkstart.$this->ref.$linkend;
return $result; return $result;
} }

View File

@ -3326,12 +3326,15 @@ class Commande extends CommonOrder
* @param int $option Where point the link (0=> main card, 1,2 => shipment) * @param int $option Where point the link (0=> main card, 1,2 => shipment)
* @param int $max Max length to show * @param int $max Max length to show
* @param int $short Use short labels * @param int $short Use short labels
* @param int $notooltip 1=Disable tooltip
* @return string String with URL * @return string String with URL
*/ */
function getNomUrl($withpicto=0,$option=0,$max=0,$short=0) function getNomUrl($withpicto=0,$option=0,$max=0,$short=0,$notooltip=0)
{ {
global $conf, $langs, $user; global $conf, $langs, $user;
if (! empty($conf->dol_no_mouse_hover)) $notooltip=1; // Force disable tooltips
$result=''; $result='';
if (! empty($conf->expedition->enabled) && ($option == 1 || $option == 2)) $url = DOL_URL_ROOT.'/expedition/shipment.php?id='.$this->id; if (! empty($conf->expedition->enabled) && ($option == 1 || $option == 2)) $url = DOL_URL_ROOT.'/expedition/shipment.php?id='.$this->id;
@ -3351,23 +3354,33 @@ class Commande extends CommonOrder
$label .= '<br><b>'.$langs->trans('RefCustomer').':</b> '.$this->ref_client; $label .= '<br><b>'.$langs->trans('RefCustomer').':</b> '.$this->ref_client;
} }
if (!empty($this->total_ht)) { if (!empty($this->total_ht)) {
$label .= '<br><b>'.$langs->trans('AmountHT').':</b> '.price($this->total_ht, 0, $langs, 0, -1, -1, $label .= '<br><b>'.$langs->trans('AmountHT').':</b> '.price($this->total_ht, 0, $langs, 0, -1, -1, $conf->currency);
$conf->currency);
} }
if (!empty($this->total_tva)) { if (!empty($this->total_tva)) {
$label .= '<br><b>'.$langs->trans('VAT').':</b> '.price($this->total_tva, 0, $langs, 0, -1, -1, $label .= '<br><b>'.$langs->trans('VAT').':</b> '.price($this->total_tva, 0, $langs, 0, -1, -1, $conf->currency);
$conf->currency);
} }
if (!empty($this->total_ttc)) { if (!empty($this->total_ttc)) {
$label .= '<br><b>'.$langs->trans('AmountTTC').':</b> '.price($this->total_ttc, 0, $langs, 0, -1, -1, $label .= '<br><b>'.$langs->trans('AmountTTC').':</b> '.price($this->total_ttc, 0, $langs, 0, -1, -1, $conf->currency);
$conf->currency);
} }
} }
$linkstart = '<a href="'.$url.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">'; $linkclose='';
if (empty($notooltip) && $user->rights->commande->lire)
{
if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER))
{
$label=$langs->trans("ShowOrder");
$linkclose.=' alt="'.dol_escape_htmltag($label, 1).'"';
}
$linkclose.= ' title="'.dol_escape_htmltag($label, 1).'"';
$linkclose.=' class="classfortooltip"';
}
$linkstart = '<a href="'.$url.'"';
$linkstart.=$linkclose.'>';
$linkend='</a>'; $linkend='</a>';
if ($withpicto) $result.=($linkstart.img_object($label, $picto, 'class="classfortooltip"').$linkend); if ($withpicto) $result.=($linkstart.img_object(($notooltip?'':$label), $picto, ($notooltip?'':'class="classfortooltip"')).$linkend);
if ($withpicto && $withpicto != 2) $result.=' '; if ($withpicto && $withpicto != 2) $result.=' ';
$result.=$linkstart.$this->ref.$linkend; $result.=$linkstart.$this->ref.$linkend;
return $result; return $result;

View File

@ -998,12 +998,15 @@ class Facture extends CommonInvoice
* @param int $max Maxlength of ref * @param int $max Maxlength of ref
* @param int $short 1=Return just URL * @param int $short 1=Return just URL
* @param string $moretitle Add more text to title tooltip * @param string $moretitle Add more text to title tooltip
* @param int $notooltip 1=Disable tooltip
* @return string String with URL * @return string String with URL
*/ */
function getNomUrl($withpicto=0,$option='',$max=0,$short=0,$moretitle='') function getNomUrl($withpicto=0,$option='',$max=0,$short=0,$moretitle='',$notooltip=0)
{ {
global $langs, $conf; global $langs, $conf;
if (! empty($conf->dol_no_mouse_hover)) $notooltip=1; // Force disable tooltips
$result=''; $result='';
if ($option == 'withdraw') $url = DOL_URL_ROOT.'/compta/facture/prelevement.php?facid='.$this->id; if ($option == 'withdraw') $url = DOL_URL_ROOT.'/compta/facture/prelevement.php?facid='.$this->id;
@ -1015,7 +1018,9 @@ class Facture extends CommonInvoice
if ($this->type == self::TYPE_REPLACEMENT) $picto.='r'; // Replacement invoice if ($this->type == self::TYPE_REPLACEMENT) $picto.='r'; // Replacement invoice
if ($this->type == self::TYPE_CREDIT_NOTE) $picto.='a'; // Credit note if ($this->type == self::TYPE_CREDIT_NOTE) $picto.='a'; // Credit note
if ($this->type == self::TYPE_DEPOSIT) $picto.='d'; // Deposit invoice if ($this->type == self::TYPE_DEPOSIT) $picto.='d'; // Deposit invoice
$label='';
if ($user->rights->facture->lire) {
$label = '<u>' . $langs->trans("ShowInvoice") . '</u>'; $label = '<u>' . $langs->trans("ShowInvoice") . '</u>';
if (! empty($this->ref)) if (! empty($this->ref))
$label .= '<br><b>'.$langs->trans('Ref') . ':</b> ' . $this->ref; $label .= '<br><b>'.$langs->trans('Ref') . ':</b> ' . $this->ref;
@ -1032,11 +1037,25 @@ class Facture extends CommonInvoice
if ($this->type == self::TYPE_DEPOSIT) $label=$langs->transnoentitiesnoconv("ShowInvoiceDeposit").': '.$this->ref; if ($this->type == self::TYPE_DEPOSIT) $label=$langs->transnoentitiesnoconv("ShowInvoiceDeposit").': '.$this->ref;
if ($this->type == self::TYPE_SITUATION) $label=$langs->transnoentitiesnoconv("ShowInvoiceSituation").': '.$this->ref; if ($this->type == self::TYPE_SITUATION) $label=$langs->transnoentitiesnoconv("ShowInvoiceSituation").': '.$this->ref;
if ($moretitle) $label.=' - '.$moretitle; if ($moretitle) $label.=' - '.$moretitle;
}
$linkstart='<a href="'.$url.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">'; $linkclose='';
if (empty($notooltip) && $user->rights->facture->lire)
{
if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER))
{
$label=$langs->trans("ShowInvoice");
$linkclose.=' alt="'.dol_escape_htmltag($label, 1).'"';
}
$linkclose.= ' title="'.dol_escape_htmltag($label, 1).'"';
$linkclose.=' class="classfortooltip"';
}
$linkstart='<a href="'.$url.'"';
$linkstart.=$linkclose.'>';
$linkend='</a>'; $linkend='</a>';
if ($withpicto) $result.=($linkstart.img_object(($max?dol_trunc($label,$max):$label), $picto, 'class="classfortooltip"').$linkend); if ($withpicto) $result.=($linkstart.img_object(($notooltip?'':$label), $picto, ($notooltip?'':'class="classfortooltip"')).$linkend);
if ($withpicto && $withpicto != 2) $result.=' '; if ($withpicto && $withpicto != 2) $result.=' ';
if ($withpicto != 2) $result.=$linkstart.($max?dol_trunc($this->ref,$max):$this->ref).$linkend; if ($withpicto != 2) $result.=$linkstart.($max?dol_trunc($this->ref,$max):$this->ref).$linkend;
return $result; return $result;

View File

@ -81,7 +81,7 @@ class DolEditor
// Check if extended editor is ok. If not we force textarea // Check if extended editor is ok. If not we force textarea
if (empty($conf->fckeditor->enabled) || ! $okforextendededitor) $this->tool = 'textarea'; if (empty($conf->fckeditor->enabled) || ! $okforextendededitor) $this->tool = 'textarea';
//if ($conf->browser->phone) $this->tool = 'textarea'; if ($conf->dol_use_jmobile) $this->tool = 'textarea'; // TODO ckeditor ko with jmobile
// Define content and some properties // Define content and some properties
if ($this->tool == 'ckeditor') if ($this->tool == 'ckeditor')

View File

@ -225,6 +225,7 @@ if (isset($_SERVER["HTTP_USER_AGENT"]))
$conf->browser->tablet=$tmp['tablet']; // TODO deprecated, use ->layout $conf->browser->tablet=$tmp['tablet']; // TODO deprecated, use ->layout
//var_dump($conf->browser); //var_dump($conf->browser);
if ($conf->browser->layout == 'phone') $conf->dol_no_mouse_hover=1;
if ($conf->browser->layout == 'phone') $conf->global->MAIN_TESTMENUHIDER=1; if ($conf->browser->layout == 'phone') $conf->global->MAIN_TESTMENUHIDER=1;
} }

View File

@ -889,15 +889,17 @@ class Project extends CommonObject
* @param int $addlabel 0=Default, 1=Add label into string, >1=Add first chars into string * @param int $addlabel 0=Default, 1=Add label into string, >1=Add first chars into string
* @param string $moreinpopup Text to add into popup * @param string $moreinpopup Text to add into popup
* @param string $sep Separator between ref and label if option addlabel is set * @param string $sep Separator between ref and label if option addlabel is set
* @param int $notooltip 1=Disable tooltip
* @return string Chaine avec URL * @return string Chaine avec URL
*/ */
function getNomUrl($withpicto=0, $option='', $addlabel=0, $moreinpopup='', $sep=' - ') function getNomUrl($withpicto=0, $option='', $addlabel=0, $moreinpopup='', $sep=' - ', $notooltip=0)
{ {
global $langs; global $conf, $langs, $user;
if (! empty($conf->dol_no_mouse_hover)) $notooltip=1; // Force disable tooltips
$result = ''; $result = '';
$link = '';
$linkend = '';
$label=''; $label='';
if ($option != 'nolink') $label = '<u>' . $langs->trans("ShowProject") . '</u>'; if ($option != 'nolink') $label = '<u>' . $langs->trans("ShowProject") . '</u>';
if (! empty($this->ref)) if (! empty($this->ref))
@ -911,33 +913,44 @@ class Project extends CommonObject
if (! empty($this->datee)) if (! empty($this->datee))
$label .= ($label?'<br>':'').'<b>' . $langs->trans('DateEnd') . ': </b>' . dol_print_date($this->datee, 'day'); // The space must be after the : to not being explode when showing the title in img_picto $label .= ($label?'<br>':'').'<b>' . $langs->trans('DateEnd') . ': </b>' . dol_print_date($this->datee, 'day'); // The space must be after the : to not being explode when showing the title in img_picto
if ($moreinpopup) $label.='<br>'.$moreinpopup; if ($moreinpopup) $label.='<br>'.$moreinpopup;
$linkclose = '" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
if ($option != 'nolink') if ($option != 'nolink')
{ {
if (preg_match('/\.php$/',$option)) { if (preg_match('/\.php$/',$option)) {
$link = '<a href="' . dol_buildpath($option,1) . '?id=' . $this->id . $linkclose; $url = dol_buildpath($option,1) . '?id=' . $this->id;
$linkend = '</a>';
} }
else if ($option == 'task') else if ($option == 'task')
{ {
$link = '<a href="' . DOL_URL_ROOT . '/projet/tasks.php?id=' . $this->id . $linkclose; $url = DOL_URL_ROOT . '/projet/tasks.php?id=' . $this->id;
$linkend = '</a>';
} }
else else
{ {
$link = '<a href="' . DOL_URL_ROOT . '/projet/card.php?id=' . $this->id . $linkclose; $url = DOL_URL_ROOT . '/projet/card.php?id=' . $this->id;
$linkend = '</a>';
} }
} }
$linkclose='';
if (empty($notooltip) && $user->rights->propal->lire)
{
if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER))
{
$label=$langs->trans("ShowProject");
$linkclose.=' alt="'.dol_escape_htmltag($label, 1).'"';
}
$linkclose.=' title="'.dol_escape_htmltag($label, 1).'"';
$linkclose.=' class="classfortooltip"';
}
$picto = 'projectpub'; $picto = 'projectpub';
if (!$this->public) $picto = 'project'; if (!$this->public) $picto = 'project';
$linkstart = '<a href="'.$url.'"';
$linkstart.=$linkclose.'>';
$linkend='</a>';
if ($withpicto) $result.=($link . img_object($label, $picto, 'class="classfortooltip"') . $linkend); if ($withpicto) $result.=($linkstart . img_object(($notooltip?'':$label), $picto, ($notooltip?'':'class="classfortooltip"')) . $linkend);
if ($withpicto && $withpicto != 2) $result.=' '; if ($withpicto && $withpicto != 2) $result.=' ';
if ($withpicto != 2) $result.=$link . $this->ref . $linkend . (($addlabel && $this->title) ? $sep . dol_trunc($this->title, ($addlabel > 1 ? $addlabel : 0)) : ''); if ($withpicto != 2) $result.=$linkstart . $this->ref . $linkend . (($addlabel && $this->title) ? $sep . dol_trunc($this->title, ($addlabel > 1 ? $addlabel : 0)) : '');
return $result; return $result;
} }

View File

@ -495,11 +495,14 @@ class Task extends CommonObject
* @param string $mode Mode 'task', 'time', 'contact', 'note', document' define page to link to. * @param string $mode Mode 'task', 'time', 'contact', 'note', document' define page to link to.
* @param int $addlabel 0=Default, 1=Add label into string, >1=Add first chars into string * @param int $addlabel 0=Default, 1=Add label into string, >1=Add first chars into string
* @param string $sep Separator between ref and label if option addlabel is set * @param string $sep Separator between ref and label if option addlabel is set
* @param int $notooltip 1=Disable tooltip
* @return string Chaine avec URL * @return string Chaine avec URL
*/ */
function getNomUrl($withpicto=0,$option='',$mode='task', $addlabel=0, $sep=' - ') function getNomUrl($withpicto=0,$option='',$mode='task', $addlabel=0, $sep=' - ', $notooltip=0)
{ {
global $langs; global $conf, $langs, $user;
if (! empty($conf->dol_no_mouse_hover)) $notooltip=1; // Force disable tooltips
$result=''; $result='';
$label = '<u>' . $langs->trans("ShowTask") . '</u>'; $label = '<u>' . $langs->trans("ShowTask") . '</u>';
@ -511,17 +514,30 @@ class Task extends CommonObject
{ {
$label .= "<br>".get_date_range($this->date_start,$this->date_end,'',$langs,0); $label .= "<br>".get_date_range($this->date_start,$this->date_end,'',$langs,0);
} }
$linkclose = '" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
$link = '<a href="'.DOL_URL_ROOT.'/projet/tasks/'.$mode.'.php?id='.$this->id.($option=='withproject'?'&withproject=1':'').$linkclose; $url = DOL_URL_ROOT.'/projet/tasks/'.$mode.'.php?id='.$this->id.($option=='withproject'?'&withproject=1':'');
$linkclose = '';
if (empty($notooltip))
{
if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER))
{
$label=$langs->trans("ShowTask");
$linkclose.=' alt="'.dol_escape_htmltag($label, 1).'"';
}
$linkclose.= ' title="'.dol_escape_htmltag($label, 1).'"';
$linkclose.=' class="classfortooltip"';
}
$linkstart = '<a href="'.$url.'"';
$linkstart.=$linkclose.'>';
$linkend='</a>'; $linkend='</a>';
$picto='projecttask'; $picto='projecttask';
if ($withpicto) $result.=($linkstart.img_object(($notooltip?'':$label), $picto, ($notooltip?'':'class="classfortooltip"')).$linkend);
if ($withpicto) $result.=($link.img_object($label, $picto, 'class="classfortooltip"').$linkend);
if ($withpicto && $withpicto != 2) $result.=' '; if ($withpicto && $withpicto != 2) $result.=' ';
if ($withpicto != 2) $result.=$link.$this->ref.$linkend . (($addlabel && $this->label) ? $sep . dol_trunc($this->label, ($addlabel > 1 ? $addlabel : 0)) : ''); if ($withpicto != 2) $result.=$linkstart.$this->ref.$linkend . (($addlabel && $this->label) ? $sep . dol_trunc($this->label, ($addlabel > 1 ? $addlabel : 0)) : '');
return $result; return $result;
} }

View File

@ -26,6 +26,7 @@ require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
$langs->load("projects"); $langs->load("projects");
@ -71,6 +72,8 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETP
* View * View
*/ */
$form = new Form($db);
$title=$langs->trans("Project").' - '.$object->ref.' '.$object->name; $title=$langs->trans("Project").' - '.$object->ref.' '.$object->name;
if (! empty($conf->global->MAIN_HTML_TITLE) && preg_match('/projectnameonly/',$conf->global->MAIN_HTML_TITLE) && $object->name) $title=$object->ref.' '.$object->name.' - '.$langs->trans("Info"); if (! empty($conf->global->MAIN_HTML_TITLE) && preg_match('/projectnameonly/',$conf->global->MAIN_HTML_TITLE) && $object->name) $title=$object->ref.' '.$object->name.' - '.$langs->trans("Info");
$help_url="EN:Module_Projects|FR:Module_Projets|ES:M&oacute;dulo_Proyectos"; $help_url="EN:Module_Projects|FR:Module_Projets|ES:M&oacute;dulo_Proyectos";

View File

@ -1828,16 +1828,16 @@ class Societe extends CommonObject
* @param int $withpicto Add picto into link (0=No picto, 1=Include picto with link, 2=Picto only) * @param int $withpicto Add picto into link (0=No picto, 1=Include picto with link, 2=Picto only)
* @param string $option Target of link ('', 'customer', 'prospect', 'supplier', 'project') * @param string $option Target of link ('', 'customer', 'prospect', 'supplier', 'project')
* @param int $maxlen Max length of name * @param int $maxlen Max length of name
* @param integer $notooltip 1=Disable tooltip * @param int $notooltip 1=Disable tooltip
* @return string String with URL * @return string String with URL
*/ */
function getNomUrl($withpicto=0, $option='', $maxlen=0, $notooltip=0) function getNomUrl($withpicto=0, $option='', $maxlen=0, $notooltip=0)
{ {
global $conf, $langs, $hookmanager; global $conf, $langs, $hookmanager;
$name=$this->name?$this->name:$this->nom; if (! empty($conf->dol_no_mouse_hover)) $notooltip=1; // Force disable tooltips
if (! empty($conf->dol_no_mouse_hover)) $notooltip=1; $name=$this->name?$this->name:$this->nom;
if (! empty($conf->global->SOCIETE_ADD_REF_IN_LIST) && (!empty($withpicto))) if (! empty($conf->global->SOCIETE_ADD_REF_IN_LIST) && (!empty($withpicto)))
{ {
@ -1853,46 +1853,46 @@ class Societe extends CommonObject
if (!empty($this->name_alias)) $name .= ' ('.$this->name_alias.')'; if (!empty($this->name_alias)) $name .= ' ('.$this->name_alias.')';
$result=''; $label=''; $result=''; $label='';
$link=''; $linkend=''; $linkstart=''; $linkend='';
$label.= '<div width="100%">'; $label.= '<div width="100%">';
if ($option == 'customer' || $option == 'compta' || $option == 'category' || $option == 'category_supplier') if ($option == 'customer' || $option == 'compta' || $option == 'category' || $option == 'category_supplier')
{ {
$label.= '<u>' . $langs->trans("ShowCustomer") . '</u>'; $label.= '<u>' . $langs->trans("ShowCustomer") . '</u>';
$link = '<a href="'.DOL_URL_ROOT.'/comm/card.php?socid='.$this->id; $linkstart = '<a href="'.DOL_URL_ROOT.'/comm/card.php?socid='.$this->id;
} }
else if ($option == 'prospect' && empty($conf->global->SOCIETE_DISABLE_PROSPECTS)) else if ($option == 'prospect' && empty($conf->global->SOCIETE_DISABLE_PROSPECTS))
{ {
$label.= '<u>' . $langs->trans("ShowProspect") . '</u>'; $label.= '<u>' . $langs->trans("ShowProspect") . '</u>';
$link = '<a href="'.DOL_URL_ROOT.'/comm/card.php?socid='.$this->id; $linkstart = '<a href="'.DOL_URL_ROOT.'/comm/card.php?socid='.$this->id;
} }
else if ($option == 'supplier') else if ($option == 'supplier')
{ {
$label.= '<u>' . $langs->trans("ShowSupplier") . '</u>'; $label.= '<u>' . $langs->trans("ShowSupplier") . '</u>';
$link = '<a href="'.DOL_URL_ROOT.'/fourn/card.php?socid='.$this->id; $linkstart = '<a href="'.DOL_URL_ROOT.'/fourn/card.php?socid='.$this->id;
} }
else if ($option == 'agenda') else if ($option == 'agenda')
{ {
$label.= '<u>' . $langs->trans("ShowAgenda") . '</u>'; $label.= '<u>' . $langs->trans("ShowAgenda") . '</u>';
$link = '<a href="'.DOL_URL_ROOT.'/societe/agenda.php?socid='.$this->id; $linkstart = '<a href="'.DOL_URL_ROOT.'/societe/agenda.php?socid='.$this->id;
} }
else if ($option == 'project') else if ($option == 'project')
{ {
$label.= '<u>' . $langs->trans("ShowProject") . '</u>'; $label.= '<u>' . $langs->trans("ShowProject") . '</u>';
$link = '<a href="'.DOL_URL_ROOT.'/societe/project.php?socid='.$this->id; $linkstart = '<a href="'.DOL_URL_ROOT.'/societe/project.php?socid='.$this->id;
} }
else if ($option == 'margin') else if ($option == 'margin')
{ {
$label.= '<u>' . $langs->trans("ShowMargin") . '</u>'; $label.= '<u>' . $langs->trans("ShowMargin") . '</u>';
$link = '<a href="'.DOL_URL_ROOT.'/margin/tabs/thirdpartyMargins.php?socid='.$this->id.'&type=1'; $linkstart = '<a href="'.DOL_URL_ROOT.'/margin/tabs/thirdpartyMargins.php?socid='.$this->id.'&type=1';
} }
// By default // By default
if (empty($link)) if (empty($linkstart))
{ {
$label.= '<u>' . $langs->trans("ShowCompany") . '</u>'; $label.= '<u>' . $langs->trans("ShowCompany") . '</u>';
$link = '<a href="'.DOL_URL_ROOT.'/societe/soc.php?socid='.$this->id; $linkstart = '<a href="'.DOL_URL_ROOT.'/societe/soc.php?socid='.$this->id;
} }
if (! empty($this->name)) if (! empty($this->name))
@ -1919,7 +1919,8 @@ class Societe extends CommonObject
$label.= '</div>'; $label.= '</div>';
// Add type of canvas // Add type of canvas
$link.=(!empty($this->canvas)?'&canvas='.$this->canvas:'').'"'; $linkstart.=(!empty($this->canvas)?'&canvas='.$this->canvas:'').'"';
$linkclose=''; $linkclose='';
if (empty($notooltip)) if (empty($notooltip))
{ {
@ -1940,14 +1941,13 @@ class Societe extends CommonObject
$parameters=array('id'=>$this->id); $parameters=array('id'=>$this->id);
$reshook=$hookmanager->executeHooks('getnomurltooltip',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks $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 ($reshook > 0) $linkclose = $hookmanager->resPrint;
} }
$link.=$linkclose.'>'; $linkstart.=$linkclose.'>';
$linkend='</a>'; $linkend='</a>';
if ($withpicto) $result.=($link.img_object(($notooltip?'':$label), 'company', ($notooltip?'':'class="classfortooltip"')).$linkend); if ($withpicto) $result.=($linkstart.img_object(($notooltip?'':$label), 'company', ($notooltip?'':'class="classfortooltip"')).$linkend);
if ($withpicto && $withpicto != 2) $result.=' '; if ($withpicto && $withpicto != 2) $result.=' ';
if ($withpicto != 2) $result.=$link.($maxlen?dol_trunc($name,$maxlen):$name).$linkend; if ($withpicto != 2) $result.=$linkstart.($maxlen?dol_trunc($name,$maxlen):$name).$linkend;
return $result; return $result;
} }

View File

@ -2368,31 +2368,60 @@ class SupplierProposal extends CommonObject
* @param int $withpicto Add picto into link * @param int $withpicto Add picto into link
* @param string $option Where point the link ('compta', 'expedition', 'document', ...) * @param string $option Where point the link ('compta', 'expedition', 'document', ...)
* @param string $get_params Parametres added to url * @param string $get_params Parametres added to url
* @param int $notooltip 1=Disable tooltip
* @return string String with URL * @return string String with URL
*/ */
function getNomUrl($withpicto=0,$option='', $get_params='') function getNomUrl($withpicto=0,$option='', $get_params='', $notooltip=0)
{ {
global $langs; global $langs, $conf, $user;
if (! empty($conf->dol_no_mouse_hover)) $notooltip=1; // Force disable tooltips
$url='';
$result=''; $result='';
$label=$langs->trans("ShowSupplierProposal").': '.$this->ref;
$linkclose = '" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">'; $label='<u>'.$langs->trans("ShowSupplierProposal").'</u>';
if (! empty($this->ref))
$label.= '<br><b>'.$langs->trans('Ref').':</b> '.$this->ref;
if (! empty($this->ref_fourn))
$label.= '<br><b>'.$langs->trans('RefSupplier').':</b> '.$this->ref_fourn;
if (! empty($this->total_ht))
$label.= '<br><b>' . $langs->trans('AmountHT') . ':</b> ' . price($this->total_ht, 0, $langs, 0, -1, -1, $conf->currency);
if (! empty($this->total_tva))
$label.= '<br><b>' . $langs->trans('VAT') . ':</b> ' . price($this->total_tva, 0, $langs, 0, -1, -1, $conf->currency);
if (! empty($this->total_ttc))
$label.= '<br><b>' . $langs->trans('AmountTTC') . ':</b> ' . price($this->total_ttc, 0, $langs, 0, -1, -1, $conf->currency);
if ($option == '') { if ($option == '') {
$link = '<a href="'.DOL_URL_ROOT.'/supplier_proposal/card.php?id='.$this->id. $get_params .$linkclose; $url = DOL_URL_ROOT.'/supplier_proposal/card.php?id='.$this->id. $get_params;
} }
if ($option == 'document') { if ($option == 'document') {
$link = '<a href="'.DOL_URL_ROOT.'/supplier_proposal/document.php?id='.$this->id. $get_params .$linkclose; $url = DOL_URL_ROOT.'/supplier_proposal/document.php?id='.$this->id. $get_params;
} }
$linkclose='';
if (empty($notooltip) && $user->rights->propal->lire)
{
if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER))
{
$label=$langs->trans("ShowSupplierProposal");
$linkclose.=' alt="'.dol_escape_htmltag($label, 1).'"';
}
$linkclose.= ' title="'.dol_escape_htmltag($label, 1).'"';
$linkclose.=' class="classfortooltip"';
}
$linkstart = '<a href="'.$url.'"';
$linkstart.=$linkclose.'>';
$linkend='</a>'; $linkend='</a>';
$picto='supplier_proposal'; $picto='supplier_proposal';
if ($withpicto) if ($withpicto)
$result.=($link.img_object($label, $picto, 'class="classfortooltip"').$linkend); $result.=($linkstart.img_object(($notooltip?'':$label), $picto, ($notooltip?'':'class="classfortooltip"')).$linkend);
if ($withpicto && $withpicto != 2) if ($withpicto && $withpicto != 2)
$result.=' '; $result.=' ';
$result.=$link.$this->ref.$linkend; $result.=$linkstart.$this->ref.$linkend;
return $result; return $result;
} }