From 407e9219bde41fa6ae67f55bbcd25bb9517dc99a Mon Sep 17 00:00:00 2001 From: "sas.fajri" Date: Fri, 24 Apr 2026 09:07:23 +0700 Subject: [PATCH] Use fisik result fallback --- .../mockup/resumeindividufacelift/Resume.php | 55 ++++++++++++++++--- 1 file changed, 47 insertions(+), 8 deletions(-) diff --git a/application/controllers/mockup/resumeindividufacelift/Resume.php b/application/controllers/mockup/resumeindividufacelift/Resume.php index be07acf2..4ca5f0c1 100644 --- a/application/controllers/mockup/resumeindividufacelift/Resume.php +++ b/application/controllers/mockup/resumeindividufacelift/Resume.php @@ -319,13 +319,52 @@ class Resume extends MY_Controller exit; } - $dataResults = count($query->result_array()) > 0 ? $query->result_array() : []; - - if (count($dataResults) > 0) { - foreach ($dataResults as $key => $result) { - $dataResults[$key]['dt_json'] = json_decode($result['dt_json'], true); - } - } + $dataResults = count($query->result_array()) > 0 ? $query->result_array() : []; + + $fisikResultRows = []; + if (count($dataResults) > 0) { + $hasFisikResult = false; + foreach ($dataResults as $result) { + if ($result['type'] === 'FISIK') { + $hasFisikResult = true; + break; + } + } + + if ($hasFisikResult) { + $sql = "SELECT + ResultFisikUmumLabel as label, + ResultFisikUmumValue as value + FROM result_fisik_umum + WHERE + ResultFisikUmumT_OrderHeaderID = ? AND + ResultFisikUmumIsActive = 'Y' + ORDER BY ResultFisikUmumID"; + $query = $this->db_onedev->query($sql, [$orderid]); + if (!$query) { + $message = $this->db_onedev->error(); + $message['qry'] = $this->db_onedev->last_query(); + $this->sys_error($message); + exit; + } + $fisikResultRows = $query->result_array(); + } + } + + if (count($dataResults) > 0) { + foreach ($dataResults as $key => $result) { + $decodedJson = json_decode($result['dt_json'], true); + if ( + $result['type'] === 'FISIK' && + (trim((string)$result['dt_json']) === '' || $decodedJson === null) + ) { + $dataResults[$key]['dt_json'] = $fisikResultRows; + } + else { + $dataResults[$key]['dt_json'] = $decodedJson; + } + } + } $sql = "SELECT Mcu_FitnessCategoryID as id, Mcu_FitnessCategoryName as name, @@ -2260,4 +2299,4 @@ class Resume extends MY_Controller $this->sys_error($message); } } -} \ No newline at end of file +}