referral import fixes, RT#4427
[freeside.git] / FS / FS / svc_phone.pm
index c356344..5dcb39e 100644 (file)
@@ -182,17 +182,20 @@ sub check {
   my $conf = new FS::Conf;
 
   my $phonenum = $self->phonenum;
+  my $phonenum_check_method;
   if ( $conf->exists('svc_phone-allow_alpha_phonenum') ) {
     $phonenum =~ s/\W//g;
+    $phonenum_check_method = 'ut_alpha';
   } else {
     $phonenum =~ s/\D//g;
+    $phonenum_check_method = 'ut_number';
   }
   $self->phonenum($phonenum);
 
   my $error = 
     $self->ut_numbern('svcnum')
     || $self->ut_numbern('countrycode')
-    || $self->ut_number('phonenum')
+    || $self->$phonenum_check_method('phonenum')
     || $self->ut_anything('sip_password')
     || $self->ut_numbern('pin')
     || $self->ut_textn('phone_name')
@@ -221,7 +224,7 @@ sucessful authentication, false if no match.
 
 sub check_pin {
   my($self, $check_pin) = @_;
-  $check_pin eq $self->pin;
+  length($self->pin) && $check_pin eq $self->pin;
 }
 
 =item radius_reply