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:16:41 +01:00
parent 7825954f2a
commit a59fd68987

View File

@@ -3,6 +3,7 @@
* Copyright (C) 2004-2009 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@inodbox.com>
* 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
@@ -115,7 +116,6 @@ function members_card_pdf_create($db, $arrayofmembers, $modele, $outputlangs, $o
// Search template files
$file = '';
$classname = '';
$filefound = 0;
$dirmodels = array('/');
if (is_array($conf->modules_parts['models'])) {
$dirmodels = array_merge($dirmodels, $conf->modules_parts['models']);
@@ -127,19 +127,18 @@ function members_card_pdf_create($db, $arrayofmembers, $modele, $outputlangs, $o
// We check that file of doc generaotr exists
$file = dol_buildpath($reldir."core/modules/member/doc/".$file, 0);
if (file_exists($file)) {
$filefound = 1;
$classname = $prefix.'_'.$template;
break;
}
}
if ($filefound) {
if ($classname !== '') {
break;
}
}
// Charge le modele
if ($filefound) {
if ($classname !== '') {
require_once $file;
$obj = new $classname($db);