[freeside-commits] branch FREESIDE_2_3_BRANCH updated. 24377ec7e7ec840cad72003262f6fe3b7158cafb

Mark Wells mark at 420.am
Sat Apr 27 15:29:08 PDT 2013


The branch, FREESIDE_2_3_BRANCH has been updated
       via  24377ec7e7ec840cad72003262f6fe3b7158cafb (commit)
      from  469062ef38a0d13c4db6d6f9e730829e2235a5f5 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 24377ec7e7ec840cad72003262f6fe3b7158cafb
Author: Mark Wells <mark at freeside.biz>
Date:   Sat Apr 27 15:22:11 2013 -0700

    when uncanceling services, clean up those that failed to export, from #22385

diff --git a/FS/FS/cust_pkg.pm b/FS/FS/cust_pkg.pm
index b48fcd0..95b39ba 100644
--- a/FS/FS/cust_pkg.pm
+++ b/FS/FS/cust_pkg.pm
@@ -979,15 +979,20 @@ sub uncancel {
         $dbh->rollback if $oldAutoCommit;
         return $svc_error;
       } else {
+        # if we've failed to insert the svc_x object, svc_Common->insert 
+        # will have removed the cust_svc already.  if not, then both records
+        # were inserted but we failed for some other reason (export, most 
+        # likely).  in that case, report the error and delete the records.
         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 ) {
+          # except if export_insert failed, export_delete probably won't be
+          # much better
+          local $FS::svc_Common::noexport_hack = 1;
+          my $cleanup_error = $svc_x->delete; # also deletes cust_svc
+          if ( $cleanup_error ) { # and if THAT fails, then run away
             $dbh->rollback if $oldAutoCommit;
-            return $cs_error;
+            return $cleanup_error;
           }
         }
       } # svc_fatal

-----------------------------------------------------------------------

Summary of changes:
 FS/FS/cust_pkg.pm |   15 ++++++++++-----
 1 files changed, 10 insertions(+), 5 deletions(-)




More information about the freeside-commits mailing list