Tweak validation for mobile phone number. #339
This commit is contained in:
parent
51e333de8b
commit
62edf0f12c
1 changed files with 6 additions and 8 deletions
|
|
@ -321,9 +321,7 @@ class CMBCustomerHandler implements CustomerHandlerInterface
|
||||||
$verror_array = [];
|
$verror_array = [];
|
||||||
|
|
||||||
if (!($this->validateMobileNumber($req->request->get('phone_mobile'))))
|
if (!($this->validateMobileNumber($req->request->get('phone_mobile'))))
|
||||||
{
|
$error_array['phone_mobile'] = 'Invalid mobile phone number.';
|
||||||
$error_array['phone_mobile'] = 'Invalid mobile phone number.'
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO: validate vehicles
|
// TODO: validate vehicles
|
||||||
|
|
||||||
|
|
@ -693,12 +691,12 @@ class CMBCustomerHandler implements CustomerHandlerInterface
|
||||||
{
|
{
|
||||||
if (empty($mobile_number))
|
if (empty($mobile_number))
|
||||||
return true;
|
return true;
|
||||||
|
if (strlen($mobile_number) != 9)
|
||||||
|
return false;
|
||||||
|
if(preg_match('/^\d+$/',$mobile_number))
|
||||||
|
return true;
|
||||||
|
|
||||||
// parse string in case multiple numbers are entered separated by
|
return false;
|
||||||
// either a space, a slash, a backslash, a pipe or a comma
|
|
||||||
$delimiters = [',', ' ', '\\', '/', '|'];
|
|
||||||
$clean_mobile = str_replace($delimiters, $delimiters[0], $mobile_number);
|
|
||||||
$mnumber_array = explode($delimiters[0], $clean_mobile);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// check if datatable filter is present and append to query
|
// check if datatable filter is present and append to query
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue