Skip to content
Snippets Groups Projects
Commit 8909b411 authored by aspangaro's avatar aspangaro
Browse files

Add options on getNomUrl

parent 1dcf02af
No related branches found
No related tags found
No related merge requests found
...@@ -307,7 +307,7 @@ else ...@@ -307,7 +307,7 @@ else
'ddate_end' =>$x_paye[$my_paye_rate]['ddate_end'][$id], 'ddate_end' =>$x_paye[$my_paye_rate]['ddate_end'][$id],
'totalht' =>price2num($x_paye[$my_paye_rate]['totalht_list'][$id]), 'totalht' =>price2num($x_paye[$my_paye_rate]['totalht_list'][$id]),
'vat' =>$x_paye[$my_paye_rate]['vat_list'][$id], 'vat' =>$x_paye[$my_paye_rate]['vat_list'][$id],
'link' =>img_object($langs->trans("ExpenseReports"),"trip").' '.$expensereport->getNomUrl(0,32)); 'link' =>$expensereport->getNomUrl(1);
} }
else else
{ {
......
...@@ -1164,25 +1164,56 @@ class ExpenseReport extends CommonObject ...@@ -1164,25 +1164,56 @@ class ExpenseReport extends CommonObject
/** /**
* Return clicable name (with picto eventually) * Return clicable name (with picto eventually)
* *
* @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto * @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto
* @return string String with URL * @param int $max Max length of shown ref
* @param int $short 1=Return just URL
* @param string $moretitle Add more text to title tooltip
* @param int $notooltip 1=Disable tooltip
* @return string String with URL
*/ */
function getNomUrl($withpicto=0) function getNomUrl($withpicto=0,$max=0,$short=0,$moretitle='',$notooltip=0)
{ {
global $langs; global $langs, $conf;
$result=''; $result='';
$link = '<a href="'.DOL_URL_ROOT.'/expensereport/card.php?id='.$this->id.'">'; $url = DOL_URL_ROOT.'/expensereport/card.php?id='.$this->id;
$linkend='</a>';
if ($short) return $url;
$picto='trip'; $picto='trip';
$label = '<u>' . $langs->trans("ShowExpenseReport") . '</u>';
if (! empty($this->ref))
$label .= '<br><b>' . $langs->trans('Ref') . ':</b> ' . $this->ref;
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 ($moretitle) $label.=' - '.$moretitle;
$ref=$this->ref;
if (empty($ref)) $ref=$this->id;
$linkclose='';
if (empty($notooltip))
{
if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER))
{
$label=$langs->trans("ShowExpenseReport");
$linkclose.=' alt="'.dol_escape_htmltag($label, 1).'"';
}
$linkclose.= ' title="'.dol_escape_htmltag($label, 1).'"';
$linkclose.=' class="classfortooltip"';
}
$label=$langs->trans("Show").': '.$this->ref; $linkstart = '<a href="'.$url.'"';
$linkstart.=$linkclose.'>';
$linkend='</a>';
if ($withpicto) $result.=($link.img_object($label,$picto).$linkend); if ($withpicto) $result.=($linkstart.img_object(($notooltip?'':$label), $picto, ($notooltip?'':'class="classfortooltip"'), 0, 0, $notooltip?0:1).$linkend.' ');
if ($withpicto && $withpicto != 2) $result.=' '; $result.=$linkstart.($max?dol_trunc($ref,$max):$ref).$linkend;
if ($withpicto != 2) $result.=$link.$this->ref.$linkend;
return $result; return $result;
} }
......
# Dolibarr language file - Source file is en_US - trips # Dolibarr language file - Source file is en_US - trips
ExpenseReport=Expense report ExpenseReport=Expense report
ExpenseReports=Expense reports ExpenseReports=Expense reports
ShowExpenseReport=Show expense report
Trips=Expense reports Trips=Expense reports
TripsAndExpenses=Expenses reports TripsAndExpenses=Expenses reports
TripsAndExpensesStatistics=Expense reports statistics TripsAndExpensesStatistics=Expense reports statistics
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment