From 7e16ac92c2de2196c7aa7c4c4918a188fe3b8486 Mon Sep 17 00:00:00 2001 From: DevSoftTech Server Date: Mon, 6 Apr 2026 00:01:08 +0530 Subject: [PATCH] fix: dynamic ABHA column SELECT in createOpdPrescriptionWorkTask (unknown column abha_no) --- app/Controllers/Opd_prescription.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/Controllers/Opd_prescription.php b/app/Controllers/Opd_prescription.php index 1fa860d..3c4d771 100644 --- a/app/Controllers/Opd_prescription.php +++ b/app/Controllers/Opd_prescription.php @@ -7806,8 +7806,11 @@ OPD SNAPSHOT JSON: " . $payload; return; } + $pmFields = $this->db->getFieldNames('patient_master') ?? []; + $abhaCols = array_filter(['abha_id', 'abha_no', 'abha_address', 'abha'], fn ($c) => in_array($c, $pmFields, true)); + $abhaSelect = $abhaCols ? (', ' . implode(', ', $abhaCols)) : ''; $patient = $this->db->table('patient_master') - ->select('p_fname,abha_id,abha_no,abha_address,abha') + ->select('p_fname' . $abhaSelect) ->where('id', $patientId) ->get(1) ->getRowArray();