Do not call, empty or 'Y'
+=item invoice_ship_address
+
+Display ship_address ("Service address") on invoices for this customer, empty or 'Y'
+
=back
=head1 METHODS
}
}
+ $self->_loc_change();
+
warn " inserting $self\n"
if $DEBUG > 1;
$self->set($l.'num', $new_loc->locationnum);
} #for $l
+ $self->_loc_change($old);
+
# replace the customer record
my $error = $self->SUPER::replace($old);
|| $self->ut_currencyn('currency')
|| $self->ut_alphan('po_number')
|| $self->ut_enum('complimentary', [ '', 'Y' ])
+ || $self->ut_flag('invoice_ship_address')
;
foreach (qw(company ship_company)) {
$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