If no mailing/billing address is linked to the account, use the first
address found for the user.
If no addresses exist, use "NONE" for required refundable xact fields.
Signed-off-by: Bill Erickson <berickxx@gmail.com>
flesh => 2,
flesh_fields => {
circ => ['usr', 'target_copy'],
- au => [qw/card billing_address mailing_address/]
+ au => [qw/card billing_address mailing_address addresses/]
}
}
]) or return $e->die_event;
my $usr = $circ->usr;
- my $addr = $usr->mailing_address || $usr->billing_address;
+
+ my $addr = $usr->billing_address ||
+ $usr->mailing_address || $usr->addresses->[0];
+
+ if (!$addr) {
+ $addr = Fieldmapper::actor::user_address->new;
+ $addr->street1('NONE');
+ $addr->city('NONE');
+ $addr->state('NONE');
+ $addr->post_code('NONE');
+ }
my $mrx = $e->search_money_refundable_xact({xact => $payment->xact->id})->[0];