diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index d1cee09dbcc..9320daefd0a 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -2352,7 +2352,13 @@ abstract class CommonObject global $linkedObjectBlock; $linkedObjectBlock = $objects; - dol_include_once('/'.$tplpath.'/tpl/linkedobjectblock.tpl.php'); + // Output template part (modules that overwrite templates must declare this into descriptor) + $dirtpls=array_merge($conf->modules_parts['tpl'],array('/'.$tplpath.'/tpl')); + foreach($dirtpls as $reldir) + { + $res=@include(dol_buildpath($reldir.'/linkedobjectblock.tpl.php')); + if ($res) break; + } } return $num; @@ -2378,14 +2384,13 @@ abstract class CommonObject global $conf,$langs,$object; global $form,$bcnd,$var; + // Output template part (modules that overwrite templates must declare this into descriptor) // Use global variables + $dateSelector + $seller and $buyer - if (file_exists(DOL_DOCUMENT_ROOT."/theme/".$conf->theme."/tpl/predefinedproductline_create.tpl.php")) + $dirtpls=array_merge($conf->modules_parts['tpl'],array('/core/tpl')); + foreach($dirtpls as $reldir) { - include(DOL_DOCUMENT_ROOT."/theme/".$conf->theme."/tpl/predefinedproductline_create.tpl.php"); - } - else - { - include(DOL_DOCUMENT_ROOT.'/core/tpl/predefinedproductline_create.tpl.php'); + $res=@include(dol_buildpath($reldir.'/predefinedproductline_create.tpl.php')); + if ($res) break; } } @@ -2405,14 +2410,13 @@ abstract class CommonObject global $conf,$langs,$object; global $form,$bcnd,$var; + // Output template part (modules that overwrite templates must declare this into descriptor) // Use global variables + $dateSelector + $seller and $buyer - if (file_exists(DOL_DOCUMENT_ROOT."/theme/".$conf->theme."/tpl/freeproductline_create.tpl.php")) + $dirtpls=array_merge($conf->modules_parts['tpl'],array('/core/tpl')); + foreach($dirtpls as $reldir) { - include(DOL_DOCUMENT_ROOT."/theme/".$conf->theme."/tpl/freeproductline_create.tpl.php"); - } - else - { - include(DOL_DOCUMENT_ROOT.'/core/tpl/freeproductline_create.tpl.php'); + $res=@include(dol_buildpath($reldir.'/freeproductline_create.tpl.php')); + if ($res) break; } } @@ -2551,27 +2555,25 @@ abstract class CommonObject $text.= ' - '.$label; $description=($conf->global->PRODUIT_DESC_IN_FORM?'':dol_htmlentitiesbr($line->description)); - // Use global variables + $seller and $buyer - if (file_exists(DOL_DOCUMENT_ROOT."/theme/".$conf->theme."/tpl/predefinedproductline_view.tpl.php")) - { - include(DOL_DOCUMENT_ROOT."/theme/".$conf->theme."/tpl/predefinedproductline_view.tpl.php"); - } - else - { - include(DOL_DOCUMENT_ROOT.'/core/tpl/predefinedproductline_view.tpl.php'); - } + // Output template part (modules that overwrite templates must declare this into descriptor) + // Use global variables + $dateSelector + $seller and $buyer + $dirtpls=array_merge($conf->modules_parts['tpl'],array('/core/tpl')); + foreach($dirtpls as $reldir) + { + $res=@include(dol_buildpath($reldir.'/predefinedproductline_view.tpl.php')); + if ($res) break; + } } else { - // Use global variables + $dateSelector + $seller and $buyer - if (file_exists(DOL_DOCUMENT_ROOT."/theme/".$conf->theme."/tpl/freeproductline_view.tpl.php")) - { - include(DOL_DOCUMENT_ROOT."/theme/".$conf->theme."/tpl/freeproductline_view.tpl.php"); - } - else - { - include(DOL_DOCUMENT_ROOT.'/core/tpl/freeproductline_view.tpl.php'); - } + // Output template part (modules that overwrite templates must declare this into descriptor) + // Use global variables + $dateSelector + $seller and $buyer + $dirtpls=array_merge($conf->modules_parts['tpl'],array('/core/tpl')); + foreach($dirtpls as $reldir) + { + $res=@include(dol_buildpath($reldir.'/freeproductline_view.tpl.php')); + if ($res) break; + } } } @@ -2580,27 +2582,25 @@ abstract class CommonObject { if ($line->fk_product > 0) { - // Use global variables + $dateSelector + $seller and $buyer - if (file_exists(DOL_DOCUMENT_ROOT."/theme/".$conf->theme."/tpl/predefinedproductline_edit.tpl.php")) - { - include(DOL_DOCUMENT_ROOT."/theme/".$conf->theme."/tpl/predefinedproductline_edit.tpl.php"); - } - else - { - include(DOL_DOCUMENT_ROOT.'/core/tpl/predefinedproductline_edit.tpl.php'); - } + // Output template part (modules that overwrite templates must declare this into descriptor) + // Use global variables + $dateSelector + $seller and $buyer + $dirtpls=array_merge($conf->modules_parts['tpl'],array('/core/tpl')); + foreach($dirtpls as $reldir) + { + $res=@include(dol_buildpath($reldir.'/predefinedproductline_edit.tpl.php')); + if ($res) break; + } } else { - // Use global variables + $dateSelector + $seller and $buyer - if (file_exists(DOL_DOCUMENT_ROOT."/theme/".$conf->theme."/tpl/freeproductline_edit.tpl.php")) - { - include(DOL_DOCUMENT_ROOT."/theme/".$conf->theme."/tpl/freeproductline_edit.tpl.php"); - } - else - { - include(DOL_DOCUMENT_ROOT.'/core/tpl/freeproductline_edit.tpl.php'); - } + // Output template part (modules that overwrite templates must declare this into descriptor) + // Use global variables + $dateSelector + $seller and $buyer + $dirtpls=array_merge($conf->modules_parts['tpl'],array('/core/tpl')); + foreach($dirtpls as $reldir) + { + $res=@include(dol_buildpath($reldir.'/freeproductline_edit.tpl.php')); + if ($res) break; + } } } } @@ -2739,15 +2739,15 @@ abstract class CommonObject $this->tpl['price'] = price($line->subprice); $this->tpl['qty'] = (($line->info_bits & 2) != 2) ? $line->qty : ' '; $this->tpl['remise_percent'] = (($line->info_bits & 2) != 2) ? vatrate($line->remise_percent, true) : ' '; - - if (file_exists(DOL_DOCUMENT_ROOT."/theme/".$conf->theme."/tpl/originproductline.tpl.php")) - { - include(DOL_DOCUMENT_ROOT."/theme/".$conf->theme."/tpl/originproductline.tpl.php"); - } - else - { - include(DOL_DOCUMENT_ROOT.'/core/tpl/originproductline.tpl.php'); - } + + // Output template part (modules that overwrite templates must declare this into descriptor) + // Use global variables + $dateSelector + $seller and $buyer + $dirtpls=array_merge($conf->modules_parts['tpl'],array('/core/tpl')); + foreach($dirtpls as $reldir) + { + $res=@include(dol_buildpath($reldir.'/originproductline.tpl.php')); + if ($res) break; + } } }