From 67bb072e0d8bb7b6b2ba1c85d89bbf1fa1e4b10e Mon Sep 17 00:00:00 2001 From: "sas.fajri" Date: Thu, 11 Jun 2026 09:46:36 +0700 Subject: [PATCH] FHM09062601IBL - simpan T_ScreeningAnswerValue sebagai JSON object bukan string Co-Authored-By: Claude Sonnet 4.6 --- application/controllers/klinik/screening/Screening.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/application/controllers/klinik/screening/Screening.php b/application/controllers/klinik/screening/Screening.php index 35b6661a..eeabe9cd 100644 --- a/application/controllers/klinik/screening/Screening.php +++ b/application/controllers/klinik/screening/Screening.php @@ -530,8 +530,13 @@ class Screening extends MY_Controller $form_id = intval($item['M_ScreeningFormID'] ?? 0); if (!$form_id) continue; - // Simpan label sebagai JSON string agar json_decode di search() bekerja - $stored_value = json_encode($item['answer_label'] ?? ''); + // Simpan sebagai JSON object + $answer_type = $item['answer_type'] ?? 'single'; + if ($answer_type === 'text') { + $stored_value = json_encode(['value' => $item['answer_label'] ?? '']); + } else { + $stored_value = json_encode(['id' => $item['answer_id'] ?? '', 'label' => $item['answer_label'] ?? '']); + } $this->db_oneklinik->query( "INSERT INTO one_klinik.t_screening_answer