X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Fpart_export%2Fbroadworks.pm;h=611bd00ecd557105d831ad15ea5ee7ff4a7af2dc;hb=ffa18709ee8a4d05e18d2d406cf73afe79e52524;hp=7a9ed70f4101ed57e288d1710bcdbdf6cfea0d96;hpb=6bc36a712285e9616a00ae38b136d7b8cd6cb58f;p=freeside.git diff --git a/FS/FS/part_export/broadworks.pm b/FS/FS/part_export/broadworks.pm index 7a9ed70f4..611bd00ec 100644 --- a/FS/FS/part_export/broadworks.pm +++ b/FS/FS/part_export/broadworks.pm @@ -6,7 +6,7 @@ use strict; use Tie::IxHash; use FS::Record qw(dbh qsearch qsearchs); use Locale::SubCountry; -use BroadWorks::OCI; +use Carp qw(carp); our $me = '[broadworks]'; our %client; # exportnum => client object @@ -42,11 +42,12 @@ number, this requires a svc_phone definition and a part_device. The "title" field ("external name") of the part_device must be one of the access device type names recognized by BroadWorks, such as "Polycom Soundpoint IP 550", "SNOM 320", or "Generic SIP Phone".

-

+

Each phone service must have a device linked before it will be functional. +Until then, authentication will be denied.

END ); -sub export_insert { +sub _export_insert { my($self, $svc_x) = (shift, shift); my $cust_main = $svc_x->cust_main; @@ -68,7 +69,7 @@ sub export_insert { ''; } -sub export_replace { +sub _export_replace { my($self, $svc_new, $svc_old) = @_; my $cust_main = $svc_new->cust_main; @@ -86,6 +87,11 @@ sub export_replace { newUserId => $newUserId ); return $message if !$success; + + if ( my $device = qsearchs('phone_device', { svcnum => $svc_new->svcnum }) ) { + # there's a Line/Port configured for the device, and it also needs to be renamed. + $error ||= $self->set_endpoint( $newUserId, $self->deviceName($device) ); + } } if ( $svc_old->phonenum ne $svc_new->phonenum ) { @@ -116,7 +122,7 @@ sub export_replace { ''; } -sub export_delete { +sub _export_delete { my ($self, $svc_x) = @_; my $cust_main = $svc_x->cust_main; @@ -157,6 +163,12 @@ sub export_delete { sub export_device_insert { my ($self, $svc_x, $device) = @_; + if ( $FS::svc_Common::noexport_hack ) { + carp 'export_device_insert() suppressed by noexport_hack' + if $self->option('debug'); + return; + } + if ( $device->count('svcnum = ?', $svc_x->svcnum) > 1 ) { return "This service already has a device."; } @@ -176,6 +188,13 @@ sub export_device_insert { sub export_device_replace { my ($self, $svc_x, $new_device, $old_device) = @_; + + if ( $FS::svc_Common::noexport_hack ) { + carp 'export_device_replace() suppressed by noexport_hack' + if $self->option('debug'); + return; + } + my $cust_main = $svc_x->cust_main; my $groupId = $self->groupId($cust_main); @@ -200,6 +219,12 @@ sub export_device_replace { sub export_device_delete { my ($self, $svc_x, $device) = @_; + if ( $FS::svc_Common::noexport_hack ) { + carp 'export_device_delete() suppressed by noexport_hack' + if $self->option('debug'); + return; + } + if ( $device->isa('FS::phone_device') ) { my $error = $self->set_endpoint( $self->userId($svc_x), '' ); return $error if $error;