From 6314bafa29637c38a25f94abe81e58fa0f5895f0 Mon Sep 17 00:00:00 2001 From: DevSoftTech Server Date: Fri, 5 Jun 2026 16:04:01 +0530 Subject: [PATCH] Combine textarea notes and test list into single {{investigation}} placeholder Modified {{investigation}} to show both: 1. Textarea content (advise_investigation_notes) if present 2. Comma-separated test list from opd_prescription_investigation table Both sources combined with newline separator when both exist. {{Tadvise_test_list}} still available separately for backward compatibility. Example combined output: USG WHOLE ABDOMEN CECT ABDOMEN PAC COMPLETE CARDIAC CHECK UP PAP SMEAR CBC (Complete Blood Count), ECG (Electrocardiogram), HBA1C, HBSAG, HCV, HIV I & II (Elisa), Liver Function Test (LFT), PT/INR, Renal Function Test (RFT), Urine Routine & Microscopy, X-Ray Chest (PA View) --- app/Controllers/Opd.php | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/app/Controllers/Opd.php b/app/Controllers/Opd.php index 8949dbd..432044c 100644 --- a/app/Controllers/Opd.php +++ b/app/Controllers/Opd.php @@ -2804,7 +2804,7 @@ class Opd extends BaseController $rxInvestigation = $rxRead($rx, ['investigation', 'Investigations', 'investigations', 'Investigation']); - // Build test list from table (comma-separated, not bullet list) + // Build test list from table (comma-separated) $rxInvestigationTestList = ''; $testNames = []; @@ -2818,11 +2818,26 @@ class Opd extends BaseController } } - // Build comma-separated test list for {{Tadvise_test_list}} placeholder - // This is independent from {{investigation}} textarea content + // Build comma-separated test list if (!empty($testNames)) { $rxInvestigationTestList = implode(', ', $testNames); } + + // Combine textarea content and test list into {{investigation}} placeholder + $combinedInvestigation = []; + if ($rxInvestigation !== '' && $rxInvestigation !== 'null') { + $combinedInvestigation[] = $rxInvestigation; + } + if ($rxInvestigationTestList !== '') { + $combinedInvestigation[] = $rxInvestigationTestList; + } + + // Join with line break if both exist, otherwise use whichever is available + if (count($combinedInvestigation) > 1) { + $rxInvestigation = implode("\n", $combinedInvestigation); + } elseif (!empty($combinedInvestigation)) { + $rxInvestigation = $combinedInvestigation[0]; + } $rxAdvice = $rxRead($rx, ['advice', 'Advice', 'prescription_advice', 'advice_notes', 'advice_note']); $rxAdviceLocal = '';