diff options
| author | Mark Wells <mark@freeside.biz> | 2012-07-10 14:54:22 -0700 |
|---|---|---|
| committer | Mark Wells <mark@freeside.biz> | 2012-07-10 14:54:22 -0700 |
| commit | c782c3a735da8166b6a61a559d9398d91f750f15 (patch) | |
| tree | 80b107c3728ec3149d87af39bb24265e7dbe235e | |
| parent | cc010a07023a2e278a5eac2835a971b2ae83b55f (diff) | |
fix uncancellation of services, from #17518
| -rw-r--r-- | FS/FS/cust_pkg.pm | 32 |
1 files changed, 18 insertions, 14 deletions
diff --git a/FS/FS/cust_pkg.pm b/FS/FS/cust_pkg.pm index 1c79ed752..81ec813c7 100644 --- a/FS/FS/cust_pkg.pm +++ b/FS/FS/cust_pkg.pm @@ -974,21 +974,25 @@ sub uncancel { } my $svc_error = $svc_x->insert; - if ( $svc_error && $options{svc_fatal} ) { - $dbh->rollback if $oldAutoCommit; - return $svc_error; - } else { - my $cust_svc = qsearchs('cust_svc', { 'svcnum' => $svc_x->svcnum }); - if ( $cust_svc ) { - my $cs_error = $cust_svc->delete; - if ( $cs_error ) { - $dbh->rollback if $oldAutoCommit; - return $cs_error; + if ( $svc_error ) { + if ( $options{svc_fatal} ) { + $dbh->rollback if $oldAutoCommit; + return $svc_error; + } else { + push @svc_errors, $svc_error; + # is this necessary? svc_Common::insert already deletes the + # cust_svc if inserting svc_x fails. + my $cust_svc = qsearchs('cust_svc', { 'svcnum' => $svc_x->svcnum }); + if ( $cust_svc ) { + my $cs_error = $cust_svc->delete; + if ( $cs_error ) { + $dbh->rollback if $oldAutoCommit; + return $cs_error; + } } - } - } - push @svc_errors, $svc_error if $svc_error; - } + } # svc_fatal + } # svc_error + } #foreach $h_cust_svc #these are pretty rare, but should handle them # - dsl_device (mac addresses) |
