[freeside-commits] branch master updated. cd7cfb165d6d843671ec11022f38ecd484812f9f

Jonathan Prykop jonathan at 420.am
Mon Mar 9 21:02:58 PDT 2015


The branch, master has been updated
       via  cd7cfb165d6d843671ec11022f38ecd484812f9f (commit)
      from  bbc7ccd18c43141c11a43b7ee4a80801120b54d1 (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 cd7cfb165d6d843671ec11022f38ecd484812f9f
Author: Jonathan Prykop <jonathan at freeside.biz>
Date:   Mon Mar 9 23:02:26 2015 -0500

    RT#29406: Per customer option to display service address of package on invoice [slight refactor]

diff --git a/FS/FS/cust_main.pm b/FS/FS/cust_main.pm
index 427112a..74433d7 100644
--- a/FS/FS/cust_main.pm
+++ b/FS/FS/cust_main.pm
@@ -464,8 +464,6 @@ sub insert {
     }
   }
 
-  $self->_loc_change();
-
   warn "  inserting $self\n"
     if $DEBUG > 1;
 
@@ -1338,8 +1336,6 @@ sub replace {
     $self->set($l.'num', $new_loc->locationnum);
   } #for $l
 
-  $self->_loc_change($old);
-
   # replace the customer record
   my $error = $self->SUPER::replace($old);
 
@@ -1642,6 +1638,11 @@ sub check {
     $self->ss("$1-$2-$3");
   }
 
+  #turn off invoice_ship_address if ship & bill are the same
+  if ($self->bill_locationnum eq $self->ship_locationnum) {
+    $self->invoice_ship_address('');
+  }
+
   # cust_main_county verification now handled by cust_location check
 
   $error =
@@ -1922,6 +1923,21 @@ sub check {
   $self->SUPER::check;
 }
 
+=item replace_check
+
+Additional checks for replace only.
+
+=cut
+
+sub replace_check {
+  my ($new,$old) = @_;
+  #preserve old value if global config is set
+  if ($old && $conf->exists('invoice-ship_address')) {
+    $new->invoice_ship_address($old->invoice_ship_address);
+  }
+  return '';
+}
+
 =item addr_fields 
 
 Returns a list of fields which have ship_ duplicates.
@@ -4782,22 +4798,6 @@ sub process_bill_and_collect {
   $cust_main->bill_and_collect( %$param );
 }
 
-#hook for insert/replace
-#runs after locations have been set
-#but before custnum has been set (for insert)
-sub _loc_change {
-  my $self = shift;
-  my $old = shift;
-  #turn off invoice_ship_address if ship & bill are the same
-  if ($self->bill_locationnum eq $self->ship_locationnum) {
-    $self->invoice_ship_address('');
-  }
-  #preserve old value if global config is set (replace only)
-  elsif ($old && $conf->exists('invoice-ship_address')) {
-    $self->invoice_ship_address($old->invoice_ship_address);
-  }
-}
-
 #starting to take quite a while for big dbs
 #   (JRNL: journaled so it only happens once per database)
 # - seq scan of h_cust_main (yuck), but not going to index paycvv, so

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

Summary of changes:
 FS/FS/cust_main.pm |   40 ++++++++++++++++++++--------------------
 1 file changed, 20 insertions(+), 20 deletions(-)




More information about the freeside-commits mailing list