[freeside-commits] branch FREESIDE_2_3_BRANCH updated. c782c3a735da8166b6a61a559d9398d91f750f15

Mark Wells mark at 420.am
Tue Jul 10 14:56:00 PDT 2012


The branch, FREESIDE_2_3_BRANCH has been updated
       via  c782c3a735da8166b6a61a559d9398d91f750f15 (commit)
      from  cc010a07023a2e278a5eac2835a971b2ae83b55f (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 c782c3a735da8166b6a61a559d9398d91f750f15
Author: Mark Wells <mark at freeside.biz>
Date:   Tue Jul 10 14:54:22 2012 -0700

    fix uncancellation of services, from #17518

diff --git a/FS/FS/cust_pkg.pm b/FS/FS/cust_pkg.pm
index 1c79ed7..81ec813 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)

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

Summary of changes:
 FS/FS/cust_pkg.pm |   32 ++++++++++++++++++--------------
 1 files changed, 18 insertions(+), 14 deletions(-)




More information about the freeside-commits mailing list