From 98ba156c25b807bef7787db9a910ae655774824c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 9 Dec 2024 16:07:03 +0100 Subject: [PATCH 01/14] fix phpstan --- build/phpstan/phpstan-baseline.neon | 6 ------ htdocs/comm/recap-client.php | 5 +++-- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/build/phpstan/phpstan-baseline.neon b/build/phpstan/phpstan-baseline.neon index 0863ab2d843..b5270503279 100644 --- a/build/phpstan/phpstan-baseline.neon +++ b/build/phpstan/phpstan-baseline.neon @@ -4638,12 +4638,6 @@ parameters: count: 1 path: ../../htdocs/comm/propal/tpl/linkedobjectblock.tpl.php - - - message: '#^Variable \$id might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/comm/recap-client.php - - message: '#^If condition is always false\.$#' identifier: if.alwaysFalse diff --git a/htdocs/comm/recap-client.php b/htdocs/comm/recap-client.php index 550baca1931..f50a69286ed 100644 --- a/htdocs/comm/recap-client.php +++ b/htdocs/comm/recap-client.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2010 Laurent Destailleur +/* Copyright (C) 2001-2004 Rodolphe Quiedeville + * Copyright (C) 2004-2010 Laurent Destailleur * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -44,6 +44,7 @@ if (isModEnabled('invoice')) { // Security check $socid = GETPOSTINT("socid"); +$id = 0; if ($user->socid > 0) { $action = ''; $id = $user->socid; From 6295abe93796b158abe56b44ee51bd9af54ce98a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 9 Dec 2024 16:07:42 +0100 Subject: [PATCH 02/14] fix phpstan --- .github/workflows/test.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 30ccca5b0e9..dc0bfbdf63c 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -20,7 +20,7 @@ jobs: steps: - name: Log run: | - echo "Run action by ${{ github.actor }}" + echo "Run action by ${{ github.actor }}" echo "github.token=${{ github.token }}" echo "secrets.GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }}" echo "GITHUB_EVENT_PATH=$GITHUB_EVENT_PATH" From a2d51a8ae56624fd6f640057ae9f325d89cd2d67 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 9 Dec 2024 16:24:01 +0100 Subject: [PATCH 03/14] fix phpstan --- .github/workflows/test.yaml | 2 +- build/phpstan/phpstan-baseline.neon | 30 --------------------- htdocs/compta/bank/various_payment/list.php | 13 ++++----- 3 files changed, 6 insertions(+), 39 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 30ccca5b0e9..dc0bfbdf63c 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -20,7 +20,7 @@ jobs: steps: - name: Log run: | - echo "Run action by ${{ github.actor }}" + echo "Run action by ${{ github.actor }}" echo "github.token=${{ github.token }}" echo "secrets.GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }}" echo "GITHUB_EVENT_PATH=$GITHUB_EVENT_PATH" diff --git a/build/phpstan/phpstan-baseline.neon b/build/phpstan/phpstan-baseline.neon index 0863ab2d843..fd515408bf0 100644 --- a/build/phpstan/phpstan-baseline.neon +++ b/build/phpstan/phpstan-baseline.neon @@ -5496,42 +5496,12 @@ parameters: count: 1 path: ../../htdocs/compta/bank/various_payment/list.php - - - message: '#^Variable \$accountingaccount might not be defined\.$#' - identifier: variable.undefined - count: 5 - path: ../../htdocs/compta/bank/various_payment/list.php - - - - message: '#^Variable \$accountingjournal might not be defined\.$#' - identifier: variable.undefined - count: 2 - path: ../../htdocs/compta/bank/various_payment/list.php - - - - message: '#^Variable \$accountstatic might not be defined\.$#' - identifier: variable.undefined - count: 7 - path: ../../htdocs/compta/bank/various_payment/list.php - - - - message: '#^Variable \$bankline might not be defined\.$#' - identifier: variable.undefined - count: 4 - path: ../../htdocs/compta/bank/various_payment/list.php - - message: '#^Variable \$contextpage in empty\(\) always exists and is not falsy\.$#' identifier: empty.variable count: 1 path: ../../htdocs/compta/bank/various_payment/list.php - - - message: '#^Variable \$variousstatic might not be defined\.$#' - identifier: variable.undefined - count: 12 - path: ../../htdocs/compta/bank/various_payment/list.php - - message: '#^Loose comparison using \=\= between ''card'' and ''card'' will always evaluate to true\.$#' identifier: equal.alwaysTrue diff --git a/htdocs/compta/bank/various_payment/list.php b/htdocs/compta/bank/various_payment/list.php index bfb4a783c65..a9abe660819 100644 --- a/htdocs/compta/bank/various_payment/list.php +++ b/htdocs/compta/bank/various_payment/list.php @@ -239,24 +239,21 @@ if (empty($reshook)) { $form = new Form($db); $proj = null; +$bankline = new AccountLine($db); +$variousstatic = new PaymentVarious($db); +$accountstatic = null; if ($arrayfields['account']['checked'] || $arrayfields['subledger']['checked']) { $formaccounting = new FormAccounting($db); } if ($arrayfields['bank']['checked'] && isModEnabled('accounting')) { $accountingjournal = new AccountingJournal($db); } -if ($arrayfields['ref']['checked']) { - $variousstatic = new PaymentVarious($db); -} if ($arrayfields['bank']['checked']) { - $accountstatic = new Account($db); + $accountstatic = new Account($db); } if ($arrayfields['project']['checked']) { $proj = new Project($db); } -if ($arrayfields['entry']['checked']) { - $bankline = new AccountLine($db); -} if ($arrayfields['account']['checked']) { $accountingaccount = new AccountingAccount($db); } @@ -817,7 +814,7 @@ while ($i < $imaxinloop) { } // Bank account - if ($arrayfields['bank']['checked']) { + if ($arrayfields['bank']['checked'] && is_object($accountstatic)) { print ''; if ($obj->bid > 0) { $accountstatic->id = $obj->bid; From 88f71557d6c1d587513b330d247ba12b4a6d099d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 9 Dec 2024 16:24:24 +0100 Subject: [PATCH 04/14] fix phpstan --- htdocs/compta/bank/various_payment/list.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/htdocs/compta/bank/various_payment/list.php b/htdocs/compta/bank/various_payment/list.php index a9abe660819..3efe6c3e0c0 100644 --- a/htdocs/compta/bank/various_payment/list.php +++ b/htdocs/compta/bank/various_payment/list.php @@ -239,6 +239,7 @@ if (empty($reshook)) { $form = new Form($db); $proj = null; +$accountingaccount = new AccountingAccount($db); $bankline = new AccountLine($db); $variousstatic = new PaymentVarious($db); $accountstatic = null; @@ -254,9 +255,6 @@ if ($arrayfields['bank']['checked']) { if ($arrayfields['project']['checked']) { $proj = new Project($db); } -if ($arrayfields['account']['checked']) { - $accountingaccount = new AccountingAccount($db); -} $title = $langs->trans("VariousPayments"); //$help_url = "EN:Module_MyObject|FR:Module_MyObject_FR|ES:Módulo_MyObject"; From b10dc8e141637c1f5613bda7555b23da279ef274 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 9 Dec 2024 16:34:26 +0100 Subject: [PATCH 05/14] fix --- htdocs/multicurrency/class/multicurrency.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/multicurrency/class/multicurrency.class.php b/htdocs/multicurrency/class/multicurrency.class.php index e749b7c0647..8f4af567800 100644 --- a/htdocs/multicurrency/class/multicurrency.class.php +++ b/htdocs/multicurrency/class/multicurrency.class.php @@ -592,7 +592,7 @@ class MultiCurrency extends CommonObject * * @param int $fk_facture id of facture * @param string $table facture or facture_fourn - * @return array|bool Rate and code of currency or false if error + * @return array{invoice_multicurrency_tx: float,invoice_multicurrency_code: string}|bool Rate and code of currency or false if error */ public static function getInvoiceRate($fk_facture, $table = 'facture') { From 34f2546120098f2b42b89327f6fd44aec0f7ade1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 9 Dec 2024 16:43:50 +0100 Subject: [PATCH 06/14] fix --- htdocs/compta/paiement/class/paiement.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/paiement/class/paiement.class.php b/htdocs/compta/paiement/class/paiement.class.php index 8aafb996656..cbe1c9b4111 100644 --- a/htdocs/compta/paiement/class/paiement.class.php +++ b/htdocs/compta/paiement/class/paiement.class.php @@ -334,7 +334,7 @@ class Paiement extends CommonObject if (empty($value)) { continue; } - + $value_converted = false; $tmparray = MultiCurrency::getInvoiceRate($key, 'facture'); $invoice_multicurrency_tx = $tmparray['invoice_multicurrency_tx']; $invoice_multicurrency_code = $tmparray['invoice_multicurrency_code']; From ea935b5978deb425145a9fbd8c6615098a780002 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20France?= Date: Mon, 9 Dec 2024 18:22:03 +0100 Subject: [PATCH 07/14] fix phpstan --- scripts/emailings/reset-invalid-emails.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/scripts/emailings/reset-invalid-emails.php b/scripts/emailings/reset-invalid-emails.php index cb78837d1bd..0c466bd2182 100755 --- a/scripts/emailings/reset-invalid-emails.php +++ b/scripts/emailings/reset-invalid-emails.php @@ -1,6 +1,7 @@ #!/usr/bin/env php + * 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 @@ -53,7 +54,12 @@ require_once $path."../../htdocs/master.inc.php"; require_once DOL_DOCUMENT_ROOT.'/core/lib/functionscli.lib.php'; require_once DOL_DOCUMENT_ROOT."/core/class/CMailFile.class.php"; require_once DOL_DOCUMENT_ROOT."/comm/mailing/class/mailing.class.php"; - +/** + * @var DoliDB $db + * @var HookManager $hookmanager + * + * @var int $dolibarr_main_db_readonly + */ // Global variables $version = DOL_VERSION; $error = 0; From 981c13c788369df700b29e3e9229a7b0d08e1ab4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20France?= Date: Mon, 9 Dec 2024 18:24:16 +0100 Subject: [PATCH 08/14] fix phpstan --- scripts/bank/export-bank-receipts.php | 12 +++++++++--- scripts/emailings/reset-invalid-emails.php | 2 +- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/scripts/bank/export-bank-receipts.php b/scripts/bank/export-bank-receipts.php index 5bea3fe5f34..e25a7c03b3c 100755 --- a/scripts/bank/export-bank-receipts.php +++ b/scripts/bank/export-bank-receipts.php @@ -1,8 +1,9 @@ #!/usr/bin/env php - * Copyright (C) 2024 MDW + * Copyright (C) 2013 Laurent Destailleur + * 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 @@ -53,7 +54,12 @@ require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/tva/class/tva.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/paymentsocialcontribution.class.php'; - +/** + * @var Conf $conf + * @var DoliDB $db + * @var HookManager $hookmanager + * @var Translate $langs + */ // Global variables $version = DOL_VERSION; $error = 0; diff --git a/scripts/emailings/reset-invalid-emails.php b/scripts/emailings/reset-invalid-emails.php index 0c466bd2182..317c40abc16 100755 --- a/scripts/emailings/reset-invalid-emails.php +++ b/scripts/emailings/reset-invalid-emails.php @@ -1,6 +1,6 @@ #!/usr/bin/env php +/* Copyright (C) 2020 Laurent Destailleur * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify From 5d88c2251e580600563a1033614c78a55a6ae349 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 9 Dec 2024 21:29:15 +0100 Subject: [PATCH 09/14] Debug v21 --- htdocs/core/tpl/objectline_create.tpl.php | 4 ++-- htdocs/fourn/facture/card.php | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/core/tpl/objectline_create.tpl.php b/htdocs/core/tpl/objectline_create.tpl.php index 8b58ba7879b..be49279b2ef 100644 --- a/htdocs/core/tpl/objectline_create.tpl.php +++ b/htdocs/core/tpl/objectline_create.tpl.php @@ -206,7 +206,7 @@ if ($nolinesbefore) { // Free line $labelforempty = 1; - print ''; + print ''; // Show radio for the non predefined product if ($forceall >= 0 && (isModEnabled("product") || isModEnabled("service"))) { print ''; } // Predefined product/service diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index 1a4ec0045d0..d306837e053 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -3595,7 +3595,7 @@ if ($action == 'create') { print ''; - // List of payments + // List of payments already done $totalpaid = 0; @@ -3649,8 +3649,8 @@ if ($action == 'create') { print ''; print ''; print ''; - print ''; - print ''; + print ''; + print ''; if (isModEnabled("bank")) { print ''; } From f667a85f292a5b66000b35de2936f9a8eb8ecd0d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20France?= Date: Mon, 9 Dec 2024 21:53:06 +0100 Subject: [PATCH 10/14] clean baseline --- build/phpstan/phpstan-baseline.neon | 36 ----------------------------- 1 file changed, 36 deletions(-) diff --git a/build/phpstan/phpstan-baseline.neon b/build/phpstan/phpstan-baseline.neon index b5270503279..ad391a528f5 100644 --- a/build/phpstan/phpstan-baseline.neon +++ b/build/phpstan/phpstan-baseline.neon @@ -34218,30 +34218,6 @@ parameters: count: 1 path: ../../htdocs/zapier/class/api_zapier.class.php - - - message: '#^Variable \$conf might not be defined\.$#' - identifier: variable.undefined - count: 2 - path: ../../scripts/bank/export-bank-receipts.php - - - - message: '#^Variable \$db might not be defined\.$#' - identifier: variable.undefined - count: 27 - path: ../../scripts/bank/export-bank-receipts.php - - - - message: '#^Variable \$hookmanager might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../scripts/bank/export-bank-receipts.php - - - - message: '#^Variable \$langs might not be defined\.$#' - identifier: variable.undefined - count: 9 - path: ../../scripts/bank/export-bank-receipts.php - - message: '#^Variable \$num in isset\(\) always exists and is not nullable\.$#' identifier: isset.variable @@ -34296,18 +34272,6 @@ parameters: count: 1 path: ../../scripts/emailings/reset-invalid-emails.php - - - message: '#^Variable \$db might not be defined\.$#' - identifier: variable.undefined - count: 21 - path: ../../scripts/emailings/reset-invalid-emails.php - - - - message: '#^Variable \$hookmanager might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../scripts/emailings/reset-invalid-emails.php - - message: '#^Variable \$conf might not be defined\.$#' identifier: variable.undefined From c7c8542039e03d7927dc83e13e4b5aa61355f9d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20France?= Date: Mon, 9 Dec 2024 22:02:52 +0100 Subject: [PATCH 11/14] clean baseline --- htdocs/compta/bank/various_payment/list.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/bank/various_payment/list.php b/htdocs/compta/bank/various_payment/list.php index 3efe6c3e0c0..e3b95c2ddba 100644 --- a/htdocs/compta/bank/various_payment/list.php +++ b/htdocs/compta/bank/various_payment/list.php @@ -243,6 +243,7 @@ $accountingaccount = new AccountingAccount($db); $bankline = new AccountLine($db); $variousstatic = new PaymentVarious($db); $accountstatic = null; +$accountingjournal = null; if ($arrayfields['account']['checked'] || $arrayfields['subledger']['checked']) { $formaccounting = new FormAccounting($db); } @@ -716,7 +717,8 @@ while ($i < $imaxinloop) { $variousstatic->datep = $obj->datep; $variousstatic->type_payment = $obj->payment_code; $bankline->fetch($obj->fk_bank); - $variousstatic->fk_bank = $bankline->getNomUrl(1); + // @phpstan-ignore-next-line + $variousstatic->fk_bank = $bankline->getNomUrl(1); // hack for kanban view TODO to remove $variousstatic->amount = $obj->amount; $accountingaccount->fetch(0, $obj->accountancy_code, 1); @@ -819,7 +821,7 @@ while ($i < $imaxinloop) { $accountstatic->ref = $obj->bref; $accountstatic->number = $obj->bnumber; - if (isModEnabled('accounting')) { + if (isModEnabled('accounting') && is_object($accountingjournal)) { $accountstatic->account_number = $obj->bank_account_number; $accountingjournal->fetch($obj->accountancy_journal); $accountstatic->accountancy_journal = $accountingjournal->getNomUrl(0, 1, 1, '', 1); From 7ff227bafe270430dac452e50900543a0346ab0f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 9 Dec 2024 22:26:56 +0100 Subject: [PATCH 12/14] Debug v21 --- htdocs/core/class/html.formfile.class.php | 33 ----------------------- htdocs/ecm/class/ecmfiles.class.php | 9 ++++++- htdocs/fourn/facture/card.php | 2 +- 3 files changed, 9 insertions(+), 35 deletions(-) diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index 52d4519caea..8c7524cd1a2 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -840,39 +840,6 @@ class FormFile $morecss = 'maxwidth100'; } $out .= $form->selectarray('model', $modellist, $modelselected, $showempty, 0, 0, '', 0, 0, 0, '', $morecss, 1, '', 0, 0); - // script for select the separator - /* TODO This must appear on export feature only - $out .= ''; - $out .= ''; - $out .= ''; - - $out .= ''; - */ if ($conf->use_javascript_ajax) { $out .= ajax_combobox('model'); } diff --git a/htdocs/ecm/class/ecmfiles.class.php b/htdocs/ecm/class/ecmfiles.class.php index df8f9ff436d..b282e6ebe5d 100644 --- a/htdocs/ecm/class/ecmfiles.class.php +++ b/htdocs/ecm/class/ecmfiles.class.php @@ -1008,7 +1008,14 @@ class EcmFiles extends CommonObject } if ($option) { - $url = DOL_URL_ROOT.'/document.php?modulepart='.$option.'&file='.urlencode(preg_replace('/^[^\/]+\//', '', $this->filepath).'/'.$this->filename).'&entity='.$this->entity; + if ($option == 'facture_fournisseur') { + $tmppath = preg_replace('/^fournisseur\/facture\//', '', $this->filepath); + } elseif ($option == 'commande_fournisseur') { + $tmppath = preg_replace('/^fournisseur\/commande\//', '', $this->filepath); + } else { + $tmppath = preg_replace('/^[^\/]+\//', '', $this->filepath); + } + $url = DOL_URL_ROOT.'/document.php?modulepart='.urlencode($option).'&file='.urlencode($tmppath.'/'.$this->filename).'&entity='.$this->entity; } else { $url = DOL_URL_ROOT.'/ecm/file_card.php?id='.$this->id; } diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index d306837e053..34349e99a91 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -4172,7 +4172,7 @@ if ($action == 'create') { $urlsource = $_SERVER['PHP_SELF'].'?id='.$object->id; $genallowed = $usercanread; $delallowed = $usercancreate; - $modelpdf = (!empty($object->model_pdf) ? $object->model_pdf : (!getDolGlobalString('INVOICE_SUPPLIER_ADDON_PDF') ? '' : $conf->global->INVOICE_SUPPLIER_ADDON_PDF)); + $modelpdf = (empty($object->model_pdf) ? getDolGlobalString('INVOICE_SUPPLIER_ADDON_PDF') : $object->model_pdf); print $formfile->showdocuments('facture_fournisseur', $subdir, $filedir, $urlsource, $genallowed, $delallowed, $modelpdf, 1, 0, 0, 40, 0, '', '', '', $societe->default_lang); $somethingshown = $formfile->numoffiles; From 973dab622ff05ba387378c6cc1bb31bfbc29058c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 9 Dec 2024 23:26:37 +0100 Subject: [PATCH 13/14] Debug v21 --- .../compta/bank/class/paymentvarious.class.php | 5 +++-- htdocs/compta/bank/various_payment/list.php | 18 ++++++++++-------- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/htdocs/compta/bank/class/paymentvarious.class.php b/htdocs/compta/bank/class/paymentvarious.class.php index 3db06e726d6..d5f006e609c 100644 --- a/htdocs/compta/bank/class/paymentvarious.class.php +++ b/htdocs/compta/bank/class/paymentvarious.class.php @@ -833,6 +833,7 @@ class PaymentVarious extends CommonObject global $langs; $selected = (empty($arraydata['selected']) ? 0 : $arraydata['selected']); + $bankline = ((empty($arraydata['bankline']) || empty($arraydata['bankline']->id)) ? 0 : $arraydata['bankline']); $return = '
'; $return .= '
'; @@ -844,8 +845,8 @@ class PaymentVarious extends CommonObject if ($selected >= 0) { $return .= ''; } - if (property_exists($this, 'fk_bank')) { - $return .= ' | '.$this->fk_bank.''; + if (!empty($bankline)) { + $return .= ' | '.$bankline->getNomUrl(1).''; } if (property_exists($this, 'datep')) { $return .= '
'.$langs->trans("Date").' : '.dol_print_date($this->db->jdate($this->datep), 'day').''; diff --git a/htdocs/compta/bank/various_payment/list.php b/htdocs/compta/bank/various_payment/list.php index e3b95c2ddba..195d635d8d5 100644 --- a/htdocs/compta/bank/various_payment/list.php +++ b/htdocs/compta/bank/various_payment/list.php @@ -716,21 +716,25 @@ while ($i < $imaxinloop) { $variousstatic->label = $obj->label; $variousstatic->datep = $obj->datep; $variousstatic->type_payment = $obj->payment_code; - $bankline->fetch($obj->fk_bank); - // @phpstan-ignore-next-line - $variousstatic->fk_bank = $bankline->getNomUrl(1); // hack for kanban view TODO to remove + $variousstatic->amount = $obj->amount; $accountingaccount->fetch(0, $obj->accountancy_code, 1); $variousstatic->accountancy_code = $accountingaccount->getNomUrl(0, 0, 1, $obj->accountingaccount, 1); if ($mode == 'kanban') { + if ($obj->fk_bank > 0) { + $bankline->fetch($obj->fk_bank); + } else { + $bankline->id = 0; + } + if ($i == 0) { print '
'; @@ -814,9 +818,9 @@ while ($i < $imaxinloop) { } // Bank account - if ($arrayfields['bank']['checked'] && is_object($accountstatic)) { + if ($arrayfields['bank']['checked']) { print ''; if (!$i) { From 78ece8355f5810f0b14e07798a7f01a32aae4403 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 10 Dec 2024 00:01:37 +0100 Subject: [PATCH 14/14] Debug v21 --- htdocs/admin/mails_senderprofile_list.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/htdocs/admin/mails_senderprofile_list.php b/htdocs/admin/mails_senderprofile_list.php index 29887bba770..bddeb8ffd1e 100644 --- a/htdocs/admin/mails_senderprofile_list.php +++ b/htdocs/admin/mails_senderprofile_list.php @@ -55,7 +55,6 @@ $optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' $mode = GETPOST('mode', 'aZ'); // The output mode ('list', 'kanban', 'hierarchy', 'calendar', ...) $id = GETPOSTINT('id'); -$rowid = GETPOST('rowid', 'alpha'); // Load variable for pagination $limit = GETPOSTINT('limit') ? GETPOSTINT('limit') : $conf->liste_limit; @@ -83,8 +82,8 @@ $search_array_options = $extrafields->getOptionalsFromPost($object->table_elemen // Default sort order (if not yet defined by previous GETPOST) if (!$sortfield) { - reset($object->fields); // Reset is required to avoid key() to return null. - $sortfield = "t.".key($object->fields); // Set here default search field. By default 1st field in definition. + reset($object->fields); // Reset is required to avoid key() to return null. + $sortfield = "t.position"; // Set here default search field. By default 1st field in definition. } if (!$sortorder) { $sortorder = "ASC";
'.($object->type == FactureFournisseur::TYPE_CREDIT_NOTE ? $langs->trans("PaymentsBack") : $langs->trans('Payments')).''.$langs->trans('Date').''.$langs->trans('Type').''.$langs->trans('Date').''.$langs->trans('Type').''.$langs->trans('BankAccount').'
'; print '
'; } // Output Kanban - print $variousstatic->getKanbanView('', array('selected' => in_array($object->id, $arrayofselected))); + print $variousstatic->getKanbanView('', array('selected' => in_array($object->id, $arrayofselected), 'bankline' => $bankline)); if ($i == ($imaxinloop) - 1) { print '
'; print '
'; - if ($obj->bid > 0) { + if (is_object($accountstatic) && $obj->bid > 0) { $accountstatic->id = $obj->bid; $accountstatic->ref = $obj->bref; $accountstatic->number = $obj->bnumber; @@ -829,8 +833,6 @@ while ($i < $imaxinloop) { $accountstatic->label = $obj->blabel; print $accountstatic->getNomUrl(1); - } else { - print ' '; } print '