From 80593ba931b9d774c422f88a768dafe259012253 Mon Sep 17 00:00:00 2001 From: DevSoftTech Server Date: Tue, 18 Aug 2026 13:40:52 +0530 Subject: [PATCH] Preserve legacy discharge template headers --- app/Controllers/Ipd_discharge.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/app/Controllers/Ipd_discharge.php b/app/Controllers/Ipd_discharge.php index 7c512de..58e8cfc 100644 --- a/app/Controllers/Ipd_discharge.php +++ b/app/Controllers/Ipd_discharge.php @@ -1134,6 +1134,15 @@ class Ipd_discharge extends BaseController 'template_css' => (string) ($selectedTemplate['template_css'] ?? ''), ]); + if (trim((string) ($templateSettings['header_html'] ?? '')) === '' + && preg_match('/]*>([\s\S]*?)<\/htmlpageheader>/i', $templateHtml, $headerMatch) === 1) { + $templateSettings['header_html'] = trim((string) ($headerMatch[1] ?? '')); + } + if (trim((string) ($templateSettings['footer_html'] ?? '')) === '' + && preg_match('/]*>([\s\S]*?)<\/htmlpagefooter>/i', $templateHtml, $footerMatch) === 1) { + $templateSettings['footer_html'] = trim((string) ($footerMatch[1] ?? '')); + } + $templateCss = trim((string) $templateSettings['template_css']); if ($templateCss !== '') { $templateHtml = '' . $templateHtml;