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.
This commit is contained in:
MDW 2024-03-12 16:15:53 +01:00
parent a333aaf50a
commit 5d3f6187bd
No known key found for this signature in database

View file

@ -7,6 +7,7 @@
* Copyright (C) 2012-2013 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2014 Teddy Andreotti <125155@supinfo.com>
* Copyright (C) 2022 Anthony Berton <anthony.berton@bb2a.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
*
* 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 "</tr>\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");