FIX_VALIDATION_ISSUE
This commit is contained in:
parent
1b79f2404b
commit
289edeb219
@ -365,6 +365,7 @@ class LeadsController extends BaseController
|
|||||||
{
|
{
|
||||||
// print_r($this->request->getPost()); die;
|
// print_r($this->request->getPost()); die;
|
||||||
$id = $this->request->getPost('id');
|
$id = $this->request->getPost('id');
|
||||||
|
$postData = $this->request->getPost();
|
||||||
$data = $this->prepareLeadData();
|
$data = $this->prepareLeadData();
|
||||||
$rules = [
|
$rules = [
|
||||||
|
|
||||||
@ -449,6 +450,21 @@ class LeadsController extends BaseController
|
|||||||
]
|
]
|
||||||
];
|
];
|
||||||
|
|
||||||
|
foreach ($postData as $key => $value) {
|
||||||
|
// Check if the key starts with 'docs_name_'
|
||||||
|
if (strpos($key, 'docs_name_') === 0) {
|
||||||
|
$rules[$key . '.*'] = [
|
||||||
|
'label' => 'Document Name',
|
||||||
|
'rules' => 'permit_empty|regex_match[/^[a-zA-Z0-9_\- ]+$/]',
|
||||||
|
'errors' => [
|
||||||
|
'regex_match' => 'Document Name in {field} can only contain letters, numbers, hyphens, and underscores.'
|
||||||
|
]
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// print_r($rules); die;
|
||||||
|
|
||||||
if (isset($data['lead_form_type']) && (int)$data['lead_form_type'] === 2) {
|
if (isset($data['lead_form_type']) && (int)$data['lead_form_type'] === 2) {
|
||||||
$rules['client_type'] = [
|
$rules['client_type'] = [
|
||||||
'rules' => 'required',
|
'rules' => 'required',
|
||||||
@ -793,7 +809,7 @@ class LeadsController extends BaseController
|
|||||||
'source_policy_end_date' => $data['source_policy_end_date'] ?? null,
|
'source_policy_end_date' => $data['source_policy_end_date'] ?? null,
|
||||||
'claim_history' => $data['claim_history'] ?? 0,
|
'claim_history' => $data['claim_history'] ?? 0,
|
||||||
|
|
||||||
'next_reminder_date' => $data['next_reminder_date'] ?? 0,
|
'next_reminder_date' => $data['next_reminder_date'] ?? null,
|
||||||
'is_insurer_auto_mail' => $data['is_insurer_auto_mail'] ?? 0
|
'is_insurer_auto_mail' => $data['is_insurer_auto_mail'] ?? 0
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1216,37 +1216,51 @@ class TicketController extends BaseController
|
|||||||
'claim_type' => ['label' => 'Claim Type','rules' => 'required',
|
'claim_type' => ['label' => 'Claim Type','rules' => 'required',
|
||||||
'errors' => ['required' => 'Claim Type is required']
|
'errors' => ['required' => 'Claim Type is required']
|
||||||
],
|
],
|
||||||
'hospital_name' => ['label' => 'Hospital Name','rules' => 'required',
|
'hospital_name' => [
|
||||||
'errors' => ['required' => 'Hospital Name is required']
|
'label' => 'Hospital Name',
|
||||||
|
'rules' => 'required|regex_match[/^[a-zA-Z0-9\s\-_.\']+$/]',
|
||||||
|
'errors' => [
|
||||||
|
'required' => 'Hospital Name is required',
|
||||||
|
'regex_match' => 'The {field} can only contain letters, numbers, spaces, dashes, underscores, dots, and apostrophes.'
|
||||||
|
]
|
||||||
],
|
],
|
||||||
'hospital_address' => ['label' => 'Hospital Address','rules' => 'required',
|
'hospital_address' => [
|
||||||
'errors' => ['required' => 'Hospital Address is required']
|
'label' => 'Hospital Address',
|
||||||
|
'rules' => 'permit_empty|regex_match[/^[a-zA-Z0-9\s\-_.,#\/]+$/]',
|
||||||
|
'errors' => [
|
||||||
|
'regex_match' => 'The {field} contains invalid characters (Allowed: letters, numbers, spaces, dashes, commas, dots, # and /).'
|
||||||
|
],
|
||||||
],
|
],
|
||||||
'hospital_state' => [
|
'hospital_state' => [
|
||||||
'label' => 'hospital_State',
|
'label' => 'Hospital State',
|
||||||
'rules' => 'required|regex_match[/^[a-zA-Z\s\-]+$/]',
|
'rules' => 'permit_empty|regex_match[/^[a-zA-Z\s\-]+$/]',
|
||||||
'errors' => [
|
'errors' => [
|
||||||
'required' => 'Hospital State is required.',
|
'regex_match' => 'Hospital State name can only contain letters, spaces, and hyphens.'
|
||||||
'regex_match' => 'Hospital State name can only contain letters, spaces, and hyphens.'
|
]
|
||||||
]
|
],
|
||||||
],
|
'hospital_city' => [
|
||||||
'hospital_city' => [
|
'label' => 'Hospital City', // Added label for consistency
|
||||||
'rules' => 'required|regex_match[/^[a-zA-Z0-9\s\-]+$/]',
|
'rules' => 'permit_empty|regex_match[/^[a-zA-Z\s\-]+$/]',
|
||||||
'errors' => [
|
'errors' => [
|
||||||
'required' => 'Hospital City is required',
|
'regex_match' => 'Hospital City can only contain letters, spaces, and hyphens.'
|
||||||
'regex_match' => 'Hospital City can contain letters, numbers, spaces, and hyphens.'
|
]
|
||||||
]
|
],
|
||||||
],
|
'hospital_pin_code' => [
|
||||||
'hospital_pin_code' => [
|
'label' => 'Hospital Pincode',
|
||||||
'rules' => 'required|numeric|exact_length[6]',
|
'rules' => 'permit_empty|numeric|exact_length[6]',
|
||||||
'errors' => [
|
'errors' => [
|
||||||
'required' => 'Hospital Pincode is required.',
|
'numeric' => 'Hospital Pincode must be digits only.',
|
||||||
'numeric' => 'Hospital Pincode must be digits only.',
|
'exact_length' => 'Hospital Pincode must be exactly 6 digits.'
|
||||||
'exact_length' => 'Hospital Pincode must be exactly 6 digits.'
|
]
|
||||||
]
|
],
|
||||||
],
|
'hospital_phone_no' => [
|
||||||
'hospital_phone_no' => ['label' => 'Hospital Phone','rules' => 'required|numeric|min_length[10]',
|
'label' => 'Hospital Phone',
|
||||||
'errors' => ['min_length' => 'Phone number too short']
|
'rules' => 'permit_empty|numeric|min_length[10]|max_length[15]',
|
||||||
|
'errors' => [
|
||||||
|
'numeric' => 'Phone number must contain only digits.',
|
||||||
|
'min_length' => 'Phone number is too short.',
|
||||||
|
'max_length' => 'Phone number is too long.'
|
||||||
|
]
|
||||||
],
|
],
|
||||||
'doa' => ['label' => 'DOA', 'rules' => 'required',
|
'doa' => ['label' => 'DOA', 'rules' => 'required',
|
||||||
'errors' => ['required' => 'Date of Admission is required']
|
'errors' => ['required' => 'Date of Admission is required']
|
||||||
@ -1551,23 +1565,51 @@ class TicketController extends BaseController
|
|||||||
'claim_type' => ['label' => 'Claim Type','rules' => 'required',
|
'claim_type' => ['label' => 'Claim Type','rules' => 'required',
|
||||||
'errors' => ['required' => 'Claim Type is required']
|
'errors' => ['required' => 'Claim Type is required']
|
||||||
],
|
],
|
||||||
'hospital_name' => ['label' => 'Hospital Name','rules' => 'required',
|
'hospital_name' => [
|
||||||
'errors' => ['required' => 'Hospital Name is required']
|
'label' => 'Hospital Name',
|
||||||
|
'rules' => 'required|regex_match[/^[a-zA-Z0-9\s\-_.\']+$/]',
|
||||||
|
'errors' => [
|
||||||
|
'required' => 'Hospital Name is required',
|
||||||
|
'regex_match' => 'The {field} can only contain letters, numbers, spaces, dashes, underscores, dots, and apostrophes.'
|
||||||
|
]
|
||||||
],
|
],
|
||||||
'hospital_address' => ['label' => 'Hospital Address','rules' => 'required',
|
'hospital_address' => [
|
||||||
'errors' => ['required' => 'Hospital Address is required']
|
'label' => 'Hospital Address',
|
||||||
|
'rules' => 'permit_empty|regex_match[/^[a-zA-Z0-9\s\-_.,#\/]+$/]',
|
||||||
|
'errors' => [
|
||||||
|
'regex_match' => 'The {field} contains invalid characters (Allowed: letters, numbers, spaces, dashes, commas, dots, # and /).'
|
||||||
|
],
|
||||||
],
|
],
|
||||||
'hospital_city' => ['label' => 'Hospital City','rules' => 'required',
|
'hospital_state' => [
|
||||||
'errors' => ['required' => 'City is required']
|
'label' => 'Hospital State',
|
||||||
|
'rules' => 'permit_empty|regex_match[/^[a-zA-Z\s\-]+$/]',
|
||||||
|
'errors' => [
|
||||||
|
'regex_match' => 'Hospital State name can only contain letters, spaces, and hyphens.'
|
||||||
|
]
|
||||||
],
|
],
|
||||||
'hospital_state' => ['label' => 'Hospital State','rules' => 'required',
|
'hospital_city' => [
|
||||||
'errors' => ['required' => 'State is required']
|
'label' => 'Hospital City', // Added label for consistency
|
||||||
|
'rules' => 'permit_empty|regex_match[/^[a-zA-Z\s\-]+$/]',
|
||||||
|
'errors' => [
|
||||||
|
'regex_match' => 'Hospital City can only contain letters, spaces, and hyphens.'
|
||||||
|
]
|
||||||
],
|
],
|
||||||
'hospital_pin_code' => ['label' => 'Hospital Pincode','rules' => 'required|numeric|exact_length[6]',
|
'hospital_pin_code' => [
|
||||||
'errors' => ['exact_length' => 'Pincode must be 6 digits']
|
'label' => 'Hospital Pincode',
|
||||||
|
'rules' => 'permit_empty|numeric|exact_length[6]',
|
||||||
|
'errors' => [
|
||||||
|
'numeric' => 'Hospital Pincode must be digits only.',
|
||||||
|
'exact_length' => 'Hospital Pincode must be exactly 6 digits.'
|
||||||
|
]
|
||||||
],
|
],
|
||||||
'hospital_phone_no' => ['label' => 'Hospital Phone','rules' => 'required|numeric|min_length[10]',
|
'hospital_phone_no' => [
|
||||||
'errors' => ['min_length' => 'Phone number too short']
|
'label' => 'Hospital Phone',
|
||||||
|
'rules' => 'permit_empty|numeric|min_length[10]|max_length[15]',
|
||||||
|
'errors' => [
|
||||||
|
'numeric' => 'Phone number must contain only digits.',
|
||||||
|
'min_length' => 'Phone number is too short.',
|
||||||
|
'max_length' => 'Phone number is too long.'
|
||||||
|
]
|
||||||
],
|
],
|
||||||
'doa' => ['label' => 'DOA', 'rules' => 'required',
|
'doa' => ['label' => 'DOA', 'rules' => 'required',
|
||||||
'errors' => ['required' => 'Date of Admission is required']
|
'errors' => ['required' => 'Date of Admission is required']
|
||||||
|
|||||||
@ -114,11 +114,13 @@ class UserController extends AdminController
|
|||||||
// Employee Code
|
// Employee Code
|
||||||
// ======================
|
// ======================
|
||||||
'emp_code' => [
|
'emp_code' => [
|
||||||
'rules' => 'required|min_length[3]|max_length[15]',
|
'label' => 'Employee Code',
|
||||||
|
'rules' => 'required|min_length[3]|max_length[15]|regex_match[/^[a-zA-Z0-9_\-\/]+$/]',
|
||||||
'errors' => [
|
'errors' => [
|
||||||
'required' => 'Employee Code is required',
|
'required' => 'Employee Code is required',
|
||||||
'min_length' => 'Employee Code must be at least 3 characters',
|
'min_length' => 'Employee Code must be at least 3 characters',
|
||||||
'max_length' => 'Employee Code cannot exceed 15 characters',
|
'max_length' => 'Employee Code cannot exceed 15 characters',
|
||||||
|
'regex_match' => 'Employee Code can only contain letters, numbers, underscores, hyphens, and forward slashes (/).'
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
|
|
||||||
@ -295,11 +297,13 @@ class UserController extends AdminController
|
|||||||
// Employee Code
|
// Employee Code
|
||||||
// ======================
|
// ======================
|
||||||
'emp_code' => [
|
'emp_code' => [
|
||||||
'rules' => 'required|min_length[3]|max_length[15]',
|
'label' => 'Employee Code',
|
||||||
|
'rules' => 'required|min_length[3]|max_length[15]|regex_match[/^[a-zA-Z0-9_\-\/]+$/]',
|
||||||
'errors' => [
|
'errors' => [
|
||||||
'required' => 'Employee Code is required',
|
'required' => 'Employee Code is required',
|
||||||
'min_length' => 'Employee Code must be at least 3 characters',
|
'min_length' => 'Employee Code must be at least 3 characters',
|
||||||
'max_length' => 'Employee Code cannot exceed 15 characters',
|
'max_length' => 'Employee Code cannot exceed 15 characters',
|
||||||
|
'regex_match' => 'Employee Code can only contain letters, numbers, underscores, hyphens, and forward slashes (/).'
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user