Merge pull request #28792 from mdeweerd/fix/PhanTypeExpectedObjectOrClassName_part1

Fix/phan type expected object or class name part1
This commit is contained in:
Laurent Destailleur
2024-03-12 22:14:14 +01:00
committed by GitHub
42 changed files with 137 additions and 177 deletions

View File

@@ -3,6 +3,7 @@
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2011-2019 Philippe Grand <philippe.grand@atoo-net.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
@@ -108,7 +109,6 @@ function fichinter_create($db, $object, $modele, $outputlangs, $hidedetails = 0,
// Search template files
$file = '';
$classname = '';
$filefound = 0;
$dirmodels = array('/');
if (is_array($conf->modules_parts['models'])) {
$dirmodels = array_merge($dirmodels, $conf->modules_parts['models']);
@@ -120,18 +120,17 @@ function fichinter_create($db, $object, $modele, $outputlangs, $hidedetails = 0,
// Get the location of the module and verify it exists
$file = dol_buildpath($reldir."core/modules/fichinter/doc/".$file, 0);
if (file_exists($file)) {
$filefound = 1;
$classname = $prefix.'_'.$modele;
break;
}
}
if ($filefound) {
if ($classname !== '') {
break;
}
}
// Charge le modele
if ($filefound) {
if ($classname !== '') {
require_once $file;
$obj = new $classname($db);

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);

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
@@ -117,7 +118,6 @@ function doc_label_pdf_create($db, $arrayofrecords, $modele, $outputlangs, $outp
// Search template files
$file = '';
$classname = '';
$filefound = 0;
$dirmodels = array('/');
if (is_array($conf->modules_parts['models'])) {
$dirmodels = array_merge($dirmodels, $conf->modules_parts['models']);
@@ -129,18 +129,17 @@ function doc_label_pdf_create($db, $arrayofrecords, $modele, $outputlangs, $outp
// Determine the model path and validate that it exists
$file = dol_buildpath($reldir."core/modules/printsheet/doc/".$file, 0);
if (file_exists($file)) {
$filefound = 1;
$classname = $prefix.'_'.$template;
break;
}
}
if ($filefound) {
if ($classname !== '') {
break;
}
}
// Load the model
if ($filefound) {
if ($classname !== '') {
require_once $file;
$obj = new $classname($db);