From 8c4fcfbf50914c1d38fbb58cfa5775d51991f3e7 Mon Sep 17 00:00:00 2001 From: velz Date: Wed, 9 Jul 2025 17:38:42 +0530 Subject: [PATCH] FIX_CLAIMAPI_FOR_HR --- app/Controllers/EmployeeRestController.php | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/app/Controllers/EmployeeRestController.php b/app/Controllers/EmployeeRestController.php index 23ea2fcf..1efbc94e 100755 --- a/app/Controllers/EmployeeRestController.php +++ b/app/Controllers/EmployeeRestController.php @@ -2595,6 +2595,25 @@ class EmployeeRestController extends AdminController $data['claims_data'] = $this->ticketMaster->getTicketDataByTicketID($ticket_id); $data['ticket_data'] = $ticketController->getMoreInfo($requestFrom = 'rest', $ticket_id); + + // $data = $response['data']; // Assuming your full array is stored in $response + // $ticketData = $data['ticket_data']; + // $ticketHistory = $data['ticket_history']; + + // Loop through ticket_data + foreach ($data['ticket_data'] as $status => &$fields) { + // Search ticket_history for matching old_status_value + foreach ($data['ticket_history'] as $history) { + if ($history['old_status_value'] === $status) { + // Attach modified_by and created_at + $fields['modified_by'] = $history['modified_by']; + $fields['modified_at'] = date('d-m-Y h:i A', strtotime($history['created_at'])); + // Break after first match (assuming latest entry is enough) + break; + } + } + } + return $this->respond(['status' => (count($data) ? 'success' : 'failed'),'code' => (count($data) ? 200 : 404),'data' => $data ], 200);