clean code

This commit is contained in:
Frédéric FRANCE 2025-12-20 10:39:39 +01:00
parent e33376d10e
commit f138005d73
No known key found for this signature in database
GPG key ID: C06E4A9656127239
5 changed files with 11 additions and 35 deletions

View file

@ -6,12 +6,6 @@ parameters:
count: 1
path: ../../../htdocs/accountancy/admin/categories.php
-
message: '#^If condition is always true\.$#'
identifier: if.alwaysTrue
count: 2
path: ../../../htdocs/accountancy/admin/categories_list.php
-
message: '#^Loose comparison using \=\= between 32 and 32 will always evaluate to true\.$#'
identifier: equal.alwaysTrue
@ -36,24 +30,12 @@ parameters:
count: 1
path: ../../../htdocs/accountancy/admin/journals_list.php
-
message: '#^If condition is always true\.$#'
identifier: if.alwaysTrue
count: 1
path: ../../../htdocs/accountancy/admin/productaccount.php
-
message: '#^Right side of && is always true\.$#'
identifier: booleanAnd.rightAlwaysTrue
count: 1
path: ../../../htdocs/accountancy/admin/productaccount.php
-
message: '#^If condition is always true\.$#'
identifier: if.alwaysTrue
count: 1
path: ../../../htdocs/accountancy/admin/report_list.php
-
message: '#^Loose comparison using \=\= between 45 and 45 will always evaluate to true\.$#'
identifier: equal.alwaysTrue

View file

@ -1,7 +1,7 @@
<?php
/* Copyright (C) 2004-2023 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2011-2025 Alexandre Spangaro <alexandre@inovea-conseil.com>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024-2025 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
*
* This program is free software; you can redistribute it and/or modify
@ -465,9 +465,7 @@ $paramwithsearch = $param;
if ($sortorder) {
$paramwithsearch .= '&sortorder='.urlencode($sortorder);
}
if ($sortfield) {
$paramwithsearch .= '&sortfield='.urlencode($sortfield);
}
$paramwithsearch .= '&sortfield='.urlencode($sortfield);
if (GETPOST('from', 'alpha')) {
$paramwithsearch .= '&from='.urlencode(GETPOST('from', 'alpha'));
}
@ -825,9 +823,7 @@ if ($resql) {
}
}
$url = $_SERVER["PHP_SELF"].'?'.($page ? 'page='.$page.'&' : '').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.(!empty($obj->rowid) ? $obj->rowid : (!empty($obj->code) ? $obj->code : '')).'&code='.(!empty($obj->code) ? urlencode($obj->code) : '');
if ($param) {
$url .= '&'.$param;
}
$url .= '&'.$param;
$url .= '&';
$canbemodified = $iserasable;

View file

@ -6,7 +6,7 @@
* Copyright (C) 2015 Ari Elbaz (elarifr) <github@accedinfo.com>
* Copyright (C) 2021 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024-2025 Frédéric France <frederic.france@free.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -202,7 +202,7 @@ if ($action == 'update' && $permissiontobind) {
$ko = 0;
$msg = '';
$sql = '';
if (!empty($toselect) && in_array($accounting_product_mode, $accounting_product_modes)) { // @phpstan-ignore-line Bug phpstan thinking that empty(array()) is always true
if (in_array($accounting_product_mode, $accounting_product_modes)) {
$accounting = new AccountingAccount($db);
$arrayofdifferentselectedvalues = array();
@ -466,9 +466,9 @@ if ($resql) {
if ($search_current_account_valid && $search_current_account_valid != '-1') {
$param .= "&search_current_account_valid=".urlencode($search_current_account_valid);
}
if ($accounting_product_mode) {
$param .= '&accounting_product_mode='.urlencode($accounting_product_mode);
}
// if ($accounting_product_mode) { // can't be empty see line 91-93
$param .= '&accounting_product_mode='.urlencode($accounting_product_mode);
// }
print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
if ($optioncss != '') {

View file

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2024 Alexandre Spangaro <alexandre@inovea-conseil.com>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024-2025 Frédéric France <frederic.france@free.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -680,9 +680,7 @@ if ($resql) {
}
}
$url = $_SERVER["PHP_SELF"].'?'.($page ? 'page='.$page.'&' : '').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.(!empty($obj->rowid) ? $obj->rowid : (!empty($obj->code) ? $obj->code : '')).'&code='.(!empty($obj->code) ? urlencode($obj->code) : '');
if ($param) {
$url .= '&'.$param;
}
$url .= '&'.$param;
$url .= '&';
$canbemodified = $iserasable;

View file

@ -8,7 +8,7 @@ parameters:
# should adapt better to target machines
# jobSize: 8 # default is 20
processTimeout: 600.0
# maximumNumberOfProcesses: 20 # default is 32
maximumNumberOfProcesses: 4 # default is 32
# minimumNumberOfJobsPerProcess: 2 # default is 2
# buffer: 134217728 # 128 MB # Not documented
customRulesetUsed: true