Fix: Code was sharing loop for custom dir and loop for subdir modules.
The loop to manage customdir must be managed by the dol_buildpath so only loop on / + module dir must be done.
This commit is contained in:
parent
7e3cb90f5a
commit
51fb1b2385
@ -71,24 +71,17 @@ if ($action == 'specimen')
|
|||||||
$commande = new Commande($db);
|
$commande = new Commande($db);
|
||||||
$commande->initAsSpecimen();
|
$commande->initAsSpecimen();
|
||||||
|
|
||||||
// Check if there is external models to do asked by plugins
|
// Search template files
|
||||||
if (is_array($conf->models_modules) && ! empty($conf->models_modules)) {
|
|
||||||
$conf->file->dol_document_root = array_merge($conf->file->dol_document_root,$conf->models_modules);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Search template file
|
|
||||||
$file=''; $classname=''; $filefound=0;
|
$file=''; $classname=''; $filefound=0;
|
||||||
foreach ($conf->file->dol_document_root as $dirroot)
|
$dirmodels=array_merge(array('/'),$conf->models_modules);
|
||||||
|
foreach($dirmodels as $reldir)
|
||||||
{
|
{
|
||||||
// Charge le modele
|
$file=dol_buildpath($reldir."core/modules/commande/doc/pdf_".$modele.".modules.php",0);
|
||||||
$dir = $dirroot."/core/modules/commande/doc/";
|
|
||||||
$file = $dir."pdf_".$modele.".modules.php";
|
|
||||||
if (file_exists($file))
|
if (file_exists($file))
|
||||||
{
|
{
|
||||||
$filefound=1;
|
$filefound=1;
|
||||||
$classname = "pdf_".$modele;
|
$classname = "pdf_".$modele;
|
||||||
break;
|
break;
|
||||||
require_once($file);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -70,18 +70,12 @@ if ($action == 'specimen')
|
|||||||
$facture = new Facture($db);
|
$facture = new Facture($db);
|
||||||
$facture->initAsSpecimen();
|
$facture->initAsSpecimen();
|
||||||
|
|
||||||
// Check if there is external models to do asked by plugins
|
// Search template files
|
||||||
if (is_array($conf->models_modules) && ! empty($conf->models_modules)) {
|
$file=''; $classname=''; $filefound=0;
|
||||||
$conf->file->dol_document_root = array_merge($conf->file->dol_document_root,$conf->models_modules);
|
$dirmodels=array_merge(array('/'),$conf->models_modules);
|
||||||
}
|
foreach($dirmodels as $reldir)
|
||||||
|
{
|
||||||
// Search template file
|
$file=dol_buildpath($reldir."core/modules/facture/doc/pdf_".$modele.".modules.php",0);
|
||||||
$file=''; $classname=''; $filefound=0;
|
|
||||||
foreach ($conf->file->dol_document_root as $dirroot)
|
|
||||||
{
|
|
||||||
// Load template
|
|
||||||
$dir = $dirroot."/core/modules/facture/doc/";
|
|
||||||
$file = $dir."pdf_".$modele.".modules.php";
|
|
||||||
if (file_exists($file))
|
if (file_exists($file))
|
||||||
{
|
{
|
||||||
$filefound=1;
|
$filefound=1;
|
||||||
|
|||||||
@ -69,18 +69,12 @@ if ($action == 'specimen')
|
|||||||
$propal = new Propal($db);
|
$propal = new Propal($db);
|
||||||
$propal->initAsSpecimen();
|
$propal->initAsSpecimen();
|
||||||
|
|
||||||
// Check if there is external models to do asked by plugins
|
// Search template files
|
||||||
if (is_array($conf->models_modules) && ! empty($conf->models_modules)) {
|
|
||||||
$conf->file->dol_document_root = array_merge($conf->file->dol_document_root,$conf->models_modules);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Search template file
|
|
||||||
$file=''; $classname=''; $filefound=0;
|
$file=''; $classname=''; $filefound=0;
|
||||||
foreach ($conf->file->dol_document_root as $dirroot)
|
$dirmodels=array_merge(array('/'),$conf->models_modules);
|
||||||
|
foreach($dirmodels as $reldir)
|
||||||
{
|
{
|
||||||
// Charge le modele
|
$file=dol_buildpath($reldir."core/modules/propale/doc/pdf_".$modele.".modules.php",0);
|
||||||
$dir = $dirroot."/core/modules/propale/doc/";
|
|
||||||
$file = $dir."pdf_".$modele.".modules.php";
|
|
||||||
if (file_exists($file))
|
if (file_exists($file))
|
||||||
{
|
{
|
||||||
$filefound=1;
|
$filefound=1;
|
||||||
|
|||||||
@ -158,7 +158,6 @@ function commande_pdf_create($db, $object, $modele, $outputlangs, $hidedetails=0
|
|||||||
|
|
||||||
$error=0;
|
$error=0;
|
||||||
|
|
||||||
$dir = "/core/modules/commande/";
|
|
||||||
$srctemplatepath='';
|
$srctemplatepath='';
|
||||||
|
|
||||||
// Positionne le modele sur le nom du modele a utiliser
|
// Positionne le modele sur le nom du modele a utiliser
|
||||||
@ -182,21 +181,17 @@ function commande_pdf_create($db, $object, $modele, $outputlangs, $hidedetails=0
|
|||||||
$srctemplatepath=$tmp[1];
|
$srctemplatepath=$tmp[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if there is external models to do asked by plugins
|
// Search template files
|
||||||
if (is_array($conf->models_modules) && ! empty($conf->models_modules)) {
|
$file=''; $classname=''; $filefound=0;
|
||||||
$conf->file->dol_document_root = array_merge($conf->file->dol_document_root,$conf->models_modules);
|
$dirmodels=array_merge(array('/'),$conf->models_modules);
|
||||||
}
|
foreach($dirmodels as $reldir)
|
||||||
|
{
|
||||||
foreach ($conf->file->dol_document_root as $dirroot)
|
|
||||||
{
|
|
||||||
// Search template file
|
|
||||||
$file=''; $classname=''; $filefound=0;
|
|
||||||
foreach(array('doc','pdf') as $prefix)
|
foreach(array('doc','pdf') as $prefix)
|
||||||
{
|
{
|
||||||
$file = $prefix."_".$modele.".modules.php";
|
$file = $prefix."_".$modele.".modules.php";
|
||||||
|
|
||||||
// On verifie l'emplacement du modele
|
// On verifie l'emplacement du modele
|
||||||
$file = $dirroot.$dir.'doc/'.$file;
|
$file=dol_buildpath($reldir."core/modules/commande/doc/".$file,0);
|
||||||
if (file_exists($file))
|
if (file_exists($file))
|
||||||
{
|
{
|
||||||
$filefound=1;
|
$filefound=1;
|
||||||
|
|||||||
@ -156,7 +156,6 @@ function facture_pdf_create($db, $object, $modele, $outputlangs, $hidedetails=0,
|
|||||||
@set_time_limit(120);
|
@set_time_limit(120);
|
||||||
error_reporting($err);
|
error_reporting($err);
|
||||||
|
|
||||||
$dir = "/core/modules/facture/";
|
|
||||||
$srctemplatepath='';
|
$srctemplatepath='';
|
||||||
|
|
||||||
// Positionne le modele sur le nom du modele a utiliser
|
// Positionne le modele sur le nom du modele a utiliser
|
||||||
@ -180,21 +179,17 @@ function facture_pdf_create($db, $object, $modele, $outputlangs, $hidedetails=0,
|
|||||||
$srctemplatepath=$tmp[1];
|
$srctemplatepath=$tmp[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if there is external models to do asked by plugins
|
// Search template files
|
||||||
if (is_array($conf->models_modules) && ! empty($conf->models_modules)) {
|
$file=''; $classname=''; $filefound=0;
|
||||||
$conf->file->dol_document_root = array_merge($conf->file->dol_document_root,$conf->models_modules);
|
$dirmodels=array_merge(array('/'),$conf->models_modules);
|
||||||
}
|
foreach($dirmodels as $reldir)
|
||||||
|
{
|
||||||
foreach ($conf->file->dol_document_root as $dirroot)
|
|
||||||
{
|
|
||||||
// Search template file
|
|
||||||
$file=''; $classname=''; $filefound=0;
|
|
||||||
foreach(array('doc','pdf') as $prefix)
|
foreach(array('doc','pdf') as $prefix)
|
||||||
{
|
{
|
||||||
$file = $prefix."_".$modele.".modules.php";
|
$file = $prefix."_".$modele.".modules.php";
|
||||||
|
|
||||||
// On verifie l'emplacement du modele
|
// On verifie l'emplacement du modele
|
||||||
$file = $dirroot.$dir.'doc/'.$file;
|
$file=dol_buildpath($reldir."core/modules/facture/doc/".$file,0);
|
||||||
if (file_exists($file))
|
if (file_exists($file))
|
||||||
{
|
{
|
||||||
$filefound=1;
|
$filefound=1;
|
||||||
|
|||||||
@ -159,7 +159,6 @@ function propale_pdf_create($db, $object, $modele, $outputlangs, $hidedetails=0,
|
|||||||
|
|
||||||
$error=0;
|
$error=0;
|
||||||
|
|
||||||
$dir = "/core/modules/propale/";
|
|
||||||
$srctemplatepath='';
|
$srctemplatepath='';
|
||||||
|
|
||||||
// Positionne le modele sur le nom du modele a utiliser
|
// Positionne le modele sur le nom du modele a utiliser
|
||||||
@ -183,21 +182,17 @@ function propale_pdf_create($db, $object, $modele, $outputlangs, $hidedetails=0,
|
|||||||
$srctemplatepath=$tmp[1];
|
$srctemplatepath=$tmp[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if there is external models to do asked by plugins
|
// Search template files
|
||||||
if (is_array($conf->models_modules) && ! empty($conf->models_modules)) {
|
$file=''; $classname=''; $filefound=0;
|
||||||
$conf->file->dol_document_root = array_merge($conf->file->dol_document_root,$conf->models_modules);
|
$dirmodels=array_merge(array('/'),$conf->models_modules);
|
||||||
}
|
foreach($dirmodels as $reldir)
|
||||||
|
{
|
||||||
// Search template file
|
|
||||||
$file=''; $classname=''; $filefound=0;
|
|
||||||
foreach ($conf->file->dol_document_root as $dirroot)
|
|
||||||
{
|
|
||||||
foreach(array('doc','pdf') as $prefix)
|
foreach(array('doc','pdf') as $prefix)
|
||||||
{
|
{
|
||||||
$file = $prefix."_".$modele.".modules.php";
|
$file = $prefix."_".$modele.".modules.php";
|
||||||
|
|
||||||
// On verifie l'emplacement du modele
|
// On verifie l'emplacement du modele
|
||||||
$file = $dirroot.$dir.'doc/'.$file;
|
$file=dol_buildpath($reldir."core/modules/propale/doc/".$file,0);
|
||||||
if (file_exists($file))
|
if (file_exists($file))
|
||||||
{
|
{
|
||||||
$filefound=1;
|
$filefound=1;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user