Preserve repaired discharge HTML sections in mPDF

Serialize the full repaired body instead of only the temporary wrapper contents so DOMDocument recovery does not drop later discharge sections before mPDF rendering.
This commit is contained in:
DevSoftTech Server 2026-07-15 21:16:25 +05:30
parent 8270c8a049
commit 0e8e164335

View File

@ -7123,9 +7123,17 @@ class Ipd_discharge extends BaseController
}
}
$root = $dom->getElementById('__discharge_pdf_root__');
if ($root instanceof \DOMElement) {
foreach ($root->childNodes as $childNode) {
$bodyNode = $dom->getElementsByTagName('body')->item(0);
if ($bodyNode instanceof \DOMElement) {
foreach ($bodyNode->childNodes as $childNode) {
if ($childNode instanceof \DOMElement && $childNode->getAttribute('id') === '__discharge_pdf_root__') {
foreach ($childNode->childNodes as $wrappedChildNode) {
$normalized .= (string) $dom->saveHTML($wrappedChildNode);
}
continue;
}
$normalized .= (string) $dom->saveHTML($childNode);
}
}