diff --git a/htdocs/api/class/api_access.class.php b/htdocs/api/class/api_access.class.php index 6402bdcb72e..31693bfec9a 100644 --- a/htdocs/api/class/api_access.class.php +++ b/htdocs/api/class/api_access.class.php @@ -30,11 +30,11 @@ require_once DOL_DOCUMENT_ROOT.'/includes/restler/framework/Luracast/Restler/iUs require_once DOL_DOCUMENT_ROOT.'/includes/restler/framework/Luracast/Restler/Resources.php'; require_once DOL_DOCUMENT_ROOT.'/includes/restler/framework/Luracast/Restler/Defaults.php'; require_once DOL_DOCUMENT_ROOT.'/includes/restler/framework/Luracast/Restler/RestException.php'; -use \Luracast\Restler\iAuthenticate; -use \Luracast\Restler\iUseAuthentication; -use \Luracast\Restler\Resources; -use \Luracast\Restler\Defaults; -use \Luracast\Restler\RestException; +use Luracast\Restler\iAuthenticate; +use Luracast\Restler\iUseAuthentication; +use Luracast\Restler\Resources; +use Luracast\Restler\Defaults; +use Luracast\Restler\RestException; /** * Dolibarr API access class diff --git a/htdocs/core/class/CMailFile.class.php b/htdocs/core/class/CMailFile.class.php index eef112a00e2..0fbf95bfe50 100644 --- a/htdocs/core/class/CMailFile.class.php +++ b/htdocs/core/class/CMailFile.class.php @@ -1350,7 +1350,7 @@ class CMailFile /** * Build a css style (mode = all) into this->styleCSS and this->bodyCSS * - * @return string + * @return void */ public function buildCSS() { diff --git a/htdocs/core/class/commondocgenerator.class.php b/htdocs/core/class/commondocgenerator.class.php index 9400d1f1ebe..fadbc1dc62b 100644 --- a/htdocs/core/class/commondocgenerator.class.php +++ b/htdocs/core/class/commondocgenerator.class.php @@ -1535,8 +1535,8 @@ abstract class CommonDocGenerator /** * get column status from column key * - * @param string $colKey the column key - * @return float width in mm + * @param string $colKey the column key + * @return boolean true if column on */ public function getColumnStatus($colKey) { diff --git a/htdocs/core/class/hookmanager.class.php b/htdocs/core/class/hookmanager.class.php index 1070bb105a6..e25f970fad2 100644 --- a/htdocs/core/class/hookmanager.class.php +++ b/htdocs/core/class/hookmanager.class.php @@ -148,7 +148,7 @@ class HookManager * @param array $parameters Array of parameters * @param Object $object Object to use hooks on * @param string $action Action code on calling page ('create', 'edit', 'view', 'add', 'update', 'delete'...) - * @return mixed For 'addreplace' hooks (doActions, formConfirm, formObjectOptions, pdf_xxx,...): Return 0 if we want to keep standard actions, >0 if we want to stop/replace standard actions, <0 if KO. Things to print are returned into ->resprints and set into ->resPrint. Things to return are returned into ->results by hook and set into ->resArray for caller. + * @return int For 'addreplace' hooks (doActions, formConfirm, formObjectOptions, pdf_xxx,...): Return 0 if we want to keep standard actions, >0 if we want to stop/replace standard actions, <0 if KO. Things to print are returned into ->resprints and set into ->resPrint. Things to return are returned into ->results by hook and set into ->resArray for caller. * For 'output' hooks (printLeftBlock, formAddObjectLine, formBuilddocOptions, ...): Return 0 if we want to keep standard actions, >0 uf we want to stop/replace standard actions (at least one > 0 and replacement will be done), <0 if KO. Things to print are returned into ->resprints and set into ->resPrint. Things to return are returned into ->results by hook and set into ->resArray for caller. * All types can also return some values into an array ->results that will be finaly merged into this->resArray for caller. * $this->error or this->errors are also defined by class called by this function if error. diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 470c7d7313c..db1265ab846 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -9987,14 +9987,14 @@ class Form /** * Return HTML to show the select of expense categories * - * @param string $selected preselected category - * @param string $htmlname name of HTML select list - * @param integer $useempty 1=Add empty line - * @param array $excludeid id to exclude - * @param string $target htmlname of target select to bind event - * @param int $default_selected default category to select if fk_c_type_fees change = EX_KME - * @param array $params param to give - * @param int $info_admin Show the tooltip help picto to setup list + * @param string $selected preselected category + * @param string $htmlname name of HTML select list + * @param integer $useempty 1=Add empty line + * @param array $excludeid id to exclude + * @param string $target htmlname of target select to bind event + * @param int $default_selected default category to select if fk_c_type_fees change = EX_KME + * @param array $params param to give + * @param int $info_admin Show the tooltip help picto to setup list * @return string */ public function selectExpenseCategories($selected = '', $htmlname = 'fk_c_exp_tax_cat', $useempty = 0, $excludeid = array(), $target = '', $default_selected = 0, $params = array(), $info_admin = 1) diff --git a/htdocs/core/class/lessc.class.php b/htdocs/core/class/lessc.class.php index 0452cab45aa..0e25b9892dd 100644 --- a/htdocs/core/class/lessc.class.php +++ b/htdocs/core/class/lessc.class.php @@ -53,6 +53,11 @@ class Lessc public $importDisabled = false; public $importDir = ''; + public $scope; + public $formatter; + public $env; + public $count; + protected $numberPrecision = null; protected $allParsedFiles = array(); diff --git a/htdocs/core/class/rssparser.class.php b/htdocs/core/class/rssparser.class.php index 6d83fd6d6da..32abb99df80 100644 --- a/htdocs/core/class/rssparser.class.php +++ b/htdocs/core/class/rssparser.class.php @@ -667,7 +667,7 @@ class RssParser /** - * To concat 2 string with no warning if an operand is not defined + * To concat 2 strings with no warning if an operand is not defined * * @param string $str1 Str1 * @param string $str2 Str2 diff --git a/htdocs/core/js/lib_notification.js.php b/htdocs/core/js/lib_notification.js.php index c2f7096432f..d60a0874e57 100644 --- a/htdocs/core/js/lib_notification.js.php +++ b/htdocs/core/js/lib_notification.js.php @@ -75,7 +75,7 @@ if ("Notification" in window) { /* Check if permission ok */ if (Notification.permission !== "granted") { console.log("Ask Notification.permission"); - Notification.requestPermission() + Notification.requestPermission(); } /* Launch timer */ diff --git a/htdocs/core/js/timesheet.js b/htdocs/core/js/timesheet.js index e9e66787aa0..63c395a953b 100644 --- a/htdocs/core/js/timesheet.js +++ b/htdocs/core/js/timesheet.js @@ -72,12 +72,9 @@ function regexEvent(objet,evt,type) // ((charCode>=96) && (charCode<=105)) || //numpad return true; - }else - { + } else { return false; } - - break; default: break; } diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 7bf81f84e2c..eece0b1005f 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -735,7 +735,7 @@ function GETPOST($paramname, $check = 'alphanohtml', $method = 0, $filter = null $qualified = 1; } - if ($qualified) { + if ($qualified && isset($user->default_values[$relativepathstring]['filters'][$defkey][$paramname])) { // We must keep $_POST and $_GET here if (isset($_POST['sall']) || isset($_POST['search_all']) || isset($_GET['sall']) || isset($_GET['search_all'])) { // We made a search from quick search menu, do we still use default filter ? @@ -1390,7 +1390,7 @@ function dol_string_unaccent($str) if (utf8_check($str)) { if (extension_loaded('intl') && !empty($conf->global->MAIN_UNACCENT_USE_TRANSLITERATOR)) { - $transliterator = \Transliterator::createFromRules(':: Any-Latin; :: Latin-ASCII; :: NFD; :: [:Nonspacing Mark:] Remove; :: NFC;', \Transliterator::FORWARD); + $transliterator = Transliterator::createFromRules(':: Any-Latin; :: Latin-ASCII; :: NFD; :: [:Nonspacing Mark:] Remove; :: NFC;', Transliterator::FORWARD); return $transliterator->transliterate($str); } // See http://www.utf8-chartable.de/ diff --git a/htdocs/core/lib/images.lib.php b/htdocs/core/lib/images.lib.php index 71e1d765de7..67b9f7e15b2 100644 --- a/htdocs/core/lib/images.lib.php +++ b/htdocs/core/lib/images.lib.php @@ -621,7 +621,7 @@ function vignette($file, $maxWidth = 160, $maxHeight = 120, $extName = '_small', } // Before PHP8, img was a resource, With PHP8, it is a GdImage - if (!is_resource($img) && !($img instanceof \GdImage)) { + if (!is_resource($img) && !($img instanceof GdImage)) { dol_syslog('Failed to detect type of image. We found infoImg[2]='.$infoImg[2], LOG_WARNING); return 0; } diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index 3b893e39256..bd735f7d033 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -241,7 +241,7 @@ function pdf_getEncryption($pathoffile) $content = file_get_contents($pathoffile); //ob_start(); - @($parser = new \TCPDF_PARSER(ltrim($content))); + @($parser = new TCPDF_PARSER(ltrim($content))); list($xref, $data) = $parser->getParsedData(); unset($parser); //ob_end_clean(); diff --git a/htdocs/core/modules/import/import_csv.modules.php b/htdocs/core/modules/import/import_csv.modules.php index affeb8ee827..37452cd5a61 100644 --- a/htdocs/core/modules/import/import_csv.modules.php +++ b/htdocs/core/modules/import/import_csv.modules.php @@ -51,7 +51,7 @@ class ImportCsv extends ModeleImports public $errors = array(); /** - * @var int ID + * @var string Code of driver */ public $id; diff --git a/htdocs/core/modules/import/import_xlsx.modules.php b/htdocs/core/modules/import/import_xlsx.modules.php index f9b41f185f1..72576e2d2e6 100644 --- a/htdocs/core/modules/import/import_xlsx.modules.php +++ b/htdocs/core/modules/import/import_xlsx.modules.php @@ -55,7 +55,7 @@ class ImportXlsx extends ModeleImports public $errors = array(); /** - * @var int ID + * @var string Code of driver */ public $id; diff --git a/htdocs/core/modules/import/modules_import.php b/htdocs/core/modules/import/modules_import.php index c57d42c8094..5b665c8e2cf 100644 --- a/htdocs/core/modules/import/modules_import.php +++ b/htdocs/core/modules/import/modules_import.php @@ -43,7 +43,7 @@ class ModeleImports public $error = ''; /** - * @var int id of driver + * @var string Code of driver */ public $id; @@ -129,7 +129,7 @@ class ModeleImports /** * getDriverId * - * @return string Id + * @return int Id */ public function getDriverId() { diff --git a/htdocs/debugbar/class/DataCollector/DolConfigCollector.php b/htdocs/debugbar/class/DataCollector/DolConfigCollector.php index 0920b140dbc..a4028bdc745 100644 --- a/htdocs/debugbar/class/DataCollector/DolConfigCollector.php +++ b/htdocs/debugbar/class/DataCollector/DolConfigCollector.php @@ -21,7 +21,7 @@ * \ingroup debugbar */ -use \DebugBar\DataCollector\ConfigCollector; +use DebugBar\DataCollector\ConfigCollector; /** * DolConfigCollector class diff --git a/htdocs/debugbar/class/DataCollector/DolExceptionsCollector.php b/htdocs/debugbar/class/DataCollector/DolExceptionsCollector.php index 38d2b971dde..5835bbde179 100644 --- a/htdocs/debugbar/class/DataCollector/DolExceptionsCollector.php +++ b/htdocs/debugbar/class/DataCollector/DolExceptionsCollector.php @@ -21,7 +21,7 @@ * \ingroup debugbar */ -use \DebugBar\DataCollector\ExceptionsCollector; +use DebugBar\DataCollector\ExceptionsCollector; /** * DolExceptionsCollector class diff --git a/htdocs/debugbar/class/DataCollector/DolMemoryCollector.php b/htdocs/debugbar/class/DataCollector/DolMemoryCollector.php index 3372e89c2b6..5d6e5310438 100644 --- a/htdocs/debugbar/class/DataCollector/DolMemoryCollector.php +++ b/htdocs/debugbar/class/DataCollector/DolMemoryCollector.php @@ -21,7 +21,7 @@ * \ingroup debugbar */ -use \DebugBar\DataCollector\MemoryCollector; +use DebugBar\DataCollector\MemoryCollector; /** * DolMemoryCollector class diff --git a/htdocs/debugbar/class/DataCollector/DolMessagesCollector.php b/htdocs/debugbar/class/DataCollector/DolMessagesCollector.php index 733009e77c6..3c605687b95 100644 --- a/htdocs/debugbar/class/DataCollector/DolMessagesCollector.php +++ b/htdocs/debugbar/class/DataCollector/DolMessagesCollector.php @@ -21,7 +21,7 @@ * \ingroup debugbar */ -use \DebugBar\DataCollector\MessagesCollector; +use DebugBar\DataCollector\MessagesCollector; /** * DolMessagesCollector class diff --git a/htdocs/debugbar/class/DataCollector/DolRequestDataCollector.php b/htdocs/debugbar/class/DataCollector/DolRequestDataCollector.php index d7e8f9a858a..0a19ca67f61 100644 --- a/htdocs/debugbar/class/DataCollector/DolRequestDataCollector.php +++ b/htdocs/debugbar/class/DataCollector/DolRequestDataCollector.php @@ -21,7 +21,7 @@ * \ingroup debugbar */ -use \DebugBar\DataCollector\RequestDataCollector; +use DebugBar\DataCollector\RequestDataCollector; /** * DolRequestDataCollector class diff --git a/htdocs/debugbar/class/DataCollector/DolTimeDataCollector.php b/htdocs/debugbar/class/DataCollector/DolTimeDataCollector.php index d16622d329f..4fdbb65c65c 100644 --- a/htdocs/debugbar/class/DataCollector/DolTimeDataCollector.php +++ b/htdocs/debugbar/class/DataCollector/DolTimeDataCollector.php @@ -21,7 +21,7 @@ * \ingroup debugbar */ -use \DebugBar\DataCollector\TimeDataCollector; +use DebugBar\DataCollector\TimeDataCollector; /** * DolTimeDataCollector class diff --git a/htdocs/debugbar/class/DebugBar.php b/htdocs/debugbar/class/DebugBar.php index bf293ea6e5f..fa7d4bd0e4f 100644 --- a/htdocs/debugbar/class/DebugBar.php +++ b/htdocs/debugbar/class/DebugBar.php @@ -23,7 +23,7 @@ dol_include_once('/debugbar/class/autoloader.php'); -use \DebugBar\DebugBar; +use DebugBar\DebugBar; dol_include_once('/debugbar/class/DataCollector/DolMessagesCollector.php'); dol_include_once('/debugbar/class/DataCollector/DolRequestDataCollector.php'); diff --git a/htdocs/don/class/don.class.php b/htdocs/don/class/don.class.php index 76ddd7e67de..1f7f29cbf92 100644 --- a/htdocs/don/class/don.class.php +++ b/htdocs/don/class/don.class.php @@ -74,6 +74,11 @@ class Don extends CommonObject */ public $amount; + /** + * @var integer Thirdparty ID + */ + public $socid; + /** * @var string Thirdparty name */ diff --git a/htdocs/expensereport/card.php b/htdocs/expensereport/card.php index 55ce88d66dc..4ec1d6d94d4 100644 --- a/htdocs/expensereport/card.php +++ b/htdocs/expensereport/card.php @@ -2337,7 +2337,7 @@ if ($action == 'create') { if (!empty($conf->global->MAIN_USE_EXPENSE_IK)) { print ''; - $params = array('fk_expense' => $object->id, 'fk_expense_det' => $line->id, 'date' => $line->dates); + $params = array('fk_expense' => $object->id, 'fk_expense_det' => $line->id, 'date' => $line->date); print $form->selectExpenseCategories($line->fk_c_exp_tax_cat, 'fk_c_exp_tax_cat', 1, array(), 'fk_c_type_fees', $userauthor->default_c_exp_tax_cat, $params); print ''; } diff --git a/htdocs/exports/class/export.class.php b/htdocs/exports/class/export.class.php index 4b8be1dc74d..6563e9d6338 100644 --- a/htdocs/exports/class/export.class.php +++ b/htdocs/exports/class/export.class.php @@ -35,7 +35,18 @@ class Export */ public $db; + /** + * @var string Last error message + */ public $error; + /** + * @var string Last error code + */ + public $errno; + /** + * @var string Error messages + */ + public $errors; public $array_export_code = array(); // Tableau de "idmodule_numexportprofile" public $array_export_code_for_sort = array(); // Tableau de "idmodule_numexportprofile" diff --git a/htdocs/imports/class/import.class.php b/htdocs/imports/class/import.class.php index e9211362408..4b228d24bf7 100644 --- a/htdocs/imports/class/import.class.php +++ b/htdocs/imports/class/import.class.php @@ -29,6 +29,21 @@ */ class Import { + /** + * @var DoliDB Database handler. + */ + public $db; + + /** + * @var string Error code (or message) + */ + public $error = ''; + + /** + * @var string[] Error codes (or messages) + */ + public $errors = array(); + public $array_import_module; public $array_import_perms; public $array_import_icon; @@ -45,16 +60,6 @@ class Import public $array_import_convertvalue; public $array_import_run_sql_after; - /** - * @var string Error code (or message) - */ - public $error = ''; - - /** - * @var string[] Error codes (or messages) - */ - public $errors = array(); - // To store import templates public $id; public $hexa; // List of fields in the export profile diff --git a/htdocs/modulebuilder/index.php b/htdocs/modulebuilder/index.php index ef929f15180..4a76968d43e 100644 --- a/htdocs/modulebuilder/index.php +++ b/htdocs/modulebuilder/index.php @@ -2864,11 +2864,11 @@ if (!empty($module) && $module != 'initmodule' && $module != 'deletemodule') { dol_include_once($fullpathdirtodescriptor); $class = 'mod'.$module; - } catch (Throwable $e) { // This is called in PHP 7 only. Never called with PHP 5.6 + } 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) { + } catch (Exception $e) { // This is called in PHP 5.6- because not already trapped by previous case in PHP 5.6-. $loadclasserrormessage = $e->getMessage()."
\n"; $loadclasserrormessage .= 'File: '.$e->getFile()."
\n"; $loadclasserrormessage .= 'Line: '.$e->getLine()."
\n"; diff --git a/htdocs/public/stripe/ipn.php b/htdocs/public/stripe/ipn.php index 7b4e559088e..eb9671ed956 100644 --- a/htdocs/public/stripe/ipn.php +++ b/htdocs/public/stripe/ipn.php @@ -122,10 +122,10 @@ $error = 0; try { $event = \Stripe\Webhook::constructEvent($payload, $sig_header, $endpoint_secret); -} catch (\UnexpectedValueException $e) { +} catch (UnexpectedValueException $e) { // Invalid payload httponly_accessforbidden('Invalid payload', 400); -} catch (\Stripe\Error\SignatureVerification $e) { +} catch (\Stripe\Exception\SignatureVerificationException $e) { httponly_accessforbidden('Invalid signature', 400); } catch (Exception $e) { httponly_accessforbidden('Error '.$e->getMessage(), 400); diff --git a/htdocs/societe/class/api_thirdparties.class.php b/htdocs/societe/class/api_thirdparties.class.php index e0386ddd1c6..c991db7e7ac 100644 --- a/htdocs/societe/class/api_thirdparties.class.php +++ b/htdocs/societe/class/api_thirdparties.class.php @@ -622,8 +622,7 @@ class Thirdparties extends DolibarrApi * @param string $sortorder Sort order * @param int $limit Limit for list * @param int $page Page number - * - * @return mixed + * @return array|void * * @url GET {id}/categories */ @@ -640,17 +639,17 @@ class Thirdparties extends DolibarrApi $categories = new Categorie($this->db); - $result = $categories->getListForItem($id, 'customer', $sortfield, $sortorder, $limit, $page); + $arrayofcateg = $categories->getListForItem($id, 'customer', $sortfield, $sortorder, $limit, $page); - if (is_numeric($result) && $result < 0) { + if (is_numeric($arrayofcateg) && $arrayofcateg < 0) { throw new RestException(503, 'Error when retrieve category list : '.$categories->error); } - if (is_numeric($result) && $result == 0) { // To fix a return of 0 instead of empty array of method getListForItem + if (is_numeric($arrayofcateg) && $arrayofcateg == 0) { // To fix a return of 0 instead of empty array of method getListForItem return array(); } - return $result; + return $arrayofcateg; } /** diff --git a/htdocs/takepos/index.php b/htdocs/takepos/index.php index 84ec7439ca3..d09a569cc71 100644 --- a/htdocs/takepos/index.php +++ b/htdocs/takepos/index.php @@ -245,18 +245,18 @@ function PrintCategories(first) { function MoreCategories(moreorless) { console.log("MoreCategories moreorless="+moreorless+" pagecategories="+pagecategories); - if (moreorless=="more") { + if (moreorless == "more") { $('#catimg15').animate({opacity: '0.5'}, 1); $('#catimg15').animate({opacity: '1'}, 100); pagecategories=pagecategories+1; } - if (moreorless=="less") { + if (moreorless == "less") { $('#catimg14').animate({opacity: '0.5'}, 1); $('#catimg14').animate({opacity: '1'}, 100); if (pagecategories==0) return; //Return if no less pages pagecategories=pagecategories-1; } - if (typeof (categories[ * pagecategories] && moreorless=="more") == "undefined"){ // Return if no more pages + if (typeof (categories[ * pagecategories] && moreorless == "more") == "undefined") { // Return if no more pages pagecategories=pagecategories-1; return; } diff --git a/qodana.yaml b/qodana.yaml index 940d2e7573a..880af166f62 100644 --- a/qodana.yaml +++ b/qodana.yaml @@ -16,6 +16,7 @@ exclude: - htdocs/includes - htdocs/install/doctemplates - htdocs/modulebuilder/template/test/phpunit/functionnal + - htdocs/theme/common/fontawesome-5 - name: PhpIssetCanBeReplacedWithCoalesceInspection - name: PhpRedundantOptionalArgumentInspection - name: PhpLanguageLevelInspection @@ -83,4 +84,13 @@ exclude: - name: PhpNestedDirNameCallsCanBeReplacedWithLevelParameterInspection - name: PhpPointlessBooleanExpressionInConditionInspection - name: PhpUndefinedMethodInspection - - name: PhpDuplicateCatchBodyInspection \ No newline at end of file + - name: PhpDuplicateCatchBodyInspection + - name: PhpDefineCanBeReplacedWithConstInspection + - name: PhpMissingParamTypeInspection + - name: PhpMissingReturnTypeInspection + - name: CommaExpressionJS + - name: JSTypeOfValues + - name: PhpRedundantVariableDocTypeInspection + - name: PhpUnhandledExceptionInspection + - name: JSIgnoredPromiseFromCall + \ No newline at end of file