summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorC.J. Adams-Collier <cjac@colliertech.org>2014-09-18 11:56:02 -0700
committerC.J. Adams-Collier <cjac@colliertech.org>2014-09-18 11:56:02 -0700
commit3c036f878548a8aab8ff88911a7b238e20d68bbe (patch)
treeae3460e02097e8541553d1aea6046ab67b05d0e2
parentd54644e17fc84f3853ca020ae68605e7900855fb (diff)
FS RT #30831 - passing the ISO 3166-1 alpha-2 country code to ut_phonen
-rw-r--r--FS/FS/Record.pm4
-rw-r--r--FS/FS/svc_alarm.pm4
2 files changed, 5 insertions, 3 deletions
diff --git a/FS/FS/Record.pm b/FS/FS/Record.pm
index 4915b96ef..51cb6dc8e 100644
--- a/FS/FS/Record.pm
+++ b/FS/FS/Record.pm
@@ -2649,8 +2649,8 @@ sub ut_alpha_lower {
Check/untaint phone numbers. May be null. If there is an error, returns
the error, otherwise returns false.
-Takes an optional two-letter ISO country code; without it or with unsupported
-countries, ut_phonen simply calls ut_alphan.
+Takes an optional two-letter ISO 3166-1 alpha-2 country code; without
+it or with unsupported countries, ut_phonen simply calls ut_alphan.
=cut
diff --git a/FS/FS/svc_alarm.pm b/FS/FS/svc_alarm.pm
index afb4c1db3..808a5d3a9 100644
--- a/FS/FS/svc_alarm.pm
+++ b/FS/FS/svc_alarm.pm
@@ -197,13 +197,15 @@ sub check {
my $x = $self->setfixed;
return $x unless ref $x;
+ my $iso3166 = $self->cust_main->ship_location->country();
+
my $error =
$self->ut_numbern('svcnum')
|| $self->ut_text('acctnum')
|| $self->ut_alphan('_password')
|| $self->ut_textn('location')
|| $self->ut_numbern('cs_receiver')
- || $self->ut_phonen('cs_phonenum')
+ || $self->ut_phonen('cs_phonenum', $iso3166)
|| $self->ut_alphan('serialnum')
|| $self->ut_foreign_key('alarmsystemnum', 'alarm_system', 'systemnum')
|| $self->ut_foreign_key('alarmtypenum', 'alarm_type', 'typenum')