1 package FS::device_Common;
5 use FS::Record qw( qsearch dbh ); # qsearchs );
9 FS::device_Common - Base class for svc_X classes which have associated X_devices
13 package FS::svc_newservice
14 use base qw( FS::device_Common FS::svc_Common );
22 ( my $device_table = $self->table ) =~ s/^svc_//;
23 $device_table.'_device';
28 my $device_table = $self->_device_table;
29 eval "use FS::$device_table;";
36 qsearch($self->device_table, { 'svcnum' => $self->svcnum } );
42 local $SIG{HUP} = 'IGNORE';
43 local $SIG{INT} = 'IGNORE';
44 local $SIG{QUIT} = 'IGNORE';
45 local $SIG{TERM} = 'IGNORE';
46 local $SIG{TSTP} = 'IGNORE';
47 local $SIG{PIPE} = 'IGNORE';
49 my $oldAutoCommit = $FS::UID::AutoCommit;
50 local $FS::UID::AutoCommit = 0;
53 foreach my $device ( $self->device_objects ) {
54 my $error = $device->delete;
56 $dbh->rollback if $oldAutoCommit;
61 my $error = $self->NEXT::delete;
63 $dbh->rollback if $oldAutoCommit;
67 $dbh->commit or die $dbh->errstr if $oldAutoCommit;