From 7e55d50d13d5ad7d27f05627342c1ca9ccb7821b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 8 Apr 2005 21:31:03 +0000 Subject: [PATCH] =?UTF-8?q?Fix:=20N'ajoute=20les=20points=20de=20suspensio?= =?UTF-8?q?ns=20des=20chaines=20tronqu=E9es=20que=20si=20la=20chaine=20a?= =?UTF-8?q?=20effectivement=20=E9t=E9=20tronqu=E9e.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- htdocs/fourn/fiche.php | 2 +- htdocs/lib/functions.inc.php | 19 +++++++++++++++---- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/htdocs/fourn/fiche.php b/htdocs/fourn/fiche.php index 0db0e4e45a2..674633ad458 100644 --- a/htdocs/fourn/fiche.php +++ b/htdocs/fourn/fiche.php @@ -240,7 +240,7 @@ if ( $societe->fetch($socid) ) print ""; print ''; print ''; - print img_object($langs->trans("ShowBill"),"bill")." ".$obj->facnumber.' '.substr($obj->libelle,0,40).'...'; + print img_object($langs->trans("ShowBill"),"bill")." ".$obj->facnumber.' '.dolibarr_trunc($obj->libelle,40).''; print "".dolibarr_print_date($obj->df).""; print ''.$obj->amount.''; $fac = new FactureFournisseur($db); diff --git a/htdocs/lib/functions.inc.php b/htdocs/lib/functions.inc.php index c664b16b4ad..e57abb1eaf0 100644 --- a/htdocs/lib/functions.inc.php +++ b/htdocs/lib/functions.inc.php @@ -314,10 +314,10 @@ function dolibarr_print_object_info($object) } /** - \brief Formatage des numéros de telephone en fonction du format d'un pays - \param phone Numéro de telephone à formater - \param country Pays selon lequel formatter - \return string Numéro de téléphone formaté + \brief Formatage des numéros de telephone en fonction du format d'un pays + \param phone Numéro de telephone à formater + \param country Pays selon lequel formatter + \return string Numéro de téléphone formaté */ function dolibarr_print_phone($phone,$country="FR") { @@ -348,6 +348,17 @@ function dolibarr_print_phone($phone,$country="FR") return $phone; } +/** + \brief Tronque une chaine à une taille donnée en ajoutant les points de suspension si cela dépasse + \param string Chaine à tronquer + \param size Longueur max de la chaine + \return string Chaine tronquée +*/ +function dolibarr_trunc($string,$size=40) +{ + if (sizeof($string) > $size) return substr($string,0,$size).'...'; + else return $string; +} /** \brief Affiche logo propre à une notion (fonction générique)