From fefa62a999802de13f5bed664183f0b53c8456c3 Mon Sep 17 00:00:00 2001 From: "venkatesh.r" Date: Tue, 2 Dec 2025 17:20:15 +0530 Subject: [PATCH] FIX_SALSE_AND_SERVICE_IDS --- app/Controllers/EmpDataServiceController.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/app/Controllers/EmpDataServiceController.php b/app/Controllers/EmpDataServiceController.php index e058330f..0ef42b4d 100755 --- a/app/Controllers/EmpDataServiceController.php +++ b/app/Controllers/EmpDataServiceController.php @@ -5282,9 +5282,20 @@ 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(); + + $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) ?? []; + $salse_person_id = $salse_person_array[0] ?? null; + }else{ + $salse_person_id = $lead_data['created_by'] ?? null; + } + $policyTransactionData = [ 'issuer' => 2, + 'issuer_branch' => $user_data['nhance_branch_id'] ?? 1, 'client_id' => $policy_data['client_id'] ?? null, 'client_branch_id' => $policy_data['client_branch_id'] ?? null, 'insurer_id' => $policy_data['insurer_id'] ?? null, @@ -5324,6 +5335,9 @@ class EmpDataServiceController extends BaseController 'installment' => $lead_data['no_of_installment'] ?? null, 'created_by' => $params['created_by'] ?? null, 'entry_from' => 2, + + 'sales_generated_by' => $salse_person_id, + 'serviced_by' => $params['created_by'] ?? null, ]; $this->myLogger->logme("error", "Constructed policy transaction data: " . json_encode($policyTransactionData));