diff --git a/htdocs/asterisk/wrapper.php b/htdocs/asterisk/wrapper.php
index 2f5096f6436..433c22979da 100644
--- a/htdocs/asterisk/wrapper.php
+++ b/htdocs/asterisk/wrapper.php
@@ -188,7 +188,7 @@ if (!empty($number)) {
} else {
$txt = "Call Asterisk dialer for caller: ".$caller.", called: ".$called." clicktodiallogin: ".$login;
dol_syslog($txt);
- print '
'."\n";
+ print ''."\n";
print '';
fputs($oSocket, "Action: login\r\n");
fputs($oSocket, "Events: off\r\n");
diff --git a/htdocs/compta/sociales/card.php b/htdocs/compta/sociales/card.php
index adb525c7d5e..4983236af4e 100644
--- a/htdocs/compta/sociales/card.php
+++ b/htdocs/compta/sociales/card.php
@@ -440,7 +440,7 @@ if ($action == 'create') {
print '';
print '';
print ' ';
- print '';
+ print '';
print '
';
print '';
diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php
index 2214dc94a81..ba6f35363b6 100644
--- a/htdocs/core/class/html.form.class.php
+++ b/htdocs/core/class/html.form.class.php
@@ -1115,7 +1115,7 @@ class Form
$out .= '';
if ($conf->use_javascript_ajax && empty($disableautocomplete)) {
- $out .= ajax_multiautocompleter('location_incoterms', '', DOL_URL_ROOT . '/core/ajax/locationincoterms.php') . "\n";
+ $out .= ajax_multiautocompleter('location_incoterms', array(), DOL_URL_ROOT . '/core/ajax/locationincoterms.php') . "\n";
$moreattrib .= ' autocomplete="off"';
}
$out .= '' . "\n";
diff --git a/htdocs/core/class/html.formcompany.class.php b/htdocs/core/class/html.formcompany.class.php
index d2fda62ae97..737e61fa4b1 100644
--- a/htdocs/core/class/html.formcompany.class.php
+++ b/htdocs/core/class/html.formcompany.class.php
@@ -876,7 +876,7 @@ class FormCompany extends Form
* @param string $morecss More css
* @return string
*/
- public function select_ziptown($selected = '', $htmlname = 'zipcode', $fields = '', $fieldsize = 0, $disableautocomplete = 0, $moreattrib = '', $morecss = '')
+ public function select_ziptown($selected = '', $htmlname = 'zipcode', $fields = array(), $fieldsize = 0, $disableautocomplete = 0, $moreattrib = '', $morecss = '')
{
// phpcs:enable
global $conf;
diff --git a/htdocs/core/class/lessc.class.php b/htdocs/core/class/lessc.class.php
index 730f2c0f9e2..34e187085af 100644
--- a/htdocs/core/class/lessc.class.php
+++ b/htdocs/core/class/lessc.class.php
@@ -1905,7 +1905,7 @@ class Lessc
}
// type based operators
- $fname = "op_${ltype}_${rtype}";
+ $fname = "op_".$ltype."_".$rtype;
if (is_callable(array($this, $fname))) {
$out = $this->$fname($op, $left, $right);
if (!is_null($out)) {
diff --git a/htdocs/core/filemanagerdol/browser/default/browser.php b/htdocs/core/filemanagerdol/browser/default/browser.php
index 1cf6d8612c2..f97841a1231 100644
--- a/htdocs/core/filemanagerdol/browser/default/browser.php
+++ b/htdocs/core/filemanagerdol/browser/default/browser.php
@@ -104,7 +104,7 @@ oConnector.CurrentFolder = '/' ;
var sConnUrl = GetUrlParam( 'Connector' );
// Gecko has some problems when using relative URLs (not starting with slash).
-if ( sConnUrl.substr(0,1) != '/' && sConnUrl.indexOf( '://' ) < 0 )
+if ( sConnUrl.substring(0,1) != '/' && sConnUrl.indexOf( '://' ) < 0 )
sConnUrl = window.location.href.replace( /browser.php.*$/, '' ) + sConnUrl ;
oConnector.ConnectorUrl = sConnUrl + ( sConnUrl.indexOf('?') != -1 ? '&' : '?' );
diff --git a/htdocs/core/get_menudiv.php b/htdocs/core/get_menudiv.php
index 8ce7e798c45..4dfe4cc5c75 100644
--- a/htdocs/core/get_menudiv.php
+++ b/htdocs/core/get_menudiv.php
@@ -225,7 +225,7 @@ $(document).ready(function(){
$(this).find("li ul").slideToggle(200);
- target = $(this);
+ var target = $(this);
$(\'html, body\').animate({
scrollTop: target.offset().top
}, 300);
diff --git a/htdocs/core/js/dst.js b/htdocs/core/js/dst.js
index 8433ada72a9..7276e37755c 100644
--- a/htdocs/core/js/dst.js
+++ b/htdocs/core/js/dst.js
@@ -1,4 +1,4 @@
-// Copyright (C) 2011-2014 Laurent Destailleur
+// Copyright (C) 2011-2023 Laurent Destailleur
// Copyright (C) 2011-2012 Regis Houssin
// Copyright (C) 2015 Marcos GarcĂa
//
@@ -69,7 +69,7 @@ function DisplayDstSwitchDates(firstsecond)
var lastOffset = 99;
// Loop through every month of the current year
- for (i = 0; i < 12; i++)
+ for (let i = 0; i < 12; i++)
{
// Fetch the timezone value for the month
var newDate = new Date(Date.UTC(year, i, 0, 0, 0, 0, 0));
@@ -109,7 +109,7 @@ function FindDstSwitchDate(year, month)
var dstDate;
// Loop to find the exact day a timezone adjust occurs
- for (day = 0; day < 50; day++)
+ for (let day = 0; day < 50; day++)
{
var tmpDate = new Date(Date.UTC(year, month, day, 0, 0, 0, 0));
var tmpOffset = -1 * tmpDate.getTimezoneOffset() / 60;
diff --git a/htdocs/core/js/lib_head.js.php b/htdocs/core/js/lib_head.js.php
index 10f600ea349..051aa2a702f 100644
--- a/htdocs/core/js/lib_head.js.php
+++ b/htdocs/core/js/lib_head.js.php
@@ -1227,7 +1227,7 @@ function pricejs(amount, mode = 'MT', currency_code = '', force_locale = '') {
* Function similar to PHP price2num()
*
* @param {number|string} amount The amount to convert/clean
- * @return {string} The amount in universal numeric format (Example: '99.99999')
+ * @return {number} The amount in universal numeric format (Example: '99.99999')
* @todo Implement rounding parameter
*/
function price2numjs(amount) {
@@ -1246,20 +1246,27 @@ function price2numjs(amount) {
var rounding = main_rounding_unit;
var pos = amount.indexOf(dec);
var decpart = '';
- if (pos >= 0) decpart = amount.substr(pos + 1).replace('/0+$/i', ''); // Remove 0 for decimal part
+ if (pos >= 0) {
+ decpart = amount.substring(pos + 1).replace('/0+$/i', ''); // Remove 0 for decimal part
+ }
var nbdec = decpart.length;
- if (nbdec > rounding) rounding = nbdec;
+ if (nbdec > rounding) {
+ rounding = nbdec;
+ }
// If rounding higher than max shown
if (rounding > main_max_dec_shown) rounding = main_max_dec_shown;
if (thousand != ',' && thousand != '.') amount = amount.replace(',', '.');
amount = amount.replace(' ', ''); // To avoid spaces
amount = amount.replace(thousand, ''); // Replace of thousand before replace of dec to avoid pb if thousand is .
amount = amount.replace(dec, '.');
+
//console.log("amount before="+amount+" rouding="+rounding)
var res = Math.round10(amount, - rounding);
// Other solution is
// var res = dolroundjs(amount, rounding)
+
console.log("price2numjs text="+amount+" return="+res);
+
return res;
}
diff --git a/htdocs/core/js/timesheet.js b/htdocs/core/js/timesheet.js
index 63c395a953b..bb0090b7e15 100644
--- a/htdocs/core/js/timesheet.js
+++ b/htdocs/core/js/timesheet.js
@@ -63,7 +63,7 @@ function regexEvent(objet,evt,type)
case 'timeChar':
//var regex= /^[0-9:]{1}$/;
//alert(event.charCode);
- var charCode = (evt.which) ? evt.which : event.keyCode;
+ var charCode = (evt.which) ? evt.which : evt.keyCode;
if(((charCode >= 48) && (charCode <= 57)) || //num
(charCode===46) || (charCode===8)||// comma & periode
diff --git a/htdocs/core/lib/barcode.lib.php b/htdocs/core/lib/barcode.lib.php
index c7d1edde3df..717ed4af1c6 100644
--- a/htdocs/core/lib/barcode.lib.php
+++ b/htdocs/core/lib/barcode.lib.php
@@ -305,7 +305,7 @@ function barcode_encode_upc($upc, $encoding = "UPC")
if ($a > 1) {
$text .= " ";
}
- $text .= "$pos:12:{$upc[$a]}";
+ $text .= $pos.":12:".$upc[$a];
if ($a == 1) {
$pos += 15;
} elseif ($a == 6) {
diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php
index 9231eba57ae..8e96c8f4d29 100644
--- a/htdocs/core/lib/functions.lib.php
+++ b/htdocs/core/lib/functions.lib.php
@@ -1866,8 +1866,8 @@ function dolButtonToOpenUrlInDialogPopup($name, $label, $buttonstring, $url, $di
console.log("open popup name='.$name.', backtopagejsfields='.$backtopagejsfields.'");
},
close: function (event, ui) {
- returnedid = jQuery("#varforreturndialogid'.$name.'").text();
- returnedlabel = jQuery("#varforreturndialoglabel'.$name.'").text();
+ var returnedid = jQuery("#varforreturndialogid'.$name.'").text();
+ var returnedlabel = jQuery("#varforreturndialoglabel'.$name.'").text();
console.log("popup has been closed. returnedid (js var defined into parent page)="+returnedid+" returnedlabel="+returnedlabel);
if (returnedid != "" && returnedid != "div for returned id") {
jQuery("#'.(empty($backtopagejsfieldsid)?"none":$backtopagejsfieldsid).'").val(returnedid);
diff --git a/htdocs/core/tpl/objectline_edit.tpl.php b/htdocs/core/tpl/objectline_edit.tpl.php
index a0bf235c0eb..b7824787ab0 100644
--- a/htdocs/core/tpl/objectline_edit.tpl.php
+++ b/htdocs/core/tpl/objectline_edit.tpl.php
@@ -453,11 +453,12 @@ if (!empty($usemargins) && $user->rights->margins->creer) {
}
var price = 0;
- remisejs=price2numjs(remise.val());
+ remisejs = price2numjs(remise.val());
- if (remisejs != 100) // If a discount not 100 or no discount
- {
- if (remisejs == '') remisejs=0;
+ if (remisejs != 100) { // If a discount not 100 or no discount
+ if (remisejs == '') {
+ remisejs = 0;
+ }
bpjs=price2numjs(buying_price.val());
ratejs=price2numjs(rate.val());
diff --git a/htdocs/hrm/compare.php b/htdocs/hrm/compare.php
index 63b40cccb0e..15b03e587c7 100644
--- a/htdocs/hrm/compare.php
+++ b/htdocs/hrm/compare.php
@@ -86,8 +86,8 @@ print dol_get_fiche_head($head, 'compare', '', 1);
}
- $userl = $(this).closest('ul');
- listname = $userl.attr('name');
+ var $userl = $(this).closest('ul');
+ var listname = $userl.attr('name');
var TId = [];
diff --git a/htdocs/install/fileconf.php b/htdocs/install/fileconf.php
index 24afafbb83c..86cd4af0f5c 100644
--- a/htdocs/install/fileconf.php
+++ b/htdocs/install/fileconf.php
@@ -630,7 +630,7 @@ function jscheckparam()
{
console.log("Click on jscheckparam");
- ok=true;
+ var ok = true;
if (document.forminstall.main_dir.value == '')
{
diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php
index dc65c49d9a3..a910f32f54b 100644
--- a/htdocs/main.inc.php
+++ b/htdocs/main.inc.php
@@ -2837,18 +2837,18 @@ function top_menu_bookmark()
jQuery("#topmenu-bookmark-dropdown .dropdown-toggle").on("click", function(event) {
console.log("Click on #topmenu-bookmark-dropdown .dropdown-toggle");
- openBookMarkDropDown();
+ openBookMarkDropDown(event);
});
// Key map shortcut
- jQuery(document).keydown(function(e){
- if( e.which === 77 && e.ctrlKey && e.shiftKey ){
- console.log(\'control + shift + m : trigger open bookmark dropdown\');
- openBookMarkDropDown();
+ jQuery(document).keydown(function(event){
+ if( event.which === 77 && event.ctrlKey && event.shiftKey ){
+ console.log("Click on control + shift + m : trigger open bookmark dropdown");
+ openBookMarkDropDown(event);
}
});
- var openBookMarkDropDown = function() {
+ var openBookMarkDropDown = function(event) {
event.preventDefault();
jQuery("#topmenu-bookmark-dropdown").toggleClass("open");
jQuery("#top-bookmark-search-input").focus();
diff --git a/htdocs/takepos/phone.php b/htdocs/takepos/phone.php
index 4e2ddac6592..71db0177d88 100644
--- a/htdocs/takepos/phone.php
+++ b/htdocs/takepos/phone.php
@@ -249,6 +249,8 @@ function AddProductConfirm(placeid, productid){
});';
}
?>
+
+ return true;
}
function SetQty(place, selectedline, qty){
@@ -278,6 +280,8 @@ function SetQty(place, selectedline, qty){
}
?>
LoadCats();
+
+ return true;
}
function SetNote(place, selectedline){
diff --git a/htdocs/takepos/reduction.php b/htdocs/takepos/reduction.php
index 5d80acb0f81..995d18599a3 100644
--- a/htdocs/takepos/reduction.php
+++ b/htdocs/takepos/reduction.php
@@ -212,19 +212,19 @@ if (!isset($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON) || !empty($conf->glob
7';
-print '';
-print '';
+print '';
+print '';
+print '';
print '';
-print '';
-print '';
-print '';
+print '';
+print '';
+print '';
print '';
-print '';
-print '';
-print '';
+print '';
+print '';
+print '';
print '';
-print '';
+print '';
print '';
print '';
print '';
diff --git a/qodana.yaml b/qodana.yaml
index 64734dcc383..b983cfee78d 100644
--- a/qodana.yaml
+++ b/qodana.yaml
@@ -111,4 +111,7 @@ exclude:
- name: JSUnnecessarySemicolon
- name: JSPrimitiveTypeWrapperUsage
- name: PhpFullyQualifiedNameUsageInspection
-
\ No newline at end of file
+ - name: PhpDocMissingThrowsInspection
+ - name: UnnecessaryLabelJS
+
+
\ No newline at end of file