CHANGE_MOBILE_NUMBER_VALIDATION
This commit is contained in:
parent
17b8d2702b
commit
3853bc0b27
@ -226,8 +226,8 @@ class EmployeeServiceController extends AdminController
|
|||||||
'col_cell_name' => 'M',
|
'col_cell_name' => 'M',
|
||||||
'col_name' => 'Phone',
|
'col_name' => 'Phone',
|
||||||
'is_mandatory' => false,
|
'is_mandatory' => false,
|
||||||
'data_type' => 'str',
|
'data_type' => 'mobile',
|
||||||
'format' => null,
|
'format' => 'mobile',
|
||||||
'allowed_values' => null,
|
'allowed_values' => null,
|
||||||
'custom' => 'check_dup_mobileno',
|
'custom' => 'check_dup_mobileno',
|
||||||
'params' => ['row', 'existing_mobilenos']
|
'params' => ['row', 'existing_mobilenos']
|
||||||
@ -940,6 +940,7 @@ class EmployeeServiceController extends AdminController
|
|||||||
{
|
{
|
||||||
$is_mandatory = $columns_to_check[$keys[$col_key]]['is_mandatory'];
|
$is_mandatory = $columns_to_check[$keys[$col_key]]['is_mandatory'];
|
||||||
$format = $columns_to_check[$keys[$col_key]]['format'];
|
$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'];
|
$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;
|
$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;
|
$binding_params = isset($columns_to_check[$keys[$col_key]]['params']) ? $columns_to_check[$keys[$col_key]]['params'] : null;
|
||||||
@ -987,14 +988,24 @@ class EmployeeServiceController extends AdminController
|
|||||||
//format check
|
//format check
|
||||||
if(isset($format))
|
if(isset($format))
|
||||||
{
|
{
|
||||||
$format_error = check_excel_date_format($col,$format);
|
|
||||||
if(!$format_error['status'])
|
$validation = validate_excel_value($col, $data_type, $format, $allowed_values);
|
||||||
{
|
if (!$validation['status']) {
|
||||||
array_push($result['error_summary'],2);
|
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]]['col_name'] = $column_dispaly_name;
|
||||||
$result['error_data'][$row_key][$keys[$col_key]]['error'][] = $format_error['error'];
|
$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);
|
// Kint::dump($is_mandatory);
|
||||||
//allowed values check
|
//allowed values check
|
||||||
|
|||||||
@ -3014,6 +3014,9 @@ if (!function_exists('validate_excel_value')) {
|
|||||||
case 'date':
|
case 'date':
|
||||||
return validate_date_value($value, $format);
|
return validate_date_value($value, $format);
|
||||||
|
|
||||||
|
case 'str':
|
||||||
|
return check_excel_date_format($value, $format);
|
||||||
|
|
||||||
case 'mobile':
|
case 'mobile':
|
||||||
return validate_mobile_value($value);
|
return validate_mobile_value($value);
|
||||||
|
|
||||||
@ -3064,7 +3067,7 @@ if (!function_exists('validate_mobile_value')) {
|
|||||||
|
|
||||||
return [
|
return [
|
||||||
'status' => false,
|
'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."
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user