=item delete
-Delete this record from the database.
+Delete this record from the database. Any corresponding queue_arg records are
+deleted as well
=cut
-# the delete method can be inherited from FS::Record
+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;
+
+ my @args = qsearch( 'queue_arg', { 'jobnum' => $self->jobnum } );
+
+ my $error = $self->SUPER::delete;
+ if ( $error ) {
+ $dbh->rollback if $oldAutoCommit;
+ return $error;
+ }
+
+ foreach my $arg ( @args ) {
+ $error = $arg->delete;
+ if ( $error ) {
+ $dbh->rollback if $oldAutoCommit;
+ return $error;
+ }
+ }
+
+ $dbh->commit or die $dbh->errstr if $oldAutoCommit;
+
+ '';
+
+}
=item replace OLD_RECORD
sub args {
my $self = shift;
- map $_->arg, qsearch( 'queue_arg', { 'jobnum' => $self->jobnum } );
+ map $_->arg, qsearch( 'queue_arg',
+ { 'jobnum' => $self->jobnum },
+ '',
+ 'ORDER BY argnum'
+ );
}
=back
=head1 VERSION
-$Id: queue.pm,v 1.1 2001-09-11 00:08:18 ivan Exp $
+$Id: queue.pm,v 1.3 2001-09-11 12:25:55 ivan Exp $
=head1 BUGS