package FS::svc_phone;
use strict;
-use vars qw( @ISA );
+use vars qw( @ISA @pw_set );
#use FS::Record qw( qsearch qsearchs );
use FS::svc_Common;
@ISA = qw( FS::svc_Common );
+#avoid l 1 and o O 0
+@pw_set = ( 'a'..'k', 'm','n', 'p-z', 'A'..'N', 'P'..'Z' , '2'..'9' );
+
=head1 NAME
FS::svc_phone - Object methods for svc_phone records
Voicemail PIN
+=item phone_name
+
=back
=head1 METHODS
disable_select => 1,
},
'sip_password' => 'SIP password',
+ 'name' => 'Name',
},
};
}
sub label {
my $self = shift;
- $self->phonenum; #XXX format it better
+ my $phonenum = $self->phonenum; #XXX format it better
+ my $label = $phonenum;
+ $label .= ' ('.$self->phone_name.')' if $self->phone_name;
+ $label;
}
=item insert
$self->ut_numbern('svcnum')
|| $self->ut_numbern('countrycode')
|| $self->ut_number('phonenum')
- || $self->ut_anythingn('sip_password')
+ || $self->ut_anything('sip_password')
|| $self->ut_numbern('pin')
+ || $self->ut_textn('phone_name')
;
return $error if $error;
$self->countrycode(1) unless $self->countrycode;
+ unless ( length($self->sip_password) ) {
+
+ $self->sip_password(
+ join('', map $pw_set[ int(rand $#pw_set) ], (0..16) )
+ );
+
+ }
+
$self->SUPER::check;
}