X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Fsvc_phone.pm;h=65a98d25ae7cb3d7a44b1e4aa4d2f1f051fd912e;hb=4109791a9b80df968edaf2e71da8ebcfb8882be3;hp=3cc1adc66769ac901d1ebb63c7bfad568f159a9b;hpb=f6d64a9f735b666e876cf1a42e5ca16169ba7870;p=freeside.git diff --git a/FS/FS/svc_phone.pm b/FS/FS/svc_phone.pm index 3cc1adc66..65a98d25a 100644 --- a/FS/FS/svc_phone.pm +++ b/FS/FS/svc_phone.pm @@ -173,6 +173,15 @@ sub table_info { select_label => 'domain', disable_inventory => 1, }, + 'sms_carrierid' => { label => 'SMS Carrier', + type => 'select', + select_table => 'cdr_carrier', + select_key => 'carrierid', + select_label => 'carriername', + disable_inventory => 1, + }, + 'sms_account' => { label => 'SMS Carrier Account', }, + 'max_simultaneous' => { label=>'Maximum number of simultaneous users' }, 'locationnum' => { label => 'E911 location', disable_inventory => 1, @@ -288,9 +297,8 @@ sub insert { #false laziness w/cust_pkg.pm... move this to location_Mixin? that would #make it more of a base class than a mixin... :) - if ( $options{'cust_location'} - && ( ! $self->locationnum || $self->locationnum == -1 ) ) { - my $error = $options{'cust_location'}->insert; + if ( $options{'cust_location'} ) { + my $error = $options{'cust_location'}->find_or_insert; if ( $error ) { $dbh->rollback if $oldAutoCommit; return "inserting cust_location (transaction rolled back): $error"; @@ -359,8 +367,6 @@ sub delete { } -# the delete method can be inherited from FS::Record - =item replace OLD_RECORD Replaces the OLD_RECORD with this one in the database. If there is an error, @@ -478,6 +484,9 @@ sub check { || $self->ut_textn('phone_name') || $self->ut_foreign_keyn('pbxsvc', 'svc_pbx', 'svcnum' ) || $self->ut_foreign_keyn('domsvc', 'svc_domain', 'svcnum' ) + || $self->ut_foreign_keyn('sms_carrierid', 'cdr_carrier', 'carrierid' ) + || $self->ut_alphan('sms_account') + || $self->ut_numbern('max_simultaneous') || $self->ut_foreign_keyn('locationnum', 'cust_location', 'locationnum') || $self->ut_numbern('forwarddst') || $self->ut_textn('email') @@ -638,6 +647,26 @@ sub radius_groups { (); } +=item sms_cdr_carrier + +=cut + +sub sms_cdr_carrier { + my $self = shift; + return '' unless $self->sms_carrierid; + qsearchs('cdr_carrier', { 'carrierid' => $self->sms_carrierid } ); +} + +=item sms_carriername + +=cut + +sub sms_carriername { + my $self = shift; + my $cdr_carrier = $self->sms_cdr_carrier or return ''; + $cdr_carrier->carriername; +} + =item phone_device Returns any FS::phone_device records associated with this service.