X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Fcust_main.pm;h=7c26d89603cf0f70c85de4a6e990bea5bc15c859;hb=b041163aaf2e447e66899b0e4a530662431cc680;hp=b87fda4d62309e939b7fbbcae972df99bb3c1842;hpb=d7d7b020db58c4aa5be2521c38719df2ec0bacb2;p=freeside.git diff --git a/FS/FS/cust_main.pm b/FS/FS/cust_main.pm index b87fda4d6..7c26d8960 100644 --- a/FS/FS/cust_main.pm +++ b/FS/FS/cust_main.pm @@ -448,8 +448,6 @@ sub insert { } } - $self->_loc_change(); - warn " inserting $self\n" if $DEBUG > 1; @@ -1536,8 +1534,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); @@ -1828,6 +1824,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 = @@ -2093,6 +2094,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. @@ -5172,22 +5188,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