diff options
author | cvs2git <cvs2git> | 2009-10-11 02:42:17 +0000 |
---|---|---|
committer | cvs2git <cvs2git> | 2009-10-11 02:42:17 +0000 |
commit | a83a000a027d1272e813259d09230d701d84df64 (patch) | |
tree | 71500c957e6d7db3e1ad3d59e74ca7bbb14e44ff /FS/FS/svc_phone.pm | |
parent | 097a12385d80ef52f37d4cc2bb93bc3f81e6f8e6 (diff) | |
parent | 0b69c091543b56a45f2ae6b8718fc67f381a6686 (diff) |
This commit was manufactured by cvs2svn to create branchfreeside_1_9_1
'FREESIDE_1_9_BRANCH'.
Diffstat (limited to 'FS/FS/svc_phone.pm')
-rw-r--r-- | FS/FS/svc_phone.pm | 49 |
1 files changed, 47 insertions, 2 deletions
diff --git a/FS/FS/svc_phone.pm b/FS/FS/svc_phone.pm index ce767d5ee..11a5a0ee0 100644 --- a/FS/FS/svc_phone.pm +++ b/FS/FS/svc_phone.pm @@ -3,10 +3,11 @@ package FS::svc_phone; use strict; use vars qw( @ISA @pw_set $conf ); use FS::Conf; -use FS::Record qw( qsearch qsearchs ); +use FS::Record qw( qsearch qsearchs dbh ); use FS::Msgcat qw(gettext); use FS::svc_Common; use FS::part_svc; +use FS::phone_device; @ISA = qw( FS::svc_Common ); @@ -102,7 +103,7 @@ sub table_info { disable_select => 1, }, 'sip_password' => 'SIP password', - 'name' => 'Name', + 'phone_name' => 'Name', }, }; } @@ -151,6 +152,39 @@ Delete this record from the database. =cut +sub delete { + my $self = shift; + + local $SIG{HUP} = 'IGNORE'; + local $SIG{INT} = 'IGNORE'; + local $SIG{QUIT} = 'IGNORE'; + local $SIG{TERM} = 'IGNORE'; + local $SIG{TSTP} = 'IGNORE'; + local $SIG{PIPE} = 'IGNORE'; + + my $oldAutoCommit = $FS::UID::AutoCommit; + local $FS::UID::AutoCommit = 0; + my $dbh = dbh; + + foreach my $phone_device ( $self->phone_device ) { + my $error = $phone_device->delete; + if ( $error ) { + $dbh->rollback if $oldAutoCommit; + return $error; + } + } + + my $error = $self->SUPER::delete; + if ( $error ) { + $dbh->rollback if $oldAutoCommit; + return $error; + } + + $dbh->commit or die $dbh->errstr if $oldAutoCommit; + ''; + +} + # the delete method can be inherited from FS::Record =item replace OLD_RECORD @@ -326,6 +360,17 @@ sub radius_groups { (); } +=item phone_device + +Returns any FS::phone_device records associated with this service. + +=cut + +sub phone_device { + my $self = shift; + qsearch('phone_device', { 'svcnum' => $self->svcnum } ); +} + =back =head1 BUGS |