From a1fbf50f3f35f87dd3772a8a0d28ecfb4fa9b756 Mon Sep 17 00:00:00 2001 From: DevSoftTech Server Date: Fri, 5 Jun 2026 15:59:16 +0530 Subject: [PATCH] Change {{Tadvise_test_list}} to comma-separated format (not bullet list) Changed placeholder behavior to match user requirements: - {{investigation}} = textarea content (advise_investigation_notes) only - {{Tadvise_test_list}} = comma-separated test names from table Removed HTML bullet list formatting. Now outputs plain comma-separated text. Example output: 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) Both placeholders are independent and can show content simultaneously. --- app/Controllers/Opd.php | 30 +++++------------------------- 1 file changed, 5 insertions(+), 25 deletions(-) diff --git a/app/Controllers/Opd.php b/app/Controllers/Opd.php index 5c8c08b..8949dbd 100644 --- a/app/Controllers/Opd.php +++ b/app/Controllers/Opd.php @@ -2804,11 +2804,11 @@ class Opd extends BaseController $rxInvestigation = $rxRead($rx, ['investigation', 'Investigations', 'investigations', 'Investigation']); - // Build test list independently from textarea content + // Build test list from table (comma-separated, not bullet list) $rxInvestigationTestList = ''; $testNames = []; - // First, try to get tests from rx_investigations table + // Get tests from rx_investigations table if (!empty($data['rx_investigations']) && is_array($data['rx_investigations'])) { foreach ($data['rx_investigations'] as $inv) { $txt = trim((string) ($inv['investigation_name'] ?? $inv['investigation'] ?? '')); @@ -2818,30 +2818,10 @@ class Opd extends BaseController } } - // If no tests from table but textarea has content, parse textarea as fallback - if (empty($testNames) && $rxInvestigation !== '') { - // Split by newlines or common delimiters - $lines = preg_split('/[\r\n]+/', $rxInvestigation); - foreach ($lines as $line) { - $line = trim($line); - if ($line !== '' && $line !== 'null') { - $testNames[] = $line; - } - } - } - - // If textarea is empty, populate it with comma-separated tests from table - if ($rxInvestigation === '' && !empty($testNames)) { - $rxInvestigation = implode(', ', $testNames); - } - - // Always build formatted HTML test list for {{Tadvise_test_list}} placeholder + // Build comma-separated test list for {{Tadvise_test_list}} placeholder + // This is independent from {{investigation}} textarea content if (!empty($testNames)) { - $rxInvestigationTestList = ''; + $rxInvestigationTestList = implode(', ', $testNames); } $rxAdvice = $rxRead($rx, ['advice', 'Advice', 'prescription_advice', 'advice_notes', 'advice_note']);