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;
|
||||
$id = $this->request->getPost('id');
|
||||
$postData = $this->request->getPost();
|
||||
$data = $this->prepareLeadData();
|
||||
$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) {
|
||||
$rules['client_type'] = [
|
||||
'rules' => 'required',
|
||||
@ -793,7 +809,7 @@ class LeadsController extends BaseController
|
||||
'source_policy_end_date' => $data['source_policy_end_date'] ?? null,
|
||||
'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
|
||||
];
|
||||
}
|
||||
|
||||
@ -1216,37 +1216,51 @@ class TicketController extends BaseController
|
||||
'claim_type' => ['label' => 'Claim Type','rules' => 'required',
|
||||
'errors' => ['required' => 'Claim Type is required']
|
||||
],
|
||||
'hospital_name' => ['label' => 'Hospital Name','rules' => 'required',
|
||||
'errors' => ['required' => 'Hospital Name is required']
|
||||
'hospital_name' => [
|
||||
'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',
|
||||
'errors' => ['required' => 'Hospital Address is required']
|
||||
'hospital_address' => [
|
||||
'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' => [
|
||||
'label' => 'hospital_State',
|
||||
'rules' => 'required|regex_match[/^[a-zA-Z\s\-]+$/]',
|
||||
'errors' => [
|
||||
'required' => 'Hospital State is required.',
|
||||
'regex_match' => 'Hospital State name can only contain letters, spaces, and hyphens.'
|
||||
]
|
||||
],
|
||||
'hospital_city' => [
|
||||
'rules' => 'required|regex_match[/^[a-zA-Z0-9\s\-]+$/]',
|
||||
'errors' => [
|
||||
'required' => 'Hospital City is required',
|
||||
'regex_match' => 'Hospital City can contain letters, numbers, spaces, and hyphens.'
|
||||
]
|
||||
],
|
||||
'hospital_pin_code' => [
|
||||
'rules' => 'required|numeric|exact_length[6]',
|
||||
'errors' => [
|
||||
'required' => 'Hospital Pincode is required.',
|
||||
'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]',
|
||||
'errors' => ['min_length' => 'Phone number too short']
|
||||
'hospital_state' => [
|
||||
'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_city' => [
|
||||
'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' => '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' => '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',
|
||||
'errors' => ['required' => 'Date of Admission is required']
|
||||
@ -1551,23 +1565,51 @@ class TicketController extends BaseController
|
||||
'claim_type' => ['label' => 'Claim Type','rules' => 'required',
|
||||
'errors' => ['required' => 'Claim Type is required']
|
||||
],
|
||||
'hospital_name' => ['label' => 'Hospital Name','rules' => 'required',
|
||||
'errors' => ['required' => 'Hospital Name is required']
|
||||
'hospital_name' => [
|
||||
'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',
|
||||
'errors' => ['required' => 'Hospital Address is required']
|
||||
'hospital_address' => [
|
||||
'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',
|
||||
'errors' => ['required' => 'City is required']
|
||||
'hospital_state' => [
|
||||
'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',
|
||||
'errors' => ['required' => 'State is required']
|
||||
'hospital_city' => [
|
||||
'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]',
|
||||
'errors' => ['exact_length' => 'Pincode must be 6 digits']
|
||||
'hospital_pin_code' => [
|
||||
'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]',
|
||||
'errors' => ['min_length' => 'Phone number too short']
|
||||
'hospital_phone_no' => [
|
||||
'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',
|
||||
'errors' => ['required' => 'Date of Admission is required']
|
||||
|
||||
@ -114,11 +114,13 @@ class UserController extends AdminController
|
||||
// Employee 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' => [
|
||||
'required' => 'Employee Code is required',
|
||||
'min_length' => 'Employee Code must be at least 3 characters',
|
||||
'max_length' => 'Employee Code cannot exceed 15 characters',
|
||||
'required' => 'Employee Code is required',
|
||||
'min_length' => 'Employee Code must be at least 3 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
|
||||
// ======================
|
||||
'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' => [
|
||||
'required' => 'Employee Code is required',
|
||||
'min_length' => 'Employee Code must be at least 3 characters',
|
||||
'max_length' => 'Employee Code cannot exceed 15 characters',
|
||||
'required' => 'Employee Code is required',
|
||||
'min_length' => 'Employee Code must be at least 3 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