From 7d767d300fffd528e22d91b70169d30c2f95d73d Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Fri, 2 Nov 2018 10:44:49 -0400 Subject: [PATCH] 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 --- .../lib/OpenILS/Application/Circ/RefundablePayment.pm | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) 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]; -- 2.11.0