From ee18ef221cda0fc132ba8bbadfd35d73e52c554d Mon Sep 17 00:00:00 2001 From: MDW Date: Tue, 12 Mar 2024 16:16:13 +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/supplier_invoice.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/htdocs/admin/supplier_invoice.php b/htdocs/admin/supplier_invoice.php index 52b1342f88e..38db853af92 100644 --- a/htdocs/admin/supplier_invoice.php +++ b/htdocs/admin/supplier_invoice.php @@ -6,6 +6,7 @@ * Copyright (C) 2004 Benoit Mortier * Copyright (C) 2010-2013 Juanjo Menent * Copyright (C) 2011-2018 Philippe Grand + * 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 @@ -102,18 +103,16 @@ if ($action == 'specimen') { // For invoices // 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/supplier_invoice/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, $facture);