MERGE_UAT_FORM_VALIDATIONS_FIX

This commit is contained in:
Ubuntu 2026-02-13 09:53:57 +05:30
commit 571da045db
8 changed files with 117 additions and 64 deletions

View File

@ -16,6 +16,8 @@ class Acl
'#^/getVerifyPosMobileNo#' => ['public' => true], '#^/getVerifyPosMobileNo#' => ['public' => true],
'#^/getVerifiedPosUserData#' => ['public' => true], '#^/getVerifiedPosUserData#' => ['public' => true],
'#^/swagger#' => ['roles' => [ADMIN_ROLE_ID]], '#^/swagger#' => ['roles' => [ADMIN_ROLE_ID]],
'#^/getEmployeeActiveOrInactivePolicy#' => ['roles' => [ADMIN_ROLE_ID, HEAD_ROLE_ID]],
'#^/test/testingquerys#' => ['roles' => [ADMIN_ROLE_ID, HEAD_ROLE_ID]],
'#^/fedeploy#' => ['roles' => [ADMIN_ROLE_ID]], '#^/fedeploy#' => ['roles' => [ADMIN_ROLE_ID]],
'#^/visitOffBoardCheck#' => ['roles' => [ADMIN_ROLE_ID]], '#^/visitOffBoardCheck#' => ['roles' => [ADMIN_ROLE_ID]],
'#^/logs#' => ['roles' => [ADMIN_ROLE_ID]], '#^/logs#' => ['roles' => [ADMIN_ROLE_ID]],

View File

@ -836,6 +836,7 @@ $routes->group('test', function($routes) {
$routes->get('membervalidation', 'TestingController::membervalidation'); $routes->get('membervalidation', 'TestingController::membervalidation');
$routes->get('generateExcel', 'TestingController::generateExcel'); $routes->get('generateExcel', 'TestingController::generateExcel');
$routes->get('logo_renaming','TestingController::logo_renaming'); $routes->get('logo_renaming','TestingController::logo_renaming');
$routes->get('testingquerys','TestingController::testingquerys');
$routes->get('thzReminderCrone','ThzController::getOpenTicketsOlderThan24HoursAndAssignNextLevel'); $routes->get('thzReminderCrone','ThzController::getOpenTicketsOlderThan24HoursAndAssignNextLevel');
// $routes->get('createDefaultMailTempalteInDB','TestingController::createDefaultMailTempalteInCrossDB'); // $routes->get('createDefaultMailTempalteInDB','TestingController::createDefaultMailTempalteInCrossDB');
// $routes->get('createDefaultMailTempalteInSameDB','TestingController::createDefaultMailTempalteInSameDB'); // $routes->get('createDefaultMailTempalteInSameDB','TestingController::createDefaultMailTempalteInSameDB');

View File

@ -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');

View File

@ -366,18 +366,6 @@ 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');
$data = $this->prepareLeadData(); $data = $this->prepareLeadData();
// print_r($data); die;
if (!$id) {
return $this->insertNewLead($data);
} else {
return $this->updateOldLead($id, $data);
}
}
private function prepareLeadData()
{
$rules = [ $rules = [
'lead_type' => [ 'lead_type' => [
@ -396,16 +384,12 @@ class LeadsController extends BaseController
'rules' => 'required|regex_match[/^[a-zA-Z0-9_ -]+$/]', 'rules' => 'required|regex_match[/^[a-zA-Z0-9_ -]+$/]',
'errors' => [ 'errors' => [
'required' => 'Client Name is required', 'required' => 'Client Name is required',
'regex_match' => 'Client Name only letters, numbers and characters _ - and space are allowed' 'regex_match' => 'Client Name only letters, numbers, space, hyphens and underscores are allowed'
] ]
], ],
'client_short_name' => [ 'client_short_name' => [
'rules' => 'required|regex_match[/^[a-zA-Z0-9_-]+$/]', 'rules' => 'required|regex_match[/^[a-zA-Z0-9_-]+$/]',
'errors' => ['required' => 'Client Short Name is required','regex_match' => 'Client Short Name only letters, numbers and characters _ and - are allowed'] 'errors' => ['required' => 'Client Short Name is required','regex_match' => 'Client Short Name only letters, numbers, hyphens and underscores are allowed']
],
'gst' => [
'rules' => 'required',
'errors' => ['required' => 'GST Number is required']
], ],
'gst' => [ 'gst' => [
'rules' => 'required|regex_match[/^[0-9]{2}[A-Z]{5}[0-9]{4}[A-Z]{1}[1-9A-Z]{1}Z[0-9A-Z]{1}$/]', 'rules' => 'required|regex_match[/^[0-9]{2}[A-Z]{5}[0-9]{4}[A-Z]{1}[1-9A-Z]{1}Z[0-9A-Z]{1}$/]',
@ -438,9 +422,11 @@ class LeadsController extends BaseController
], ],
'contact_person_mobile' => [ 'contact_person_mobile' => [
'rules' => 'required', 'rules' => 'required',
'rules' => 'required|regex_match[/^[0-9]+$/]', 'rules' => 'required|exact_length[10]|regex_match[/^[0-9]+$/]',
'errors' => ['required' => 'Contact Person Mobile is required' , 'errors' => [
'regex_match' => 'Contact Person Mobile Only numbers' 'required' => 'Contact Person Mobile is required' ,
'regex_match' => 'Contact Person Mobile Only numbers',
'exact_length'=> 'Contact Person Mobile must be exactly 10 digits long.'
] ]
], ],
'contact_person_email' => [ 'contact_person_email' => [
@ -462,8 +448,7 @@ class LeadsController extends BaseController
'errors' => ['required' => 'Status is required'] 'errors' => ['required' => 'Status is required']
] ]
]; ];
$request_data = $this->request->getPost();
$data = sanitizeInputArrayAdvanced($request_data);
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',
@ -524,8 +509,23 @@ class LeadsController extends BaseController
]); ]);
} }
// print_r($data); die;
if (!$id) {
return $this->insertNewLead($data);
} else {
return $this->updateOldLead($id, $data);
}
}
private function prepareLeadData()
{
$request_data = $this->request->getPost();
$data = sanitizeInputArrayAdvanced($request_data);
$data['client_type'] = 1; $data['client_type'] = 1;
$data['pan'] = ""; $data['pan'] = "";

View File

@ -254,7 +254,7 @@ class MasterController extends AdminController
$this->myLogger->logme('error','Insurer Onboarding function called'); $this->myLogger->logme('error','Insurer Onboarding function called');
$headerData['tab_name'] = 'Insurer Masters'; $headerData['tab_name'] = 'Insurer Masters';
$headerData['page_name'] = 'Insurers'; $headerData['page_name'] = 'Insurers';
$types = array( $types = array(
(object) array('id' => 'pvt', 'name' => 'PVT'), (object) array('id' => 'pvt', 'name' => 'PVT'),
(object) array('id' => 'psu', 'name' => 'PSU') (object) array('id' => 'psu', 'name' => 'PSU')
@ -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([

View File

@ -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' => [

View File

@ -77,7 +77,8 @@ class VidalApiController extends BaseController
curl_setopt($ch2, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch2, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch2, CURLOPT_HTTPHEADER, [ curl_setopt($ch2, CURLOPT_HTTPHEADER, [
"x-ms-blob-type: BlockBlob", "x-ms-blob-type: BlockBlob",
"Content-Length: $fileSize" "Content-Length: $fileSize" ,
"Content-Type: multipart/form-data"
]); ]);
$uploadResponse = curl_exec($ch2); $uploadResponse = curl_exec($ch2);

View File

@ -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">