FIX #5966 Bug: getNomUrl tooltips show Proposal info even if user has no rights to read them

This commit is contained in:
Marcos García de La Fuente 2016-11-09 11:28:05 +01:00
parent 75cc6bcf75
commit 0b594eab59

View File

@ -2734,34 +2734,46 @@ class Propal extends CommonObject
*/ */
function getNomUrl($withpicto=0,$option='', $get_params='') function getNomUrl($withpicto=0,$option='', $get_params='')
{ {
global $langs, $conf; global $langs, $conf, $user;
$result=''; $result='';
$label = '<u>' . $langs->trans("ShowPropal") . '</u>'; $label = '';
if (! empty($this->ref))
$label.= '<br><b>'.$langs->trans('Ref').':</b> '.$this->ref; if ($user->rights->propal->lire) {
if (! empty($this->ref_client)) $label .= '<u>'.$langs->trans("ShowPropal").'</u>';
$label.= '<br><b>'.$langs->trans('RefCustomer').':</b> '.$this->ref_client; if (!empty($this->ref)) {
if (! empty($this->total_ht)) $label .= '<br><b>'.$langs->trans('Ref').':</b> '.$this->ref;
$label.= '<br><b>' . $langs->trans('AmountHT') . ':</b> ' . price($this->total_ht, 0, $langs, 0, -1, -1, $conf->currency); }
if (! empty($this->total_tva)) if (!empty($this->ref_client)) {
$label.= '<br><b>' . $langs->trans('VAT') . ':</b> ' . price($this->total_tva, 0, $langs, 0, -1, -1, $conf->currency); $label .= '<br><b>'.$langs->trans('RefCustomer').':</b> '.$this->ref_client;
if (! empty($this->total_ttc)) }
$label.= '<br><b>' . $langs->trans('AmountTTC') . ':</b> ' . price($this->total_ttc, 0, $langs, 0, -1, -1, $conf->currency); if (!empty($this->total_ht)) {
$linkclose = '" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">'; $label .= '<br><b>'.$langs->trans('AmountHT').':</b> '.price($this->total_ht, 0, $langs, 0, -1, -1,
if ($option == '') { $conf->currency);
$link = '<a href="'.DOL_URL_ROOT.'/comm/propal.php?id='.$this->id. $get_params .$linkclose; }
} if (!empty($this->total_tva)) {
if ($option == 'compta') { // deprecated $label .= '<br><b>'.$langs->trans('VAT').':</b> '.price($this->total_tva, 0, $langs, 0, -1, -1,
$link = '<a href="'.DOL_URL_ROOT.'/comm/propal.php?id='.$this->id. $get_params .$linkclose; $conf->currency);
} }
if ($option == 'expedition') { if (!empty($this->total_ttc)) {
$link = '<a href="'.DOL_URL_ROOT.'/expedition/propal.php?id='.$this->id. $get_params .$linkclose; $label .= '<br><b>'.$langs->trans('AmountTTC').':</b> '.price($this->total_ttc, 0, $langs, 0, -1, -1,
} $conf->currency);
if ($option == 'document') { }
$link = '<a href="'.DOL_URL_ROOT.'/comm/propal/document.php?id='.$this->id. $get_params .$linkclose; $linkclose = '" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
} if ($option == '') {
$linkend='</a>'; $link = '<a href="'.DOL_URL_ROOT.'/comm/propal.php?id='.$this->id.$get_params.$linkclose;
}
if ($option == 'compta') { // deprecated
$link = '<a href="'.DOL_URL_ROOT.'/comm/propal.php?id='.$this->id.$get_params.$linkclose;
}
if ($option == 'expedition') {
$link = '<a href="'.DOL_URL_ROOT.'/expedition/propal.php?id='.$this->id.$get_params.$linkclose;
}
if ($option == 'document') {
$link = '<a href="'.DOL_URL_ROOT.'/comm/propal/document.php?id='.$this->id.$get_params.$linkclose;
}
$linkend = '</a>';
}
$picto='propal'; $picto='propal';