FS RT #30831 - passing the ISO 3166-1 alpha-2 country code to ut_phonen
authorC.J. Adams-Collier <cjac@colliertech.org>
Thu, 18 Sep 2014 18:56:02 +0000 (11:56 -0700)
committerC.J. Adams-Collier <cjac@colliertech.org>
Thu, 18 Sep 2014 18:56:02 +0000 (11:56 -0700)
FS/FS/Record.pm
FS/FS/svc_alarm.pm

index 4915b96..51cb6dc 100644 (file)
@@ -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
 
index afb4c1d..808a5d3 100644 (file)
@@ -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')