Tooltip for loan

This commit is contained in:
frederic34 2015-03-27 18:09:00 +01:00
parent 631c3d72e3
commit a0c7cedaf1
2 changed files with 17 additions and 7 deletions

View File

@ -395,12 +395,18 @@ class Loan extends CommonObject
$result='';
$link = '<a href="'.DOL_URL_ROOT.'/loan/card.php?id='.$this->id.'">';
$linkend='</a>';
$tooltip = '<u>' . $langs->trans("ShowLoan") . '</u>';
if (! empty($this->ref))
$tooltip .= '<br><b>' . $langs->trans('Ref') . ':</b> ' . $this->ref;
if (! empty($this->label))
$tooltip .= '<br><b>' . $langs->trans('Label') . ':</b> ' . $this->label;
$link = '<a href="'.DOL_URL_ROOT.'/loan/card.php?id='.$this->id.'"';
$linkclose = '" title="'.str_replace('\n', '', dol_escape_htmltag($tooltip, 1)).'" class="classfortooltip">';
$linkend = '</a>';
if ($withpicto) $result.=($link.img_object($langs->trans("ShowLoan").': '.$this->label,'bill').$linkend.' ');
if ($withpicto) $result.=($link.$linkclose.img_object($langs->trans("ShowLoan").': '.$this->label,'bill', 'class="classfortooltip"').$linkend.' ');
if ($withpicto && $withpicto != 2) $result.=' ';
if ($withpicto != 2) $result.=$link.($maxlen?dol_trunc($this->label,$maxlen):$this->label).$linkend;
if ($withpicto != 2) $result.=$link.$linkclose.($maxlen?dol_trunc($this->label,$maxlen):$this->label).$linkend;
return $result;
}

View File

@ -1,5 +1,6 @@
<?php
/* Copyright (C) 2014 Alexandre Spangaro <alexandre.spangaro@gmail.com>
/* Copyright (C) 2014 Alexandre Spangaro <alexandre.spangaro@gmail.com>
* Copyright (C) 2015 Frederic France <frederic.france@free.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -117,12 +118,15 @@ if ($resql)
while ($i < min($num,$limit))
{
$obj = $db->fetch_object($resql);
$loan_static->id = $obj->rowid;
$loan_static->ref = $obj->rowid;
$loan_static->label = $obj->label;
$var = !$var;
print "<tr ".$bc[$var].">";
// Ref
print '<td><a href="card.php?id='.$obj->rowid.'">'.img_object($langs->trans("ShowLoan"),"label").' '.$obj->rowid.'</a></td>';
print '<td>'.$loan_static->getLinkUrl(1, 42).'</td>';
// Label
print '<td>'.dol_trunc($obj->label,42).'</td>';
@ -150,4 +154,4 @@ else
}
llxFooter();
$db->close();
$db->close();