Skip to content

Commit

Permalink
Fix the automatic nb of list
Browse files Browse the repository at this point in the history
  • Loading branch information
eldy committed Nov 16, 2024
1 parent e866f90 commit cbdda5d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
7 changes: 5 additions & 2 deletions htdocs/core/class/conf.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -951,11 +951,14 @@ public function setValues($db)
}

// conf->liste_limit = constant to limit size of lists
// This value can be overwritten by user choice in main.inc.php
$this->liste_limit = getDolGlobalInt('MAIN_SIZE_LISTE_LIMIT', 15);
if ((int) $this->liste_limit <= 0) {
// Mode automatic.
// Mode automatic. Similar code than into main.inc.php
$this->liste_limit = 15;
if (!empty($_SESSION['dol_screenheight']) && $_SESSION['dol_screenheight'] < 910) {
if (!empty($_SESSION['dol_screenheight']) && $_SESSION['dol_screenheight'] < 700) {
$this->liste_limit = 8;
} elseif (!empty($_SESSION['dol_screenheight']) && $_SESSION['dol_screenheight'] < 910) {
$this->liste_limit = 10;
} elseif (!empty($_SESSION['dol_screenheight']) && $_SESSION['dol_screenheight'] > 1130) {
$this->liste_limit = 20;
Expand Down
6 changes: 4 additions & 2 deletions htdocs/main.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -1405,9 +1405,11 @@ function analyseVarsForSqlAndScriptsInjection(&$var, $type, $stopcode = 1)
$conf->liste_limit = getDolUserInt('MAIN_SIZE_LISTE_LIMIT'); // Can be 0
}
if ((int) $conf->liste_limit <= 0) {
// Mode automatic.
// Mode automatic. Similar code than into conf.class.php
$conf->liste_limit = 15;
if (!empty($_SESSION['dol_screenheight']) && $_SESSION['dol_screenheight'] < 910) {
if (!empty($_SESSION['dol_screenheight']) && $_SESSION['dol_screenheight'] < 700) {
$conf->liste_limit = 8;
} elseif (!empty($_SESSION['dol_screenheight']) && $_SESSION['dol_screenheight'] < 910) {
$conf->liste_limit = 10;
} elseif (!empty($_SESSION['dol_screenheight']) && $_SESSION['dol_screenheight'] > 1130) {
$conf->liste_limit = 20;
Expand Down

0 comments on commit cbdda5d

Please sign in to comment.