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)