diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php
index 194fee33bfc..20b7d4369ac 100644
--- a/htdocs/core/lib/functions.lib.php
+++ b/htdocs/core/lib/functions.lib.php
@@ -683,42 +683,86 @@ function dol_get_fiche_head($links=array(), $active='0', $title='', $notab=0, $p
if (count($keys)) $maxkey=max($keys);
}
- // Show tabs
+ // Show tabs
+ $bactive=false;
+ // if =0 we don't use the feature
+ $limittoshow=($conf->global->MAXTABS_IN_CARD?$conf->global->MAXTABS_IN_CARD:99);
+ $displaytab=0;
+
for ($i = 0 ; $i <= $maxkey ; $i++)
{
- $isactive=(is_numeric($active) && $i == $active) || (! is_numeric($active) && $active == $links[$i][2]);
- $out.='
';
- if (isset($links[$i][2]) && $links[$i][2] == 'image')
+ if ((is_numeric($active) && $i == $active) || (! is_numeric($active) && $active == $links[$i][2]))
{
- if (!empty($links[$i][0]))
- {
- $out.='
'.$links[$i][1].''."\n";
- }
- else
- {
- $out.='
'.$links[$i][1].''."\n";
- }
+ $isactive=true;
+ $bactive=true;
+ if ($i <=$limittoshow)
+ $limittoshow++;
}
- else if (! empty($links[$i][1]))
+ else
+ $isactive=false;
+
+ if ($i <=$limittoshow || $isactive )
{
- //print "x $i $active ".$links[$i][2]." z";
- if ($isactive)
+ $out.='
';
+ if (isset($links[$i][2]) && $links[$i][2] == 'image')
{
- $out.='
'.$links[$i][1].''."\n";
+ if (!empty($links[$i][0]))
+ {
+ $out.='
'.$links[$i][1].''."\n";
+ }
+ else
+ {
+ $out.='
'.$links[$i][1].''."\n";
+ }
}
- else
+ else if (! empty($links[$i][1]))
{
- $out.='
'.$links[$i][1].''."\n";
+ //print "x $i $active ".$links[$i][2]." z";
+ if ($isactive)
+ {
+ $out.='
'.$links[$i][1].''."\n";
+ }
+ else
+ {
+ $out.='
'.$links[$i][1].''."\n";
+ }
}
+ $out.='
';
}
- $out.='
';
+ else
+ {
+ $outmore.='';
+ if (isset($links[$i][2]) && $links[$i][2] == 'image')
+ {
+ if (!empty($links[$i][0]))
+ $outmore.='
'.$links[$i][1].''."\n";
+ else
+ $outmore.='
'.$links[$i][1].''."\n";
+
+ }
+ else if (! empty($links[$i][1]))
+ $outmore.='
'.$links[$i][1].''."\n";
+
+ $outmore.='
';
+ }
+ $displaytab=$i;
}
- $out.="\n";
+ if ($displaytab > $limittoshow)
+ {
+ $out.='