[freeside-commits] branch FREESIDE_3_BRANCH updated. 97105665715dd56465db126082919a319c71c2e2

Ivan ivan at 420.am
Tue May 13 12:35:10 PDT 2014


The branch, FREESIDE_3_BRANCH has been updated
       via  97105665715dd56465db126082919a319c71c2e2 (commit)
      from  3a69843e23952a529f2a110e28fcdfbcb691def1 (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 97105665715dd56465db126082919a319c71c2e2
Author: Ivan Kohler <ivan at freeside.biz>
Date:   Tue May 13 12:35:09 2014 -0700

    remove deleted contacts from packages, RT#28949

diff --git a/FS/FS/contact.pm b/FS/FS/contact.pm
index 5c3981b..4a1fb39 100644
--- a/FS/FS/contact.pm
+++ b/FS/FS/contact.pm
@@ -11,6 +11,7 @@ use FS::cust_location;
 use FS::contact_phone;
 use FS::contact_email;
 use FS::queue;
+use FS::cust_pkg;
 
 =head1 NAME
 
@@ -211,6 +212,15 @@ sub delete {
   local $FS::UID::AutoCommit = 0;
   my $dbh = dbh;
 
+  foreach my $cust_pkg ( $self->cust_pkg ) {
+    $cust_pkg->contactnum('');
+    my $error = $cust_pkg->replace;
+    if ( $error ) {
+      $dbh->rollback if $oldAutoCommit;
+      return $error;
+    }
+  }
+
   foreach my $object ( $self->contact_phone, $self->contact_email ) {
     my $error = $object->delete;
     if ( $error ) {
@@ -491,6 +501,12 @@ sub cust_main {
   qsearchs('cust_main', { 'custnum' => $self->custnum  } );
 }
 
+sub cust_pkg {
+  my $self = shift;
+  qsearch('cust_pkg', { 'contactnum' => $self->contactnum  } );
+}
+
+
 sub by_selfservice_email {
   my($class, $email) = @_;
 

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

Summary of changes:
 FS/FS/contact.pm |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)




More information about the freeside-commits mailing list