FIX_Validation
This commit is contained in:
parent
d10d849389
commit
2b67f5b77f
@ -1717,14 +1717,14 @@ class ClientController extends AdminController
|
|||||||
]
|
]
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
if (!$this->validate($rules)) {
|
// if (!$this->validate($rules)) {
|
||||||
return $this->response->setStatusCode(400)->setJSON([
|
// return $this->response->setStatusCode(400)->setJSON([
|
||||||
'status' => false,
|
// 'status' => false,
|
||||||
'message' => 'Input validation failed',
|
// 'message' => 'Input validation failed',
|
||||||
'code' => 400,
|
// 'code' => 400,
|
||||||
'errors' => $this->validator->getErrors()
|
// 'errors' => $this->validator->getErrors()
|
||||||
]);
|
// ]);
|
||||||
}
|
// }
|
||||||
|
|
||||||
$id = $this->request->getPost('PrimaryKey');
|
$id = $this->request->getPost('PrimaryKey');
|
||||||
$data['client_id'] = $this->request->getPost('client_id');
|
$data['client_id'] = $this->request->getPost('client_id');
|
||||||
|
|||||||
@ -284,29 +284,78 @@ class MasterController extends AdminController
|
|||||||
|
|
||||||
$this->myLogger->logme('error','Insurer general info function called');
|
$this->myLogger->logme('error','Insurer general info function called');
|
||||||
$rules = [
|
$rules = [
|
||||||
'name' => [
|
'name' => [
|
||||||
'rules' => 'required',
|
'label' => 'Insurer Name',
|
||||||
'errors' => [
|
'rules' => ['required', 'regex_match[/^[a-zA-Z0-9\s\-_]+$/]'],
|
||||||
'required' => 'Name is required'
|
'errors' => [
|
||||||
]
|
'required' => 'Insurer Name is required.',
|
||||||
],
|
'regex_match' => 'Insurer Name can only contain letters, numbers, spaces, hyphens, and underscores.',
|
||||||
'short_name' => [
|
]
|
||||||
'rules' => 'required|min_length[3]|max_length[8]',
|
],
|
||||||
'errors' => [
|
'short_name' => [
|
||||||
'required' => 'Short name is required',
|
'label' => 'Insurer Short Name',
|
||||||
'min_length' => 'Short name must be at least 3 characters',
|
'rules' => ['required', 'regex_match[/^[a-zA-Z0-9\-_]+$/]'],
|
||||||
'max_length' => 'Short name cannot exceed 8 characters'
|
'errors' => [
|
||||||
]
|
'required' => 'Short Name is required.',
|
||||||
],
|
'regex_match' => 'Short Name can only contain letters, numbers, hyphens, and underscores.',
|
||||||
'insurer_logo' => [
|
]
|
||||||
|
],
|
||||||
|
'type' => [
|
||||||
|
'label' => 'Insurer Type',
|
||||||
|
'rules' => 'permit_empty|in_list[pvt,psu]',
|
||||||
|
'errors' => [
|
||||||
|
'in_list' => 'Please select a valid Insurer Type (PVT or PSU).'
|
||||||
|
]
|
||||||
|
],
|
||||||
|
'category' => [
|
||||||
|
'label' => 'Insurer Category',
|
||||||
|
'rules' => 'permit_empty|in_list[life,general]',
|
||||||
|
'errors' => [
|
||||||
|
'in_list' => 'Please select a valid Category (Life or General).'
|
||||||
|
]
|
||||||
|
],
|
||||||
|
'addition_add_day' => [
|
||||||
|
'rules' => 'permit_empty' // Checkboxes return null if unchecked
|
||||||
|
],
|
||||||
|
'deletion_add_day' => [
|
||||||
|
'rules' => 'permit_empty'
|
||||||
|
],
|
||||||
|
'is_multi_event' => [
|
||||||
|
'rules' => 'permit_empty'
|
||||||
|
],
|
||||||
|
'insurer_logo' => [
|
||||||
'rules' => 'if_exist|is_image[insurer_logo]|max_size[insurer_logo,200]|ext_in[insurer_logo,jpg,jpeg,png]',
|
'rules' => 'if_exist|is_image[insurer_logo]|max_size[insurer_logo,200]|ext_in[insurer_logo,jpg,jpeg,png]',
|
||||||
'errors' => [
|
'errors' => [
|
||||||
'is_image' => 'The uploaded file must be an image',
|
'is_image' => 'The uploaded file must be an image',
|
||||||
'max_size' => 'File size should not exceed 200 KB',
|
'max_size' => 'File size should not exceed 200 KB',
|
||||||
'ext_in' => 'Allowed file types: jpg, jpeg, png',
|
'ext_in' => 'Allowed file types: jpg, jpeg, png',
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
|
// $rules = [
|
||||||
|
// 'name' => [
|
||||||
|
// 'rules' => 'required',
|
||||||
|
// 'errors' => [
|
||||||
|
// 'required' => 'Name is required'
|
||||||
|
// ]
|
||||||
|
// ],
|
||||||
|
// 'short_name' => [
|
||||||
|
// 'rules' => 'required|min_length[3]|max_length[8]',
|
||||||
|
// 'errors' => [
|
||||||
|
// 'required' => 'Short name is required',
|
||||||
|
// 'min_length' => 'Short name must be at least 3 characters',
|
||||||
|
// 'max_length' => 'Short name cannot exceed 8 characters'
|
||||||
|
// ]
|
||||||
|
// ],
|
||||||
|
// 'insurer_logo' => [
|
||||||
|
// 'rules' => 'if_exist|is_image[insurer_logo]|max_size[insurer_logo,200]|ext_in[insurer_logo,jpg,jpeg,png]',
|
||||||
|
// 'errors' => [
|
||||||
|
// 'is_image' => 'The uploaded file must be an image',
|
||||||
|
// 'max_size' => 'File size should not exceed 200 KB',
|
||||||
|
// 'ext_in' => 'Allowed file types: jpg, jpeg, png',
|
||||||
|
// ]
|
||||||
|
// ],
|
||||||
|
// ];
|
||||||
|
|
||||||
if (!$this->validate($rules)) {
|
if (!$this->validate($rules)) {
|
||||||
return $this->response->setStatusCode(400)->setJSON([
|
return $this->response->setStatusCode(400)->setJSON([
|
||||||
|
|||||||
@ -1136,11 +1136,11 @@ class TicketController extends BaseController
|
|||||||
$rules = [
|
$rules = [
|
||||||
// --- EMPLOYEE DETAILS ---
|
// --- EMPLOYEE DETAILS ---
|
||||||
'emp_code' => [
|
'emp_code' => [
|
||||||
'label' => 'Employee Code',
|
'label' => 'Employee ID',
|
||||||
'rules' => 'required|min_length[2]|max_length[20]|regex_match[/^[a-zA-Z0-9_-]+$/]',
|
'rules' => 'required|min_length[2]|max_length[20]|regex_match[/^[a-zA-Z0-9_-]+$/]',
|
||||||
'errors' => [
|
'errors' => [
|
||||||
'required' => 'Employee Code is required.',
|
'required' => 'Employee ID is required.',
|
||||||
'regex_match' => 'Employee Code cannot contain spaces or special characters (only letters, numbers, hyphens and underscores. allowed).'
|
'regex_match' => 'Employee ID cannot contain spaces or special characters (only letters, numbers, hyphens and underscores. allowed).'
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
'emp_name' => [
|
'emp_name' => [
|
||||||
@ -1332,11 +1332,11 @@ class TicketController extends BaseController
|
|||||||
$rules = [
|
$rules = [
|
||||||
// --- EMPLOYEE DETAILS ---
|
// --- EMPLOYEE DETAILS ---
|
||||||
'emp_code' => [
|
'emp_code' => [
|
||||||
'label' => 'Employee Code',
|
'label' => 'Employee ID',
|
||||||
'rules' => 'required|min_length[2]|max_length[20]|regex_match[/^[a-zA-Z0-9_-]+$/]',
|
'rules' => 'required|min_length[2]|max_length[20]|regex_match[/^[a-zA-Z0-9_-]+$/]',
|
||||||
'errors' => [
|
'errors' => [
|
||||||
'required' => 'Employee Code is required.',
|
'required' => 'Employee ID is required.',
|
||||||
'regex_match' => 'Employee Code cannot contain spaces or special characters (only letters, numbers, hyphens and underscores. allowed).',
|
'regex_match' => 'Employee ID cannot contain spaces or special characters (only letters, numbers, hyphens and underscores. allowed).',
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
'emp_name' => [
|
'emp_name' => [
|
||||||
@ -1471,11 +1471,11 @@ class TicketController extends BaseController
|
|||||||
$rules = [
|
$rules = [
|
||||||
// --- EMPLOYEE DETAILS ---
|
// --- EMPLOYEE DETAILS ---
|
||||||
'emp_code' => [
|
'emp_code' => [
|
||||||
'label' => 'Employee Code',
|
'label' => 'Employee ID',
|
||||||
'rules' => 'required|min_length[2]|max_length[20]|regex_match[/^[a-zA-Z0-9_-]+$/]',
|
'rules' => 'required|min_length[2]|max_length[20]|regex_match[/^[a-zA-Z0-9_-]+$/]',
|
||||||
'errors' => [
|
'errors' => [
|
||||||
'required' => 'Employee Code is required.',
|
'required' => 'Employee ID is required.',
|
||||||
'regex_match' => 'Employee Code cannot contain spaces or special characters (only letters, numbers, hyphens and underscores. allowed).',
|
'regex_match' => 'Employee ID cannot contain spaces or special characters (only letters, numbers, hyphens and underscores. allowed).',
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
'emp_name' => [
|
'emp_name' => [
|
||||||
@ -1653,11 +1653,11 @@ class TicketController extends BaseController
|
|||||||
$rules = [
|
$rules = [
|
||||||
// --- EMPLOYEE DETAILS ---
|
// --- EMPLOYEE DETAILS ---
|
||||||
'emp_code' => [
|
'emp_code' => [
|
||||||
'label' => 'Employee Code',
|
'label' => 'Employee ID',
|
||||||
'rules' => 'required|min_length[2]|max_length[20]|regex_match[/^[a-zA-Z0-9_-]+$/]',
|
'rules' => 'required|min_length[2]|max_length[20]|regex_match[/^[a-zA-Z0-9_-]+$/]',
|
||||||
'errors' => [
|
'errors' => [
|
||||||
'required' => 'Employee Code is required.',
|
'required' => 'Employee ID is required.',
|
||||||
'regex_match' => 'Employee Code cannot contain spaces or special characters (only letters, numbers, hyphens and underscores. allowed).',
|
'regex_match' => 'Employee ID cannot contain spaces or special characters (only letters, numbers, hyphens and underscores. allowed).',
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
'emp_name' => [
|
'emp_name' => [
|
||||||
|
|||||||
@ -67,7 +67,7 @@
|
|||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<div class="form-group col-md-6">
|
<div class="form-group col-md-6">
|
||||||
<label for="mobile">CD Account Number<span class="text-danger">*</span></label>
|
<label for="mobile">CD Account Number<span class="text-danger">*</span></label>
|
||||||
<input type="text" class="form-control" id="cd_ac_no_for_cd_master" name="cd_ac_no" required data-parsley-type="digits">
|
<input type="text" class="form-control" id="cd_ac_no_for_cd_master" name="cd_ac_no" onkeypress="return onlyNumbers(event)" required data-parsley-type="digits">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group col-md-6">
|
<div class="form-group col-md-6">
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user