From 729c2da70aebed5a4962d8bfd6e200b5199ba2f8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 23 Jul 2026 11:44:05 +0200 Subject: [PATCH] Code comment --- htdocs/core/js/lib_head.js.php | 19 ++++++++++++++----- htdocs/main.inc.php | 11 ++++++----- 2 files changed, 20 insertions(+), 10 deletions(-) diff --git a/htdocs/core/js/lib_head.js.php b/htdocs/core/js/lib_head.js.php index 90f093db0ad..3426a83d592 100644 --- a/htdocs/core/js/lib_head.js.php +++ b/htdocs/core/js/lib_head.js.php @@ -148,7 +148,10 @@ if ($thousand == 'Space') { // Javascript libraries for Dolibarr ERP CRM (https://www.dolibarr.org) -// To start/stop Block UI +/* + * To start/stop Block UI + */ + function dolBlockUI(message = 'Loading...', indicatorUrl = 'theme."/img/working.gif" ; ?>') { const block = document.getElementById('dol-block-ui'); if (block != null) { @@ -165,7 +168,10 @@ function dolUnblockUI() { } -// For jQuery date picker +/* + * For jQuery date picker + */ + var tradMonths = ; var tradMonthsShort = ; var tradDays = ; @@ -295,6 +301,7 @@ function dpChangeDay(dateFieldID, format) return 0; } + /* * ================================================================= * Function: formatDate(javascript object Date(), format) @@ -356,7 +363,6 @@ function formatDate(date,format) return result; } - /* * ================================================================= * Function: getDateFromFormat(date_string, format_string) @@ -504,6 +510,7 @@ function urlencode(s) { return news; } + /* * ================================================================= * Purpose: Clean string to get a HTML coded string. @@ -1379,9 +1386,11 @@ function generateFilterString(column, operator, context, fieldType) { } })(); + // Another solution, easier, to build a javascript rounding function function dolroundjs(number, decimals) { return +(Math.round(number + "e+" + decimals) + "e-" + decimals); } + /** * Function similar to PHP price() * @@ -1604,10 +1613,10 @@ jQuery(document).ready(function() { jQuery(document).on("click", function(event) { // search if click was outside drop down if (!$(event.target).closest('.butAction.dropdown-toggle').length) { - /* console.log("click close butAction - we click outside"); */ + /* console.log("click close butAction - we click outside"); // disabled because too verbose */ let parentholder = jQuery(".butAction.dropdown-toggle").closest(".dropdown.open"); if (parentholder){ - // Hide the menus. + // Hide the dropdown. parentholder.removeClass("open --up --left"); } } diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 6ffdb4afcb8..0dff765d8da 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -2700,7 +2700,8 @@ function top_menu_user($hideloginname = 0, $urllogout = '') jQuery(document).on("click", function(event) { if (jQuery("#topmenu-login-dropdown").hasClass("open")) { if (!$(event.target).closest("#topmenu-login-dropdown").length) { - /* console.log("click close login - we click outside"); */ + /* console.log("click close login - we click outside"); // disabled because too verbose */ + // Hide the dropdown. closeTopMenuLoginDropdown(); } } @@ -2901,8 +2902,8 @@ function top_menu_quickadd() jQuery(document).ready(function() { jQuery(document).on("click", function(event) { if (!$(event.target).closest("#topmenu-quickadd-dropdown").length) { - /* console.log("click close quick add - we click outside"); */ - // Hide the menus. + /* console.log("click close quick add - we click outside"); // disabled because too verbose */ + // Hide the dropdown. $("#topmenu-quickadd-dropdown").removeClass("open"); } }); @@ -3365,8 +3366,8 @@ function top_menu_search() // close drop down jQuery(document).on("click", function(event) { if (!$(event.target).closest("#topmenu-global-search-dropdown").length) { - console.log("click close search - we click outside"); - // Hide the menus. + /* console.log("click close search - we click outside"); // disabled because too verbose */ + // Hide the dropdown. jQuery("#topmenu-global-search-dropdown").removeClass("open"); } });