From e2ec34e1e545ddea1471d26814b48044ee070cc8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 1 May 2023 14:33:08 +0200 Subject: [PATCH] Clean code --- htdocs/admin/expensereport_ik.php | 2 +- .../class/assetaccountancycodes.class.php | 2 +- .../class/assetdepreciationoptions.class.php | 2 +- htdocs/core/class/evalmath.class.php | 2 +- htdocs/core/class/html.form.class.php | 2 +- htdocs/core/class/lessc.class.php | 2 +- htdocs/core/class/translate.class.php | 2 +- .../connectors/php/connector.lib.php | 2 +- htdocs/core/js/lib_head.js.php | 49 ++++++++++++------- htdocs/core/lib/barcode.lib.php | 2 +- htdocs/core/lib/functions.lib.php | 10 ++-- .../class/expensereport.class.php | 2 +- htdocs/hrm/job_card.php | 2 +- htdocs/hrm/position.php | 2 +- htdocs/hrm/skill_card.php | 2 +- htdocs/modulebuilder/index.php | 6 +-- htdocs/product/fournisseurs.php | 4 +- .../stocktransfer/stocktransfer_card.php | 2 +- htdocs/projet/card.php | 3 +- .../eventorganization/subscriptionok.php | 2 +- htdocs/public/payment/paymentko.php | 2 +- htdocs/public/payment/paymentok.php | 4 +- .../company/actions_card_company.class.php | 4 +- htdocs/societe/card.php | 6 +-- htdocs/societe/checkvat/checkVatPopup.php | 2 +- htdocs/takepos/index.php | 10 +++- htdocs/takepos/invoice.php | 11 ++++- htdocs/takepos/pay.php | 4 ++ htdocs/variants/card.php | 2 +- .../variants/class/ProductAttribute.class.php | 2 +- qodana.yaml | 6 +++ 31 files changed, 93 insertions(+), 62 deletions(-) diff --git a/htdocs/admin/expensereport_ik.php b/htdocs/admin/expensereport_ik.php index b26cefba580..7124a24c82a 100644 --- a/htdocs/admin/expensereport_ik.php +++ b/htdocs/admin/expensereport_ik.php @@ -184,7 +184,7 @@ foreach ($rangesbycateg as $fk_c_exp_tax_cat => $Tab) { if ($range->range_active == 1) { if ($action == 'edit' && $range->ik->id == $id && $range->rowid == $fk_range && $range->fk_c_exp_tax_cat == $fk_c_exp_tax_cat) { echo ''; - echo ''; + echo ''; } else { echo ''.img_edit().''; if (!empty($range->ik->id)) { diff --git a/htdocs/asset/class/assetaccountancycodes.class.php b/htdocs/asset/class/assetaccountancycodes.class.php index 60b545ba6ce..6c33e3af901 100644 --- a/htdocs/asset/class/assetaccountancycodes.class.php +++ b/htdocs/asset/class/assetaccountancycodes.class.php @@ -174,7 +174,7 @@ class AssetAccountancyCodes extends CommonObject public function updateAccountancyCodes($user, $asset_id = 0, $asset_model_id = 0, $notrigger = 0) { global $langs, $hookmanager; - dol_syslog(__METHOD__ . " user_id={$user->id}, asset_id=$asset_id, asset_model_id=$asset_model_id, notrigger=$notrigger"); + dol_syslog(__METHOD__ . " user_id=".$user->id.", asset_id=".$asset_id.", asset_model_id=".$asset_model_id.", notrigger=".$notrigger); $error = 0; $this->errors = array(); diff --git a/htdocs/asset/class/assetdepreciationoptions.class.php b/htdocs/asset/class/assetdepreciationoptions.class.php index f2411ea4494..8d52fa1a6a4 100644 --- a/htdocs/asset/class/assetdepreciationoptions.class.php +++ b/htdocs/asset/class/assetdepreciationoptions.class.php @@ -418,7 +418,7 @@ class AssetDepreciationOptions extends CommonObject public function updateDeprecationOptions($user, $asset_id = 0, $asset_model_id = 0, $notrigger = 0) { global $langs, $hookmanager; - dol_syslog(__METHOD__ . " user_id={$user->id}, asset_id=$asset_id, asset_model_id=$asset_model_id, notrigger=$notrigger"); + dol_syslog(__METHOD__ . " user_id=".$user->id.", asset_id=".$asset_id.", asset_model_id=".$asset_model_id.", notrigger=".$notrigger); $error = 0; $this->errors = array(); diff --git a/htdocs/core/class/evalmath.class.php b/htdocs/core/class/evalmath.class.php index 24be9731df9..8ae529091af 100644 --- a/htdocs/core/class/evalmath.class.php +++ b/htdocs/core/class/evalmath.class.php @@ -248,7 +248,7 @@ class EvalMath $matches = array(); if (preg_match("/[^\w\s+*^\/()\.,-]/", $expr, $matches)) { // make sure the characters are all good - return $this->trigger(4, "illegal character '{$matches[0]}'", $matches[0]); + return $this->trigger(4, "illegal character '".$matches[0]."'", $matches[0]); } while (1) { // 1 Infinite Loop ;) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 13779fb64da..2214dc94a81 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -9181,7 +9181,7 @@ class Form if (empty($conf->use_javascript_ajax)) { print ''; } else { - print ''; + print ''; } print ''; $this->db->free($resqllist); diff --git a/htdocs/core/class/lessc.class.php b/htdocs/core/class/lessc.class.php index 69846b46fa7..730f2c0f9e2 100644 --- a/htdocs/core/class/lessc.class.php +++ b/htdocs/core/class/lessc.class.php @@ -873,7 +873,7 @@ class Lessc break; default: - $this->throwError("unknown op: {$prop[0]}\n"); + $this->throwError("unknown op: $prop[0]\n"); } } diff --git a/htdocs/core/class/translate.class.php b/htdocs/core/class/translate.class.php index 19cb66ad68d..5aa334600fb 100644 --- a/htdocs/core/class/translate.class.php +++ b/htdocs/core/class/translate.class.php @@ -1049,7 +1049,7 @@ class Translate if (isset($this->cache_currencies[$currency_code]) && !empty($this->cache_currencies[$currency_code]['unicode']) && is_array($this->cache_currencies[$currency_code]['unicode'])) { foreach ($this->cache_currencies[$currency_code]['unicode'] as $unicode) { - $currency_sign .= mb_convert_encoding("&#{$unicode};", "UTF-8", 'HTML-ENTITIES'); + $currency_sign .= mb_convert_encoding("&#".$unicode.";", "UTF-8", 'HTML-ENTITIES'); } } } diff --git a/htdocs/core/filemanagerdol/connectors/php/connector.lib.php b/htdocs/core/filemanagerdol/connectors/php/connector.lib.php index 75c4d1e3e08..694292ef47a 100644 --- a/htdocs/core/filemanagerdol/connectors/php/connector.lib.php +++ b/htdocs/core/filemanagerdol/connectors/php/connector.lib.php @@ -527,7 +527,7 @@ function ServerMapFolder($resourceType, $folderPath, $sCommand) // Ensure that the directory exists. $sErrorMsg = CreateServerFolder($sResourceTypePath); if ($sErrorMsg != '') { - SendError(1, "Error creating folder \"{$sResourceTypePath}\" ({$sErrorMsg})"); + SendError(1, "Error creating folder \"$sResourceTypePath\" ($sErrorMsg)"); } // Return the resource type directory combined with the required path. diff --git a/htdocs/core/js/lib_head.js.php b/htdocs/core/js/lib_head.js.php index 2e552ea605e..10f600ea349 100644 --- a/htdocs/core/js/lib_head.js.php +++ b/htdocs/core/js/lib_head.js.php @@ -565,6 +565,7 @@ function hideMessage(fieldId,message) { * @param int userid User id * @param int value Value to set * @param string token Token + * @retun boolean */ function setConstant(url, code, input, entity, strict, forcereload, userid, token, value) { var saved_url = url; /* avoid undefined url */ @@ -654,20 +655,23 @@ function setConstant(url, code, input, entity, strict, forcereload, userid, toke return false; } }).fail(function(error) { console.log("Error, we force reload"); location.reload(); }); /* When it fails, we always force reload to have setEventErrorMessages in session visible */ + + return true; } /* * Used by button to set on/off * Call url then make complementary action (like show/hide, enable/disable or set another option). * - * @param string url Url (warning: as any url called in ajax mode, the url called here must not renew the token) - * @param string code Code - * @param string intput Array of complementary actions to do if success - * @param int entity Entity - * @param int strict Strict - * @param int forcereload Force reload - * @param int userid User id - * @param string token Token + * @param {string} url Url (warning: as any url called in ajax mode, the url called here must not renew the token) + * @param {string} code Code + * @param {string} intput Array of complementary actions to do if success + * @param {int} entity Entity + * @param {int} strict Strict + * @param {int} forcereload Force reload + * @param {int} userid User id + * @param {string} token Token + * @return boolean */ function delConstant(url, code, input, entity, strict, forcereload, userid, token) { var saved_url = url; /* avoid undefined url */ @@ -747,6 +751,8 @@ function delConstant(url, code, input, entity, strict, forcereload, userid, toke return false; } }).fail(function(error) { console.log("Error, we force reload"); location.reload(); }); /* When it fails, we always force reload to have setEventErrorMessages in session visible */ + + return true; } /* @@ -764,6 +770,7 @@ function delConstant(url, code, input, entity, strict, forcereload, userid, toke * @param int strict Strict * @param int userid User id * @param string token Token + * @return boolean */ function confirmConstantAction(action, url, code, input, box, entity, yesButton, noButton, strict, userid, token) { var boxConfirm = box; @@ -809,6 +816,8 @@ function confirmConstantAction(action, url, code, input, box, entity, yesButton, if (boxConfirm.info) { $("#noButton_" + code).button().hide(); } + + return true; } @@ -931,8 +940,8 @@ function confirmConstantAction(action, url, code, input, box, entity, yesButton, /** * Function to output a dialog box for copy/paste * - * @param string text Text to put into copy/paste area - * @param string text2 Text to put under the copy/paste area + * @param text Text to put into copy/paste area + * @param text2 Text to put under the copy/paste area */ function copyToClipboard(text,text2) { @@ -942,6 +951,7 @@ function copyToClipboard(text,text2) $("#dialogforpopup").html(newElem); $("#dialogforpopup").dialog(); $("#coordsforpopup").select(); + return false; } @@ -949,9 +959,9 @@ function copyToClipboard(text,text2) /** * Show a popup HTML page. Use the "window.open" function. * - * @param string url Url - * @param string title Title of popup - * @return boolean False + * @param url Url + * @param title Title of popup + * @return boolean False * @see document_preview */ function newpopup(url, title) { @@ -965,6 +975,7 @@ function newpopup(url, title) { var top = (screen.height - h)/2; var wfeatures = "directories=0,menubar=0,status=0,resizable=0,scrollbars=1,toolbar=0,width=" + l +",height=" + h + ",left=" + left + ",top=" + top; fen=window.open(tmp,title,wfeatures); + return false; } @@ -972,9 +983,9 @@ function newpopup(url, title) { * Function show document preview. It uses the "dialog" function. * The a tag around the img must have the src='', class='documentpreview', mime='image/xxx', target='_blank' from getAdvancedPreviewUrl(). * - * @param string file Url - * @param string type Mime file type ("image/jpeg", "application/pdf", "text/html") - * @param string title Title of popup + * @param file Url + * @param type Mime file type ("image/jpeg", "application/pdf", "text/html") + * @param title Title of popup * @return void * @see newpopup */ @@ -1064,9 +1075,9 @@ function document_preview(file, type, title) /* * Provide a function to get an URL GET parameter in javascript * - * @param string name Name of parameter - * @param mixed valueifnotfound Value if not found - * @return string Value + * @param name Name of parameter + * @param valueifnotfound Value if not found + * @return string Value */ function getParameterByName(name, valueifnotfound) { diff --git a/htdocs/core/lib/barcode.lib.php b/htdocs/core/lib/barcode.lib.php index 560f4b772b4..c7d1edde3df 100644 --- a/htdocs/core/lib/barcode.lib.php +++ b/htdocs/core/lib/barcode.lib.php @@ -257,7 +257,7 @@ function barcode_encode_ean($ean, $encoding = "EAN-13") if ($a > 0) { $text .= " "; } - $text .= "$pos:12:{$ean[$a]}"; + $text .= $pos.":12:".$ean[$a]; if ($a == 0) { $pos += 12; } elseif ($a == 6) { diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index bfbf0f8414e..9231eba57ae 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -1837,7 +1837,7 @@ function dolButtonToOpenUrlInDialogPopup($name, $label, $buttonstring, $url, $di if (empty($conf->use_javascript_ajax)) { $out .= ' href="'.DOL_URL_ROOT.$url.'" target="_blank"'; } elseif ($jsonopen) { - $out .= ' href="#" onclick="javascript:'.$jsonopen.'"'; + $out .= ' href="#" onclick="'.$jsonopen.'"'; } else { $out .= ' href="#"'; } @@ -5452,7 +5452,7 @@ function load_fiche_titre($titre, $morehtmlright = '', $picto = 'generic', $pict * Print a title with navigation controls for pagination * * @param string $titre Title to show (required) - * @param int $page Numero of page to show in navigation links (required) + * @param int|null $page Numero of page to show in navigation links (required) * @param string $file Url of page (required) * @param string $options More parameters for links ('' by default, does not include sortfield neither sortorder). Value must be 'urlencoded' before calling function. * @param string $sortfield Field to sort on ('' by default) @@ -5479,6 +5479,8 @@ function print_barre_liste($titre, $page, $file, $options = '', $sortfield = '', $savtotalnboflines = $totalnboflines; $totalnboflines = abs((int) $totalnboflines); + $page = (int) $page; + if ($picto == 'setup') { $picto = 'title_setup.png'; } @@ -5529,7 +5531,7 @@ function print_barre_liste($titre, $page, $file, $options = '', $sortfield = '', } // Show navigation bar $pagelist = ''; - if ($savlimit != 0 && ((int) $page > 0 || $num > $limit)) { + if ($savlimit != 0 && ($page > 0 || $num > $limit)) { if ($totalnboflines) { // If we know total nb of lines // Define nb of extra page links before and after selected page + ... + first or last $maxnbofpage = (empty($conf->dol_optimize_smallscreen) ? 4 : 0); @@ -5590,7 +5592,7 @@ function print_barre_liste($titre, $page, $file, $options = '', $sortfield = '', } if ($savlimit || $morehtmlright || $morehtmlrightbeforearrow) { - print_fleche_navigation((int) $page, $file, $options, $nextpage, $pagelist, $morehtmlright, $savlimit, $totalnboflines, $hideselectlimit, $morehtmlrightbeforearrow, $hidenavigation); // output the div and ul for previous/last completed with page numbers into $pagelist + print_fleche_navigation($page, $file, $options, $nextpage, $pagelist, $morehtmlright, $savlimit, $totalnboflines, $hideselectlimit, $morehtmlrightbeforearrow, $hidenavigation); // output the div and ul for previous/last completed with page numbers into $pagelist } // js to autoselect page field on focus diff --git a/htdocs/expensereport/class/expensereport.class.php b/htdocs/expensereport/class/expensereport.class.php index 3cf5d8a5003..5cb0f88e67b 100644 --- a/htdocs/expensereport/class/expensereport.class.php +++ b/htdocs/expensereport/class/expensereport.class.php @@ -2335,7 +2335,7 @@ class ExpenseReport extends CommonObject // phpcs:enable $sql = "SELECT rowid, date_debut, date_fin"; $sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element; - $sql .= " WHERE fk_user_author = '{$fuser->id}'"; + $sql .= " WHERE fk_user_author = ".((int) $fuser->id); dol_syslog(get_class($this)."::periode_existe sql=".$sql); $result = $this->db->query($sql); diff --git a/htdocs/hrm/job_card.php b/htdocs/hrm/job_card.php index d9bc8629e9f..942b17a5193 100644 --- a/htdocs/hrm/job_card.php +++ b/htdocs/hrm/job_card.php @@ -210,7 +210,7 @@ if ($action == 'create') { print '
'; print ''; print '  '; - print ''; // Cancel for create does not post form if we don't know the backtopage + print ''; // Cancel for create does not post form if we don't know the backtopage print '
'; print ''; diff --git a/htdocs/hrm/position.php b/htdocs/hrm/position.php index 92f3efd6fe9..29dc18aa828 100644 --- a/htdocs/hrm/position.php +++ b/htdocs/hrm/position.php @@ -279,7 +279,7 @@ if ($action == 'create') { print ''; print '  '; - print ''; // Cancel for create does not post form if we don't know the backtopage + print ''; // Cancel for create does not post form if we don't know the backtopage print ''; print ''; diff --git a/htdocs/hrm/skill_card.php b/htdocs/hrm/skill_card.php index d5b62b26151..bb84aeddbce 100644 --- a/htdocs/hrm/skill_card.php +++ b/htdocs/hrm/skill_card.php @@ -225,7 +225,7 @@ if ($action == 'create') { print ''; print '  '; - print ''; // Cancel for create does not post form if we don't know the backtopage + print ''; // Cancel for create does not post form if we don't know the backtopage print ''; print ''; diff --git a/htdocs/modulebuilder/index.php b/htdocs/modulebuilder/index.php index 4a76968d43e..d5a7a7079b2 100644 --- a/htdocs/modulebuilder/index.php +++ b/htdocs/modulebuilder/index.php @@ -2864,11 +2864,7 @@ if (!empty($module) && $module != 'initmodule' && $module != 'deletemodule') { dol_include_once($fullpathdirtodescriptor); $class = 'mod'.$module; - } catch (Throwable $e) { // This is called in PHP 7 only (includes Error and Exception). Never called with PHP 5.6-. - $loadclasserrormessage = $e->getMessage()."
\n"; - $loadclasserrormessage .= 'File: '.$e->getFile()."
\n"; - $loadclasserrormessage .= 'Line: '.$e->getLine()."
\n"; - } catch (Exception $e) { // This is called in PHP 5.6- because not already trapped by previous case in PHP 5.6-. + } catch (Throwable $e) { // This is called in PHP 7 only (includes Error and Exception) $loadclasserrormessage = $e->getMessage()."
\n"; $loadclasserrormessage .= 'File: '.$e->getFile()."
\n"; $loadclasserrormessage .= 'Line: '.$e->getLine()."
\n"; diff --git a/htdocs/product/fournisseurs.php b/htdocs/product/fournisseurs.php index 2a4217f5810..5d62485f3bc 100644 --- a/htdocs/product/fournisseurs.php +++ b/htdocs/product/fournisseurs.php @@ -537,8 +537,8 @@ if ($id > 0 || $ref) { rate_options = $.parseHTML(data.value) rate_options.forEach(opt => { if (opt.selected) { - replaceVATWithSupplierValue(opt.value) - return + replaceVATWithSupplierValue(opt.value); + return; } }) } diff --git a/htdocs/product/stock/stocktransfer/stocktransfer_card.php b/htdocs/product/stock/stocktransfer/stocktransfer_card.php index 2df2123d00b..171408df070 100644 --- a/htdocs/product/stock/stocktransfer/stocktransfer_card.php +++ b/htdocs/product/stock/stocktransfer/stocktransfer_card.php @@ -426,7 +426,7 @@ if ($action == 'create') { print '
'; print ''; print '  '; - print ''; // Cancel for create does not post form if we don't know the backtopage + print ''; // Cancel for create does not post form if we don't know the backtopage print '
'; print ''; diff --git a/htdocs/projet/card.php b/htdocs/projet/card.php index 43c31a23776..ea7c3e51d35 100644 --- a/htdocs/projet/card.php +++ b/htdocs/projet/card.php @@ -1449,8 +1449,7 @@ if ($action == 'create' && $user->rights->projet->creer) { else { console.log("oldpercent="+oldpercent+" defaultpercent="+defaultpercent); - if ((parseFloat(jQuery("#opp_percent").val()) < parseFloat(defaultpercent))); - { + if ((parseFloat(jQuery("#opp_percent").val()) < parseFloat(defaultpercent))) { if (jQuery("#opp_percent").val() != \'\' && oldpercent != \'\') jQuery("#oldopppercent").text(\' - '.dol_escape_js($langs->transnoentities("PreviousValue")).': \'+price2numjs(oldpercent)+\' %\'); jQuery("#opp_percent").val(price2numjs(defaultpercent)); } diff --git a/htdocs/public/eventorganization/subscriptionok.php b/htdocs/public/eventorganization/subscriptionok.php index d87d231d599..5b77b5df7b3 100644 --- a/htdocs/public/eventorganization/subscriptionok.php +++ b/htdocs/public/eventorganization/subscriptionok.php @@ -98,7 +98,7 @@ dol_syslog("Callback url when a payment was done. query_string=".(dol_escape_htm $tracepost = ""; foreach ($_POST as $k => $v) { - $tracepost .= "{$k} - {$v}\n"; + $tracepost .= "$k - $v\n"; } dol_syslog("POST=".$tracepost, LOG_DEBUG, 0, '_payment'); diff --git a/htdocs/public/payment/paymentko.php b/htdocs/public/payment/paymentko.php index 764455e073c..ea5395e7618 100644 --- a/htdocs/public/payment/paymentko.php +++ b/htdocs/public/payment/paymentko.php @@ -132,7 +132,7 @@ dol_syslog("Callback url when an online payment is refused or canceled. query_st $tracepost = ""; foreach ($_POST as $k => $v) { if (is_scalar($k) && is_scalar($v)) { - $tracepost .= "{$k} - {$v}\n"; + $tracepost .= "$k - $v\n"; } } dol_syslog("POST=".$tracepost, LOG_DEBUG, 0, '_payment'); diff --git a/htdocs/public/payment/paymentok.php b/htdocs/public/payment/paymentok.php index 0c287d90a85..38891ee677d 100644 --- a/htdocs/public/payment/paymentok.php +++ b/htdocs/public/payment/paymentok.php @@ -177,14 +177,14 @@ dol_syslog("_SERVER[SERVER_ADDR] = ".(empty($_SERVER["SERVER_ADDR"]) ? '' : dol_ $tracepost = ""; foreach ($_POST as $k => $v) { if (is_scalar($k) && is_scalar($v)) { - $tracepost .= "{$k} - {$v}\n"; + $tracepost .= "$k - $v\n"; } } dol_syslog("POST=".$tracepost, LOG_DEBUG, 0, '_payment'); $tracesession = ""; foreach ($_SESSION as $k => $v) { if (is_scalar($k) && is_scalar($v)) { - $tracesession .= "{$k} - {$v}\n"; + $tracesession .= "$k - $v\n"; } } dol_syslog("SESSION=".$tracesession, LOG_DEBUG, 0, '_payment'); diff --git a/htdocs/societe/canvas/company/actions_card_company.class.php b/htdocs/societe/canvas/company/actions_card_company.class.php index 1e034d46322..1ee7e003b2a 100644 --- a/htdocs/societe/canvas/company/actions_card_company.class.php +++ b/htdocs/societe/canvas/company/actions_card_company.class.php @@ -133,7 +133,7 @@ class ActionsCardCompany extends ActionsCardCommon $s .= ' '; if ($conf->use_javascript_ajax) { - $s .= ''.$langs->trans("VATIntraCheck").''; + $s .= ''.$langs->trans("VATIntraCheck").''; $this->tpl['tva_intra'] = $form->textwithpicto($s, $langs->trans("VATIntraCheckDesc", $langs->transnoentitiesnoconv("VATIntraCheck")), 1); } else { $this->tpl['tva_intra'] = $s.'object->country_id).'" target="_blank">'.img_picto($langs->trans("VATIntraCheckableOnEUSite"), 'help').''; @@ -161,7 +161,7 @@ class ActionsCardCompany extends ActionsCardCommon $s .= '   '; if ($conf->use_javascript_ajax) { - $s .= ''.$langs->trans("VATIntraCheck").''; + $s .= ''.$langs->trans("VATIntraCheck").''; $this->tpl['tva_intra'] = $form->textwithpicto($s, $langs->trans("VATIntraCheckDesc", $langs->transnoentitiesnoconv("VATIntraCheck")), 1); } else { $this->tpl['tva_intra'] = $s.'object->country_id).'" target="_blank">'.img_picto($langs->trans("VATIntraCheckableOnEUSite"), 'help').''; diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index a6d904ae359..3f62deb8a98 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -1722,7 +1722,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { print "}\n"; print ''; print "\n"; - $s .= ''.$langs->trans("VATIntraCheck").''; + $s .= ''.$langs->trans("VATIntraCheck").''; $s = $form->textwithpicto($s, $langs->trans("VATIntraCheckDesc", $langs->transnoentitiesnoconv("VATIntraCheck")), 1); } else { $s .= 'country_id).'" target="_blank" rel="noopener noreferrer">'.img_picto($langs->trans("VATIntraCheckableOnEUSite"), 'help').''; @@ -2494,7 +2494,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { print "}\n"; print ''; print "\n"; - $s .= ''.$langs->trans("VATIntraCheck").''; + $s .= ''.$langs->trans("VATIntraCheck").''; $s = $form->textwithpicto($s, $langs->trans("VATIntraCheckDesc", $langs->transnoentitiesnoconv("VATIntraCheck")), 1); } else { $s .= 'country_id).'" class="hideonsmartphone" target="_blank" rel="noopener noreferrer">'.img_picto($langs->trans("VATIntraCheckableOnEUSite"), 'help').''; @@ -2962,7 +2962,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { print "}\n"; print ''; print "\n"; - $s .= ''.$langs->trans("VATIntraCheck").''; + $s .= ''.$langs->trans("VATIntraCheck").''; $s = $form->textwithpicto($s, $langs->trans("VATIntraCheckDesc", $langs->transnoentitiesnoconv("VATIntraCheck")), 1); } else { $s .= 'country_id).'" class="hideonsmartphone" target="_blank" rel="noopener noreferrer">'.img_picto($langs->trans("VATIntraCheckableOnEUSite"), 'help').''; diff --git a/htdocs/societe/checkvat/checkVatPopup.php b/htdocs/societe/checkvat/checkVatPopup.php index dc88baf0c28..93a4668cf7c 100644 --- a/htdocs/societe/checkvat/checkVatPopup.php +++ b/htdocs/societe/checkvat/checkVatPopup.php @@ -149,7 +149,7 @@ if (!$vatNumber) { print '
'; print $langs->trans("VATIntraManualCheck", $langs->trans("VATIntraCheckURL"), $langs->transnoentitiesnoconv("VATIntraCheckURL")).'
'; print '
'; -print '
'; +print '
'; if ($messagetoshow) { print '

'; diff --git a/htdocs/takepos/index.php b/htdocs/takepos/index.php index 8399b1dc3d4..9a4e0c7b09a 100644 --- a/htdocs/takepos/index.php +++ b/htdocs/takepos/index.php @@ -92,6 +92,7 @@ if ($conf->browser->layout == 'phone') { } $MAXCATEG = (empty($conf->global->TAKEPOS_NB_MAXCATEG) ? $maxcategbydefaultforthisdevice : $conf->global->TAKEPOS_NB_MAXCATEG); $MAXPRODUCT = (empty($conf->global->TAKEPOS_NB_MAXPRODUCT) ? $maxproductbydefaultforthisdevice : $conf->global->TAKEPOS_NB_MAXPRODUCT); +$MAXCATEG = 5; /* $constforcompanyid = 'CASHDESK_ID_THIRDPARTY'.$_SESSION["takeposterminal"]; @@ -260,8 +261,11 @@ function MoreCategories(moreorless) { pagecategories=pagecategories-1; return; } + for (i = 0; i < ; i++) { if (typeof (categories[i+( * pagecategories)]) == "undefined") { + // complete with empty record + console.log("complete with empty record"); $("#catdivdesc"+i).hide(); $("#catdesc"+i).text(""); $("#catimg"+i).attr("src","genimg/empty.png"); @@ -589,8 +593,8 @@ function New() { /** * Search products * - * @param string keyCodeForEnter Key code for "enter" or '' if not - * @param int moreorless ?? + * @param keyCodeForEnter Key code for "enter" or '' if not + * @param moreorless "more" or "less" * return void */ function Search2(keyCodeForEnter, moreorless) { @@ -875,6 +879,8 @@ function MoreActions(totalactions){ else $("#action"+i).hide(); } } + + return true; } function ControlCashOpening() diff --git a/htdocs/takepos/invoice.php b/htdocs/takepos/invoice.php index ed01050d030..c1c5b8aeccd 100644 --- a/htdocs/takepos/invoice.php +++ b/htdocs/takepos/invoice.php @@ -1074,16 +1074,19 @@ function SendTicket(id) { console.log("Open box to select the Print/Send form"); $.colorbox({href:"send.php?facid="+id, width:"70%", height:"30%", transition:"none", iframe:"true", title:'trans("SendTicket")); ?>'}); + return true; } function PrintBox(id, action) { console.log("Open box before printing"); $.colorbox({href:"printbox.php?facid="+id+"&action="+action+"&token=", width:"80%", height:"200px", transition:"none", iframe:"true", title:"trans("PrintWithoutDetails"); ?>"}); + return true; } function Print(id, gift){ console.log("Call Print() to generate the receipt."); $.colorbox({href:"receipt.php?facid="+id+"&gift="+gift, width:"40%", height:"90%", transition:"none", iframe:"true", title:'trans("PrintTicket")); ?>'}); + return true; } function TakeposPrinting(id){ @@ -1097,6 +1100,7 @@ function TakeposPrinting(id){ data: receipt }); }); + return true; } function TakeposConnector(id){ @@ -1108,6 +1112,7 @@ function TakeposConnector(id){ data: 'invoice='+data }); }); + return true; } function DolibarrTakeposPrinting(id) { @@ -1117,15 +1122,17 @@ function DolibarrTakeposPrinting(id) { data: { token: '' }, url: "" + id, }); + return true; } function CreditNote() { - $("#poslines").load("invoice.php?action=creditnote&token=&invoiceid="+placeid, function() { - }); + $("#poslines").load("invoice.php?action=creditnote&token=&invoiceid="+placeid, function() { }); + return true; } function SetNote() { $("#poslines").load("invoice.php?action=addnote&token=&invoiceid="+placeid+"&idline="+selectedline, { "addnote": $("#textinput").val() }); + return true; } diff --git a/htdocs/takepos/pay.php b/htdocs/takepos/pay.php index b15ac8b787c..ea4a106e808 100644 --- a/htdocs/takepos/pay.php +++ b/htdocs/takepos/pay.php @@ -297,6 +297,8 @@ if ($conf->global->TAKEPOS_NUMPAD == 0) { $('.change2').addClass('colorwhite'); } } + + return true; } function reset() @@ -332,6 +334,8 @@ if ($conf->global->TAKEPOS_NUMPAD == 0) { location.reload(); } }); + + return true; } function fetchPaymentIntentClientSecret(amount, invoiceid) { diff --git a/htdocs/variants/card.php b/htdocs/variants/card.php index 8daf1239deb..5eda8e9d1bc 100644 --- a/htdocs/variants/card.php +++ b/htdocs/variants/card.php @@ -186,7 +186,7 @@ if ($action == 'create') { print '
'; print ''; print '  '; - print ''; // Cancel for create does not post form if we don't know the backtopage + print ''; // Cancel for create does not post form if we don't know the backtopage print '
'; print ''; diff --git a/htdocs/variants/class/ProductAttribute.class.php b/htdocs/variants/class/ProductAttribute.class.php index 194bf16b33f..4a8a02fd0bc 100644 --- a/htdocs/variants/class/ProductAttribute.class.php +++ b/htdocs/variants/class/ProductAttribute.class.php @@ -607,7 +607,7 @@ class ProductAttribute extends CommonObject public function addLine($ref, $value, $position = -1, $notrigger = 0) { global $langs, $user; - dol_syslog(__METHOD__ . " id={$this->id}, ref=$ref, value=$value, notrigger=$notrigger"); + dol_syslog(__METHOD__ . " id=".$this->id.", ref=".$ref.", value=".$value.", notrigger=".$notrigger); $error = 0; // Clean parameters diff --git a/qodana.yaml b/qodana.yaml index a9c94abadcc..64734dcc383 100644 --- a/qodana.yaml +++ b/qodana.yaml @@ -106,3 +106,9 @@ exclude: - name: JSJQueryEfficiency - name: JSDuplicatedDeclaration - name: JSUnresolvedLibraryURL + - name: UnnecessaryReturnJS + - name: UnreachableCodeJS + - name: JSUnnecessarySemicolon + - name: JSPrimitiveTypeWrapperUsage + - name: PhpFullyQualifiedNameUsageInspection + \ No newline at end of file