diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 5685a2fbb92..e9251da148e 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -738,6 +738,15 @@ function dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $pi $displaytab=0; $nbintab=0; $popuptab=0; + for ($i = 0 ; $i <= $maxkey ; $i++) + { + if ((is_numeric($active) && $i == $active) || (! empty($links[$i][2]) && ! is_numeric($active) && $active == $links[$i][2])) + { + // si l'active est présent dans la box + if ($i >= $limittoshow) + $limittoshow--; + } + } for ($i = 0 ; $i <= $maxkey ; $i++) { @@ -745,13 +754,11 @@ function dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $pi { $isactive=true; $bactive=true; - if ($i <=$limittoshow) - $limittoshow++; } else $isactive=false; - if ($i <= $limittoshow || $isactive) + if ($i < $limittoshow || $isactive) { $out.='
'; if (isset($links[$i][2]) && $links[$i][2] == 'image')