From 9d9429f66bf67694a614b8434f50b789c3e48928 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 24 Feb 2020 20:41:29 +0100 Subject: [PATCH] New: Can limit number of tabs by page. --- htdocs/core/lib/functions.lib.php | 18 +++++++++++------- htdocs/modulebuilder/index.php | 3 +-- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 8129c810303..1375df9d0b6 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -1145,15 +1145,16 @@ function dol_syslog($message, $level = LOG_INFO, $ident = 0, $suffixinfilename = * @param int $pictoisfullpath If 1, image path is a full path. If you set this to 1, you can use url returned by dol_buildpath('/mymodyle/img/myimg.png',1) for $picto. * @param string $morehtmlright Add more html content on right of tabs title * @param string $morecss More Css + * @param int $limittoshow Limit number of tabs to show. Use 0 to use automatic default value. * @return void */ -function dol_fiche_head($links = array(), $active = '0', $title = '', $notab = 0, $picto = '', $pictoisfullpath = 0, $morehtmlright = '', $morecss = '') +function dol_fiche_head($links = array(), $active = '0', $title = '', $notab = 0, $picto = '', $pictoisfullpath = 0, $morehtmlright = '', $morecss = '', $limittoshow = 0) { - print dol_get_fiche_head($links, $active, $title, $notab, $picto, $pictoisfullpath, $morehtmlright, $morecss); + print dol_get_fiche_head($links, $active, $title, $notab, $picto, $pictoisfullpath, $morehtmlright, $morecss, $limittoshow); } /** - * Show tab header of a card + * Show tabs of a record * * @param array $links Array of tabs * @param string $active Active tab name @@ -1163,9 +1164,10 @@ function dol_fiche_head($links = array(), $active = '0', $title = '', $notab = 0 * @param int $pictoisfullpath If 1, image path is a full path. If you set this to 1, you can use url returned by dol_buildpath('/mymodyle/img/myimg.png',1) for $picto. * @param string $morehtmlright Add more html content on right of tabs title * @param string $morecss More Css + * @param int $limittoshow Limit number of tabs to show. Use 0 to use automatic default value. * @return string */ -function dol_get_fiche_head($links = array(), $active = '', $title = '', $notab = 0, $picto = '', $pictoisfullpath = 0, $morehtmlright = '', $morecss = '') +function dol_get_fiche_head($links = array(), $active = '', $title = '', $notab = 0, $picto = '', $pictoisfullpath = 0, $morehtmlright = '', $morecss = '', $limittoshow = 0) { global $conf, $langs, $hookmanager; @@ -1202,11 +1204,13 @@ function dol_get_fiche_head($links = array(), $active = '', $title = '', $notab if (count($keys)) $maxkey = max($keys); } - if (!empty($conf->dol_optimize_smallscreen)) $conf->global->MAIN_MAXTABS_IN_CARD = 2; - // Show tabs // if =0 we don't use the feature - $limittoshow = (empty($conf->global->MAIN_MAXTABS_IN_CARD) ? 99 : $conf->global->MAIN_MAXTABS_IN_CARD); + if (empty($limittoshow)) { + $limittoshow = (empty($conf->global->MAIN_MAXTABS_IN_CARD) ? 99 : $conf->global->MAIN_MAXTABS_IN_CARD); + } + if (!empty($conf->dol_optimize_smallscreen)) $limittoshow = 2; + $displaytab = 0; $nbintab = 0; $popuptab = 0; diff --git a/htdocs/modulebuilder/index.php b/htdocs/modulebuilder/index.php index 531d8d224d9..80b3aa87adb 100644 --- a/htdocs/modulebuilder/index.php +++ b/htdocs/modulebuilder/index.php @@ -1652,8 +1652,7 @@ $head[$h][1] = $langs->trans("DangerZone"); $head[$h][2] = 'deletemodule'; $h++; - -dol_fiche_head($head, $module, $langs->trans("Modules"), -1, 'generic', 0, $infomodulesfound); // Modules +dol_fiche_head($head, $module, $langs->trans("Modules"), -1, 'generic', 0, $infomodulesfound, '', 8); // Modules if ($module == 'initmodule') {