From 84d982cdfbd4e172a63617d3edf5271ad9eb4b5b Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Thu, 16 Jan 2025 15:35:17 +0100 Subject: [PATCH] Fix js warning --- htdocs/core/class/html.form.class.php | 6 +++--- htdocs/societe/card.php | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 16ab5f8f1b9..847d8fe8027 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -9091,7 +9091,7 @@ class Form }, cache: true }, - language: select2arrayoflanguage || \'en\', + language: (typeof select2arrayoflanguage === \'undefined\') ? \'en\' : select2arrayoflanguage, containerCssClass: \':all:\', /* Line to add class from the original SELECT propagated to the new tag */ placeholder: \'' . dol_escape_js($placeholder) . '\', escapeMarkup: function (markup) { return markup; }, // let our custom formatter work @@ -9375,7 +9375,7 @@ class Form // Specify format function for selected item formatSelection: formatSelection, templateSelection: formatSelection, /* For 4.0 */ - language: select2arrayoflanguage || \'en\' + language: (typeof select2arrayoflanguage === \'undefined\') ? \'en\' : select2arrayoflanguage }); /* Add also morecss to the css .select2 that is after the #htmlname, for component that are show dynamically after load, because select2 set diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index 470acf88c76..fd29d86a584 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -1375,7 +1375,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($canvasdisplayactio placeholder: "' . $langs->trans('Name of the new third party. In the meantime we check if it already exists...') . '", allowClear: true, minimumInputLength: 3, - language: select2arrayoflanguage, + language: (typeof select2arrayoflanguage === \'undefined\') ? \'en\' : select2arrayoflanguage, containerCssClass: ":all:", selectionCssClass: ":all:", tags: true,