From ddf3431b81078a32b04319984e3771e7a4e2c998 Mon Sep 17 00:00:00 2001 From: Norbert Penel Date: Sat, 30 Nov 2024 13:31:53 +0100 Subject: [PATCH 1/4] Allow various format of dates on API paiement https://github.com/Dolibarr/dolibarr/issues/32111 --- htdocs/compta/facture/class/api_invoices.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/facture/class/api_invoices.class.php b/htdocs/compta/facture/class/api_invoices.class.php index b4867e8168a..d0735ce1c87 100644 --- a/htdocs/compta/facture/class/api_invoices.class.php +++ b/htdocs/compta/facture/class/api_invoices.class.php @@ -1463,7 +1463,7 @@ class Invoices extends DolibarrApi * Add payment line to a specific invoice with the remain to pay as amount. * * @param int $id Id of invoice - * @param string $datepaye {@from body} Payment date {@type timestamp} + * @param string $datepaye {@from body} Payment date * @param int $paymentid {@from body} Payment mode Id {@min 1} * @param string $closepaidinvoices {@from body} Close paid invoices {@choice yes,no} * @param int $accountid {@from body} Account Id {@min 1} @@ -1584,7 +1584,7 @@ class Invoices extends DolibarrApi * Example of value for parameter arrayofamounts: {"1": {"amount": "99.99", "multicurrency_amount": ""}, "2": {"amount": "", "multicurrency_amount": "10"}} * * @param array $arrayofamounts {@from body} Array with id of invoices with amount to pay for each invoice - * @param string $datepaye {@from body} Payment date {@type timestamp} + * @param string $datepaye {@from body} Payment date * @param int $paymentid {@from body} Payment mode Id {@min 1} * @param string $closepaidinvoices {@from body} Close paid invoices {@choice yes,no} * @param int $accountid {@from body} Account Id {@min 1} From 5323368e92e6b6d26c0d88d8b3e0b812c1ea31a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20France?= Date: Tue, 3 Dec 2024 18:14:34 +0100 Subject: [PATCH 2/4] fix phpstan --- build/phpstan/phpstan-baseline.neon | 36 ----------------------------- htdocs/fourn/commande/index.php | 9 +++++++- 2 files changed, 8 insertions(+), 37 deletions(-) diff --git a/build/phpstan/phpstan-baseline.neon b/build/phpstan/phpstan-baseline.neon index 3999e4d96da..121bb4c5ca8 100644 --- a/build/phpstan/phpstan-baseline.neon +++ b/build/phpstan/phpstan-baseline.neon @@ -20946,42 +20946,6 @@ parameters: count: 1 path: ../../htdocs/fourn/commande/document.php - - - message: '#^Variable \$badgeStatus0 might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/fourn/commande/index.php - - - - message: '#^Variable \$badgeStatus1 might not be defined\.$#' - identifier: variable.undefined - count: 2 - path: ../../htdocs/fourn/commande/index.php - - - - message: '#^Variable \$badgeStatus4 might not be defined\.$#' - identifier: variable.undefined - count: 2 - path: ../../htdocs/fourn/commande/index.php - - - - message: '#^Variable \$badgeStatus6 might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/fourn/commande/index.php - - - - message: '#^Variable \$badgeStatus9 might not be defined\.$#' - identifier: variable.undefined - count: 2 - path: ../../htdocs/fourn/commande/index.php - - - - message: '#^Variable \$socid might not be defined\.$#' - identifier: variable.undefined - count: 4 - path: ../../htdocs/fourn/commande/index.php - - message: '#^If condition is always false\.$#' identifier: if.alwaysFalse diff --git a/htdocs/fourn/commande/index.php b/htdocs/fourn/commande/index.php index 74c608bfd06..43c87192533 100644 --- a/htdocs/fourn/commande/index.php +++ b/htdocs/fourn/commande/index.php @@ -52,6 +52,7 @@ $max = getDolGlobalInt('MAIN_SIZE_SHORTLIST_LIMIT', 5); // Security check $orderid = GETPOST('orderid'); +$socid = GETPOSTINT('socid'); if ($user->socid) { $socid = $user->socid; } @@ -116,7 +117,13 @@ if ($resql) { $db->free($resql); include DOL_DOCUMENT_ROOT.'/theme/'.$conf->theme.'/theme_vars.inc.php'; - + /** + * @var string $badgeStatus0 + * @var string $badgeStatus1 + * @var string $badgeStatus4 + * @var string $badgeStatus6 + * @var string $badgeStatus9 + */ print '
'; print ''; print ''; From c9dc2952ca25af8839374d759342ff3fb480a605 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20France?= Date: Tue, 3 Dec 2024 18:26:24 +0100 Subject: [PATCH 3/4] fix phpstan --- .../modules/supplier_order/modules_commandefournisseur.php | 5 +++-- htdocs/fourn/commande/card.php | 2 +- htdocs/fourn/commande/contact.php | 2 +- htdocs/fourn/commande/dispatch.php | 2 +- htdocs/fourn/commande/document.php | 2 +- htdocs/fourn/commande/index.php | 2 +- htdocs/fourn/commande/info.php | 2 +- htdocs/fourn/commande/list.php | 2 +- htdocs/fourn/commande/note.php | 2 +- 9 files changed, 11 insertions(+), 10 deletions(-) diff --git a/htdocs/core/modules/supplier_order/modules_commandefournisseur.php b/htdocs/core/modules/supplier_order/modules_commandefournisseur.php index 9a2b8aca0b0..01b04b0a338 100644 --- a/htdocs/core/modules/supplier_order/modules_commandefournisseur.php +++ b/htdocs/core/modules/supplier_order/modules_commandefournisseur.php @@ -6,7 +6,8 @@ * Copyright (C) 2006 Andre Cianfarani * Copyright (C) 2011-2016 Philippe Grand * Copyright (C) 2014 Marcos García - * Copyright (C) 2024 MDW + * Copyright (C) 2024 MDW + * 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 @@ -25,7 +26,7 @@ /** * \file htdocs/core/modules/supplier_order/modules_commandefournisseur.php - * \ingroup order fournisseur + * \ingroup supplier order * \brief File that contains parent class for supplier orders models * and parent class for supplier orders numbering models */ diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index 376ca90db2b..d4fff20a846 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -32,7 +32,7 @@ /** * \file htdocs/fourn/commande/card.php - * \ingroup supplier, order + * \ingroup supplier order * \brief Card supplier order */ diff --git a/htdocs/fourn/commande/contact.php b/htdocs/fourn/commande/contact.php index 03efd74eaaa..67b436e308e 100644 --- a/htdocs/fourn/commande/contact.php +++ b/htdocs/fourn/commande/contact.php @@ -22,7 +22,7 @@ /** * \file htdocs/fourn/commande/contact.php - * \ingroup order + * \ingroup supplier order * \brief Onglet de gestion des contacts de commande */ diff --git a/htdocs/fourn/commande/dispatch.php b/htdocs/fourn/commande/dispatch.php index 485470da945..d61d72ea72b 100644 --- a/htdocs/fourn/commande/dispatch.php +++ b/htdocs/fourn/commande/dispatch.php @@ -27,7 +27,7 @@ /** * \file htdocs/fourn/commande/dispatch.php - * \ingroup commande + * \ingroup supplier order * \brief Page to dispatch receiving */ diff --git a/htdocs/fourn/commande/document.php b/htdocs/fourn/commande/document.php index e5f3a3f8ebe..5c43e0ba3d8 100644 --- a/htdocs/fourn/commande/document.php +++ b/htdocs/fourn/commande/document.php @@ -24,7 +24,7 @@ /** * \file htdocs/fourn/commande/document.php - * \ingroup supplier + * \ingroup supplier order * \brief Management page of attached documents to a supplier order */ diff --git a/htdocs/fourn/commande/index.php b/htdocs/fourn/commande/index.php index 43c87192533..25f6d7e4f90 100644 --- a/htdocs/fourn/commande/index.php +++ b/htdocs/fourn/commande/index.php @@ -22,7 +22,7 @@ /** * \file htdocs/fourn/commande/index.php - * \ingroup order fournisseur + * \ingroup supplier order * \brief Home page of supplier's orders area */ diff --git a/htdocs/fourn/commande/info.php b/htdocs/fourn/commande/info.php index e55e2c9a1da..477b4b11f95 100644 --- a/htdocs/fourn/commande/info.php +++ b/htdocs/fourn/commande/info.php @@ -21,7 +21,7 @@ /** * \file htdocs/fourn/commande/info.php - * \ingroup order + * \ingroup supplier order * \brief Info page for Purchase Order / Supplier Order */ diff --git a/htdocs/fourn/commande/list.php b/htdocs/fourn/commande/list.php index 44e6630c970..051e09d453d 100644 --- a/htdocs/fourn/commande/list.php +++ b/htdocs/fourn/commande/list.php @@ -29,7 +29,7 @@ /** * \file htdocs/fourn/commande/list.php - * \ingroup fournisseur + * \ingroup supplier order * \brief List of purchase orders */ diff --git a/htdocs/fourn/commande/note.php b/htdocs/fourn/commande/note.php index 22cf2d2f02e..967a875cd60 100644 --- a/htdocs/fourn/commande/note.php +++ b/htdocs/fourn/commande/note.php @@ -22,7 +22,7 @@ /** * \file htdocs/fourn/commande/note.php - * \ingroup order + * \ingroup supplier order * \brief page for notes on supplier orders */ From efcf6c6b247995861bf4dd33af64615c1b50e24e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 3 Dec 2024 20:34:47 +0100 Subject: [PATCH 4/4] fix pre-commit and CI (#32213) * fix pre-commit * fix phpstan * clean code --- .github/workflows/pr-18.yaml | 5 ++++- htdocs/expensereport/class/expensereport.class.php | 13 ++++--------- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/.github/workflows/pr-18.yaml b/.github/workflows/pr-18.yaml index 2682e99df38..b8b18169b58 100644 --- a/.github/workflows/pr-18.yaml +++ b/.github/workflows/pr-18.yaml @@ -19,7 +19,7 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Install GitHub CLI run: | @@ -36,7 +36,10 @@ jobs: #REVIEWER: "eldy,lvessiller-opendsi,rycks" # Remplacez par le nom d'utilisateur GitHub du reviewer REVIEWER: "rycks" # Remplacez par le nom d'utilisateur GitHub du reviewer run: | + # shellcheck disable=2086 echo "GH_TOKEN=$GH_TOKEN" + # shellcheck disable=2086 pr_number=$(jq --raw-output .number < $GITHUB_EVENT_PATH) + # shellcheck disable=2086 gh pr edit $pr_number --add-reviewer "$REVIEWER" continue-on-error: true diff --git a/htdocs/expensereport/class/expensereport.class.php b/htdocs/expensereport/class/expensereport.class.php index 5f7ef6df827..01827248462 100644 --- a/htdocs/expensereport/class/expensereport.class.php +++ b/htdocs/expensereport/class/expensereport.class.php @@ -616,8 +616,6 @@ class ExpenseReport extends CommonObject */ public function update($user, $notrigger = 0, $userofexpensereport = null) { - global $langs; - $error = 0; $this->db->begin(); @@ -644,24 +642,21 @@ class ExpenseReport extends CommonObject dol_syslog(get_class($this)."::update", LOG_DEBUG); $result = $this->db->query($sql); if ($result) { - if (!$error) { - $result = $this->insertExtraFields(); - if ($result < 0) { - $error++; - } + $result = $this->insertExtraFields(); + if ($result < 0) { + $error++; } if (!$error && !$notrigger) { // Call trigger $result = $this->call_trigger('EXPENSE_REPORT_MODIFY', $user); - if ($result < 0) { $error++; } // End call triggers } - if (empty($error)) { + if (!$error) { $this->db->commit(); return 1; } else {
'.$langs->trans("Statistics").' - '.$langs->trans("SuppliersOrders").'