okohll/agileBase — pull request #31 by g1smd (2012-08-05 21:33:50+00:00)
Title: TELEPHONE NUMBER FUNCTIONALITY.

Add telephone number formatting functionality for GB numbers in national or international format and for non-GB numbers in international format. User input is accepted in many common formats. For GB numbers, the +44 and 0 prefixes are usual, but those with non-standard +44 (0), 00 44 or 011 44 prefixes are also accepted. For GB numbers with the correct number of digits, the user input is reformatted with correct country code (if present), area code and local number splits, e.g. 00 44 (0) 203 000 5555 is reformatted as +44 20 3000 5555 and 01174 557 777 is reformatted as 0117 455 7777. Some UK numbers are one digit shorter, e.g. 01750 62555, 0800 333555 or 016977 3555, and these are catered for only in the area codes where these shorter numbers are actually allocated. Numbers entered with a digit missing in other area codes are now reformatted similar to 01 7775 5555 to alert the user to their potential input error. Numbers that are too short or too long to be GB telephone numbers are left as-is without reformatting. Non-GB numbers are deemed those that begin + but not +44. For non-GB numbers, the correct country code and national number split is made but the national number part always retains the spacing found in the original user input, e.g. +3 31 7777 8888 is reformatted as +33 1 7777 8888. For valid GB number ranges, the area code name (for geographic numbers) or the number type (for non-geographic numbers) is shown. Non-valid GB numbers (either non-valid range or incorrect length) should show either no name or 'invalid'. For non-GB numbers the country code name is usually shown (or 'unassigned', 'discontinued', etc, as appropriate).