Resolve "Final CMB Fixes" #1229

Merged
korina.cordero merged 102 commits from 270-final-cmb-fixes into master 2020-04-03 02:54:29 +00:00
Showing only changes of commit 2fb24e4e13 - Show all commits

View file

@ -320,7 +320,11 @@ class CMBCustomerHandler implements CustomerHandlerInterface
$nerror_array = [];
$verror_array = [];
// TODO: validate mobile numbers
if (!($this->validateMobileNumber($req->request->get('phone_mobile'))))
{
$error_array['phone_mobile'] = 'Invalid mobile phone number.'
}
// TODO: validate vehicles
// custom validation for vehicles
@ -685,6 +689,18 @@ class CMBCustomerHandler implements CustomerHandlerInterface
}
}
protected function validateMobileNumber($mobile_number)
{
if (empty($mobile_number))
return true;
// parse string in case multiple numbers are entered separated by
// 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
protected function setQueryFilters($datatable, &$query) {
if (isset($datatable['query']['data-rows-search']) && !empty($datatable['query']['data-rows-search'])) {