diff --git a/htdocs/adherents/admin/website.php b/htdocs/adherents/admin/website.php index a67de387d6e..4a40efc74a4 100644 --- a/htdocs/adherents/admin/website.php +++ b/htdocs/adherents/admin/website.php @@ -4,7 +4,7 @@ * Copyright (C) 2006-2012 Regis Houssin * Copyright (C) 2011 Juanjo Menent * Copyright (C) 2024 Alexandre Spangaro - * Copyright (C) 2024-2025 Frédéric France + * Copyright (C) 2024-2026 Frédéric France * Copyright (C) 2025 MDW * * This program is free software; you can redistribute it and/or modify @@ -51,7 +51,6 @@ $langs->loadLangs(array("admin", "members")); $action = GETPOST('action', 'aZ09'); // Hook to be used by external payment modules (ie Payzen, ...) -$hookmanager = new HookManager($db); $hookmanager->initHooks(array('newpayment')); if (!$user->admin) { diff --git a/htdocs/adherents/index.php b/htdocs/adherents/index.php index 68e8888ac19..472748ccada 100644 --- a/htdocs/adherents/index.php +++ b/htdocs/adherents/index.php @@ -4,7 +4,7 @@ * Copyright (C) 2004-2020 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2019 Nicolas ZABOURI - * Copyright (C) 2021-2025 Frédéric France + * Copyright (C) 2021-2026 Frédéric France * Copyright (C) 2021-2023 Waël Almoman * Copyright (C) 2024 MDW * Copyright (C) 2024 Alexandre Spangaro @@ -46,13 +46,9 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; // Load translation files required by the page $langs->loadLangs(array("companies", "members")); - -$hookmanager = new HookManager($db); - // Initialize a technical object to manage hooks. Note that conf->hooks_modules contains array $hookmanager->initHooks(array('membersindex')); - // Security check $result = restrictedArea($user, 'adherent'); diff --git a/htdocs/admin/eventorganization_public.php b/htdocs/admin/eventorganization_public.php index 5167abaecc9..ef2eea9a11d 100644 --- a/htdocs/admin/eventorganization_public.php +++ b/htdocs/admin/eventorganization_public.php @@ -1,7 +1,7 @@ * Copyright (C) 2024-2025 MDW - * Copyright (C) 2024-2025 Frédéric France + * Copyright (C) 2024-2026 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 @@ -83,8 +83,6 @@ if ($cancel) { include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php'; -$action = 'edit'; - /* * View diff --git a/htdocs/bom/ajax/ajax.php b/htdocs/bom/ajax/ajax.php index 0c6f199a9c6..36c058ec938 100644 --- a/htdocs/bom/ajax/ajax.php +++ b/htdocs/bom/ajax/ajax.php @@ -1,7 +1,7 @@ - * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024-2026 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 @@ -86,7 +86,7 @@ if ($action == 'getWorkstationByProduct' && $user->hasRight('product', 'lire')) $error = 'NOT FOUND'; } else { $error = null; - $result['defaultWk']=$product->fk_default_workstation; + $result['defaultWk'] = $product->fk_default_workstation; } $result['error']=$error; diff --git a/htdocs/bom/bom_agenda.php b/htdocs/bom/bom_agenda.php index be80f66d86a..96e63fbcf82 100644 --- a/htdocs/bom/bom_agenda.php +++ b/htdocs/bom/bom_agenda.php @@ -1,7 +1,7 @@ * Copyright (C) ---Put here your own copyright and developer email--- - * Copyright (C) 2024-2025 Frédéric France + * Copyright (C) 2024-2026 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 @@ -25,21 +25,20 @@ // Load Dolibarr environment require '../main.inc.php'; +/** + * @var Conf $conf + * @var DoliDB $db + * @var ExtraFields $extrafields + * @var HookManager $hookmanager + * @var Translate $langs + * @var User $user + */ require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; require_once DOL_DOCUMENT_ROOT.'/bom/class/bom.class.php'; require_once DOL_DOCUMENT_ROOT.'/bom/lib/bom.lib.php'; - -/** - * @var Conf $conf - * @var DoliDB $db - * @var HookManager $hookmanager - * @var Translate $langs - * @var User $user - */ - // Load translation files required by the page $langs->loadLangs(array('mrp', 'other')); @@ -84,7 +83,6 @@ if (!$sortorder) { // Initialize a technical objects $object = new BOM($db); -$extrafields = new ExtraFields($db); $diroutputmassaction = getMultidirOutput($object) . '/temp/massgeneration/'.$user->id; $hookmanager->initHooks(array('bomagenda', 'globalcard')); // Note that conf->hooks_modules contains array diff --git a/htdocs/bom/bom_card.php b/htdocs/bom/bom_card.php index 36f2c478d75..90c9bdb0472 100644 --- a/htdocs/bom/bom_card.php +++ b/htdocs/bom/bom_card.php @@ -1,6 +1,6 @@ - * Copyright (C) 2019-2025 Frédéric France + * Copyright (C) 2019-2026 Frédéric France * Copyright (C) 2023 Charlene Benke * Copyright (C) 2024-2025 MDW * @@ -30,6 +30,7 @@ require '../main.inc.php'; * The main.inc.php has been included so the following variable are now defined: * @var Conf $conf * @var DoliDB $db + * @var ExtraFields $extrafields * @var HookManager $hookmanager * @var Societe $mysoc * @var Translate $langs @@ -63,7 +64,6 @@ $hideref = (GETPOSTINT('hideref') ? GETPOSTINT('hideref') : (getDolGlobalString( // Initialize a technical objects $object = new BOM($db); -$extrafields = new ExtraFields($db); $diroutputmassaction = getMultidirOutput($object) . '/temp/massgeneration/'.$user->id; $hookmanager->initHooks(array('bomcard', 'globalcard')); // Note that conf->hooks_modules contains array diff --git a/htdocs/bom/bom_document.php b/htdocs/bom/bom_document.php index 5fbc7266b27..707873d57fd 100644 --- a/htdocs/bom/bom_document.php +++ b/htdocs/bom/bom_document.php @@ -1,6 +1,6 @@ - * Copyright (C) 2019-2025 Frédéric France + * Copyright (C) 2019-2026 Frédéric France * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify @@ -25,6 +25,14 @@ // Load Dolibarr environment require '../main.inc.php'; +/** + * @var Conf $conf + * @var DoliDB $db + * @var ExtraFields $extrafields + * @var HookManager $hookmanager + * @var Translate $langs + * @var User $user + */ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; @@ -32,14 +40,6 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php'; require_once DOL_DOCUMENT_ROOT.'/bom/class/bom.class.php'; require_once DOL_DOCUMENT_ROOT.'/bom/lib/bom.lib.php'; -/** - * @var Conf $conf - * @var DoliDB $db - * @var HookManager $hookmanager - * @var Translate $langs - * @var User $user - */ - // Load translation files required by the page $langs->loadLangs(array("mrp", "companies", "other", "mails")); @@ -75,7 +75,6 @@ if (!$sortfield) { // Initialize a technical objects $object = new BOM($db); -$extrafields = new ExtraFields($db); $diroutputmassaction = getMultidirOutput($object) . '/temp/massgeneration/'.$user->id; $hookmanager->initHooks(array('bomdocument', 'globalcard')); // Note that conf->hooks_modules contains array // Fetch optionals attributes and labels diff --git a/htdocs/bom/bom_list.php b/htdocs/bom/bom_list.php index cd29bae641b..1f0e1fe0e61 100644 --- a/htdocs/bom/bom_list.php +++ b/htdocs/bom/bom_list.php @@ -1,7 +1,7 @@ * Copyright (C) 2024-2025 MDW - * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024-2026 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 @@ -25,20 +25,20 @@ // Load Dolibarr environment require '../main.inc.php'; +/** + * @var Conf $conf + * @var DoliDB $db + * @var ExtraFields $extrafields + * @var HookManager $hookmanager + * @var Translate $langs + * @var User $user + */ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; require_once DOL_DOCUMENT_ROOT.'/bom/class/bom.class.php'; require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; -/** - * @var Conf $conf - * @var DoliDB $db - * @var HookManager $hookmanager - * @var Translate $langs - * @var User $user - */ - // Load translation files required by the page $langs->loadLangs(array('mrp', 'other')); @@ -73,7 +73,6 @@ $pagenext = $page + 1; // Initialize a technical objects $object = new BOM($db); -$extrafields = new ExtraFields($db); $diroutputmassaction = getMultidirOutput($object) . '/temp/massgeneration/'.$user->id; $hookmanager->initHooks(array('bomlist')); // Note that conf->hooks_modules contains array diff --git a/htdocs/bom/bom_net_needs.php b/htdocs/bom/bom_net_needs.php index a264f147732..8ed73e67725 100644 --- a/htdocs/bom/bom_net_needs.php +++ b/htdocs/bom/bom_net_needs.php @@ -1,6 +1,6 @@ - * Copyright (C) 2019-2025 Frédéric France + * Copyright (C) 2019-2026 Frédéric France * Copyright (C) 2025 MDW * * This program is free software; you can redistribute it and/or modify @@ -25,19 +25,19 @@ // Load Dolibarr environment require '../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; -require_once DOL_DOCUMENT_ROOT.'/bom/class/bom.class.php'; -require_once DOL_DOCUMENT_ROOT.'/bom/lib/bom.lib.php'; - /** * @var Conf $conf * @var DoliDB $db + * @var ExtraFields $extrafields * @var HookManager $hookmanager * @var Societe $mysoc * @var Translate $langs * @var User $user */ +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; +require_once DOL_DOCUMENT_ROOT.'/bom/class/bom.class.php'; +require_once DOL_DOCUMENT_ROOT.'/bom/lib/bom.lib.php'; // Load translation files required by the page $langs->loadLangs(array("mrp", "other", "stocks")); @@ -45,17 +45,16 @@ $langs->loadLangs(array("mrp", "other", "stocks")); // Get parameters $id = GETPOSTINT('id'); $lineid = GETPOSTINT('lineid'); -$ref = GETPOST('ref', 'alpha'); +$ref = GETPOST('ref', 'alpha'); $action = GETPOST('action', 'aZ09'); -$confirm = GETPOST('confirm', 'alpha'); -$cancel = GETPOST('cancel', 'alpha'); +$confirm = GETPOST('confirm', 'alpha'); +$cancel = GETPOST('cancel', 'alpha'); $contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'bomnet_needs'; // To manage different context of search -$backtopage = GETPOST('backtopage', 'alpha'); +$backtopage = GETPOST('backtopage', 'alpha'); // Initialize a technical objects $object = new BOM($db); -$extrafields = new ExtraFields($db); // Initialize a technical objects for hooks $hookmanager->initHooks(array('bomnetneeds')); // Note that conf->hooks_modules contains array diff --git a/htdocs/bom/bom_note.php b/htdocs/bom/bom_note.php index 4fa2f6b9262..c802dabda5b 100644 --- a/htdocs/bom/bom_note.php +++ b/htdocs/bom/bom_note.php @@ -1,6 +1,6 @@ - * Copyright (C) 2019-2025 Frédéric France + * Copyright (C) 2019-2026 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 @@ -24,16 +24,17 @@ // Load Dolibarr environment require '../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/bom/class/bom.class.php'; -require_once DOL_DOCUMENT_ROOT.'/bom/lib/bom.lib.php'; - /** * @var Conf $conf * @var DoliDB $db + * @var ExtraFields $extrafields * @var HookManager $hookmanager * @var Translate $langs * @var User $user */ +require_once DOL_DOCUMENT_ROOT.'/bom/class/bom.class.php'; +require_once DOL_DOCUMENT_ROOT.'/bom/lib/bom.lib.php'; + // Load translation files required by the page $langs->loadLangs(array("mrp", "companies")); @@ -47,7 +48,6 @@ $backtopage = GETPOST('backtopage', 'alpha'); // Initialize a technical objects $object = new BOM($db); -$extrafields = new ExtraFields($db); // Initialize a technical objects for hooks $hookmanager->initHooks(array('bomnote', 'globalcard')); // Note that conf->hooks_modules contains array diff --git a/htdocs/bom/lib/bom.lib.php b/htdocs/bom/lib/bom.lib.php index 91ba3d8b291..5233d354586 100644 --- a/htdocs/bom/lib/bom.lib.php +++ b/htdocs/bom/lib/bom.lib.php @@ -1,6 +1,6 @@ - * Copyright (C) 2019-2025 Frédéric France + * Copyright (C) 2019-2026 Frédéric France * Copyright (C) 2024 MDW * * This program is free software: you can redistribute it and/or modify @@ -30,10 +30,8 @@ */ function bomAdminPrepareHead() { - global $langs, $conf; + global $langs, $conf, $extrafields; - global $db; - $extrafields = new ExtraFields($db); $extrafields->fetch_name_optionals_label('bom_bom'); $extrafields->fetch_name_optionals_label('bom_bomline'); diff --git a/htdocs/comm/index.php b/htdocs/comm/index.php index 92733c42883..00abcdb2743 100644 --- a/htdocs/comm/index.php +++ b/htdocs/comm/index.php @@ -7,7 +7,7 @@ * Copyright (C) 2020 Pierre Ardoin * Copyright (C) 2020 Tobias Sekan * Copyright (C) 2024-2026 MDW - * Copyright (C) 2024-2025 Frédéric France + * Copyright (C) 2024-2026 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 @@ -31,6 +31,13 @@ // Load Dolibarr environment require '../main.inc.php'; +/** + * @var Conf $conf + * @var DoliDB $db + * @var HookManager $hookmanager + * @var Translate $langs + * @var User $user + */ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/agenda.lib.php'; require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php'; @@ -48,16 +55,8 @@ if (isModEnabled('intervention')) { require_once DOL_DOCUMENT_ROOT.'/fichinter/class/fichinter.class.php'; } -/** - * @var Conf $conf - * @var DoliDB $db - * @var HookManager $hookmanager - * @var Translate $langs - * @var User $user - */ // Initialize a technical object to manage hooks. Note that conf->hooks_modules contains array -$hookmanager = new HookManager($db); $hookmanager->initHooks(array('commercialindex')); // Load translation files required by the page diff --git a/htdocs/comm/mailing/index.php b/htdocs/comm/mailing/index.php index 667b6ebea39..e761c2c1a95 100644 --- a/htdocs/comm/mailing/index.php +++ b/htdocs/comm/mailing/index.php @@ -4,7 +4,7 @@ * Copyright (C) 2010 Regis Houssin * Copyright (C) 2019 Nicolas ZABOURI * Copyright (C) 2024 MDW - * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024-2026 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 @@ -28,9 +28,6 @@ // Load Dolibarr environment require '../../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/comm/mailing/class/mailing.class.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; - /** * @var Conf $conf * @var DoliDB $db @@ -38,8 +35,8 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; * @var Translate $langs * @var User $user */ - -$hookmanager = new HookManager($db); +require_once DOL_DOCUMENT_ROOT.'/comm/mailing/class/mailing.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; // Initialize a technical object to manage hooks. Note that conf->hooks_modules contains array $hookmanager->initHooks(array('mailingindex')); diff --git a/htdocs/comm/propal/agenda.php b/htdocs/comm/propal/agenda.php index 4b906ce8065..d90a560adb0 100644 --- a/htdocs/comm/propal/agenda.php +++ b/htdocs/comm/propal/agenda.php @@ -1,6 +1,6 @@ - * Copyright (C) 2024-2025 Frédéric France + * Copyright (C) 2024-2026 Frédéric France * Copyright (C) 2025 MDW * * This program is free software; you can redistribute it and/or modify @@ -23,6 +23,14 @@ * \brief Tab of events on Proposal */ require '../../main.inc.php'; +/** + * @var Conf $conf + * @var DoliDB $db + * @var ExtraFields $extrafields + * @var HookManager $hookmanager + * @var Translate $langs + * @var User $user + */ require_once DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php'; require_once DOL_DOCUMENT_ROOT . '/comm/propal/class/propal.class.php'; require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php'; @@ -30,13 +38,6 @@ require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/propal.lib.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/functions2.lib.php'; -/** - * @var Conf $conf - * @var DoliDB $db - * @var HookManager $hookmanager - * @var Translate $langs - * @var User $user - */ // Load translation files required by the page $langs->loadLangs(array("propal", "other")); @@ -80,7 +81,6 @@ if (!$sortorder) { // Initialize a technical objects $object = new Propal($db); -$extrafields = new ExtraFields($db); $diroutputmassaction = $conf->propal->multidir_output[$conf->entity] . '/temp/massgeneration/' . $user->id; $hookmanager->initHooks(array('propalagenda', 'globalcard')); // Note that conf->hooks_modules contains array // Fetch optionals attributes and labels @@ -96,6 +96,7 @@ $permissiontoread = $user->hasRight("propal", "lire"); $permissiontoadd = $user->hasRight("propal", "creer"); // Security check +$socid = ''; if (!empty($user->socid)) { $socid = $user->socid; } @@ -150,7 +151,11 @@ if ($object->id > 0) { // Object card // ------------------------------------------------------------ - $linkback = '' . $langs->trans("BackToList") . ''; + $query = ['restore_lastsearch_values' => 1]; + if (!empty($socid) && $socid > 0) { + $query += ['socid' => $socid]; + } + $linkback = '' . $langs->trans("BackToList") . ''; $morehtmlref = '
'; // Ref customer @@ -167,7 +172,7 @@ if ($object->id > 0) { if ($action != 'classify') { $morehtmlref .= '' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' '; } - $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, (string) $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, 0, 0, 1, '', 'maxwidth300'); + $morehtmlref .= $form->form_project(dolBuildUrl($_SERVER['PHP_SELF'], ['id' => $object->id]), $object->socid, (string) $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, 0, 0, 1, '', 'maxwidth300'); } else { if (!empty($object->fk_project)) { $proj = new Project($db); diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 65ef049d0e4..05f06514944 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -12,7 +12,7 @@ * Copyright (C) 2013-2014 Florian Henry * Copyright (C) 2014 Ferran Marcet * Copyright (C) 2016 Marcos García - * Copyright (C) 2018-2025 Frédéric France + * Copyright (C) 2018-2026 Frédéric France * Copyright (C) 2020 Nicolas ZABOURI * Copyright (C) 2022 Gauthier VERDOL * Copyright (C) 2023 Lenin Rivas @@ -182,14 +182,14 @@ if ($reshook < 0) { setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); } if (empty($reshook)) { - $backurlforlist = DOL_URL_ROOT . '/comm/propal/list.php'; + $backurlforlist = dolBuildUrl(DOL_URL_ROOT . '/comm/propal/list.php'); if (empty($backtopage) || ($cancel && empty($id))) { if (empty($backtopage) || ($cancel && strpos($backtopage, '__ID__'))) { if (empty($id) && (($action != 'add' && $action != 'create') || $cancel)) { $backtopage = $backurlforlist; } else { - $backtopage = DOL_URL_ROOT . '/comm/propal/card.php?id=' . ((!empty($id) && $id > 0) ? $id : '__ID__'); + $backtopage = dolBuildUrl(DOL_URL_ROOT . '/comm/propal/card.php', ['id' => ((!empty($id) && $id > 0) ? $id : '__ID__')]); } } } @@ -286,7 +286,7 @@ if (empty($reshook)) { // Cancel proposal $result = $object->setCancel($user); if ($result > 0) { - header('Location: ' . $_SERVER["PHP_SELF"] . '?id=' . $object->id); + header('Location: ' . dolBuildUrl($_SERVER["PHP_SELF"], ['id' => $object->id])); exit(); } else { $langs->load("errors"); @@ -296,7 +296,7 @@ if (empty($reshook)) { // Delete proposal $result = $object->delete($user); if ($result > 0) { - header('Location: ' . DOL_URL_ROOT . '/comm/propal/list.php?restore_lastsearch_values=1'); + header('Location: ' . dolBuildUrl(DOL_URL_ROOT . '/comm/propal/list.php', ['restore_lastsearch_values' => 1])); exit(); } else { $langs->load("errors"); @@ -472,7 +472,7 @@ if (empty($reshook)) { } elseif ($action == 'setdate_livraison' && $usercancreate) { $result = $object->setDeliveryDate($user, dol_mktime(12, 0, 0, GETPOSTINT('date_livraisonmonth'), GETPOSTINT('date_livraisonday'), GETPOSTINT('date_livraisonyear'))); if ($result < 0) { - dol_print_error($db, $object->error); + setEventMessages($object->error, $object->errors, 'errors'); } } elseif ($action == 'setref_client' && $usercancreate) { // Positionne ref client @@ -483,8 +483,14 @@ if (empty($reshook)) { } elseif ($action == 'set_incoterms' && isModEnabled('incoterm') && $usercancreate) { // Set incoterm $result = $object->setIncoterms(GETPOSTINT('incoterm_id'), GETPOST('location_incoterms')); + if ($result < 0) { + setEventMessages($object->error, $object->errors, 'errors'); + } } elseif ($action == 'settags' && isModEnabled('category') && $usercancreate) { // Set tags $result = $object->setCategories(GETPOST('categories', 'array')); + if ($result < 0) { + setEventMessages($object->error, $object->errors, 'errors'); + } } elseif ($action == 'add' && $usercancreate) { // Create proposal $object->socid = $socid; @@ -1003,10 +1009,16 @@ if (empty($reshook)) { } } elseif ($action == 'addline' && GETPOST('updateallvatlinesblock', 'alpha') && GETPOST('vatforblocklines', 'alpha') !== '' && $usercancreate) { $tx_tva = GETPOST('vatforblocklines') ? GETPOST('vatforblocklines') : 0; - $object->updateSubtotalLineBlockLines($langs, $object->getRangOfLine($lineid), 'tva', $tx_tva); + $result = $object->updateSubtotalLineBlockLines($langs, $object->getRangOfLine($lineid), 'tva', $tx_tva); + if ($result < 0) { + setEventMessages($object->error, $object->errors, 'errors'); + } } elseif ($action == 'addline' && GETPOST('updatealldiscountlinesblock', 'alpha') && GETPOST('discountforblocklines', 'alpha') !== '' && $usercancreate) { $discount = GETPOST('discountforblocklines') ? GETPOST('discountforblocklines') : 0; - $object->updateSubtotalLineBlockLines($langs, $object->getRangOfLine($lineid), 'discount', $discount); + $result = $object->updateSubtotalLineBlockLines($langs, $object->getRangOfLine($lineid), 'discount', $discount); + if ($result < 0) { + setEventMessages($object->error, $object->errors, 'errors'); + } } include DOL_DOCUMENT_ROOT . '/core/actions_printing.inc.php'; diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index af2a5f56174..9529526d22c 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -13,7 +13,7 @@ * Copyright (C) 2013 Florian Henry * Copyright (C) 2014-2015 Marcos García * Copyright (C) 2018 Nicolas ZABOURI - * Copyright (C) 2018-2025 Frédéric France + * Copyright (C) 2018-2026 Frédéric France * Copyright (C) 2018 Ferran Marcet * Copyright (C) 2022 ATM Consulting * Copyright (C) 2022 OpenDSI @@ -3562,8 +3562,8 @@ class Propal extends CommonObject $response->warning_delay = $delay_warning / 60 / 60 / 24; $response->label = $label; $response->labelShort = $labelShort; - $response->url = DOL_URL_ROOT.'/comm/propal/list.php?search_status='.$status.'&mainmenu=commercial&leftmenu=propals'; - $response->url_late = DOL_URL_ROOT.'/comm/propal/list.php?search_option=late&mainmenu=commercial&leftmenu=propals&sortfield=p.datep&sortorder=asc'; + $response->url = dolBuildUrl(DOL_URL_ROOT.'/comm/propal/list.php', ['search_status' => $status, 'mainmenu' => 'commercial', 'leftmenu' => 'propals']); + $response->url_late = dolBuildUrl(DOL_URL_ROOT.'/comm/propal/list.php', ['search_option' => 'late', 'mainmenu' => 'commercial', 'leftmenu' => 'propals', 'sortfield' => 'p.datep', 'sortorder' => 'asc']); $response->img = img_object('', "propal"); // This assignment in condition is not a bug. It allows walking the results. @@ -3979,7 +3979,7 @@ class Propal extends CommonObject if ($txttoshow) { $result .= ' '; - $result .= ''; + $result .= ''; $result .= img_picto('', 'note'); $result .= ''; $result .= ''; @@ -4025,12 +4025,10 @@ class Propal extends CommonObject $outputlangs->loadLangs(array("propale", "products")); if (!dol_strlen($modele)) { - $modele = 'azur'; + $modele = getDolGlobalString('PROPALE_ADDON_PDF', 'cyan'); if ($this->model_pdf) { $modele = $this->model_pdf; - } elseif (getDolGlobalString('PROPALE_ADDON_PDF')) { - $modele = getDolGlobalString('PROPALE_ADDON_PDF'); } } diff --git a/htdocs/comm/propal/document.php b/htdocs/comm/propal/document.php index 0bc7f7f9c5b..b76421abec7 100644 --- a/htdocs/comm/propal/document.php +++ b/htdocs/comm/propal/document.php @@ -5,7 +5,7 @@ * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2013 Cédric Salvador * Copyright (C) 2017 Ferran Marcet - * Copyright (C) 2024-2025 Frédéric France + * Copyright (C) 2024-2026 Frédéric France * Copyright (C) 2025 MDW * * This program is free software; you can redistribute it and/or modify @@ -30,6 +30,13 @@ // Load Dolibarr environment require '../../main.inc.php'; +/** + * @var Conf $conf + * @var DoliDB $db + * @var HookManager $hookmanager + * @var Translate $langs + * @var User $user + */ require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/propal.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; @@ -39,13 +46,6 @@ if (isModEnabled('project')) { require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; } -/** - * @var Conf $conf - * @var DoliDB $db - * @var HookManager $hookmanager - * @var Translate $langs - * @var User $user - */ // Load translation files required by the page $langs->loadLangs(array('propal', 'compta', 'other', 'companies')); @@ -133,8 +133,11 @@ if ($object->id > 0) { // Proposal card - - $linkback = ''.$langs->trans("BackToList").''; + $query = ['restore_lastsearch_values' => 1]; + if (!empty($socid) && $socid > 0) { + $query += ['socid' => $socid]; + } + $linkback = ''.$langs->trans("BackToList").''; $morehtmlref = '
'; diff --git a/htdocs/comm/propal/index.php b/htdocs/comm/propal/index.php index 7ff7a943aaa..4438bed9e71 100644 --- a/htdocs/comm/propal/index.php +++ b/htdocs/comm/propal/index.php @@ -4,7 +4,7 @@ * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2019 Nicolas ZABOURI * Copyright (C) 2020 Tobias Sekan - * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024-2026 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 @@ -28,10 +28,6 @@ // Load Dolibarr environment require '../../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; -require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/propal.lib.php'; - /** * @var Conf $conf * @var DoliDB $db @@ -39,9 +35,12 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/propal.lib.php'; * @var Translate $langs * @var User $user */ +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; +require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/propal.lib.php'; + // Initialize a technical object to manage hooks. Note that conf->hooks_modules contains array -$hookmanager = new HookManager($db); $hookmanager->initHooks(array('proposalindex')); // Load translation files required by the page diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index 27380f64a83..96f416bfe5b 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -15,7 +15,7 @@ * Copyright (C) 2018 Nicolas ZABOURI * Copyright (C) 2019-2026 Alexandre Spangaro * Copyright (C) 2021 Anthony Berton - * Copyright (C) 2021-2025 Frédéric France + * Copyright (C) 2021-2026 Frédéric France * Copyright (C) 2022 Josep Lluís Amador * Copyright (C) 2024-2026 MDW * Copyright (C) 2024 William Mead @@ -42,6 +42,14 @@ // Load Dolibarr environment require '../../main.inc.php'; +/** + * @var Conf $conf + * @var DoliDB $db + * @var ExtraFields $extrafields + * @var HookManager $hookmanager + * @var Translate $langs + * @var User $user + */ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formpropal.class.php'; @@ -58,13 +66,6 @@ if (isModEnabled('category')) { require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcategory.class.php'; } -/** - * @var Conf $conf - * @var DoliDB $db - * @var HookManager $hookmanager - * @var Translate $langs - * @var User $user - */ // Load translation files required by the page $langs->loadLangs(array('companies', 'propal', 'compta', 'bills', 'orders', 'products', 'sendings', 'categories')); @@ -207,7 +208,6 @@ $diroutputmassaction = $conf->propal->multidir_output[$conf->entity].'/temp/mass // Initialize a technical object to manage hooks of page. Note that conf->hooks_modules contains an array of hook context $object = new Propal($db); -$extrafields = new ExtraFields($db); // fetch optionals attributes and labels $extrafields->fetch_name_optionals_label($object->table_element); diff --git a/htdocs/comm/propal/messaging.php b/htdocs/comm/propal/messaging.php index 26d865aba1d..5fe4b9c0ca7 100644 --- a/htdocs/comm/propal/messaging.php +++ b/htdocs/comm/propal/messaging.php @@ -2,7 +2,7 @@ /* Copyright (C) 2005-2016 Laurent Destailleur * Copyright (C) 2005-2009 Regis Houssin * Copyright (C) 2024 MDW - * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024-2026 Frédéric France * Copyright (C) 2025 Valentin Grimal * * This program is free software; you can redistribute it and/or modify @@ -27,12 +27,6 @@ // Load Dolibarr environment require '../../main.inc.php'; -require_once DOL_DOCUMENT_ROOT . '/comm/propal/class/propal.class.php'; -require_once DOL_DOCUMENT_ROOT . '/core/lib/functions2.lib.php'; -require_once DOL_DOCUMENT_ROOT . '/core/lib/propal.lib.php'; -require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php'; -require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php'; - /** * @var Conf $conf * @var DoliDB $db @@ -40,6 +34,11 @@ require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php'; * @var Translate $langs * @var User $user */ +require_once DOL_DOCUMENT_ROOT . '/comm/propal/class/propal.class.php'; +require_once DOL_DOCUMENT_ROOT . '/core/lib/functions2.lib.php'; +require_once DOL_DOCUMENT_ROOT . '/core/lib/propal.lib.php'; +require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php'; +require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php'; // Load translation files required by the page $langs->load("propal"); diff --git a/htdocs/comm/propal/note.php b/htdocs/comm/propal/note.php index 881731f4761..83ba8ffffe0 100644 --- a/htdocs/comm/propal/note.php +++ b/htdocs/comm/propal/note.php @@ -5,7 +5,7 @@ * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2013 Florian Henry * Copyright (C) 2017 Ferran Marcet - * Copyright (C) 2024-2025 Frédéric France + * Copyright (C) 2024-2026 Frédéric France * Copyright (C) 2025 MDW * * This program is free software; you can redistribute it and/or modify @@ -111,8 +111,11 @@ if ($object->id > 0) { // Proposal card - - $linkback = ''.$langs->trans("BackToList").''; + $query = ['restore_lastsearch_values' => 1]; + if (!empty($socid) && $socid > 0) { + $query += ['socid' => $socid]; + } + $linkback = ''.$langs->trans("BackToList").''; $morehtmlref = '
'; @@ -130,7 +133,7 @@ if ($object->id > 0) { if ($action != 'classify') { $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; } - $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, (string) $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, 0, 0, 1, '', 'maxwidth300'); + $morehtmlref .= $form->form_project(dolBuildUrl($_SERVER['PHP_SELF'], ['id' => $object->id]), $object->socid, (string) $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, 0, 0, 1, '', 'maxwidth300'); } else { if (!empty($object->fk_project)) { $proj = new Project($db); diff --git a/htdocs/compta/charges/index.php b/htdocs/compta/charges/index.php index af862991a82..1ea1dd0b71e 100644 --- a/htdocs/compta/charges/index.php +++ b/htdocs/compta/charges/index.php @@ -8,7 +8,7 @@ * Copyright (C) 2019 Nicolas ZABOURI * Copyright (C) 2021 Gauthier VERDOL * Copyright (C) 2024-2025 MDW - * Copyright (C) 2024-2025 Frédéric France + * Copyright (C) 2024-2026 Frédéric France * Copyright (C) 2026 Nick Fragoulis * * This program is free software; you can redistribute it and/or modify @@ -33,15 +33,6 @@ // Load Dolibarr environment require '../../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/compta/tva/class/tva.class.php'; -require_once DOL_DOCUMENT_ROOT.'/compta/tva/class/paymentvat.class.php'; -require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/chargesociales.class.php'; -require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/paymentsocialcontribution.class.php'; -require_once DOL_DOCUMENT_ROOT.'/salaries/class/salary.class.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; - - /** * @var Conf $conf * @var DoliDB $db @@ -50,8 +41,13 @@ require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; * @var Translate $langs * @var User $user */ - -$hookmanager = new HookManager($db); +require_once DOL_DOCUMENT_ROOT.'/compta/tva/class/tva.class.php'; +require_once DOL_DOCUMENT_ROOT.'/compta/tva/class/paymentvat.class.php'; +require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/chargesociales.class.php'; +require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/paymentsocialcontribution.class.php'; +require_once DOL_DOCUMENT_ROOT.'/salaries/class/salary.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; // Initialize a technical object to manage hooks. Note that conf->hooks_modules contains array $hookmanager->initHooks(array('specialexpensesindex')); diff --git a/htdocs/don/admin/donation_extrafields.php b/htdocs/don/admin/donation_extrafields.php index f6a8e0bc40d..75240e2dbc7 100644 --- a/htdocs/don/admin/donation_extrafields.php +++ b/htdocs/don/admin/donation_extrafields.php @@ -1,7 +1,7 @@ * Copyright (C) 2015 Juanjo Menent - * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024-2026 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 @@ -31,6 +31,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; /** * @var Conf $conf * @var DoliDB $db + * @var ExtraFields $extrafields * @var HookManager $hookmanager * @var Translate $langs * @var User $user @@ -39,7 +40,6 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; // Load translation files required by the page $langs->loadLangs(array('companies', 'admin', 'donations')); -$extrafields = new ExtraFields($db); $form = new Form($db); // List of supported format diff --git a/htdocs/don/admin/website.php b/htdocs/don/admin/website.php index dfcf86178ac..644ab81421f 100644 --- a/htdocs/don/admin/website.php +++ b/htdocs/don/admin/website.php @@ -4,7 +4,7 @@ * Copyright (C) 2006-2012 Regis Houssin * Copyright (C) 2011 Juanjo Menent * Copyright (C) 2024 Alexandre Spangaro - * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024-2026 Frédéric France * Copyright (C) 2025 MDW * * This program is free software; you can redistribute it and/or modify @@ -50,7 +50,6 @@ $langs->loadLangs(array("admin", "donations")); $action = GETPOST('action', 'aZ09'); // Hook to be used by external payment modules (ie Payzen, ...) -$hookmanager = new HookManager($db); $hookmanager->initHooks(array('newpayment')); if (!$user->admin) { diff --git a/htdocs/don/list.php b/htdocs/don/list.php index 3c826aa16d0..b65a4da20ea 100644 --- a/htdocs/don/list.php +++ b/htdocs/don/list.php @@ -5,7 +5,7 @@ * Copyright (C) 2013 Cédric Salvador * Copyright (C) 2019 Thibault FOUCART * Copyright (C) 2024-2025 MDW - * Copyright (C) 2024-2025 Frédéric France + * Copyright (C) 2024-2026 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 @@ -329,21 +329,6 @@ if ($num == 1 && getDolGlobalInt('MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && $sear llxHeader('', $title, $help_url, '', 0, 0, $morejs, $morecss, '', 'mod-donation page-list bodyforlist'); // Can use also classforhorizontalscrolloftabs instead of bodyforlist for no horizontal scroll -// Example : Adding jquery code -// print ''; - $arrayofselected = is_array($toselect) ? $toselect : array(); $param = ''; @@ -602,10 +587,10 @@ while ($i < $imaxinloop) { $donationstatic->setVarsFromFetchObj($obj); - $donationstatic->id = $obj->rowid; + $donationstatic->id = (int) $obj->rowid; $donationstatic->ref = ($obj->ref ? $obj->ref : $obj->rowid); $donationstatic->date = $db->jdate($obj->datedon); - $donationstatic->status = $obj->status; + $donationstatic->status = (int) $obj->status; $donationstatic->lastname = $obj->lastname; $donationstatic->firstname = $obj->firstname; $object = $donationstatic; @@ -699,7 +684,7 @@ while ($i < $imaxinloop) { print ''.price($obj->amount).''; // Status - print ''.$donationstatic->LibStatut($obj->status, 5).''; + print ''.$donationstatic->LibStatut($donationstatic->status, 5).''; // Action column if (empty($conf->main_checkbox_left_column)) { diff --git a/htdocs/don/paiement/list.php b/htdocs/don/paiement/list.php index 53b95f19638..719f8efb7dc 100644 --- a/htdocs/don/paiement/list.php +++ b/htdocs/don/paiement/list.php @@ -5,7 +5,7 @@ * Copyright (C) 2013 Cédric Salvador * Copyright (C) 2019 Thibault FOUCART * Copyright (C) 2024-2025 MDW - * Copyright (C) 2024-2025 Frédéric France + * Copyright (C) 2024-2026 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 @@ -49,8 +49,9 @@ $action = GETPOST('action', 'aZ09') ? GETPOST('action', 'aZ09') : 'view'; // $massaction = GETPOST('massaction', 'alpha'); // The bulk action (combo box choice into lists) $contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'sclist'; $mode = GETPOST('mode', 'alpha'); +$toselect = GETPOST('toselect', 'array:int'); // Array of ids of elements selected into a list -$paiementid = GETPOSTINT('paiementid'); +$paiementid = GETPOSTINT('paiementid'); $search_ref = GETPOST("search_ref", "alpha"); $search_date_startday = GETPOSTINT('search_date_startday'); @@ -270,6 +271,7 @@ $num = $db->num_rows($resql); llxHeader('', $title, $help_url, '', 0, 0, $morejs, $morecss, '', 'bodyforlist'); // Can use also classforhorizontalscrolloftabs instead of bodyforlist for no horizontal scroll +$arrayofselected = is_array($toselect) ? $toselect : array(); $param = ''; if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { $param .= '&contextpage='.urlencode($contextpage); @@ -340,10 +342,10 @@ if ($search_all) { $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage; $selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, $conf->main_checkbox_left_column); // This also change content of $arrayfields -$massactionbutton = ''; -if ($massactionbutton) { - $selectedfields .= $form->showCheckAddButtons('checkforselect', 1); -} +// $massactionbutton = ''; +// if ($massactionbutton) { +// $selectedfields .= $form->showCheckAddButtons('checkforselect', 1); +// } $moreforfilter = ''; print '
'; @@ -530,7 +532,7 @@ while ($i < $imaxinloop) { print ''; if ($conf->main_checkbox_left_column) { print ''; - if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined + if (/* $massactionbutton || */ $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined $selected = 0; if (in_array($obj->id_paiement, $arrayofselected)) { $selected = 1; @@ -640,7 +642,7 @@ while ($i < $imaxinloop) { if (!$conf->main_checkbox_left_column) { print ''; - if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined + if (/* $massactionbutton || */ $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined $selected = 0; if (in_array($obj->id_paiement, $arrayofselected)) { $selected = 1; diff --git a/htdocs/don/payment/card.php b/htdocs/don/payment/card.php index 5d747c11d92..537f979e5e3 100644 --- a/htdocs/don/payment/card.php +++ b/htdocs/don/payment/card.php @@ -1,6 +1,6 @@ - * Copyright (C) 2019-2024 Frédéric France + * Copyright (C) 2019-2026 Frédéric France * Copyright (C) 2024-2025 MDW * * This program is free software; you can redistribute it and/or modify @@ -25,6 +25,13 @@ // Load Dolibarr environment require '../../main.inc.php'; +/** + * @var Conf $conf + * @var DoliDB $db + * @var HookManager $hookmanager + * @var Translate $langs + * @var User $user + */ require_once DOL_DOCUMENT_ROOT.'/don/class/don.class.php'; require_once DOL_DOCUMENT_ROOT.'/don/class/paymentdonation.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; @@ -33,13 +40,6 @@ if (isModEnabled("bank")) { require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; } -/** - * @var Conf $conf - * @var DoliDB $db - * @var HookManager $hookmanager - * @var Translate $langs - * @var User $user - */ // Load translation files required by the page $langs->loadLangs(array("bills", "banks", "companies", "donations")); @@ -109,8 +109,8 @@ if (empty($object->id)) { $h = 0; -$head = array(); -$head[$h][0] = DOL_URL_ROOT.'/don/payment/card.php?id='.$id; +$head = []; +$head[$h][0] = dolBuildUrl(DOL_URL_ROOT.'/don/payment/card.php', ['id'=> $id]); $head[$h][1] = $langs->trans("DonationPayment"); $hselected = (string) $h; $h++; @@ -236,9 +236,9 @@ print '
'; if (empty($action)) { if ($user->hasRight('don', 'supprimer')) { if (!$disable_delete) { - print dolGetButtonAction($langs->trans('Delete'), '', 'delete', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken(), '', 1); + print dolGetButtonAction($langs->trans('Delete'), '', 'delete', dolBuildUrl($_SERVER["PHP_SELF"], ['id' => $object->id, 'action' => 'delete'], true), '', 1); } else { - print dolGetButtonAction($langs->trans("CantRemovePaymentWithOneInvoicePaid"), $langs->trans('Delete'), '', $_SERVER["PHP_SELF"].'?id='.$object->id.'#', '', 1, [ 'attr' => ['classOverride' => 'butActionRefused']]); + print dolGetButtonAction($langs->trans("CantRemovePaymentWithOneInvoicePaid"), $langs->trans('Delete'), '', dolBuildUrl($_SERVER["PHP_SELF"], ['id' => $object->id], false, '#'), '', 1, ['attr' => ['classOverride' => 'butActionRefused']]); } } } diff --git a/htdocs/don/stats/index.php b/htdocs/don/stats/index.php index 64b9aeab82e..4774e4f8cf9 100644 --- a/htdocs/don/stats/index.php +++ b/htdocs/don/stats/index.php @@ -4,7 +4,7 @@ * Copyright (C) 2005-2009 Regis Houssin * Copyright (C) 2015 Alexandre Spangaro * Copyright (C) 2024-2025 MDW - * Copyright (C) 2024-2025 Frédéric France + * Copyright (C) 2024-2026 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 @@ -124,7 +124,7 @@ if (!$mesg) { $data = $stats->getAmountByMonthWithPrevYear($endyear, $startyear); $filenameamount = $dir."/donationamount-".$year.".png"; -$fileurlamount = DOL_URL_ROOT.'/viewimage.php?modulepart=donationStats&file=donationamoutinyear-'.$year.'.png'; +$fileurlamount = dolBuildUrl(DOL_URL_ROOT.'/viewimage.php', ['modulepart' => 'donationStats', 'file' => 'donationamoutinyear-'.$year.'.png']); $px2 = new DolGraph(); $mesg = $px2->isGraphKo(); @@ -153,7 +153,7 @@ if (!$mesg) { $data = $stats->getAverageByMonthWithPrevYear($endyear, $startyear); $filename_avg = $dir."/donationaverage-".$year.".png"; -$fileurl_avg = DOL_URL_ROOT.'/viewimage.php?modulepart=donationStats&file=donationaverageinyear-'.$year.'.png'; +$fileurl_avg = dolBuildUrl(DOL_URL_ROOT.'/viewimage.php', ['modulepart' => 'donationStats', 'file' => 'donationaverageinyear-'.$year.'.png']); $px3 = new DolGraph(); $mesg = $px3->isGraphKo(); @@ -290,7 +290,7 @@ foreach ($data as $val) { while (!empty($year) && $oldyear > (int) $year + 1) { $oldyear--; print ''; - print ''.$oldyear.''; + print ' $oldyear]).'">'.$oldyear.''; print '0'; print ''; @@ -306,7 +306,14 @@ foreach ($data as $val) { $greenavg = (empty($val['avg_diff']) || $val['avg_diff'] >= 0); print ''; - print ' 0 ? '&userid='.$userid : '').'">'.$year.''; + $query = ['year' => $year, 'mode' => $mode]; + if ($socid > 0) { + $query += ['socid' => $socid]; + } + if ($userid > 0) { + $query += ['userid' => $userid]; + } + print ''.$year.''; print ''.$val['nb'].''; print ''.(!empty($val['nb_diff']) && $val['nb_diff'] < 0 ? '' : '+').round(!empty($val['nb_diff']) ? $val['nb_diff'] : 0).'%'; print ''.price(price2num($val['total'], 'MT'), 1).''; diff --git a/htdocs/hrm/index.php b/htdocs/hrm/index.php index 239a3e67696..2fd363484b5 100644 --- a/htdocs/hrm/index.php +++ b/htdocs/hrm/index.php @@ -4,7 +4,7 @@ * Copyright (C) 2012-2014 Regis Houssin * Copyright (C) 2015-2016 Alexandre Spangaro * Copyright (C) 2019 Nicolas ZABOURI - * Copyright (C) 2021-2025 Frédéric France + * Copyright (C) 2021-2026 Frédéric France * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify @@ -30,6 +30,13 @@ // Load Dolibarr environment require '../main.inc.php'; +/** + * @var Conf $conf + * @var DoliDB $db + * @var HookManager $hookmanager + * @var Translate $langs + * @var User $user + */ require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; @@ -53,20 +60,10 @@ if (isModEnabled('holiday')) { } -/** - * @var Conf $conf - * @var DoliDB $db - * @var HookManager $hookmanager - * @var Translate $langs - * @var User $user - */ - // Load translation files required by the page $langs->loadLangs(array('users', 'holiday', 'trips', 'boxes')); // Initialize a technical object to manage hooks of page. Note that conf->hooks_modules contains an array of hook context -$hookmanager = new HookManager($db); - $hookmanager->initHooks(array('hrmindex')); // Get Parameters diff --git a/htdocs/opensurvey/index.php b/htdocs/opensurvey/index.php index ec7e5127294..711051d0075 100644 --- a/htdocs/opensurvey/index.php +++ b/htdocs/opensurvey/index.php @@ -1,7 +1,7 @@ * Copyright (C) 2019 Nicolas ZABOURI - * Copyright (C) 2019-2024 Frédéric France + * Copyright (C) 2019-2026 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 @@ -25,9 +25,6 @@ // Load Dolibarr environment require '../main.inc.php'; -require_once DOL_DOCUMENT_ROOT."/core/lib/admin.lib.php"; -require_once DOL_DOCUMENT_ROOT."/core/lib/files.lib.php"; - /** * @var Conf $conf * @var DoliDB $db @@ -35,6 +32,8 @@ require_once DOL_DOCUMENT_ROOT."/core/lib/files.lib.php"; * @var Translate $langs * @var User $user */ +require_once DOL_DOCUMENT_ROOT."/core/lib/admin.lib.php"; +require_once DOL_DOCUMENT_ROOT."/core/lib/files.lib.php"; // Load translation files required by the page $langs->load("opensurvey"); @@ -44,8 +43,6 @@ if (!$user->hasRight('opensurvey', 'read')) { accessforbidden(); } -$hookmanager = new HookManager($db); - // Initialize a technical object to manage hooks. Note that conf->hooks_modules contains array $hookmanager->initHooks(array('opensurveyindex')); diff --git a/htdocs/projet/index.php b/htdocs/projet/index.php index ecf426473e0..d0219746621 100644 --- a/htdocs/projet/index.php +++ b/htdocs/projet/index.php @@ -3,7 +3,7 @@ * Copyright (C) 2004-2022 Laurent Destailleur * Copyright (C) 2005-2010 Regis Houssin * Copyright (C) 2019 Nicolas ZABOURI - * Copyright (C) 2024-2025 Frédéric France + * Copyright (C) 2024-2026 Frédéric France * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify @@ -44,8 +44,6 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; // Load translation files required by the page $langs->loadLangs(array('projects', 'companies')); -$hookmanager = new HookManager($db); - // Initialize a technical object to manage hooks. Note that conf->hooks_modules contains array $hookmanager->initHooks(array('projectsindex')); diff --git a/htdocs/societe/index.php b/htdocs/societe/index.php index b54346765e0..30afeee4f61 100644 --- a/htdocs/societe/index.php +++ b/htdocs/societe/index.php @@ -6,7 +6,7 @@ * Copyright (C) 2015 Jean-François Ferry * Copyright (C) 2016 Ferran Marcet * Copyright (C) 2019 Nicolas ZABOURI - * Copyright (C) 2024-2025 Frédéric France + * Copyright (C) 2024-2026 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 @@ -46,7 +46,6 @@ $langs->load("companies"); // Initialize a technical object to manage hooks. Note that conf->hooks_modules contains array -$hookmanager = new HookManager($db); $hookmanager->initHooks(array('thirdpartiesindex'));