+#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);
+ }
+}
+