diff --git a/app/Controllers/ApiServiceController.php b/app/Controllers/ApiServiceController.php index 133d6ad1..b69fe231 100644 --- a/app/Controllers/ApiServiceController.php +++ b/app/Controllers/ApiServiceController.php @@ -518,7 +518,7 @@ class ApiServiceController extends BaseController $userParams['phone'] = $row['phone']; $userParams['email'] = $row['email']; $userParams['relationship'] = $row['relation']; - $userParams['gender'] = $row['gender']; + $userParams['gender'] = $row['gender'] == 'M' ? 'Male' : 'Female'; $userParams['dob'] = $row['dob']; $userParams['policyNumber'] = $row['policyNumber']; $userParams['policyStartDate'] = $row['policyStartDate']; diff --git a/app/Controllers/EmployeeController.php b/app/Controllers/EmployeeController.php index 6019a866..25072e55 100755 --- a/app/Controllers/EmployeeController.php +++ b/app/Controllers/EmployeeController.php @@ -3852,7 +3852,7 @@ class EmployeeController extends AdminController foreach ($families as $empCode => $members) { $familiesPayload[$empCode] = $this->buildFamilyPayload($empCode, $members); } - + log_message('error', "[WellnessOnboard] Page {$page} API calls done. Families processed: " . json_encode($familiesPayload)); // ---------------------------------------------------------------- // 5. SEND TO WELLNESS API // ---------------------------------------------------------------- diff --git a/app/Controllers/EmployeeMultiEventServiceController.php b/app/Controllers/EmployeeMultiEventServiceController.php index 4f51f1ad..231cd231 100644 --- a/app/Controllers/EmployeeMultiEventServiceController.php +++ b/app/Controllers/EmployeeMultiEventServiceController.php @@ -227,7 +227,7 @@ class EmployeeMultiEventServiceController extends BaseController 'format' => 'mobile', 'allowed_values' => null, 'custom' => 'check_dup_mobileno', - 'params' => ['row', 'existing_mobilenos'] + 'params' => ['row', 'existing_mobilenos', 'excel_data', 'row_key'] ], 'email' => [ 'col_idx' => 13, diff --git a/app/Controllers/EmployeeServiceController.php b/app/Controllers/EmployeeServiceController.php index 064d1dc5..f490be1e 100755 --- a/app/Controllers/EmployeeServiceController.php +++ b/app/Controllers/EmployeeServiceController.php @@ -230,7 +230,7 @@ class EmployeeServiceController extends AdminController 'format' => 'mobile', 'allowed_values' => null, 'custom' => 'check_dup_mobileno', - 'params' => ['row', 'existing_mobilenos'] + 'params' => ['row', 'existing_mobilenos', 'excel_data', 'row_key'] ], 'email' => [ 'col_idx' => 13, diff --git a/app/Controllers/TicketController.php b/app/Controllers/TicketController.php index 6f64777c..bcfb183a 100644 --- a/app/Controllers/TicketController.php +++ b/app/Controllers/TicketController.php @@ -1162,28 +1162,28 @@ class TicketController extends BaseController // --- EMPLOYEE DETAILS --- 'emp_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\s\/_-]+$/]', 'errors' => [ 'required' => 'Employee ID is required.', - 'regex_match' => 'Employee ID cannot contain spaces or special characters (only letters, numbers, hyphens and underscores. allowed).' + 'regex_match' => 'Employee ID can only contain letters, numbers, spaces, slashes (/), hyphens (-) and underscores (_).' ] ], 'emp_name' => [ 'label' => 'Employee Name', - 'rules' => 'required|min_length[3]|regex_match[/^[a-zA-Z0-9\s_-]+$/]', + 'rules' => 'required|min_length[3]|regex_match[/^[a-zA-Z0-9\s\/_-]+$/]', 'errors' => [ 'required' => 'Employee Name is required', 'min_length' => 'Employee Name must be at least 3 characters long', - 'regex_match' => 'Employee Name can only contain letters, numbers, spaces, hyphens, and underscores.' + 'regex_match' => 'Employee Name can only contain letters, numbers, spaces, slashes (/), hyphens (-), and underscores (_).' ] ], 'insured_name' => [ 'label' => 'Insured Name', - 'rules' => 'required|min_length[3]|regex_match[/^[a-zA-Z0-9\s_-]+$/]', + 'rules' => 'required|min_length[3]|regex_match[/^[a-zA-Z0-9\s\/_-]+$/]', 'errors' => [ 'required' => 'Insured Name is required', 'min_length' => 'Insured Name must be at least 3 characters long', - 'regex_match' => 'Insured Name can only contain letters, numbers, spaces, hyphens, and underscores.' + 'regex_match' => 'Insured Name can only contain letters, numbers, spaces, slashes (/), hyphens (-), and underscores (_).' ] ], 'relationship' => ['label' => 'Relationship','rules' => 'required', @@ -1393,19 +1393,19 @@ class TicketController extends BaseController // --- EMPLOYEE DETAILS --- 'emp_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\s\/_-]+$/]', 'errors' => [ 'required' => 'Employee ID is required.', - 'regex_match' => 'Employee ID cannot contain spaces or special characters (only letters, numbers, hyphens and underscores. allowed).', + 'regex_match' => 'Employee ID can only contain letters, numbers, spaces, slashes (/), hyphens (-) and underscores (_).', ] ], 'emp_name' => [ 'label' => 'Employee Name', - 'rules' => 'required|min_length[3]|regex_match[/^[a-zA-Z0-9\s_-]+$/]', + 'rules' => 'required|min_length[3]|regex_match[/^[a-zA-Z0-9\s\/_-]+$/]', 'errors' => [ 'required' => 'Employee Name is required', 'min_length' => 'Employee Name must be at least 3 characters long', - 'regex_match' => 'Employee Name can only contain letters, numbers, spaces, hyphens, and underscores.' + 'regex_match' => 'Employee Name can only contain letters, numbers, spaces, slashes (/), hyphens (-), and underscores (_).' ] ], 'emp_mobile' => ['label' => 'Employee Mobile No','rules' => 'required|numeric|exact_length[10]', @@ -1650,28 +1650,28 @@ class TicketController extends BaseController // --- EMPLOYEE DETAILS --- 'emp_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\s\/_-]+$/]', 'errors' => [ 'required' => 'Employee ID is required.', - 'regex_match' => 'Employee ID cannot contain spaces or special characters (only letters, numbers, hyphens and underscores. allowed).', + 'regex_match' => 'Employee ID can only contain letters, numbers, spaces, slashes (/), hyphens (-) and underscores (_).', ] ], 'emp_name' => [ 'label' => 'Employee Name', - 'rules' => 'required|min_length[3]|regex_match[/^[a-zA-Z0-9\s_-]+$/]', + 'rules' => 'required|min_length[3]|regex_match[/^[a-zA-Z0-9\s\/_-]+$/]', 'errors' => [ 'required' => 'Employee Name is required', 'min_length' => 'Employee Name must be at least 3 characters long', - 'regex_match' => 'Employee Name can only contain letters, numbers, spaces, hyphens, and underscores.' + 'regex_match' => 'Employee Name can only contain letters, numbers, spaces, slashes (/), hyphens (-), and underscores (_).' ] ], 'insured_name' => [ 'label' => 'Insured Name', - 'rules' => 'required|min_length[3]|regex_match[/^[a-zA-Z0-9\s_-]+$/]', + 'rules' => 'required|min_length[3]|regex_match[/^[a-zA-Z0-9\s\/_-]+$/]', 'errors' => [ 'required' => 'Insured Name is required', 'min_length' => 'Insured Name must be at least 3 characters long', - 'regex_match' => 'Insured Name can only contain letters, numbers, spaces, hyphens, and underscores.' + 'regex_match' => 'Insured Name can only contain letters, numbers, spaces, slashes (/), hyphens (-), and underscores (_).' ] ], 'relationship' => ['label' => 'Relationship','rules' => 'required', @@ -1882,19 +1882,19 @@ class TicketController extends BaseController // --- EMPLOYEE DETAILS --- 'emp_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\s\/_-]+$/]', 'errors' => [ 'required' => 'Employee ID is required.', - 'regex_match' => 'Employee ID cannot contain spaces or special characters (only letters, numbers, hyphens and underscores. allowed).', + 'regex_match' => 'Employee ID can only contain letters, numbers, spaces, slashes (/), hyphens (-) and underscores (_).', ] ], 'emp_name' => [ 'label' => 'Employee Name', - 'rules' => 'required|min_length[3]|regex_match[/^[a-zA-Z0-9\s_-]+$/]', + 'rules' => 'required|min_length[3]|regex_match[/^[a-zA-Z0-9\s\/_-]+$/]', 'errors' => [ 'required' => 'Employee Name is required', 'min_length' => 'Employee Name must be at least 3 characters long', - 'regex_match' => 'Employee Name can only contain letters, numbers, spaces, hyphens, and underscores.' + 'regex_match' => 'Employee Name can only contain letters, numbers, spaces, slashes (/), hyphens (-), and underscores (_).' ] ], 'emp_mobile' => ['label' => 'Employee Mobile No','rules' => 'required|numeric|exact_length[10]', diff --git a/app/Helpers/excel_util_helper.php b/app/Helpers/excel_util_helper.php index 0b7d0039..326c2d14 100755 --- a/app/Helpers/excel_util_helper.php +++ b/app/Helpers/excel_util_helper.php @@ -2107,8 +2107,8 @@ if (!function_exists('remap_default_age_ratio_into_relationship')) { } } -if (!function_exists('check_dup_mobileno')) { - function check_dup_mobileno(array $row, array $existing_mobilenos) +if (!function_exists('check_dup_mobileno_old')) { + function check_dup_mobileno_old(array $row, array $existing_mobilenos) { if(!empty($row['12'])){ foreach ($existing_mobilenos as $k => $value) { @@ -2122,6 +2122,41 @@ if (!function_exists('check_dup_mobileno')) { } } +if (!function_exists('check_dup_mobileno')) { + function check_dup_mobileno(array $row, array $existing_mobilenos, $excel_data = [], $row_key = null) + { + if(!empty($row['12'])){ + $current_relation = strtolower(trim($row['5'] ?? '')); + $current_mobile = trim((string) $row['12']); + + foreach ($existing_mobilenos as $k => $value) { + if ($current_relation == 'self' && $current_mobile == trim((string) ($value['mobile'] ?? ''))) { + return array('status' => false, 'error' => "Duplicate Mobile No"); + // break; + } + } + + foreach ($excel_data as $ed_row => $value) { + if ($row_key !== null && (string) $ed_row === (string) $row_key) { + continue; + } + + $excel_relation = strtolower(trim($value['5'] ?? '')); + $excel_mobile = trim((string) ($value['12'] ?? '')); + + if ($current_relation == 'self' && $excel_relation == 'self' && $excel_mobile !== '' && $current_mobile == $excel_mobile) { + $duplicate_row_no = is_numeric($ed_row) ? $ed_row + 1 : $ed_row; + $current_row_no = is_numeric($row_key) ? $row_key + 1 : $row_key; + return array('status' => false, 'error' => "This mobile number has already been used for another self in Excel at row no. " . ($duplicate_row_no) . " and " . ($current_row_no)); + // break; + } + } + + } + return array('status' => true); + } +} + // if (!function_exists('check_dup_email')) { // function check_dup_email(array $row, array $existing_mobilenos) // { diff --git a/app/Views/file_list.php b/app/Views/file_list.php index d7bc5bba..8292a6ae 100755 --- a/app/Views/file_list.php +++ b/app/Views/file_list.php @@ -298,6 +298,7 @@ $fl_col_width_px = nhance_dt_column_widths_px($fl_header_labels, $fl_col_max_len