From: Bill Erickson Date: Fri, 2 Nov 2018 14:44:49 +0000 (-0400) Subject: JBAS-2101 Refundable xact address handling improvements X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=7d767d300fffd528e22d91b70169d30c2f95d73d;p=working%2FEvergreen.git JBAS-2101 Refundable xact address handling improvements 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 --- diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/RefundablePayment.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/RefundablePayment.pm index 8327a4646f..f4fa171fd6 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/RefundablePayment.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/RefundablePayment.pm @@ -210,13 +210,23 @@ sub create_refundable_payment { 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];