I've migrated this from #1008800: UK phone numbers only display as "+44-", comment 34:

In the 17 Feb dev version (once I'd got rid of #1444442: Fatal error) a regular UK phone number now displays correctly.

But UK mobile numbers don't work at all. As soon as I change the leading number to a 7 (which is the only thing that specifies a mobile number), I get an error:
"70 1234 5678" is not a valid United Kingdom phone number, it should be a 10 digit number like "99 9999 9999", with optional leading "0"

The only way to make it work is to untick the "Enable country level validation" checkbox in the field config.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

dddbbb’s picture

Same problem here.

ckng’s picture

Status: Active » Needs review
FileSize
482 bytes

Please test out the attached patch.

dddbbb’s picture

The patch in #2 works for me but I just know that my client is going to ask why the leading 0 is automatically removed...

I also tested the results on my Android phone (Dolphin browser) and the phone number was not clickable (as in touch to call number). I guess this is a probably a separate issue though.

samw’s picture

Patch worked fine for me, but I also took the liberty of adding 08* non-geographic numbers as well, since I was getting similar errors with those. Does this still work for people?

g1smd’s picture

> "70 1234 5678" is not a valid United Kingdom phone number"

This isn't a mobile number. It's a premium rate Personal Number. It is important to use a "real" number (or at least a "possible" number from a valid range) as an example.

UK mobile numbers begin 074, 075, 07624, 077, 078, 079 (and will likely also use 073, 072, and 071 in the future).

The patch lists 08 numbers as non-geographic. 03 numbers are also non-geographic, as are 0500 numbers.

Some 0800 numbers and all 0500 numbers are a digit shorter than all others with nine NSN digits instead of ten. The patch allows all 08 numbers to be a digit shorter, not just those ranges that actually are a digit shorter.

I have recently generated a complete set of validation and formatting RegEx patterns for every UK number range and number type. It's too long to reproduce here and it would be difficult to maintain multiple copies. This can be seen at:
http://www.aa-asterisk.org.uk/index.php/Regular_Expressions_for_Validati...
The first section of the page shows patterns that can be used to identify whether the number is valid and the number type.
The second section shows the various patterns used for formatting each number range.

The code works to the formats listed at:
http://www.aa-asterisk.org.uk/index.php/Number_format
noting the complexities detailed in:
http://www.aa-asterisk.org.uk/index.php/01_numbers
http://www.aa-asterisk.org.uk/index.php/02_numbers
http://www.aa-asterisk.org.uk/index.php/Mixed_areas
and other pages.

g1smd’s picture

I have rewritten the GB module to cover all UK numbers and will be submitting it as soon as it has been tested.

dddbbb’s picture

What's the latest regarding this issue?

g1smd’s picture

Repo owner is still AWOL. I have code ready for 3 months.

goodale’s picture

Would you be able to you post the code anyhow? This still seems to be the most functional phone number module despite the repo owner's absence.

ckng’s picture

@g1smd, if you have a working fix, please supply the correct patch.

The initial patch has been there for review for so long, since nobody is reviewing it, it is likely other don't need it that much.

I may not have time to work on it currently, but I do still apply reviewed patch.

dddbbb’s picture

This still seems to be the most functional phone number module despite the repo owner's absence.

@goodale A new module option popped up earlier this year that seems very promising:

https://drupal.org/project/telephone

Slightly different approach so I guess it depends on your use case but I'm having success with it.

ckng’s picture

Issue summary: View changes
Status: Needs review » Needs work

Available patches are not working for all cases, if anyone has a better fix, please do so.

jsibley’s picture

No progress for the last 8 months? What are people with those phone numbers supposed to do?

togermano’s picture

Thanks cck_phone-uk_mobile-1450146-4.patch fixed my websites problem :) you rock!!

Pimmy’s picture

Pretty standard UK phone numbers like these ones also doesnt work in 7.x-1.0-beta1 (not accepted at all):
0500 41 41 41 (ScrewFix telephone order (landline friendly))
03330 11 21 12 (ScrewFix telephone order (mobile friendly))

Additionally '0345 077 8888' (HomeBase customer service) is throwing 'Notice' messages:
Notice: Undefined offset: 8 in format_gb_phone_number() (line 122 of /home/content/87/10103787/html/sites/all/modules/phone/include/phone.gb.inc).

kscheirer’s picture

Status: Needs work » Reviewed & tested by the community

Based on #14