From 0739942b7e0d12f37a3e83db18ce0504fdfc3025 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 11 Jun 2012 19:28:04 +0200 Subject: [PATCH] Can add more text into title shown by getNomUrl --- htdocs/compta/facture/class/facture.class.php | 13 ++++++++----- htdocs/compta/facture/list.php | 10 ++++++---- htdocs/core/lib/functions.lib.php | 2 +- 3 files changed, 15 insertions(+), 10 deletions(-) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index c3a29863d12..e8ecfaf74b5 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -711,9 +711,10 @@ class Facture extends CommonObject * @param string $option Where point the link * @param int $max Maxlength of ref * @param int $short 1=Return just URL + * @param string $moretitle Add more text to title tooltip * @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; @@ -724,9 +725,6 @@ class Facture extends CommonObject if ($short) return $url; - $linkstart=''; - $linkend=''; - $picto='bill'; if ($this->type == 1) $picto.='r'; // Replacement invoice 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 == 2) $label=$langs->transnoentitiesnoconv("ShowInvoiceAvoir").': '.$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=''; + $linkstart=''; + $linkend=''; + + if ($withpicto) $result.=($linkstart.img_object(($max?dol_trunc($label,$max):$label),$picto).$linkend); if ($withpicto && $withpicto != 2) $result.=' '; if ($withpicto != 2) $result.=$linkstart.($max?dol_trunc($this->ref,$max):$this->ref).$linkend; return $result; diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index 82100aef8cf..e8013631703 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -23,7 +23,7 @@ */ /** - * \file htdocs/compta/facture.php + * \file htdocs/compta/facture/list.php * \ingroup facture * \brief Page to create/see an invoice */ @@ -131,7 +131,7 @@ if (! $sall) $sql = 'SELECT'; else $sql = 'SELECT DISTINCT'; $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.paye as paye, f.fk_statut,'; +$sql.= ' f.paye as paye, f.fk_statut, f.note,'; $sql.= ' s.nom, s.rowid as socid'; if (! $sall) $sql.= ', SUM(pf.amount) as am'; // To be able to sort on status $sql.= ' FROM '.MAIN_DB_PREFIX.'societe as s'; @@ -307,12 +307,13 @@ if ($resql) $facturestatic->id=$objp->facid; $facturestatic->ref=$objp->facnumber; $facturestatic->type=$objp->type; + $notetoshow=dol_string_nohtmltag(($user->societe_id>0?$objp->note_public:$objp->note),1); $paiement = $facturestatic->getSommePaiement(); print ''; print ''; @@ -322,7 +323,8 @@ if ($resql) $urlsource=$_SERVER['PHP_SELF'].'?facid='.$objp->facid; $formfile->show_documents('facture',$filename,$filedir,$urlsource,'','','',1,'',1); print ''; - print '
'; - print $facturestatic->getNomUrl(1); + print $facturestatic->getNomUrl(1,'',200,0,$notetoshow); print $objp->increment; print '
'; + print ''; + print ''; print "\n"; diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 569d27a517d..eeff6e48068 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -3076,7 +3076,7 @@ function dol_string_nohtmltag($StringHtml,$removelinefeed=1,$pagecodeto='UTF-8') $temp = preg_replace($pattern,"",$temp); // 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 while(strpos($temp," "))