NEW Add tpl loader for discounts.tpl.php (#34798)

* Add tpl loader for discounts.tpl.php

* Update card.php
This commit is contained in:
Sébastien NASSIET 2025-07-31 22:28:45 +02:00 committed by GitHub
parent d929240ed0
commit 73d7f755c1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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 '</td></tr>';
}
@ -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 '</td></tr>';
// Date invoice