Merge branch '270-final-cmb-fixes' of gitlab.com:jankstudio/resq into 340-cmb-walk-in-customer-form
This commit is contained in:
commit
6a944eeb16
1 changed files with 15 additions and 1 deletions
|
|
@ -320,7 +320,9 @@ 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 +687,18 @@ class CMBCustomerHandler implements CustomerHandlerInterface
|
|||
}
|
||||
}
|
||||
|
||||
protected function validateMobileNumber($mobile_number)
|
||||
{
|
||||
if (empty($mobile_number))
|
||||
return true;
|
||||
if (strlen($mobile_number) != 9)
|
||||
return false;
|
||||
if(preg_match('/^\d+$/',$mobile_number))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// 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'])) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue