Skip to content
Snippets Groups Projects
Commit c2fed808 authored by Laurent Destailleur's avatar Laurent Destailleur
Browse files

Fix: Echec mise en page sur boite rss si echec de recup du flux

parent b43c4643
Branches
Tags
No related merge requests found
...@@ -69,10 +69,12 @@ class box_external_rss extends ModeleBoxes { ...@@ -69,10 +69,12 @@ class box_external_rss extends ModeleBoxes {
if ($rss->ERROR) { if ($rss->ERROR) {
// Affiche warning car il y a eu une erreur // Affiche warning car il y a eu une erreur
$title.=" ".img_error($langs->trans("FailedToRefreshDataInfoNotUpToDate",(isset($rss->date)?dolibarr_print_date($rss->date,"%d %b %Y %H:%M"):'unknown date'))); $title.=" ".img_error($langs->trans("FailedToRefreshDataInfoNotUpToDate",(isset($rss->date)?dolibarr_print_date($rss->date,"%d %b %Y %H:%M"):'unknown date')));
$this->info_box_head = array('text' => $title); $this->info_box_head = array('text' => $title,'limit' => 0);
} }
else
{
$this->info_box_head = array('text' => $title); $this->info_box_head = array('text' => $title);
}
for($i = 0; $i < $max ; $i++){ for($i = 0; $i < $max ; $i++){
$item = $rss->items[$i]; $item = $rss->items[$i];
......
...@@ -70,7 +70,8 @@ class ModeleBoxes ...@@ -70,7 +70,8 @@ class ModeleBoxes
// Affiche titre de la boite // Affiche titre de la boite
print '<tr class="box_titre"><td'; print '<tr class="box_titre"><td';
if ($nbcol > 0) { print ' colspan="'.$nbcol.'"'; } if ($nbcol > 0) { print ' colspan="'.$nbcol.'"'; }
print '>'.dolibarr_trunc($head['text'],$this->MAXLENGTHBOX); print '>';
print dolibarr_trunc($head['text'],isset($head['limit'])?$head['limit']:$this->MAXLENGTHBOX);
if ($head['sublink']) if ($head['sublink'])
{ {
print ' <a href="'.$head['sublink'].'">'.img_picto($head['subtext'],$head['subpicto']).'</a>'; print ' <a href="'.$head['sublink'].'">'.img_picto($head['subtext'],$head['subpicto']).'</a>';
......
...@@ -516,11 +516,12 @@ function dolibarr_print_phone($phone,$country="FR") ...@@ -516,11 +516,12 @@ function dolibarr_print_phone($phone,$country="FR")
/** /**
\brief Tronque une chaine une taille donne en ajoutant les points de suspension si cela dpasse \brief Tronque une chaine une taille donne en ajoutant les points de suspension si cela dpasse
\param string Chaine tronquer \param string Chaine tronquer
\param size Longueur max de la chaine \param size Longueur max de la chaine. Si 0, pas de limite.
\return string Chaine tronque \return string Chaine tronque
*/ */
function dolibarr_trunc($string,$size=40) function dolibarr_trunc($string,$size=40)
{ {
if ($size==0) return $string;
if (strlen($string) > $size) if (strlen($string) > $size)
return substr($string,0,$size).'...'; return substr($string,0,$size).'...';
else else
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment