FIX : do not include disabled modules tpl

This commit is contained in:
Christophe Battarel 2019-05-24 12:10:58 +02:00
parent f99f1d83c2
commit aaaad71347

View File

@ -3716,15 +3716,24 @@ abstract class CommonObject
// Output template part (modules that overwrite templates must declare this into descriptor) // Output template part (modules that overwrite templates must declare this into descriptor)
// Use global variables + $dateSelector + $seller and $buyer // Use global variables + $dateSelector + $seller and $buyer
$dirtpls=array_merge($conf->modules_parts['tpl'], array('/core/tpl')); $dirtpls=array_merge($conf->modules_parts['tpl'], array('/core/tpl'));
foreach($dirtpls as $reldir) foreach($dirtpls as $module => $reldir)
{
if (!empty($module) && empty($conf->$module->enabled)) continue;
if (!empty($module))
{ {
$tpl = dol_buildpath($reldir.'/objectline_create.tpl.php'); $tpl = dol_buildpath($reldir.'/objectline_create.tpl.php');
}
else
{
$tpl = DOL_DOCUMENT_ROOT.$reldir.'/objectline_create.tpl.php';
}
if (empty($conf->file->strict_mode)) { if (empty($conf->file->strict_mode)) {
$res=@include $tpl; $res=@include $tpl;
} else { } else {
$res=include $tpl; // for debug $res=include $tpl; // for debug
} }
if ($res) break; if ($res > 0) break;
} }
} }
@ -3968,15 +3977,24 @@ abstract class CommonObject
// Output template part (modules that overwrite templates must declare this into descriptor) // Output template part (modules that overwrite templates must declare this into descriptor)
// Use global variables + $dateSelector + $seller and $buyer // Use global variables + $dateSelector + $seller and $buyer
$dirtpls=array_merge($conf->modules_parts['tpl'], array('/core/tpl')); $dirtpls=array_merge($conf->modules_parts['tpl'], array('/core/tpl'));
foreach($dirtpls as $reldir) foreach($dirtpls as $module => $reldir)
{
if (!empty($module) && empty($conf->$module->enabled)) continue;
if (!empty($module))
{ {
$tpl = dol_buildpath($reldir.'/objectline_view.tpl.php'); $tpl = dol_buildpath($reldir.'/objectline_view.tpl.php');
}
else
{
$tpl = DOL_DOCUMENT_ROOT.$reldir.'/objectline_view.tpl.php';
}
if (empty($conf->file->strict_mode)) { if (empty($conf->file->strict_mode)) {
$res=@include $tpl; $res=@include $tpl;
} else { } else {
$res=include $tpl; // for debug $res=include $tpl; // for debug
} }
if ($res) break; if ($res > 0) break;
} }
} }
@ -3991,15 +4009,24 @@ abstract class CommonObject
// Output template part (modules that overwrite templates must declare this into descriptor) // Output template part (modules that overwrite templates must declare this into descriptor)
// Use global variables + $dateSelector + $seller and $buyer // Use global variables + $dateSelector + $seller and $buyer
$dirtpls=array_merge($conf->modules_parts['tpl'], array('/core/tpl')); $dirtpls=array_merge($conf->modules_parts['tpl'], array('/core/tpl'));
foreach($dirtpls as $reldir) foreach($dirtpls as $module => $reldir)
{
if (!empty($module) && empty($conf->$module->enabled)) continue;
if (!empty($module))
{ {
$tpl = dol_buildpath($reldir.'/objectline_edit.tpl.php'); $tpl = dol_buildpath($reldir.'/objectline_edit.tpl.php');
}
else
{
$tpl = DOL_DOCUMENT_ROOT.$reldir.'/objectline_edit.tpl.php';
}
if (empty($conf->file->strict_mode)) { if (empty($conf->file->strict_mode)) {
$res=@include $tpl; $res=@include $tpl;
} else { } else {
$res=include $tpl; // for debug $res=include $tpl; // for debug
} }
if ($res) break; if ($res > 0) break;
} }
} }
} }
@ -4187,15 +4214,24 @@ abstract class CommonObject
// Output template part (modules that overwrite templates must declare this into descriptor) // Output template part (modules that overwrite templates must declare this into descriptor)
// Use global variables + $dateSelector + $seller and $buyer // Use global variables + $dateSelector + $seller and $buyer
$dirtpls=array_merge($conf->modules_parts['tpl'], array('/core/tpl')); $dirtpls=array_merge($conf->modules_parts['tpl'], array('/core/tpl'));
foreach($dirtpls as $reldir) foreach($dirtpls as $module => $reldir)
{
if (!empty($module) && empty($conf->$module->enabled)) continue;
if (!empty($module))
{ {
$tpl = dol_buildpath($reldir.'/originproductline.tpl.php'); $tpl = dol_buildpath($reldir.'/originproductline.tpl.php');
}
else
{
$tpl = DOL_DOCUMENT_ROOT.$reldir.'/originproductline.tpl.php';
}
if (empty($conf->file->strict_mode)) { if (empty($conf->file->strict_mode)) {
$res=@include $tpl; $res=@include $tpl;
} else { } else {
$res=include $tpl; // for debug $res=include $tpl; // for debug
} }
if ($res) break; if ($res > 0) break;
} }
} }