MERGE_LIVE_NONEB_POLICY_TYPE_VALIDATION
This commit is contained in:
commit
9840f29fa5
@ -517,7 +517,7 @@ class LeadsController extends BaseController
|
|||||||
'regex_match' => 'Date of Loss must be inValid format.'],
|
'regex_match' => 'Date of Loss must be inValid format.'],
|
||||||
];
|
];
|
||||||
$rules['first_cause_of_loss.*'] = [
|
$rules['first_cause_of_loss.*'] = [
|
||||||
'rules' => 'required|regex_match[/^[a-zA-Z0-9\s_-]+$/]',
|
'rules' => 'required|regex_match[/^[a-zA-Z0-9 _-]+$/]',
|
||||||
'errors' => [
|
'errors' => [
|
||||||
'required' => 'Cause of Loss is required.',
|
'required' => 'Cause of Loss is required.',
|
||||||
'regex_match' => 'Cause of Loss only letters, numbers, space, hyphens and underscores are allowed',
|
'regex_match' => 'Cause of Loss only letters, numbers, space, hyphens and underscores are allowed',
|
||||||
@ -6802,16 +6802,16 @@ class LeadsController extends BaseController
|
|||||||
|
|
||||||
public function handleMemberDataGPATotalSumInsurerFromExcel($params)
|
public function handleMemberDataGPATotalSumInsurerFromExcel($params)
|
||||||
{
|
{
|
||||||
|
try {
|
||||||
$lead_id = $params['lead_id'];
|
$lead_id = $params['lead_id'];
|
||||||
$lead_data = $this->leadsModel->find((int) $lead_id);
|
$lead_data = $this->leadsModel->find((int) $lead_id);
|
||||||
// dd($lead_data);
|
|
||||||
$file_name_with_path = WRITEPATH . "/uploads/lead_files/" . $lead_data['file_name'];
|
|
||||||
// dd($file_name_with_path);
|
|
||||||
|
|
||||||
if (! $lead_data) {
|
if (! $lead_data) {
|
||||||
return ['status' => 'failed', 'message' => 'Opportunity data not found'];
|
return ['status' => 'failed', 'message' => 'Opportunity data not found'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$file_name_with_path = WRITEPATH . "/uploads/lead_files/" . $lead_data['file_name'];
|
||||||
|
|
||||||
if ($lead_data['file_name']) {
|
if ($lead_data['file_name']) {
|
||||||
|
|
||||||
//check physical file
|
//check physical file
|
||||||
@ -6827,13 +6827,17 @@ class LeadsController extends BaseController
|
|||||||
//get members data
|
//get members data
|
||||||
$members_sheet = $spreadsheet->getSheet(0);
|
$members_sheet = $spreadsheet->getSheet(0);
|
||||||
$highestRowAndColumn = $members_sheet->getHighestRowAndColumn();
|
$highestRowAndColumn = $members_sheet->getHighestRowAndColumn();
|
||||||
// dd($highestRowAndColumn);
|
|
||||||
|
|
||||||
$uncleaned_members = $members_sheet->rangeToArray('A1:' . $highestRowAndColumn['column'] . $highestRowAndColumn['row']);
|
// Read raw values and skip formula evaluation to avoid Calculation exceptions from malformed formulas.
|
||||||
// dd($uncleaned_members);
|
$uncleaned_members = $members_sheet->rangeToArray(
|
||||||
|
'A1:' . $highestRowAndColumn['column'] . $highestRowAndColumn['row'],
|
||||||
|
null,
|
||||||
|
false,
|
||||||
|
true,
|
||||||
|
false
|
||||||
|
);
|
||||||
|
|
||||||
$members = ExcelSanitizeHelper::sanitizeArrayData($uncleaned_members);
|
$members = ExcelSanitizeHelper::sanitizeArrayData($uncleaned_members);
|
||||||
// dd($members);
|
|
||||||
|
|
||||||
// Check column headings
|
// Check column headings
|
||||||
$members_heading = $members[0];
|
$members_heading = $members[0];
|
||||||
@ -6842,7 +6846,6 @@ class LeadsController extends BaseController
|
|||||||
$lower_headers = array_map('strtolower', $members_heading);
|
$lower_headers = array_map('strtolower', $members_heading);
|
||||||
foreach ($lower_headers as $index => $header) {
|
foreach ($lower_headers as $index => $header) {
|
||||||
if (preg_match('/^(sa\s*-\s*option|proposed\s+sum\s+insured)\s+\d+$/i', $header)) {
|
if (preg_match('/^(sa\s*-\s*option|proposed\s+sum\s+insured)\s+\d+$/i', $header)) {
|
||||||
$column_name = $members_heading[$index];
|
|
||||||
$sum = 0;
|
$sum = 0;
|
||||||
|
|
||||||
for ($i = 1; $i < count($members); $i++) {
|
for ($i = 1; $i < count($members); $i++) {
|
||||||
@ -6858,11 +6861,20 @@ class LeadsController extends BaseController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// dd($available_col);
|
|
||||||
return $available_col;
|
return $available_col;
|
||||||
}
|
}
|
||||||
|
|
||||||
return [];
|
return [];
|
||||||
|
} catch (\Throwable $e) {
|
||||||
|
log_message('error', 'Exception in handleMemberDataGPATotalSumInsurerFromExcel: {message}', [
|
||||||
|
'message' => $e->getMessage(),
|
||||||
|
]);
|
||||||
|
log_message('error', 'Trace: {trace}', [
|
||||||
|
'trace' => $e->getTraceAsString(),
|
||||||
|
]);
|
||||||
|
|
||||||
|
return [];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function generateDemographyDataTable($param = [])
|
public function generateDemographyDataTable($param = [])
|
||||||
|
|||||||
@ -845,6 +845,7 @@ class MediAssistApiController extends BaseController
|
|||||||
tm.id,
|
tm.id,
|
||||||
tm.tpa_no as memberId,
|
tm.tpa_no as memberId,
|
||||||
tm.tpa_claim_push_reference_no as claimRefNo,
|
tm.tpa_claim_push_reference_no as claimRefNo,
|
||||||
|
tm.doa,
|
||||||
cp.policy_no as policyNo,
|
cp.policy_no as policyNo,
|
||||||
cp.policy_start_date as startDate,
|
cp.policy_start_date as startDate,
|
||||||
cp.policy_end_date as endDate,
|
cp.policy_end_date as endDate,
|
||||||
|
|||||||
@ -465,6 +465,7 @@ class VidalApiController extends BaseController
|
|||||||
tm.tpa_no as memberId,
|
tm.tpa_no as memberId,
|
||||||
tm.tpa_claim_push_reference_no as claimRefNo,
|
tm.tpa_claim_push_reference_no as claimRefNo,
|
||||||
tm.tpa_claim_id as claimID,
|
tm.tpa_claim_id as claimID,
|
||||||
|
tm.doa,
|
||||||
cp.policy_no as policyNo,
|
cp.policy_no as policyNo,
|
||||||
cp.policy_start_date as startDate,
|
cp.policy_start_date as startDate,
|
||||||
cp.policy_end_date as endDate,
|
cp.policy_end_date as endDate,
|
||||||
|
|||||||
@ -74,6 +74,43 @@ Old function copied as `uploadRequiredDoc_v1` (preserved for reference).
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
||||||
|
## LeadsController — Bug Fix: `createClientWithLeadData` for Non-EB Leads
|
||||||
|
|
||||||
|
### 6. Fix: `prepareClientPolicyData` crashes on Non-EB leads
|
||||||
|
|
||||||
|
**Problem:** `proposel_data` is always `null` for Non-EB leads. The function unconditionally did:
|
||||||
|
```php
|
||||||
|
$proposel_data = json_decode($data['proposel_data'], true);
|
||||||
|
list($insurer_branch_id, $insurer_id) = explode('-', $proposel_data['insurer'], 2);
|
||||||
|
```
|
||||||
|
This throws a PHP 8 TypeError (cannot access key on null) for any Non-EB lead, making `createClientWithLeadData` silently fail.
|
||||||
|
|
||||||
|
**Fix:** Split insurer resolution by `lead_form_type`:
|
||||||
|
- **EB (`lead_form_type == 1`):** parse insurer from `proposel_data['insurer']` as `"{insurer_branch_id}-{insurer_id}"` — unchanged
|
||||||
|
- **Non-EB:** read `insurer_id` and `insurer_branch_id` directly from lead row columns
|
||||||
|
|
||||||
|
### 7. Fix: `getPlacementJson` null-safety for Non-EB leads
|
||||||
|
|
||||||
|
**Problem:** Same null `proposel_data` issue — `json_decode($data['proposel_data'], true)` returned null, and downstream `$proposel_data['proposel_name']` access would crash if a Non-EB lead had QCR data.
|
||||||
|
|
||||||
|
**Fix:** `json_decode($data['proposel_data'] ?? '', true) ?? []` — `proposel_data` is now always an array, so all `??` key accesses are safe.
|
||||||
|
|
||||||
|
### Smoke Test Results
|
||||||
|
|
||||||
|
| Path | Step | Result |
|
||||||
|
|---|---|---|
|
||||||
|
| EB | `proposel_data` decode | ✅ decodes normally |
|
||||||
|
| EB | `explode('-', proposel_data['insurer'])` | ✅ `insurer_branch_id` + `insurer_id` parsed correctly |
|
||||||
|
| EB | `preparePolicyTermsFromRFQ` | ✅ unaffected |
|
||||||
|
| Non-EB | `proposel_data` null → `[]` | ✅ safe |
|
||||||
|
| Non-EB | insurer from lead row columns | ✅ `insurer_id` + `insurer_branch_id` read directly |
|
||||||
|
| Non-EB | `getPlacementJson` — no QCR data | ✅ returns null safely, policy terms skipped |
|
||||||
|
| Non-EB | `getPlacementJson` — QCR data exists | ⚠️ line 4356: `$proposel_data['proposel_name']` missing `??` — pending clarification on whether Non-EB leads can have QCR data |
|
||||||
|
|
||||||
|
### Files Changed
|
||||||
|
- `app/Controllers/LeadsController.php`
|
||||||
|
|
||||||
## Task Plan — Policy Transaction Inception Form JS Validation
|
## Task Plan — Policy Transaction Inception Form JS Validation
|
||||||
|
|
||||||
### Goal
|
### Goal
|
||||||
@ -145,3 +182,4 @@ Implement client-side form validation for `app/Views/policy_transaction_inceptio
|
|||||||
- Preserved existing AJAX submit and payload/date conversion behavior
|
- Preserved existing AJAX submit and payload/date conversion behavior
|
||||||
- Technical validation done:
|
- Technical validation done:
|
||||||
- JS syntax check passed (`node --check public/assets/js/pages/policy_transaction_inception_validation.js`)
|
- JS syntax check passed (`node --check public/assets/js/pages/policy_transaction_inception_validation.js`)
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user