[freeside-commits] branch master updated. 201962afb41285b50dc853028b7b1f1ef83039d2

Mark Wells mark at 420.am
Tue Oct 1 12:33:10 PDT 2013


The branch, master has been updated
       via  201962afb41285b50dc853028b7b1f1ef83039d2 (commit)
       via  ce86623467df8a58fc8833a490ff69f447df4b25 (commit)
      from  e7b2e4ef48c2fdc509dba13495d2910c90564929 (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 201962afb41285b50dc853028b7b1f1ef83039d2
Author: Mark Wells <mark at freeside.biz>
Date:   Tue Oct 1 12:30:58 2013 -0700

    when a service is deleted, transfer its tickets to the owning customer, #25180

diff --git a/FS/FS/cust_svc.pm b/FS/FS/cust_svc.pm
index d6d7d4c..9582090 100644
--- a/FS/FS/cust_svc.pm
+++ b/FS/FS/cust_svc.pm
@@ -113,6 +113,10 @@ my $rt_session;
 
 sub delete {
   my $self = shift;
+
+  my $cust_pkg = $self->cust_pkg;
+  my $custnum = $cust_pkg->custnum if $cust_pkg;
+
   my $error = $self->SUPER::delete;
   return $error if $error;
 
@@ -126,7 +130,15 @@ sub delete {
     $links->Limit(FIELD => 'Target', 
                   VALUE => 'freeside://freeside/cust_svc/'.$svcnum);
     while ( my $l = $links->Next ) {
-      my ($val, $msg) = $l->Delete;
+      my ($val, $msg);
+      if ( $custnum ) {
+        # re-link to point to the customer instead
+        ($val, $msg) =
+          $l->SetTarget('freeside://freeside/cust_main/'.$custnum);
+      } else {
+        # unlinked service
+        ($val, $msg) = $l->Delete;
+      }
       # can't do anything useful on error
       warn "error unlinking ticket $svcnum: $msg\n" if !$val;
     }

commit ce86623467df8a58fc8833a490ff69f447df4b25
Author: Mark Wells <mark at freeside.biz>
Date:   Tue Oct 1 12:30:51 2013 -0700

    fix upgrade warning

diff --git a/FS/FS/Schema.pm b/FS/FS/Schema.pm
index 16546b3..5ea24e4 100644
--- a/FS/FS/Schema.pm
+++ b/FS/FS/Schema.pm
@@ -4421,6 +4421,7 @@ sub tables_hashref {
       ],
       'primary_key' => 'confnum',
       'unique' => [ [ 'modenum', 'locale' ] ],
+      'index'  => [ ],
     },
 
     # name type nullability length default local

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

Summary of changes:
 FS/FS/Schema.pm   |    1 +
 FS/FS/cust_svc.pm |   14 +++++++++++++-
 2 files changed, 14 insertions(+), 1 deletions(-)




More information about the freeside-commits mailing list