From 6113112bc6828edffddbb075f62732782e34d037 Mon Sep 17 00:00:00 2001 From: "sanjeev.p" Date: Tue, 27 Jan 2026 18:06:50 +0530 Subject: [PATCH] FIX_MasterCTRL --- .../AppContentManagementController.php | 6 +- app/Controllers/BDSReportController.php | 18 ++-- app/Controllers/EmployeeController.php | 14 ++-- app/Controllers/MasterController.php | 84 ++++++++++--------- 4 files changed, 62 insertions(+), 60 deletions(-) diff --git a/app/Controllers/AppContentManagementController.php b/app/Controllers/AppContentManagementController.php index ac00f848..a7032a4c 100755 --- a/app/Controllers/AppContentManagementController.php +++ b/app/Controllers/AppContentManagementController.php @@ -62,7 +62,7 @@ class AppContentManagementController extends AdminController $data = $this->request->getPost(); $sanitized_post_data = sanitizeInputArrayAdvanced($data); - $id = (int) $sanitized_post_data['add_image_id']; + $id = ((int) $sanitized_post_data['add_image_id']) ?? null; $rules = [ 'client_id' => [ @@ -100,7 +100,7 @@ class AppContentManagementController extends AdminController $file = $this->request->getFile('advertise_image'); - $client_id = $sanitized_post_data['client_id']; + $client_id = $sanitized_post_data['client_id'] ?? null; //1) original file name for vaildations $fileName = $file->getClientName(); //original file name for vaildations $existing = $this->addImgModel->where('name', $fileName)->where('client_id', $fileName)->where('is_active', 1)->first(); @@ -120,7 +120,7 @@ class AppContentManagementController extends AdminController $file->move($uploadPath, $fileName); - $id = $sanitized_post_data['add_image_id']; + $id = $sanitized_post_data['add_image_id'] ?? null; $details = ['name' => $fileName,'client_id'=>$client_id]; if ($id == 0) { diff --git a/app/Controllers/BDSReportController.php b/app/Controllers/BDSReportController.php index c871254b..902da3e7 100644 --- a/app/Controllers/BDSReportController.php +++ b/app/Controllers/BDSReportController.php @@ -194,10 +194,10 @@ class BDSReportController extends AdminController $request_post_data = $this->request->getPost(); $sanitized_post_data = sanitizeInputArrayAdvanced($request_post_data); - $fromDate = $sanitized_post_data['fromDate']; - $toDate = $sanitized_post_data['toDate']; - $category = $sanitized_post_data['category']; - $report_type = $sanitized_post_data['report_type']; + $fromDate = $sanitized_post_data['fromDate'] ?? null; + $toDate = $sanitized_post_data['toDate'] ?? null; + $category = $sanitized_post_data['category'] ?? null; + $report_type = $sanitized_post_data['report_type'] ?? null; // log_message('error',json_encode($_POST));die(); if ($report_type == 'insurer') { $life = $category == 'life' ? 1 : 0; @@ -942,11 +942,11 @@ class BDSReportController extends AdminController $request_post_data = $this->request->getPost(); $sanitized_post_data = sanitizeInputArrayAdvanced($request_post_data); - $fromDate = $sanitized_post_data['fromDate']; - $toDate = $sanitized_post_data['toDate']; - $client_id = $sanitized_post_data['client_id']; - $client_type = $sanitized_post_data['client_type']; - $issuer_branch = $sanitized_post_data['issuer_branch']; + $fromDate = $sanitized_post_data['fromDate'] ?? null; + $toDate = $sanitized_post_data['toDate'] ?? null; + $client_id = $sanitized_post_data['client_id'] ?? null; + $client_type = $sanitized_post_data['client_type'] ?? null; + $issuer_branch = $sanitized_post_data['issuer_branch'] ?? null; $data['issuer_branch'] = $this->nhanceBranchModel->where('is_active', 1)->findAll(); $data['client_type'] = [1 => 'Group', 2 => 'Individual']; diff --git a/app/Controllers/EmployeeController.php b/app/Controllers/EmployeeController.php index 45650b81..b662d8b1 100755 --- a/app/Controllers/EmployeeController.php +++ b/app/Controllers/EmployeeController.php @@ -3066,12 +3066,12 @@ class EmployeeController extends AdminController $request_post_data = $this->request->getPost(); $sanitized_post_data = sanitizeInputArrayAdvanced($request_post_data); - $client_id = $sanitized_post_data['client_id']; - $branch_id = $sanitized_post_data['branch_id']; - $policy_id = $sanitized_post_data['client_policy_id']; - $selected_employees = (array)$sanitized_post_data['selected']; - $si_amt = $sanitized_post_data['si_amt']; - $policy_start_date_unformatted = $sanitized_post_data['policy_start_date']; + $client_id = $sanitized_post_data['client_id'] ?? null; + $branch_id = $sanitized_post_data['branch_id'] ?? null; + $policy_id = $sanitized_post_data['client_policy_id'] ?? null; + $selected_employees = (array)$sanitized_post_data['selected'] ?? []; + $si_amt = $sanitized_post_data['si_amt'] ?? null; + $policy_start_date_unformatted = $sanitized_post_data['policy_start_date'] ?? null; $policy_start_date = change_date_format($policy_start_date_unformatted, 'd/M/Y', 'Y-m-d'); @@ -3110,7 +3110,7 @@ class EmployeeController extends AdminController public function unmapEmployees($actionType){ $request_post_data = $this->request->getPost(); $sanitized_post_data = sanitizeInputArrayAdvanced($request_post_data); - $selected_employees = (array)$sanitized_post_data['selected']; + $selected_employees = (array)$sanitized_post_data['selected'] ?? []; if($actionType == 0){ for($i = 0;$iemployeeModel->set(['client_id' => null, 'client_branch_id' => null])->where('id',$selected_employees[$i])->update();log_message('error',$result1); diff --git a/app/Controllers/MasterController.php b/app/Controllers/MasterController.php index c5f27862..610d6de2 100755 --- a/app/Controllers/MasterController.php +++ b/app/Controllers/MasterController.php @@ -456,10 +456,10 @@ class MasterController extends AdminController 'contact_type' => 'insurer', 'ref_id' => $insert, 'created_by' => get_session_userid(), - 'name' => $sanitized_post_data['name'][$i], - 'email' => $sanitized_post_data['email'][$i], - 'mobile' => $sanitized_post_data['mobile'][$i], - 'designation' => $sanitized_post_data['designation'][$i] + 'name' => $sanitized_post_data['name'][$i] ?? null, + 'email' => $sanitized_post_data['email'][$i] ?? null, + 'mobile' => $sanitized_post_data['mobile'][$i] ?? null, + 'designation' => $sanitized_post_data['designation'][$i] ?? null ]; $contacts = $this->levelContactModel->insert($sanitized_post_data_for_level); } @@ -674,7 +674,7 @@ class MasterController extends AdminController } $data = $this->request->getPost(); $sanitized_post_data = sanitizeInputArrayAdvanced($data); - $id = $sanitized_post_data['PrimaryKey']; + $id = $sanitized_post_data['PrimaryKey'] ?? null; $update = $this->insurerBranchModel->update($id, $sanitized_post_data); if($update){ @@ -688,11 +688,11 @@ class MasterController extends AdminController 'contact_type' => 'insurer', 'ref_id' => $id, 'created_by' => get_session_userid(), - 'name' => $sanitized_post_data['name'][$i], - 'email' => $sanitized_post_data['email'][$i], - 'mobile' => $sanitized_post_data['mobile'][$i], - 'designation' => $sanitized_post_data['designation'][$i] - ]; + 'name' => $sanitized_post_data['name'][$i] ?? null, + 'email' => $sanitized_post_data['email'][$i] ?? null, + 'mobile' => $sanitized_post_data['mobile'][$i] ?? null, + 'designation' => $sanitized_post_data['designation'][$i] ?? null + ]; $contacts = $this->levelContactModel->insert($sanitized_post_data_for_level); } } @@ -927,12 +927,12 @@ class MasterController extends AdminController $sanitized_post_data['tpa_logo'] = $file_name; $sanitized_post_data['front_card'] = $front_card_file_name; $sanitized_post_data['back_card'] = $back_card_file_name; - $inssanitized_post_dataert_data['network_hospitals'] = $sanitized_post_data['network_hospitals']; + $sanitized_post_data['network_hospitals'] = $sanitized_post_data['network_hospitals']; $insert = $this->tpaModel->insert($sanitized_post_data); - $tpa_name = (string) $sanitized_post_data['name']; - $short_name = (string) $sanitized_post_data['short_name']; + $tpa_name = ((string) $sanitized_post_data['name']) ?? null; + $short_name = ((string) $sanitized_post_data['short_name']) ?? null; $filename = strtolower(str_replace(' ', '_', $short_name)) . '.html'; $file_directory = WRITEPATH . 'e_card_template/'; @@ -1081,10 +1081,10 @@ class MasterController extends AdminController 'contact_type' => 'tpa', 'ref_id' => $insert, 'created_by' => get_session_userid(), - 'name' => $sanitized_post_data['name'][$i], - 'email' => $sanitized_post_data['email'][$i], - 'mobile' => $sanitized_post_data['mobile'][$i], - 'designation' => $sanitized_post_data['designation'][$i] + 'name' => $sanitized_post_data['name'][$i] ?? null, + 'email' => $sanitized_post_data['email'][$i] ?? null, + 'mobile' => $sanitized_post_data['mobile'][$i] ?? null, + 'designation' => $sanitized_post_data['designation'][$i] ?? null ]; $contacts = $this->levelContactModel->insert($sanitized_post_data_for_level); } @@ -1210,7 +1210,7 @@ class MasterController extends AdminController $front_card_file_name = file_Upload($this->request->getFile('fc'), $template_bg_path); $back_card_file_name = file_Upload($this->request->getFile('bc'), $template_bg_path); - $id = $sanitized_post_data['PrimaryKey']; + $id = $sanitized_post_data['PrimaryKey'] ?? null; $sanitized_post_data['updated_by'] = get_session_userid(); @@ -1226,13 +1226,13 @@ class MasterController extends AdminController $sanitized_post_data['back_card'] = $back_card_file_name; } - $sanitized_post_data['network_hospitals'] = $sanitized_post_data['network_hospitals']; + $sanitized_post_data['network_hospitals'] = $sanitized_post_data['network_hospitals'] ?? null; $update = $this->tpaModel->update($id,$sanitized_post_data); - $tpa_name = (string) $sanitized_post_data['name']; - $short_name = (string) $sanitized_post_data['short_name']; - $eCardTemplate = $sanitized_post_data['ecard_content']; + $tpa_name = ((string) $sanitized_post_data['name']) ?? null; + $short_name = ((string) $sanitized_post_data['short_name']) ?? null; + $eCardTemplate = $sanitized_post_data['ecard_content'] ?? null; $filename = strtolower(str_replace(' ', '_', $short_name)) . '.html'; $file_directory = WRITEPATH . 'e_card_template/'; @@ -1384,7 +1384,7 @@ class MasterController extends AdminController } $data = $this->request->getPost(); $sanitized_post_data = sanitizeInputArrayAdvanced($data); - $id = $sanitized_post_data['PrimaryKey']; + $id = $sanitized_post_data['PrimaryKey'] ?? null; $update = $this->tpaBranchModel->update($id, $sanitized_post_data); // print_r($this->request->getPost('name[]')); @@ -1403,10 +1403,10 @@ class MasterController extends AdminController 'contact_type' => 'tpa', 'ref_id' => $id, 'created_by' => get_session_userid(), - 'name' => $sanitized_post_data['name'][$i], - 'email' => $sanitized_post_data['email'][$i], - 'mobile' => $sanitized_post_data['mobile'][$i], - 'designation' => $sanitized_post_data['designation'][$i] + 'name' => $sanitized_post_data['name'][$i] ?? null, + 'email' => $sanitized_post_data['email'][$i] ?? null, + 'mobile' => $sanitized_post_data['mobile'][$i] ?? null, + 'designation' => $sanitized_post_data['designation'][$i] ?? null ]; $contacts = $this->levelContactModel->insert($sanitized_post_data_for_level); } @@ -1645,7 +1645,7 @@ class MasterController extends AdminController $data = $this->request->getPost(); $sanitized_post_data = sanitizeInputArrayAdvanced($data); - $id = $sanitized_post_data['PrimaryKey']; + $id = $sanitized_post_data['PrimaryKey'] ?? null; $sanitized_post_data['updated_by'] = get_session_userid(); $update = $this->kycEntityTypeModel->update($id,$sanitized_post_data); if($update){ @@ -1996,7 +1996,7 @@ class MasterController extends AdminController $data = $this->request->getPost(); $sanitized_post_data = sanitizeInputArrayAdvanced($data); - $id = $sanitized_post_data['PrimaryKey']; + $id = $sanitized_post_data['PrimaryKey'] ?? null; $sanitized_post_data['updated_by'] = get_session_userid(); $update = $this->policyTypeModel->update($id,$sanitized_post_data); if($update){ @@ -2049,8 +2049,10 @@ class MasterController extends AdminController public function editPolicies() { $this->myLogger->logme('error','edit Policy general info function called'); - $id = $this->request->getPost('PrimaryKey'); - $data = $this->request->getPost(); + $request_post_data = $this->request->getPost(); + $data = sanitizeInputArrayAdvanced($request_post_data); + + $id = $data['PrimaryKey'] ?? null; $data['updated_by'] = get_session_userid(); $update = $this->policesModel->update($id,$data); if($update){ @@ -2260,13 +2262,13 @@ class MasterController extends AdminController if ($insert) { $cd_tranction_data = [ - 'amount' => $sanitized_post_data['opening_bal'], + 'amount' => $sanitized_post_data['opening_bal'] ?? null, 'sub_type_id' => 7, - 'client_id' => $sanitized_post_data['client_id'], + 'client_id' => $sanitized_post_data['client_id'] ?? null, 'client_policy_id' => null, - 'cd_ac_no' => $sanitized_post_data['cd_ac_no'], + 'cd_ac_no' => $sanitized_post_data['cd_ac_no'] ?? null, 'endorsement_no' => null, - 'insurer_id' => $sanitized_post_data['insurer_id'], + 'insurer_id' => $sanitized_post_data['insurer_id'] ?? null, 'description' => 'Opening Amount', 'transaction_type' => 'Credit', 'event_name' => null, @@ -2411,8 +2413,8 @@ class MasterController extends AdminController } $data = $this->request->getPost(); $sanitized_post_data = sanitizeInputArrayAdvanced($data); - $id = $sanitized_post_data['PrimaryKey']; - $date = (string) $sanitized_post_data['opening_date']; + $id = $sanitized_post_data['PrimaryKey'] ?? null; + $date = ((string) $sanitized_post_data['opening_date']) ?? null; $sanitized_post_data['opening_date'] = date('Y-m-d', strtotime($date)); if ($data) { @@ -2714,11 +2716,11 @@ class MasterController extends AdminController $fetch_data = [ - 'insurer_id' => $sanitized_post_data['insurer_id'], - 'policy_type_id' => $sanitized_post_data['policy_type'], - 'event_name' => $sanitized_post_data['event'], + 'insurer_id' => $sanitized_post_data['insurer_id'] ?? null , + 'policy_type_id' => $sanitized_post_data['policy_type'] ?? null, + 'event_name' => $sanitized_post_data['event'] ?? null, 'type_name' => 'export', - 'jsoncolumns' => $sanitized_post_data['json_data'], + 'jsoncolumns' => $sanitized_post_data['json_data'] ?? null, 'is_active' => 1, 'created_by' => get_session_userid(), ];