CHANGE_MOBILE_NUMBER_VALIDATION

This commit is contained in:
VENKATESHWARAN 2026-04-30 12:45:40 +05:30
parent 17b8d2702b
commit 3853bc0b27
2 changed files with 25 additions and 11 deletions

View File

@ -226,8 +226,8 @@ class EmployeeServiceController extends AdminController
'col_cell_name' => 'M',
'col_name' => 'Phone',
'is_mandatory' => false,
'data_type' => 'str',
'format' => null,
'data_type' => 'mobile',
'format' => 'mobile',
'allowed_values' => null,
'custom' => 'check_dup_mobileno',
'params' => ['row', 'existing_mobilenos']
@ -940,6 +940,7 @@ class EmployeeServiceController extends AdminController
{
$is_mandatory = $columns_to_check[$keys[$col_key]]['is_mandatory'];
$format = $columns_to_check[$keys[$col_key]]['format'];
$data_type = $columns_to_check[$keys[$col_key]]['data_type'];
$allowed_values = $columns_to_check[$keys[$col_key]]['allowed_values'];
$custom_function = isset($columns_to_check[$keys[$col_key]]['custom']) ? $columns_to_check[$keys[$col_key]]['custom'] : null;
$binding_params = isset($columns_to_check[$keys[$col_key]]['params']) ? $columns_to_check[$keys[$col_key]]['params'] : null;
@ -986,15 +987,25 @@ class EmployeeServiceController extends AdminController
//format check
if(isset($format))
{
$format_error = check_excel_date_format($col,$format);
if(!$format_error['status'])
{
array_push($result['error_summary'],2);
$result['error_data'][$row_key][$keys[$col_key]]['col_name'] = $column_dispaly_name; //push column name
$result['error_data'][$row_key][$keys[$col_key]]['col_idx'] = $column_index; //push column index
$result['error_data'][$row_key][$keys[$col_key]]['error'][] = $format_error['error'];
{
$validation = validate_excel_value($col, $data_type, $format, $allowed_values);
if (!$validation['status']) {
array_push($result['error_summary'], 2);
$result['error_data'][$row_key][$keys[$col_key]]['col_name'] = $column_dispaly_name;
$result['error_data'][$row_key][$keys[$col_key]]['col_idx'] = $column_index;
$result['error_data'][$row_key][$keys[$col_key]]['error'][] = $validation['error'];
}
// $format_error = check_excel_date_format($col,$format);
// if(!$format_error['status'])
// {
// array_push($result['error_summary'],2);
// $result['error_data'][$row_key][$keys[$col_key]]['col_name'] = $column_dispaly_name; //push column name
// $result['error_data'][$row_key][$keys[$col_key]]['col_idx'] = $column_index; //push column index
// $result['error_data'][$row_key][$keys[$col_key]]['error'][] = $format_error['error'];
// }
}
// Kint::dump($is_mandatory);
//allowed values check

View File

@ -3014,6 +3014,9 @@ if (!function_exists('validate_excel_value')) {
case 'date':
return validate_date_value($value, $format);
case 'str':
return check_excel_date_format($value, $format);
case 'mobile':
return validate_mobile_value($value);
@ -3064,7 +3067,7 @@ if (!function_exists('validate_mobile_value')) {
return [
'status' => false,
'error' => "Invalid mobile number. Expected 10 digits."
'error' => "Invalid mobile number. It must be exactly 10 digits, with no spaces and no +91 prefix."
];
}
}