diff --git a/htdocs/admin/ihm.php b/htdocs/admin/ihm.php index fc160d8abf6..5182c25f467 100644 --- a/htdocs/admin/ihm.php +++ b/htdocs/admin/ihm.php @@ -434,7 +434,15 @@ if ($mode == 'other') { print ''; // Max size of lists - print '' . $langs->trans("DefaultMaxSizeList") . ''; + print '' . $langs->trans("DefaultMaxSizeList") . ''; + if (getDolGlobalInt('MAIN_SIZE_LISTE_LIMIT') <= 0) { + print '   ('.$langs->trans("Automatic").')'; + } + print ''; print ''; // Max size of short lists on customer card diff --git a/htdocs/bom/tpl/objectline_create.tpl.php b/htdocs/bom/tpl/objectline_create.tpl.php index 510372ae572..011666eb6ab 100644 --- a/htdocs/bom/tpl/objectline_create.tpl.php +++ b/htdocs/bom/tpl/objectline_create.tpl.php @@ -123,9 +123,9 @@ if (isModEnabled("product") || isModEnabled("service")) { $statustoshow = -1; if (getDolGlobalString('ENTREPOT_EXTRA_STATUS')) { // hide products in closed warehouse, but show products for internal transfer - print $form->select_produits(GETPOSTINT('idprod'), (($filtertype == 1) ? 'idprodservice' : 'idprod'), $filtertype, $conf->product->limit_size, $buyer->price_level, $statustoshow, 2, '', 1, array(), $buyer->id, '1', 0, 'maxwidth500', 0, 'warehouseopen,warehouseinternal', GETPOSTINT('combinations'), 1); + print $form->select_produits(GETPOSTINT('idprod'), (($filtertype == 1) ? 'idprodservice' : 'idprod'), $filtertype, getDolGlobalInt('PRODUIT_LIMIT_SIZE'), $buyer->price_level, $statustoshow, 2, '', 1, array(), $buyer->id, '1', 0, 'maxwidth500', 0, 'warehouseopen,warehouseinternal', GETPOSTINT('combinations'), 1); } else { - print $form->select_produits(GETPOSTINT('idprod'), (($filtertype == 1) ? 'idprodservice' : 'idprod'), $filtertype, $conf->product->limit_size, $buyer->price_level, $statustoshow, 2, '', 1, array(), $buyer->id, '1', 0, 'maxwidth500', 0, '', GETPOSTINT('combinations'), 1); + print $form->select_produits(GETPOSTINT('idprod'), (($filtertype == 1) ? 'idprodservice' : 'idprod'), $filtertype, getDolGlobalInt('PRODUIT_LIMIT_SIZE'), $buyer->price_level, $statustoshow, 2, '', 1, array(), $buyer->id, '1', 0, 'maxwidth500', 0, '', GETPOSTINT('combinations'), 1); } $urltocreateproduct = DOL_URL_ROOT.'/product/card.php?action=create&backtopage='.urlencode($_SERVER["PHP_SELF"].'?id='.$object->id); print ''; diff --git a/htdocs/core/class/conf.class.php b/htdocs/core/class/conf.class.php index 91883ed2ef3..b6ebbf93d32 100644 --- a/htdocs/core/class/conf.class.php +++ b/htdocs/core/class/conf.class.php @@ -810,20 +810,20 @@ class Conf extends stdClass $this->global->MAIN_HTML_TITLE = 'thirdpartynameonly,contactnameonly,projectnameonly'; } - // conf->liste_limit = constante de taille maximale des listes - if (empty($this->global->MAIN_SIZE_LISTE_LIMIT)) { - $this->global->MAIN_SIZE_LISTE_LIMIT = 15; + // conf->liste_limit = constant to limit size of lists + $this->liste_limit = getDolGlobalInt('MAIN_SIZE_LISTE_LIMIT', 15); + if ((int) $this->liste_limit <= 0) { + // Mode automatic. TODO Define a value according to height + $this->liste_limit = 15; } - $this->liste_limit = $this->global->MAIN_SIZE_LISTE_LIMIT; - // conf->product->limit_size = constante de taille maximale des select de produit + // Set PRODUIT_LIMIT_SIZE if never defined if (!isset($this->global->PRODUIT_LIMIT_SIZE)) { $this->global->PRODUIT_LIMIT_SIZE = 1000; } - $this->product->limit_size = $this->global->PRODUIT_LIMIT_SIZE; // Set PRODUIT_DESC_IN_FORM_ACCORDING_TO_DEVICE, may be modified later according to browser - $this->global->PRODUIT_DESC_IN_FORM_ACCORDING_TO_DEVICE = (isset($this->global->PRODUIT_DESC_IN_FORM) ? $this->global->PRODUIT_DESC_IN_FORM : 0); + $this->global->PRODUIT_DESC_IN_FORM_ACCORDING_TO_DEVICE = getDolGlobalInt('PRODUIT_DESC_IN_FORM'); // conf->theme et $this->css if (empty($this->global->MAIN_THEME)) { diff --git a/htdocs/core/tpl/objectline_create.tpl.php b/htdocs/core/tpl/objectline_create.tpl.php index 8cd60aa4b77..b4548c71e28 100644 --- a/htdocs/core/tpl/objectline_create.tpl.php +++ b/htdocs/core/tpl/objectline_create.tpl.php @@ -259,9 +259,9 @@ if ($nolinesbefore) { } if (getDolGlobalString('ENTREPOT_EXTRA_STATUS')) { // hide products in closed warehouse, but show products for internal transfer - $form->select_produits(GETPOST('idprod'), 'idprod', $filtertype, $conf->product->limit_size, $buyer->price_level, $statustoshow, 2, '', 1, array(), $buyer->id, '1', 0, 'maxwidth500 widthcentpercentminusx', 0, $statuswarehouse, GETPOST('combinations', 'array')); + $form->select_produits(GETPOST('idprod'), 'idprod', $filtertype, getDolGlobalInt('PRODUIT_LIMIT_SIZE'), $buyer->price_level, $statustoshow, 2, '', 1, array(), $buyer->id, '1', 0, 'maxwidth500 widthcentpercentminusx', 0, $statuswarehouse, GETPOST('combinations', 'array')); } else { - $form->select_produits(GETPOST('idprod'), 'idprod', $filtertype, $conf->product->limit_size, $buyer->price_level, $statustoshow, 2, '', 1, array(), $buyer->id, '1', 0, 'maxwidth500 widthcentpercentminusx', 0, '', GETPOST('combinations', 'array')); + $form->select_produits(GETPOST('idprod'), 'idprod', $filtertype, getDolGlobalInt('PRODUIT_LIMIT_SIZE'), $buyer->price_level, $statustoshow, 2, '', 1, array(), $buyer->id, '1', 0, 'maxwidth500 widthcentpercentminusx', 0, '', GETPOST('combinations', 'array')); } if (getDolGlobalString('MAIN_AUTO_OPEN_SELECT2_ON_FOCUS_FOR_CUSTOMER_PRODUCTS')) { ?> diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 250c39f5f31..d4c1532c9d1 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -1342,17 +1342,18 @@ if (!defined('NOLOGIN')) { * Overwrite some configs globals (try to avoid this and have code to use instead $user->conf->xxx) */ - // Set liste_limit - if (isset($user->conf->MAIN_SIZE_LISTE_LIMIT)) { - $conf->liste_limit = $user->conf->MAIN_SIZE_LISTE_LIMIT; // Can be 0 + // Set liste_limit from user setup + if (isset($user->conf->MAIN_SIZE_LISTE_LIMIT)) { // If a user setup exists + $conf->liste_limit = getDolUserInt('MAIN_SIZE_LISTE_LIMIT'); // Can be 0 } - if (isset($user->conf->PRODUIT_LIMIT_SIZE)) { - $conf->product->limit_size = $user->conf->PRODUIT_LIMIT_SIZE; // Can be 0 + if ((int) $conf->liste_limit <= 0) { + // Mode automatic. TODO Define a value according to height + $conf->liste_limit = 15; } // Replace conf->css by personalized value if theme not forced - if (!getDolGlobalString('MAIN_FORCETHEME') && !empty($user->conf->MAIN_THEME)) { - $conf->theme = $user->conf->MAIN_THEME; + if (!getDolGlobalString('MAIN_FORCETHEME') && getDolUserString('MAIN_THEME')) { + $conf->theme = getDolUserString('MAIN_THEME'); $conf->css = "/theme/".$conf->theme."/style.css.php"; } } else { @@ -1373,14 +1374,14 @@ if (GETPOST('theme', 'aZ09')) { if (GETPOSTINT('nojs')) { // If javascript was not disabled on URL $conf->use_javascript_ajax = 0; } else { - if (!empty($user->conf->MAIN_DISABLE_JAVASCRIPT)) { - $conf->use_javascript_ajax = !$user->conf->MAIN_DISABLE_JAVASCRIPT; + if (getDolUserString('MAIN_DISABLE_JAVASCRIPT')) { + $conf->use_javascript_ajax = !getDolUserString('MAIN_DISABLE_JAVASCRIPT'); } } // Set MAIN_OPTIMIZEFORTEXTBROWSER for user (must be after login part) -if (!getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER') && !empty($user->conf->MAIN_OPTIMIZEFORTEXTBROWSER)) { - $conf->global->MAIN_OPTIMIZEFORTEXTBROWSER = $user->conf->MAIN_OPTIMIZEFORTEXTBROWSER; +if (!getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER') && getDolUserString('MAIN_OPTIMIZEFORTEXTBROWSER')) { + $conf->global->MAIN_OPTIMIZEFORTEXTBROWSER = getDolUserString('MAIN_OPTIMIZEFORTEXTBROWSER'); if (getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER') == 1) { $conf->global->THEME_TOPMENU_DISABLE_IMAGE = 1; } @@ -1389,7 +1390,7 @@ if (!getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER') && !empty($user->conf->MA //var_dump($user->conf->THEME_TOPMENU_DISABLE_IMAGE); // set MAIN_OPTIMIZEFORCOLORBLIND for user -$conf->global->MAIN_OPTIMIZEFORCOLORBLIND = empty($user->conf->MAIN_OPTIMIZEFORCOLORBLIND) ? '' : $user->conf->MAIN_OPTIMIZEFORCOLORBLIND; +$conf->global->MAIN_OPTIMIZEFORCOLORBLIND = getDolUserString('MAIN_OPTIMIZEFORCOLORBLIND'); // Set terminal output option according to conf->browser. if (GETPOSTINT('dol_hide_leftmenu') || !empty($_SESSION['dol_hide_leftmenu'])) {