Use fisik result fallback
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user