diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 23c1db25034..66addfb203b 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -4381,7 +4381,25 @@ if ($action == 'create') { $thirdparty = $soc; // used by object_discounts.tpl.php $discount_type = 0; // used by object_discounts.tpl.php $backtopage = $_SERVER["PHP_SELF"].'?socid='.$thirdparty->id.'&action='.$action.'&origin='.urlencode((string) (GETPOST('origin'))).'&originid='.urlencode((string) (GETPOSTINT('originid'))); - include DOL_DOCUMENT_ROOT.'/core/tpl/object_discounts.tpl.php'; + + // loading object_discounts.tpl.php from module core/tpl if exists + $dirtpls = array_merge($conf->modules_parts['tpl'], array($defaulttpldir)); + foreach ($dirtpls as $module => $reldir) { + $res = 0; + if (!empty($module)) { + $tpl = dol_buildpath($reldir.'/object_discounts.tpl.php'); + } else { + $tpl = DOL_DOCUMENT_ROOT.$reldir.'/object_discounts.tpl.php'; + } + if (file_exists($tpl)) { + if (empty($conf->file->strict_mode)) { + $res = @include $tpl; + } else { + $res = include $tpl; + } + } + if ($res) { break; } + } print ''; } @@ -5315,7 +5333,25 @@ if ($action == 'create') { $thirdparty = $soc; $discount_type = 0; $backtopage = $_SERVER["PHP_SELF"].'?facid='.$object->id; - include DOL_DOCUMENT_ROOT.'/core/tpl/object_discounts.tpl.php'; + // loading object_discounts.tpl.php from module core/tpl if exists + $dirtpls = array_merge($conf->modules_parts['tpl'], array($defaulttpldir)); + foreach ($dirtpls as $module => $reldir) { + $res = 0; + if (!empty($module)) { + $tpl = dol_buildpath($reldir.'/object_discounts.tpl.php'); + } else { + $tpl = DOL_DOCUMENT_ROOT.$reldir.'/object_discounts.tpl.php'; + } + if (file_exists($tpl)) { + if (empty($conf->file->strict_mode)) { + $res = @include $tpl; + } else { + $res = include $tpl; + } + } + if ($res) { break; } + } + print ''; // Date invoice