Page 1 of 1

Adding Mobile phone numbers - New Zealand

Posted: Mon Apr 11, 2016 10:05 pm
by dcrobertson01
Hi - I am having some problems adding New Zealand phone numbers. I can add an ordinary nine digit number - such as 031234567, but when adding mobile numbers and free phone numbers, I get problems.

Mobile numbers:
I can add 021123456, and 02112345678, but not 0211234567

Free phone numbers
I can add 080012345 and 0800123456 and 080012345678, but not 08001234567

I thought it was something to do with models/person.php, but am not sure now. It looks to me as though it should the numbers correctly. But I'm a bit rusty on these things :-)

Code: Select all

if ($this->data[$this->alias]['addr_country'] == 'New Zealand') {
				$this->validate['addr_postalcode']['postal'] = array(
					'rule' => array('postal', '/^[0-9]{4}/', 'nz'),
					'message' => 'You must enter a valid New Zealand postal code',
				);
				$this->validate['home_phone']['phone']['rule'] = $this->validate['work_phone']['phone']['rule'] =
					$this->validate['mobile_phone']['phone']['rule'] = $this->validate['alternate_work_phone']['phone']['rule'] =
					$this->validate['alternate_mobile_phone']['phone']['rule'] = array('phone', '/^((03|04|06|07|09)\d{7})|((021|022|026|027|028|029)\d{6,8})|((0508|0800|0900)\d{5,8})$/');
			}
Also - numbers that will validate will also validate with additional characters on the end. eg 0211234567812345678910 will validate and get entered into the data base. 02112345678thisshouldbestopped will validate, but only the numerical part will get added to the data base.

This seems to stop it happening.

Code: Select all

$this->validate['alternate_mobile_phone']['phone']['rule'] = array('phone', '/(^(03|04|06|07|09)\d{7}$|^(021|022|026|027|028|029)\d{6,8}$|^(0508|0800|0900)\d{5,8}$)/');
But still does not validate my phone number :-(

Re: Adding Mobile phone numbers - New Zealand

Posted: Mon Apr 11, 2016 11:51 pm
by GregS
The code I put in for New Zealand numbers was done quickly; it's all going to be obsoleted with a better method in the new version. If you're just setting this up as a demonstration, maybe we can put a pin in this particular piece for the moment?

Re: Adding Mobile phone numbers - New Zealand

Posted: Fri Apr 14, 2017 2:06 am
by Clifford
GregS wrote:The code I put in for New Zealand numbers was done quickly; it's all going to be obsoleted with a better method in the new version. If you're just setting this up as a demonstration, maybe we can put a pin in this particular piece for the moment?
Cool, when is the new version coming out?

Re: Adding Mobile phone numbers - New Zealand

Posted: Fri Apr 14, 2017 11:54 am
by GregS
Clifford wrote:Cool, when is the new version coming out?
I don't have a definitive date. It's been delayed now for far longer than I expected due to my being very busy with the projects that pay the bills. I'm working my way through adding automated testing, so that when it's released I can be confident that it's solid and not a big step backwards in terms of reliability.

Re: Adding Mobile phone numbers - New Zealand

Posted: Sat Sep 01, 2018 5:23 pm
by GregS
The new version of Zuluru has finally been released! See the release notice in the Announcements forum.