diff --git a/htdocs/admin/ihm.php b/htdocs/admin/ihm.php index d1d80394832..8733d18c6dd 100644 --- a/htdocs/admin/ihm.php +++ b/htdocs/admin/ihm.php @@ -249,7 +249,7 @@ if ($action == 'update') { dolibarr_set_const($db, "MAIN_IHM_PARAMS_REV", getDolGlobalInt('MAIN_IHM_PARAMS_REV') + 1, 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_SIZE_LISTE_LIMIT", GETPOSTINT("MAIN_SIZE_LISTE_LIMIT"), 'chaine', 0, '', $conf->entity); - dolibarr_set_const($db, "MAIN_SIZE_SHORTLIST_LIMIT", GETPOSTINT("main_size_shortliste_limit"), 'chaine', 0, '', $conf->entity); + dolibarr_set_const($db, "MAIN_SIZE_SHORTLIST_LIMIT", GETPOSTINT("MAIN_SIZE_SHORTLIST_LIMIT"), 'chaine', 0, '', $conf->entity); if (GETPOSTISSET("MAIN_CHECKBOX_LEFT_COLUMN")) { dolibarr_set_const($db, "MAIN_CHECKBOX_LEFT_COLUMN", GETPOSTINT("MAIN_CHECKBOX_LEFT_COLUMN"), 'chaine', 0, '', $conf->entity); @@ -430,11 +430,11 @@ if ($mode == 'other') { print ''; // Max size of lists - print '' . $langs->trans("DefaultMaxSizeList") . ''; + print '' . $langs->trans("DefaultMaxSizeList") . ''; print ''; // Max size of short lists on customer card - print '' . $langs->trans("DefaultMaxSizeShortList") . ''; + print '' . $langs->trans("DefaultMaxSizeShortList") . ''; print ''; // Display checkboxes and fields menu left / right diff --git a/htdocs/core/class/html.formother.class.php b/htdocs/core/class/html.formother.class.php index df94752c97c..a99af668fd8 100644 --- a/htdocs/core/class/html.formother.class.php +++ b/htdocs/core/class/html.formother.class.php @@ -1373,7 +1373,7 @@ class FormOther $boxlista .= "\n\n"; // Define $box_max_lines - $box_max_lines = getDolGlobalInt('MAIN_SIZE_SHORTLIST_LIMIT', 6); + $box_max_lines = getDolUserInt('MAIN_SIZE_SHORTLIST_LIMIT', getDolGlobalInt('MAIN_SIZE_SHORTLIST_LIMIT', 5)); $ii = 0; foreach ($boxactivated as $key => $box) { diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index 8b318d895a6..76b98339c8b 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -3445,9 +3445,9 @@ function dol_filecache($directory, $filename, $object) /** * Test if Refresh needed. * - * @param string $directory Directory of cache - * @param string $filename Name of filecache - * @param int $cachetime Cachetime delay + * @param string $directory Directory of cache + * @param string $filename Name of filecache + * @param int $cachetime Cachetime delay * @return boolean 0 no refresh 1 if refresh needed */ function dol_cache_refresh($directory, $filename, $cachetime) @@ -3461,9 +3461,9 @@ function dol_cache_refresh($directory, $filename, $cachetime) /** * Read object from cachefile. * - * @param string $directory Directory of cache - * @param string $filename Name of filecache - * @return mixed Unserialise from file + * @param string $directory Directory of cache + * @param string $filename Name of filecache + * @return mixed Unserialise from file */ function dol_readcachefile($directory, $filename) { @@ -3475,7 +3475,7 @@ function dol_readcachefile($directory, $filename) /** * Return the relative dirname (relative to DOL_DATA_ROOT) of a full path string. * - * @param string $pathfile Full path of a file + * @param string $pathfile Full path of a file * @return string Path of file relative to DOL_DATA_ROOT */ function dirbasename($pathfile) diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index f82390b2341..b5f4ef00dde 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -1205,10 +1205,11 @@ DefaultMenuManager= Standard menu manager DefaultMenuSmartphoneManager=Smartphone menu manager Skin=Skin theme DefaultSkin=Default skin theme -MaxSizeList=Max length for list +MaxSizeList=Max length for lists DefaultMaxSizeList=Default max length for lists -DisplayGrandTotalInList=Display grand total (for all pages) in lists footer +MaxSizeShortList=Max length for short lists DefaultMaxSizeShortList=Default max length for short lists (i.e. in customer card) +DisplayGrandTotalInList=Display grand total (for all pages) in lists footer MessageOfDay=Message of the day MessageLogin=Login page message LoginPage=Login page diff --git a/htdocs/user/param_ihm.php b/htdocs/user/param_ihm.php index c59313ec708..3ffb3302c96 100644 --- a/htdocs/user/param_ihm.php +++ b/htdocs/user/param_ihm.php @@ -110,12 +110,18 @@ if (empty($reshook)) { $tabparam["MAIN_LANG_DEFAULT"] = ''; } - if (GETPOST("check_SIZE_LISTE_LIMIT") == "on") { + if (GETPOST("check_MAIN_SIZE_LISTE_LIMIT") == "on") { $tabparam["MAIN_SIZE_LISTE_LIMIT"] = GETPOSTINT("MAIN_SIZE_LISTE_LIMIT"); } else { $tabparam["MAIN_SIZE_LISTE_LIMIT"] = ''; } + if (GETPOST("check_MAIN_SIZE_SHORTLIST_LIMIT") == "on") { + $tabparam["MAIN_SIZE_SHORTLIST_LIMIT"] = GETPOSTINT("MAIN_SIZE_SHORTLIST_LIMIT"); + } else { + $tabparam["MAIN_SIZE_SHORTLIST_LIMIT"] = ''; + } + if (GETPOST("check_AGENDA_DEFAULT_VIEW") == "on") { $tabparam["AGENDA_DEFAULT_VIEW"] = GETPOST("AGENDA_DEFAULT_VIEW", 'aZ09'); } else { @@ -174,6 +180,10 @@ if (empty($reshook)) { $result = dol_set_user_param($db, $conf, $object, $tabparam); + // Clear cache of widgets (because we may have modified the length of cached widget lists) + $cachedir = DOL_DATA_ROOT.'/users/temp/widgets'; + dol_delete_dir_recursive($cachedir); + header('Location: '.$_SERVER["PHP_SELF"].'?id='.$id); exit; } @@ -307,9 +317,12 @@ if ($action == 'edit') { if (jQuery("#check_MAIN_LANG_DEFAULT").prop("checked")) { jQuery("#main_lang_default").removeAttr(\'disabled\'); } else { jQuery("#main_lang_default").attr(\'disabled\',\'disabled\'); } - if (jQuery("#check_SIZE_LISTE_LIMIT").prop("checked")) { jQuery("#MAIN_SIZE_LISTE_LIMIT").removeAttr(\'disabled\'); } + if (jQuery("#check_MAIN_SIZE_LISTE_LIMIT").prop("checked")) { jQuery("#MAIN_SIZE_LISTE_LIMIT").removeAttr(\'disabled\'); } else { jQuery("#MAIN_SIZE_LISTE_LIMIT").attr(\'disabled\',\'disabled\'); } + if (jQuery("#check_MAIN_SIZE_SHORTLIST_LIMIT").prop("checked")) { jQuery("#MAIN_SIZE_SHORTLIST_LIMIT").removeAttr(\'disabled\'); } + else { jQuery("#MAIN_SIZE_SHORTLIST_LIMIT").attr(\'disabled\',\'disabled\'); } + if (jQuery("#check_AGENDA_DEFAULT_VIEW").prop("checked")) { jQuery("#AGENDA_DEFAULT_VIEW").removeAttr(\'disabled\'); } else { jQuery("#AGENDA_DEFAULT_VIEW").attr(\'disabled\',\'disabled\'); } @@ -322,7 +335,8 @@ if ($action == 'edit') { init_myfunc(); jQuery("#check_MAIN_LANDING_PAGE").click(function() { init_myfunc(); }); jQuery("#check_MAIN_LANG_DEFAULT").click(function() { init_myfunc(); }); - jQuery("#check_SIZE_LISTE_LIMIT").click(function() { init_myfunc(); }); + jQuery("#check_MAIN_SIZE_LISTE_LIMIT").click(function() { init_myfunc(); }); + jQuery("#check_MAIN_SIZE_SHORTLIST_LIMIT").click(function() { init_myfunc(); }); jQuery("#check_AGENDA_DEFAULT_VIEW").click(function() { init_myfunc(); }); jQuery("#check_MAIN_THEME").click(function() { init_myfunc(); }); jQuery("#check_THEME_ELDY_TOPMENU_BACK1").click(function() { init_myfunc(); }); @@ -379,11 +393,19 @@ if ($action == 'edit') { // Max size of lists print ''.$langs->trans("MaxSizeList").''; print '' . getDolGlobalString('MAIN_SIZE_LISTE_LIMIT').''; - print 'conf->MAIN_SIZE_LISTE_LIMIT) ? " checked" : ""); + print 'conf->MAIN_SIZE_LISTE_LIMIT) ? " checked" : ""); print empty($dolibarr_main_demo) ? '' : ' disabled="disabled"'; // Disabled for demo - print '> '; + print '> '; print ''; + // Max size of lists + print ''.$langs->trans("MaxSizeShortList").''; + print '' . getDolGlobalString('MAIN_SIZE_SHORTLIST_LIMIT').''; + print 'conf->MAIN_SIZE_SHORTLIST_LIMIT) ? " checked" : ""); + print empty($dolibarr_main_demo) ? '' : ' disabled="disabled"'; // Disabled for demo + print '> '; + print ''; + print '
'; // Theme @@ -505,10 +527,16 @@ if ($action == 'edit') { // Max size for lists print ''.$langs->trans("MaxSizeList").''; - print ''.(getDolGlobalString('MAIN_SIZE_LISTE_LIMIT') ? $conf->global->MAIN_SIZE_LISTE_LIMIT : ' ').''; + print ''.getDolGlobalString('MAIN_SIZE_LISTE_LIMIT', ' ').''; print 'conf->MAIN_SIZE_LISTE_LIMIT) ? " checked" : "").'> '.$langs->trans("UsePersonalValue").''; print ''.(!empty($object->conf->MAIN_SIZE_LISTE_LIMIT) ? $object->conf->MAIN_SIZE_LISTE_LIMIT : ' ').''; + // Max size for lists + print ''.$langs->trans("MaxSizeShortList").''; + print ''.getDolGlobalString('MAIN_SIZE_SHORTLIST_LIMIT', ' ').''; + print 'conf->MAIN_SIZE_SHORTLIST_LIMIT) ? " checked" : "").'> '.$langs->trans("UsePersonalValue").''; + print ''.(!empty($object->conf->MAIN_SIZE_SHORTLIST_LIMIT) ? $object->conf->MAIN_SIZE_SHORTLIST_LIMIT : ' ').''; + print ''; print ''; print '
';