FIX_SALSE_AND_SERVICE_IDS

This commit is contained in:
VENKATESHWARAN 2025-12-02 17:20:15 +05:30
parent e19abc0ebb
commit fefa62a999

View File

@ -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));