From 983255baa45e6e8fa73a2488d0ea9ed50a3e7f0c Mon Sep 17 00:00:00 2001 From: "venkatesh.r" Date: Thu, 4 Dec 2025 15:55:19 +0530 Subject: [PATCH] CHANGE_ADD_ACM_ID_FTO_SERVICE_PERSON_ID --- app/Controllers/EmpDataServiceController.php | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/app/Controllers/EmpDataServiceController.php b/app/Controllers/EmpDataServiceController.php index f4787b33..c5581519 100755 --- a/app/Controllers/EmpDataServiceController.php +++ b/app/Controllers/EmpDataServiceController.php @@ -5282,8 +5282,17 @@ class EmpDataServiceController extends BaseController $action_type_string = "addition"; } - $user_data = db_connect()->table('user_profiles')->where('is_active', 1)->where('id', $lead_data['created_by'] ?? null)->get()->getRowArray(); + // get the acm data for service person id + $acm_data = db_connect()->table('client_rm')->where('is_active', 1)->where('client_id', $policy_data['client_id'] ?? null)->where('level', 3) ->get() ->getRowArray(); + $service_person_id = null; + if(!empty($acm_data)){ + $service_person_id = $acm_data['user_id'] ?? null; + }else{ + $service_person_id = $params['created_by'] ?? null; + } + // get the user data for salse person id + $user_data = db_connect()->table('user_profiles')->where('is_active', 1)->where('id', $lead_data['created_by'] ?? null)->get()->getRowArray(); $salse_person_id = null; if(isset($lead_data['salse_person_id']) && !empty($lead_data['salse_person_id'])){ $salse_person_array = json_decode($lead_data['salse_person_id'] ?? '{}', true) ?? []; @@ -5337,7 +5346,7 @@ class EmpDataServiceController extends BaseController 'entry_from' => 2, 'sales_generated_by' => $salse_person_id, - 'serviced_by' => $params['created_by'] ?? null, + 'serviced_by' => $service_person_id, ]; $this->myLogger->logme("error", "Constructed policy transaction data: " . json_encode($policyTransactionData));