diff --git a/app/Controllers/EmployeeRestController.php b/app/Controllers/EmployeeRestController.php index f307a351..4fc7d1c4 100755 --- a/app/Controllers/EmployeeRestController.php +++ b/app/Controllers/EmployeeRestController.php @@ -3902,7 +3902,9 @@ class EmployeeRestController extends AdminController $filePath = $uploadPath . $record[0]['file_name']; if (!file_exists($filePath)) { - return $this->failNotFound("File not found on server"); + // return $this->failNotFound("File not found on server"); + $data['message'] = 'The Physical File Not Found'; + return view('errors/404', $data); } // Force file download diff --git a/app/Controllers/PolicyTransactionController.php b/app/Controllers/PolicyTransactionController.php index f7e75acf..cada5a8f 100644 --- a/app/Controllers/PolicyTransactionController.php +++ b/app/Controllers/PolicyTransactionController.php @@ -248,12 +248,14 @@ class PolicyTransactionController extends BaseController // policy Transaction Create function start public function createInceptionPolicy() - { - // print_r($this->request->getPost()); die; + { + $post_data = $this->request->getPost() ?? []; + $this->myLogger->logme('error', 'Policy Trancaction form data : '. json_encode($post_data)); + $id = $this->request->getPost('id'); $data = $this->preparePolicyData(); $data['cd_ac_pk'] = $this->request->getPost('cd_ac_no'); - // print_r($this->request->getPost()); die; + $this->myLogger->logme('error', 'Policy Trancaction modified form data ( insert data ) : '. json_encode($data)); if (!$id) { diff --git a/app/Controllers/TicketServiceController.php b/app/Controllers/TicketServiceController.php index 3bf4f628..16c92d55 100644 --- a/app/Controllers/TicketServiceController.php +++ b/app/Controllers/TicketServiceController.php @@ -976,11 +976,12 @@ class TicketServiceController extends BaseController $columns_to_check = $excel_data_and_headers['claim_dump_excel_columns']; // dd($columns_to_check); - $client_data = $this->clientModel->where('is_active', 1)->where('client_type', 1)->findAll(); - $insurer_data = $this->insurerModel->where('is_active', 1)->findAll(); - $tpa_data = $this->TPAModel->where('is_active', 1)->findAll(); - $claim_status_data = $this->ticketClaimStatusModel->select('id, claim_status')->where('is_active', 1)->orderBy('id', 'asc')->groupBy('claim_status')->findAll(); - + //if upload the unwanted file upload handle + if(count($columns_to_check) == 0){ + $message = "Wrong file was uploaded"; + $this->claimDumpFileModel->where('id', $file_id)->set(['status' => 'failed', 'reason' => json_encode(['error_summary' => array_count_values([5]), 'error_data' => $message])])->update(); + return array('error_summary' => [5], 'error_data' => $message); + } //Store the error data by this structure $result = ['error_type' => 1, 'error_summary' => [], 'error_data' => []]; @@ -988,6 +989,7 @@ class TicketServiceController extends BaseController //excel data is empty than through the error if(count($excel_data ?? []) <= 1){ $message = "Uploaded file is empty"; + $this->claimDumpFileModel->where('id', $file_id)->set(['status' => 'failed', 'reason' => json_encode(['error_summary' => array_count_values([5]), 'error_data' => $message])])->update(); return array('error_summary' => [5], 'error_data' => $message); } @@ -1007,6 +1009,11 @@ class TicketServiceController extends BaseController return array('error_summary' => [6], 'error_data' => $message); } + $client_data = $this->clientModel->where('is_active', 1)->where('client_type', 1)->findAll(); + $insurer_data = $this->insurerModel->where('is_active', 1)->findAll(); + $tpa_data = $this->TPAModel->where('is_active', 1)->findAll(); + $claim_status_data = $this->ticketClaimStatusModel->select('id, claim_status')->where('is_active', 1)->orderBy('id', 'asc')->groupBy('claim_status')->findAll(); + //remove header unset($excel_data[0]); @@ -1213,9 +1220,15 @@ class TicketServiceController extends BaseController //seperate the Account Manager Name and Mobile No if (!empty($excel_acm_data)) { + $excel_acm_data = str_replace(['–', '—'], '-', $excel_acm_data); $parts = array_map('trim', explode('-', $excel_acm_data, 2)); $acm_name = $parts[0] ?? null; $acm_mobile = $parts[1] ?? null; + + // ensure mobile number is digits only + if ($acm_mobile !== null) { + $acm_mobile = preg_replace('/\D/', '', $acm_mobile); + } } // dd($acm_name, $acm_mobile); @@ -1648,13 +1661,13 @@ class TicketServiceController extends BaseController 'claim_status_id' => $claim_status_id ?? null, 'acm_id' => $acm_data['id'] ?? null, 'insurer_id' => $db_data['insurer_id'] ?? null, - 'tpa_id' => $excel_tpa_id_data ?? $db_data['tpa_id'] ?? null, + 'tpa_id' => $db_data['tpa_id'] ?? null, 'client_id' => $db_data['client_id'] ?? null, 'emp_id' => $db_data['emp_id'] ?? null, 'client_policy_id' => $db_data['client_policy_id'] ?? null, 'policy_no' => $db_data['policy_no'] ?? null, 'emp_code' => $db_data['emp_code'] ?? null, - 'tpa_no' => $db_data['tpa_no'] ?? null, + 'tpa_no' => $excel_tpa_id_data ?? $db_data['tpa_no'] ?? null, 'emp_name' => $db_data['emp_name'] ?? null, 'relationship' => $excel_relationship_data ?? null, 'emp_mobile' => $excel_emp_mobile_data ?? $db_data['emp_mobile'] ?? null, diff --git a/app/Views/policy_transaction_inception_form.php b/app/Views/policy_transaction_inception_form.php index 12478554..9e095f2e 100644 --- a/app/Views/policy_transaction_inception_form.php +++ b/app/Views/policy_transaction_inception_form.php @@ -3975,14 +3975,6 @@ $('#policy_no').change(function(){ toastr.warning(res.message,'WARNING'); $('#policy_no').val(""); return; - } - - if(res.status == true){ - $('#ct_type').val(1); - $('#client_policy_id').val(res.data.id); - $('#policy_start_date').val(res.data.policy_start_date); - $('#policy_end_date').val(res.data.policy_end_date); - $('#tpa').val(res.data.tpa_branch_id+'-'+res.data.tpa_id).select2(); }else{ $('#ct_type').val(2); $('#client_policy_id').val(''); @@ -3991,6 +3983,14 @@ $('#policy_no').change(function(){ $('#tpa').val('').select2(); console.log(res.message, 'warning'); } + + // if(res.status == true){ + // $('#ct_type').val(1); + // $('#client_policy_id').val(res.data.id); + // $('#policy_start_date').val(res.data.policy_start_date); + // $('#policy_end_date').val(res.data.policy_end_date); + // $('#tpa').val(res.data.tpa_branch_id+'-'+res.data.tpa_id).select2(); + // } }, error: function (xhr, status, error) { console.error(xhr.responseText); @@ -3999,12 +3999,12 @@ $('#policy_no').change(function(){ }); }else{ - $('#ct_type').val(2) + $('#ct_type').val(2); $('#client_policy_id').val(); $('#policy_start_date').val(); $('#policy_end_date').val(); $('#tpa').val('').select2(); - console.log("Could not get policy data") + console.log("This is new policy Could not get policy data") } });