Can add more text into title shown by getNomUrl

This commit is contained in:
Laurent Destailleur 2012-06-11 19:28:04 +02:00
parent e0109c019d
commit 0739942b7e
3 changed files with 15 additions and 10 deletions

View File

@ -711,9 +711,10 @@ class Facture extends CommonObject
* @param string $option Where point the link * @param string $option Where point the link
* @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
* @return string String with URL * @return string String with URL
*/ */
function getNomUrl($withpicto=0,$option='',$max=0,$short=0) function getNomUrl($withpicto=0,$option='',$max=0,$short=0,$moretitle='')
{ {
global $langs; global $langs;
@ -724,9 +725,6 @@ class Facture extends CommonObject
if ($short) return $url; if ($short) return $url;
$linkstart='<a href="'.$url.'">';
$linkend='</a>';
$picto='bill'; $picto='bill';
if ($this->type == 1) $picto.='r'; // Replacement invoice if ($this->type == 1) $picto.='r'; // Replacement invoice
if ($this->type == 2) $picto.='a'; // Credit note if ($this->type == 2) $picto.='a'; // Credit note
@ -736,8 +734,13 @@ class Facture extends CommonObject
if ($this->type == 1) $label=$langs->transnoentitiesnoconv("ShowInvoiceReplace").': '.$this->ref; if ($this->type == 1) $label=$langs->transnoentitiesnoconv("ShowInvoiceReplace").': '.$this->ref;
if ($this->type == 2) $label=$langs->transnoentitiesnoconv("ShowInvoiceAvoir").': '.$this->ref; if ($this->type == 2) $label=$langs->transnoentitiesnoconv("ShowInvoiceAvoir").': '.$this->ref;
if ($this->type == 3) $label=$langs->transnoentitiesnoconv("ShowInvoiceDeposit").': '.$this->ref; if ($this->type == 3) $label=$langs->transnoentitiesnoconv("ShowInvoiceDeposit").': '.$this->ref;
if ($moretitle) $label.=' - '.$moretitle;
if ($withpicto) $result.=($linkstart.img_object($label,$picto).$linkend); //$linkstart='<a href="'.$url.'" title="'.dol_escape_htmltag($label).'">';
$linkstart='<a href="'.$url.'">';
$linkend='</a>';
if ($withpicto) $result.=($linkstart.img_object(($max?dol_trunc($label,$max):$label),$picto).$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

@ -23,7 +23,7 @@
*/ */
/** /**
* \file htdocs/compta/facture.php * \file htdocs/compta/facture/list.php
* \ingroup facture * \ingroup facture
* \brief Page to create/see an invoice * \brief Page to create/see an invoice
*/ */
@ -131,7 +131,7 @@ if (! $sall) $sql = 'SELECT';
else $sql = 'SELECT DISTINCT'; else $sql = 'SELECT DISTINCT';
$sql.= ' f.rowid as facid, f.facnumber, f.type, f.increment, f.total, f.total_ttc,'; $sql.= ' f.rowid as facid, f.facnumber, f.type, f.increment, f.total, f.total_ttc,';
$sql.= ' f.datef as df, f.date_lim_reglement as datelimite,'; $sql.= ' f.datef as df, f.date_lim_reglement as datelimite,';
$sql.= ' f.paye as paye, f.fk_statut,'; $sql.= ' f.paye as paye, f.fk_statut, f.note,';
$sql.= ' s.nom, s.rowid as socid'; $sql.= ' s.nom, s.rowid as socid';
if (! $sall) $sql.= ', SUM(pf.amount) as am'; // To be able to sort on status if (! $sall) $sql.= ', SUM(pf.amount) as am'; // To be able to sort on status
$sql.= ' FROM '.MAIN_DB_PREFIX.'societe as s'; $sql.= ' FROM '.MAIN_DB_PREFIX.'societe as s';
@ -307,12 +307,13 @@ if ($resql)
$facturestatic->id=$objp->facid; $facturestatic->id=$objp->facid;
$facturestatic->ref=$objp->facnumber; $facturestatic->ref=$objp->facnumber;
$facturestatic->type=$objp->type; $facturestatic->type=$objp->type;
$notetoshow=dol_string_nohtmltag(($user->societe_id>0?$objp->note_public:$objp->note),1);
$paiement = $facturestatic->getSommePaiement(); $paiement = $facturestatic->getSommePaiement();
print '<table class="nobordernopadding"><tr class="nocellnopadd">'; print '<table class="nobordernopadding"><tr class="nocellnopadd">';
print '<td class="nobordernopadding" nowrap="nowrap">'; print '<td class="nobordernopadding" nowrap="nowrap">';
print $facturestatic->getNomUrl(1); print $facturestatic->getNomUrl(1,'',200,0,$notetoshow);
print $objp->increment; print $objp->increment;
print '</td>'; print '</td>';
@ -322,7 +323,8 @@ if ($resql)
$urlsource=$_SERVER['PHP_SELF'].'?facid='.$objp->facid; $urlsource=$_SERVER['PHP_SELF'].'?facid='.$objp->facid;
$formfile->show_documents('facture',$filename,$filedir,$urlsource,'','','',1,'',1); $formfile->show_documents('facture',$filename,$filedir,$urlsource,'','','',1,'',1);
print '</td>'; print '</td>';
print '</tr></table>'; print '</tr>';
print '</table>';
print "</td>\n"; print "</td>\n";

View File

@ -3076,7 +3076,7 @@ function dol_string_nohtmltag($StringHtml,$removelinefeed=1,$pagecodeto='UTF-8')
$temp = preg_replace($pattern,"",$temp); $temp = preg_replace($pattern,"",$temp);
// Supprime aussi les retours // Supprime aussi les retours
if ($removelinefeed) $temp=str_replace("\n"," ",$temp); if ($removelinefeed) $temp=str_replace(array("\r\n","\r","\n")," ",$temp);
// et les espaces doubles // et les espaces doubles
while(strpos($temp," ")) while(strpos($temp," "))