X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=FS%2FFS%2Fqueue.pm;h=a0654a13c94ebc55a705c31cb6a88ecba13e26e7;hp=67d124d02207ffb60ca8f275f09ea552c19cba78;hb=57bb423fe457ba4e13726877f53bcdf944f828f8;hpb=df94942698dac9ecf31b8d1eb7a0d383b247ee17 diff --git a/FS/FS/queue.pm b/FS/FS/queue.pm index 67d124d02..a0654a13c 100644 --- a/FS/FS/queue.pm +++ b/FS/FS/queue.pm @@ -206,9 +206,27 @@ sub delete { } } + my $oldAutoCommit = $FS::UID::AutoCommit; + local $FS::UID::AutoCommit = 0; + my $dbh = dbh; + + foreach my $cust_pay_pending (qsearch('cust_pay_pending',{ jobnum => $self->jobnum })) { + $cust_pay_pending->set('jobnum',''); + my $error = $cust_pay_pending->replace(); + if ( $error ) { + $dbh->rollback if $oldAutoCommit; + return $error; + } + } + my $error = $self->SUPER::delete; - return $error if $error; + if ( $error ) { + $dbh->rollback if $oldAutoCommit; + return $error; + } + $dbh->commit or die $dbh->errstr if $oldAutoCommit; + unlink $reportname if $reportname; '';