diff --git a/build/phpstan/phpstan-baseline.neon b/build/phpstan/phpstan-baseline.neon index e3610846bdd..f08d62540be 100644 --- a/build/phpstan/phpstan-baseline.neon +++ b/build/phpstan/phpstan-baseline.neon @@ -1158,36 +1158,6 @@ parameters: count: 2 path: ../../htdocs/adherents/class/subscription.class.php - - - message: '#^Variable \$badgeStatus0 might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/adherents/index.php - - - - message: '#^Variable \$badgeStatus1 might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/adherents/index.php - - - - message: '#^Variable \$badgeStatus4 might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/adherents/index.php - - - - message: '#^Variable \$badgeStatus6 might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/adherents/index.php - - - - message: '#^Variable \$badgeStatus8 might not be defined\.$#' - identifier: variable.undefined - count: 2 - path: ../../htdocs/adherents/index.php - - message: '#^If condition is always false\.$#' identifier: if.alwaysFalse @@ -18246,12 +18216,6 @@ parameters: count: 1 path: ../../htdocs/cron/list.php - - - message: '#^Variable \$head might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/cron/list.php - - message: '#^Variable \$texttoshow might not be defined\.$#' identifier: variable.undefined @@ -23220,12 +23184,6 @@ parameters: count: 1 path: ../../htdocs/hrm/skill_tab.php - - - message: '#^Variable \$head might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/hrm/skill_tab.php - - message: '#^Variable \$object might not be defined\.$#' identifier: variable.undefined @@ -24720,12 +24678,6 @@ parameters: count: 2 path: ../../htdocs/master.inc.php - - - message: '#^Variable \$head might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/modulebuilder/admin/setup.php - - message: '#^Call to function is_array\(\) with array\ will always evaluate to true\.$#' identifier: function.alreadyNarrowedType @@ -26460,12 +26412,6 @@ parameters: count: 1 path: ../../htdocs/product/admin/product_tools.php - - - message: '#^Variable \$arrayresult might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/product/ajax/products.php - - message: '#^Property ActionsCardProduct\:\:\$field_list has no type specified\.$#' identifier: missingType.property @@ -36312,54 +36258,18 @@ parameters: count: 1 path: ../../scripts/product/migrate_picture_path.php - - - message: '#^Variable \$db might not be defined\.$#' - identifier: variable.undefined - count: 4 - path: ../../scripts/product/migrate_picture_path.php - - - - message: '#^Variable \$hookmanager might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../scripts/product/migrate_picture_path.php - - - - message: '#^Variable \$langs might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../scripts/product/migrate_picture_path.php - - message: '#^Result of \|\| is always false\.$#' identifier: booleanOr.alwaysFalse count: 1 path: ../../scripts/product/regenerate_thumbs.php - - - message: '#^Variable \$db might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../scripts/product/regenerate_thumbs.php - - message: '#^Variable \$dir in empty\(\) always exists and is not falsy\.$#' identifier: empty.variable count: 1 path: ../../scripts/product/regenerate_thumbs.php - - - message: '#^Variable \$hookmanager might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../scripts/product/regenerate_thumbs.php - - - - message: '#^Variable \$langs might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../scripts/product/regenerate_thumbs.php - - message: '#^Variable \$subdir in empty\(\) always exists and is not falsy\.$#' identifier: empty.variable @@ -36372,44 +36282,8 @@ parameters: count: 1 path: ../../scripts/user/migrate_picture_path.php - - - message: '#^Variable \$db might not be defined\.$#' - identifier: variable.undefined - count: 4 - path: ../../scripts/user/migrate_picture_path.php - - - - message: '#^Variable \$hookmanager might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../scripts/user/migrate_picture_path.php - - - - message: '#^Variable \$langs might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../scripts/user/migrate_picture_path.php - - - - message: '#^Variable \$user might not be defined\.$#' - identifier: variable.undefined - count: 2 - path: ../../scripts/user/sync_groups_dolibarr2ldap.php - - - - message: '#^Variable \$user might not be defined\.$#' - identifier: variable.undefined - count: 2 - path: ../../scripts/user/sync_users_dolibarr2ldap.php - - message: '#^Unable to resolve the template type T in call to function array_values$#' identifier: argument.templateType count: 1 path: ../../scripts/user/sync_users_ldap2dolibarr.php - - - - message: '#^Variable \$user might not be defined\.$#' - identifier: variable.undefined - count: 2 - path: ../../scripts/user/sync_users_ldap2dolibarr.php diff --git a/htdocs/accountancy/class/accountancysystem.class.php b/htdocs/accountancy/class/accountancysystem.class.php index 980779ff254..8fdbd1a300c 100644 --- a/htdocs/accountancy/class/accountancysystem.class.php +++ b/htdocs/accountancy/class/accountancysystem.class.php @@ -1,9 +1,9 @@ - * Copyright (C) 2013-2014 Alexandre Spangaro - * Copyright (C) 2013-2014 Florian Henry - * Copyright (C) 2023 Frédéric France - * Copyright (C) 2024 Alexandre Janniaux +/* Copyright (C) 2013-2014 Olivier Geffroy + * Copyright (C) 2013-2014 Alexandre Spangaro + * Copyright (C) 2013-2014 Florian Henry + * Copyright (C) 2023-2024 Frédéric France + * Copyright (C) 2024 Alexandre Janniaux * * 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 diff --git a/htdocs/adherents/index.php b/htdocs/adherents/index.php index bc86a13d033..05f86c5989d 100644 --- a/htdocs/adherents/index.php +++ b/htdocs/adherents/index.php @@ -136,6 +136,13 @@ if ($conf->use_javascript_ajax) { $dataseries[] = array($langs->transnoentitiesnoconv("MembersStatusExcluded"), $sumMembers['total']['members_excluded']); $dataseries[] = array($langs->transnoentitiesnoconv("MembersStatusResiliated"), $sumMembers['total']['members_resiliated']); + /** + * @var string $badgeStatus0 + * @var string $badgeStatus1 + * @var string $badgeStatus4 + * @var string $badgeStatus6 + * @var string $badgeStatus8 + */ include DOL_DOCUMENT_ROOT.'/theme/'.$conf->theme.'/theme_vars.inc.php'; include_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php'; diff --git a/htdocs/admin/remotestore/ajax/image.php b/htdocs/admin/remotestore/ajax/image.php index c32791685fa..b78bab01011 100644 --- a/htdocs/admin/remotestore/ajax/image.php +++ b/htdocs/admin/remotestore/ajax/image.php @@ -1,7 +1,7 @@ . - * Copyright (C) 2008-2011 Laurent Destailleur - * Copyright (C) 2020 Frédéric France +/* Copyright (C) 2017 Oscss-Shop . + * Copyright (C) 2008-2011 Laurent Destailleur + * Copyright (C) 2020-2024 Frédéric France * * This program is free software; you can redistribute it and/or modifyion 2.0 (the "License"); * it under the terms of the GNU General Public License as published bypliance with the License. diff --git a/htdocs/core/js/lib_foot.js.php b/htdocs/core/js/lib_foot.js.php index 224caed534c..7bf2a7eff0d 100644 --- a/htdocs/core/js/lib_foot.js.php +++ b/htdocs/core/js/lib_foot.js.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2017 Laurent Destailleur * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -50,6 +50,8 @@ require_once '../../main.inc.php'; /** * @var Conf $conf * @var Translate $langs + * + * @var int $dolibarr_nocache */ @@ -75,7 +77,7 @@ jQuery(document).ready(function () {\n"; if (empty($conf->dol_no_mouse_hover)) { print ' - /* for standard tooltip */ + /* for standard tooltip */ jQuery(".classfortooltip").tooltip({ tooltipClass: "mytooltip", show: { collision: "flipfit", effect:"toggle", delay:50, duration: 20 }, @@ -101,30 +103,30 @@ if (empty($conf->dol_no_mouse_hover)) { target.off("mouseover mouseout"); target.on("mouseover", function(event) { console.log("we will create timer for ajax call"); - event.stopImmediatePropagation(); + event.stopImmediatePropagation(); clearTimeout(elemtostoretooltiptimer.data("openTimeoutId")); var params = JSON.parse($(this).attr("data-params")); params.token = currenttoken; var elemfortooltip = $(this); - elemtostoretooltiptimer.data("openTimeoutId", setTimeout(function() { + elemtostoretooltiptimer.data("openTimeoutId", setTimeout(function() { target.tooltip("close"); $.ajax({ - url:"'. DOL_URL_ROOT.'/core/ajax/ajaxtooltip.php", - type: "post", - async: true, - data: params, - success: function(response){ - // Setting content option - console.log("ajax success"); - if (elemfortooltip.is(":hover")) { - elemfortooltip.tooltip("option","content",response); - elemfortooltip.tooltip("open"); - } + url:"'. DOL_URL_ROOT.'/core/ajax/ajaxtooltip.php", + type: "post", + async: true, + data: params, + success: function(response){ + // Setting content option + console.log("ajax success"); + if (elemfortooltip.is(":hover")) { + elemfortooltip.tooltip("option","content",response); + elemfortooltip.tooltip("open"); } - }); - }, opendelay)); + } + }); + }, opendelay)); }); target.on("mouseout", function(event) { console.log("mouse out of a .classforajaxtooltip"); @@ -346,9 +348,9 @@ print ' var currenttoken = jQuery("meta[name=anti-csrf-currenttoken]").attr("content"); console.log("We click on a cssforclicktodial class with href="+this.href); $.ajax({ - url: this.href, - type: \'GET\', - data: { token: currenttoken } + url: this.href, + type: \'GET\', + data: { token: currenttoken } }).done(function(xhr, textStatus, errorThrown) { /* do nothing */ }).fail(function(xhr, textStatus, errorThrown) { diff --git a/htdocs/core/js/lib_gravatar.js.php b/htdocs/core/js/lib_gravatar.js.php index d7ca7bea933..34e350fbbc1 100644 --- a/htdocs/core/js/lib_gravatar.js.php +++ b/htdocs/core/js/lib_gravatar.js.php @@ -1,5 +1,6 @@ +/* Copyright (C) 2017 Laurent Destailleur + * Copyright (C) 2024 Frédéric France * * 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 @@ -50,7 +51,9 @@ if (!defined('NOREQUIREAJAX')) { session_cache_limiter('public'); require_once '../../main.inc.php'; - +/** + * @var int $dolibarr_nocache + */ // Define javascript type top_httphead('text/javascript; charset=UTF-8'); // Important: Following code is to avoid page request by browser and PHP CPU at each Dolibarr page access. diff --git a/htdocs/core/js/timepicker.js.php b/htdocs/core/js/timepicker.js.php index 5db75245711..0ac0b269b0d 100644 --- a/htdocs/core/js/timepicker.js.php +++ b/htdocs/core/js/timepicker.js.php @@ -50,6 +50,8 @@ require_once '../../main.inc.php'; /** * @var DoliDB $db * @var Translate $langs + * + * @var int $dolibarr_nocache */ /* * View diff --git a/htdocs/cron/list.php b/htdocs/cron/list.php index 79cd9af8ae9..c65e63af98b 100644 --- a/htdocs/cron/list.php +++ b/htdocs/cron/list.php @@ -401,6 +401,7 @@ if (GETPOSTINT('nomassaction') || in_array($massaction, array('presend', 'predel } $massactionbutton = $form->selectMassAction('', $arrayofmassactions); +$head = []; if ($mode == 'modulesetup') { $linkback = ''.$langs->trans("BackToModuleList").''; print load_fiche_titre($langs->trans("CronSetup"), $linkback, 'title_setup'); @@ -422,8 +423,7 @@ print ''; print ''; // Line with explanation and button new -$newcardbutton = ''; -$newcardbutton .= dolGetButtonTitle($langs->trans('New'), $langs->trans('CronCreateJob'), 'fa fa-plus-circle', DOL_URL_ROOT.'/cron/card.php?action=create&backtopage='.urlencode($_SERVER['PHP_SELF'].'?mode=modulesetup'), '', $user->hasRight('cron', 'create')); +$newcardbutton = dolGetButtonTitle($langs->trans('New'), $langs->trans('CronCreateJob'), 'fa fa-plus-circle', DOL_URL_ROOT.'/cron/card.php?action=create&backtopage='.urlencode($_SERVER['PHP_SELF'].'?mode=modulesetup'), '', $user->hasRight('cron', 'create')); if ($mode == 'modulesetup') { diff --git a/htdocs/hrm/skill_tab.php b/htdocs/hrm/skill_tab.php index c933765fdef..7843c63de5b 100644 --- a/htdocs/hrm/skill_tab.php +++ b/htdocs/hrm/skill_tab.php @@ -350,6 +350,8 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea $object->getRights(); $head = user_prepare_head($object); $listLink = dol_buildpath('/user/list.php', 1); + } else { + $head = []; } print dol_get_fiche_head($head, 'skill_tab', $langs->trans("Workstation"), -1, $object->picto); diff --git a/htdocs/modulebuilder/admin/setup.php b/htdocs/modulebuilder/admin/setup.php index e0e5df8bc15..d4222b926b6 100644 --- a/htdocs/modulebuilder/admin/setup.php +++ b/htdocs/modulebuilder/admin/setup.php @@ -36,6 +36,7 @@ $langs->loadLangs(array("admin", "other", "modulebuilder")); $action = GETPOST('action', 'aZ09'); $backtopage = GETPOST('backtopage', 'alpha'); +$head = []; if (!$user->admin || !isModEnabled('modulebuilder')) { accessforbidden(); diff --git a/htdocs/product/ajax/products.php b/htdocs/product/ajax/products.php index 9eebdb978c4..a0337a75a49 100644 --- a/htdocs/product/ajax/products.php +++ b/htdocs/product/ajax/products.php @@ -323,6 +323,7 @@ if ($action == 'fetch' && !empty($id)) { $form = new Form($db); } + $arrayresult = []; if (empty($mode) || $mode == 1) { // mode=1: customer $arrayresult = $form->select_produits_list("", $htmlname, $type, getDolGlobalInt('PRODUIT_LIMIT_SIZE', 1000), $price_level, $searchkey, $status, $finished, $outjson, $socid, '1', 0, '', $hidepriceinlabel, $warehouseStatus, $status_purchase, $warehouseId); } elseif ($mode == 2) { // mode=2: supplier diff --git a/scripts/product/migrate_picture_path.php b/scripts/product/migrate_picture_path.php index 098024e4847..724f8bf21bf 100755 --- a/scripts/product/migrate_picture_path.php +++ b/scripts/product/migrate_picture_path.php @@ -1,8 +1,9 @@ #!/usr/bin/env php - * Copyright (C) 2015 Jean Heimburger + * Copyright (C) 2007-2016 Laurent Destailleur + * Copyright (C) 2015 Jean Heimburger + * Copyright (C) 2024 Frédéric France * * 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 @@ -48,7 +49,12 @@ require_once DOL_DOCUMENT_ROOT."/product/class/product.class.php"; require_once DOL_DOCUMENT_ROOT."/core/lib/files.lib.php"; // After this $db, $mysoc, $langs, $conf and $hookmanager are defined (Opened $db handler to database will be closed at end of file). // $user is created but empty. - +/** + * @var DoliDB $db + * @var HookManager $hookmanager + * @var Translate $langs + * @var User $user + */ // $langs->setDefaultLang('en_US'); // To change default language of $langs $langs->load("main"); // To load language file for default language diff --git a/scripts/product/regenerate_thumbs.php b/scripts/product/regenerate_thumbs.php index 6504fb14069..07b202d7d9b 100755 --- a/scripts/product/regenerate_thumbs.php +++ b/scripts/product/regenerate_thumbs.php @@ -1,7 +1,8 @@ #!/usr/bin/env php - * Copyright (C) 2015 Jean Heimburger +/* Copyright (C) 2007-2016 Laurent Destailleur + * Copyright (C) 2015 Jean Heimburger + * Copyright (C) 2024 Frédéric France * * 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 @@ -48,7 +49,12 @@ require_once DOL_DOCUMENT_ROOT."/core/lib/files.lib.php"; require_once DOL_DOCUMENT_ROOT."/core/lib/images.lib.php"; // After this $db, $mysoc, $langs, $conf and $hookmanager are defined (Opened $db handler to database will be closed at end of file). // $user is created but empty. - +/** + * @var DoliDB $db + * @var HookManager $hookmanager + * @var Translate $langs + * @var User $user + */ // $langs->setDefaultLang('en_US'); // To change default language of $langs $langs->load("main"); // To load language file for default language diff --git a/scripts/user/migrate_picture_path.php b/scripts/user/migrate_picture_path.php index 9ef9d886aba..bf7b7d843ac 100755 --- a/scripts/user/migrate_picture_path.php +++ b/scripts/user/migrate_picture_path.php @@ -3,6 +3,7 @@ /* * Copyright (C) 2007-2016 Laurent Destailleur * Copyright (C) 2015 Jean Heimburger + * Copyright (C) 2024 Frédéric France * * 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 @@ -48,7 +49,12 @@ require_once DOL_DOCUMENT_ROOT."/user/class/user.class.php"; require_once DOL_DOCUMENT_ROOT."/core/lib/files.lib.php"; // After this $db, $mysoc, $langs, $conf and $hookmanager are defined (Opened $db handler to database will be closed at end of file). // $user is created but empty. - +/** + * @var DoliDB $db + * @var HookManager $hookmanager + * @var Translate $langs + * @var User $user + */ // $langs->setDefaultLang('en_US'); // To change default language of $langs $langs->load("main"); // To load language file for default language diff --git a/scripts/user/sync_groups_dolibarr2ldap.php b/scripts/user/sync_groups_dolibarr2ldap.php index 3f20ac90149..c9b23786405 100755 --- a/scripts/user/sync_groups_dolibarr2ldap.php +++ b/scripts/user/sync_groups_dolibarr2ldap.php @@ -55,6 +55,7 @@ require_once DOL_DOCUMENT_ROOT."/user/class/usergroup.class.php"; * @var DoliDB $db * @var HookManager $hookmanager * @var Translate $langs + * @var User $user */ // Global variables diff --git a/scripts/user/sync_groups_ldap2dolibarr.php b/scripts/user/sync_groups_ldap2dolibarr.php index f6aa7a85c07..ed3e7415010 100755 --- a/scripts/user/sync_groups_ldap2dolibarr.php +++ b/scripts/user/sync_groups_ldap2dolibarr.php @@ -52,6 +52,7 @@ require_once DOL_DOCUMENT_ROOT."/user/class/usergroup.class.php"; * @var DoliDB $db * @var HookManager $hookmanager * @var Translate $langs + * @var User $user */ $langs->loadLangs(array("main", "errors")); diff --git a/scripts/user/sync_users_dolibarr2ldap.php b/scripts/user/sync_users_dolibarr2ldap.php index 97dd59f311f..5a21b9f5a61 100755 --- a/scripts/user/sync_users_dolibarr2ldap.php +++ b/scripts/user/sync_users_dolibarr2ldap.php @@ -55,6 +55,7 @@ require_once DOL_DOCUMENT_ROOT."/user/class/user.class.php"; * @var DoliDB $db * @var HookManager $hookmanager * @var Translate $langs + * @var User $user */ // Global variables diff --git a/scripts/user/sync_users_ldap2dolibarr.php b/scripts/user/sync_users_ldap2dolibarr.php index b730ce45cf7..3e7625fdf11 100755 --- a/scripts/user/sync_users_ldap2dolibarr.php +++ b/scripts/user/sync_users_ldap2dolibarr.php @@ -50,6 +50,7 @@ require_once DOL_DOCUMENT_ROOT."/user/class/user.class.php"; * @var DoliDB $db * @var HookManager $hookmanager * @var Translate $langs + * @var User $user */ $langs->loadLangs(array("main", "errors"));