From 5d3f6187bd97a8276eba3ad79bc0ee52b1e48cbc Mon Sep 17 00:00:00 2001 From: MDW Date: Tue, 12 Mar 2024 16:15:53 +0100 Subject: [PATCH] Qual: Fix PhanTypeExpectedObjectOrClassName by testing on classname # Qual: Fix PhanTypeExpectedObjectOrClassName by testing on classname PhanTypeExpectedObjectOrClassName should be fixed by testing that the classname is not empty. --- htdocs/admin/invoice.php | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/htdocs/admin/invoice.php b/htdocs/admin/invoice.php index 26678685f53..a2f0282ba9f 100644 --- a/htdocs/admin/invoice.php +++ b/htdocs/admin/invoice.php @@ -7,6 +7,7 @@ * Copyright (C) 2012-2013 Juanjo Menent * Copyright (C) 2014 Teddy Andreotti <125155@supinfo.com> * Copyright (C) 2022 Anthony Berton + * Copyright (C) 2024 MDW * * 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 @@ -99,18 +100,16 @@ if ($action == 'updateMask') { // Search template files $file = ''; $classname = ''; - $filefound = 0; $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); foreach ($dirmodels as $reldir) { $file = dol_buildpath($reldir."core/modules/facture/doc/pdf_".$modele.".modules.php", 0); if (file_exists($file)) { - $filefound = 1; $classname = "pdf_".$modele; break; } } - if ($filefound) { + if ($classname !== '') { require_once $file; $module = new $classname($db); @@ -628,10 +627,10 @@ if (getDolGlobalString('INVOICE_USE_DEFAULT_DOCUMENT')) { // Hidden conf print "\n"; $listtype = array( - Facture::TYPE_STANDARD=>$langs->trans("InvoiceStandard"), - Facture::TYPE_REPLACEMENT=>$langs->trans("InvoiceReplacement"), - Facture::TYPE_CREDIT_NOTE=>$langs->trans("InvoiceAvoir"), - Facture::TYPE_DEPOSIT=>$langs->trans("InvoiceDeposit"), + Facture::TYPE_STANDARD => $langs->trans("InvoiceStandard"), + Facture::TYPE_REPLACEMENT => $langs->trans("InvoiceReplacement"), + Facture::TYPE_CREDIT_NOTE => $langs->trans("InvoiceAvoir"), + Facture::TYPE_DEPOSIT => $langs->trans("InvoiceDeposit"), ); if (getDolGlobalInt('INVOICE_USE_SITUATION')) { $listtype[Facture::TYPE_SITUATION] = $langs->trans("InvoiceSituation");