mirror of
https://github.com/espocrm/espocrm.git
synced 2026-06-30 07:56:05 +00:00
phone validate strict
This commit is contained in:
@@ -210,6 +210,10 @@ class PhoneType
|
||||
return false;
|
||||
}
|
||||
|
||||
if ((string) $numberObj !== $number) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return $numberObj->isPossibleNumber();
|
||||
}
|
||||
|
||||
|
||||
@@ -1259,7 +1259,13 @@ class Import
|
||||
|
||||
private function formatPhoneNumber(string $value, Params $params): string
|
||||
{
|
||||
$value = trim($value);
|
||||
|
||||
if (str_starts_with($value, '+')) {
|
||||
if ($this->config->get('phoneNumberInternational')) {
|
||||
return $this->parsePhoneNumber($value, null);
|
||||
}
|
||||
|
||||
return $value;
|
||||
}
|
||||
|
||||
@@ -1269,6 +1275,11 @@ class Import
|
||||
|
||||
$code = strtoupper($params->getPhoneNumberCountry());
|
||||
|
||||
return $this->parsePhoneNumber($value, $code);
|
||||
}
|
||||
|
||||
private function parsePhoneNumber(string $value, ?string $code): string
|
||||
{
|
||||
try {
|
||||
$number = PhoneNumber::parse($value, $code);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user