diff options
Diffstat (limited to 'FS/FS/svc_phone.pm')
| -rw-r--r-- | FS/FS/svc_phone.pm | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/FS/FS/svc_phone.pm b/FS/FS/svc_phone.pm index a599ea227..adf7a6c56 100644 --- a/FS/FS/svc_phone.pm +++ b/FS/FS/svc_phone.pm @@ -13,6 +13,7 @@ use FS::phone_device; use FS::svc_pbx; use FS::svc_domain; use FS::cust_location; +use FS::phone_avail; $me = '[' . __PACKAGE__ . ']'; $DEBUG = 0; @@ -262,6 +263,16 @@ sub delete { } } + my @phone_avail = qsearch('phone_avail', { 'svcnum' => $self->svcnum } ); + foreach my $phone_avail ( @phone_avail ) { + $phone_avail->svcnum(''); + my $error = $phone_avail->replace; + if ( $error ) { + $dbh->rollback if $oldAutoCommit; + return $error; + } + } + my $error = $self->SUPER::delete; if ( $error ) { $dbh->rollback if $oldAutoCommit; |
