diff options
author | Jonathan Prykop <jonathan@freeside.biz> | 2015-10-27 01:15:29 -0500 |
---|---|---|
committer | Jonathan Prykop <jonathan@freeside.biz> | 2015-10-27 01:15:29 -0500 |
commit | c594747d4f8a1467987b9b241930ea3cbf0d899c (patch) | |
tree | b9b24bf2b365561c416c896f3f97fb01b5090248 /FS/FS/queue.pm | |
parent | 27f72f8225edc0d903ce534613ad037b7baf3bcf (diff) |
RT#38765: Foreign key error during selfservice signup
Diffstat (limited to 'FS/FS/queue.pm')
-rw-r--r-- | FS/FS/queue.pm | 20 |
1 files changed, 19 insertions, 1 deletions
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; ''; |