Fix warning qodana

This commit is contained in:
Laurent Destailleur
2023-06-29 13:47:28 +02:00
parent 673236cf4b
commit e6d77f991d
3 changed files with 17 additions and 15 deletions

View File

@@ -284,7 +284,7 @@ function formatDate(date,format)
while (i < format.length) while (i < format.length)
{ {
c=format.charAt(i); // Recupere char du format c=format.charAt(i); // Recupere char du format
substr=""; var substr = '';
j=i; j=i;
while ((format.charAt(j)==c) && (j < format.length)) // Recupere char successif identiques while ((format.charAt(j)==c) && (j < format.length)) // Recupere char successif identiques
{ {
@@ -456,7 +456,7 @@ function getIntegerInString(str,i,minlength,maxlength)
* ================================================================== * ==================================================================
*/ */
function urlencode(s) { function urlencode(s) {
news=s; var news = s;
news = news.replace(/\+/gi,'%2B'); news = news.replace(/\+/gi,'%2B');
news = news.replace(/&/gi,'%26'); news = news.replace(/&/gi,'%26');
return news; return news;
@@ -472,16 +472,16 @@ function urlencode(s) {
*/ */
function htmlEntityDecodeJs(inp){ function htmlEntityDecodeJs(inp){
var replacements = {'&lt;':'<','&gt;':'>','&sol;':'/','&quot;':'"','&apos;':'\'','&amp;':'&','&nbsp;':' '}; var replacements = {'&lt;':'<','&gt;':'>','&sol;':'/','&quot;':'"','&apos;':'\'','&amp;':'&','&nbsp;':' '};
if (inp) if (inp) {
{
for(var r in replacements){ for(var r in replacements){
inp = inp.replace(new RegExp(r,'g'),replacements[r]); inp = inp.replace(new RegExp(r,'g'),replacements[r]);
} }
return inp.replace(/&#(\d+);/g, function(match, dec) { return inp.replace(/&#(\d+);/g, function(match, dec) {
return String.fromCharCode(dec); return String.fromCharCode(dec);
}); });
} else {
return '';
} }
else { return ''; }
} }
@@ -509,7 +509,9 @@ function htmlEntityDecodeJs(inp){
* ================================================================== * ==================================================================
*/ */
function cleanSerialize(expr) { function cleanSerialize(expr) {
if (typeof(expr) != 'string') return ''; if (typeof(expr) != 'string') {
return '';
}
var reg = new RegExp("(&)", "g"); var reg = new RegExp("(&)", "g");
var reg2 = new RegExp("[^A-Z0-9,]", "g"); var reg2 = new RegExp("[^A-Z0-9,]", "g");
var liste1 = expr.replace(reg, ","); var liste1 = expr.replace(reg, ",");
@@ -962,12 +964,12 @@ function copyToClipboard(text,text2)
* @param url Url * @param url Url
* @param title Title of popup * @param title Title of popup
* @return boolean False * @return boolean False
* @see document_preview * @see document_preview()
*/ */
function newpopup(url, title) { function newpopup(url, title) {
var argv = newpopup.arguments; var argv = newpopup.arguments;
var argc = newpopup.arguments.length; var argc = newpopup.arguments.length;
tmp=url; var tmp = url;
console.log("newpopup "+argv[2]+" "+argv[3]); console.log("newpopup "+argv[2]+" "+argv[3]);
var l = (argc > 2) ? argv[2] : 600; var l = (argc > 2) ? argv[2] : 600;
var h = (argc > 3) ? argv[3] : 400; var h = (argc > 3) ? argv[3] : 400;
@@ -987,7 +989,7 @@ function newpopup(url, title) {
* @param type Mime file type ("image/jpeg", "application/pdf", "text/html") * @param type Mime file type ("image/jpeg", "application/pdf", "text/html")
* @param title Title of popup * @param title Title of popup
* @return void * @return void
* @see newpopup * @see newpopup()
*/ */
function document_preview(file, type, title) function document_preview(file, type, title)
{ {

View File

@@ -101,8 +101,8 @@ function addDispatchLine(index, type, mode) {
if (qty <= 1) { if (qty <= 1) {
window.alert("Remain quantity to dispatch is too low to be split"); window.alert("Remain quantity to dispatch is too low to be split");
} else { } else {
oldlineqty = qtyDispatched; var oldlineqty = qtyDispatched;
newlineqty = qtyOrdered - qtyDispatched; var newlineqty = qtyOrdered - qtyDispatched;
if (newlineqty <= 0) { if (newlineqty <= 0) {
newlineqty = qty - 1; newlineqty = qty - 1;
oldlineqty = 1; oldlineqty = 1;

View File

@@ -101,8 +101,8 @@ function addDispatchLine(index, type, mode) {
if (qty <= 1) { if (qty <= 1) {
window.alert("Remain quantity to dispatch is too low to be split"); window.alert("Remain quantity to dispatch is too low to be split");
} else { } else {
oldlineqty = qtyDispatched; var oldlineqty = qtyDispatched;
newlineqty = qtyOrdered - qtyDispatched; var newlineqty = qtyOrdered - qtyDispatched;
if (newlineqty <= 0) { if (newlineqty <= 0) {
newlineqty = qty - 1; newlineqty = qty - 1;
oldlineqty = 1; oldlineqty = 1;