From 5d1b430df19770ec29520ee39f46efc7a70378bd Mon Sep 17 00:00:00 2001 From: Terran McCanna Date: Wed, 30 Nov 2022 20:03:42 -0500 Subject: [PATCH] Online Renewal - Add check for valid mailing address Only allow renewal option if neither mailing nor billing addresses have been marked invalid. Signed-off-by: Terran McCanna --- .../src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm index 182d17966e..f64b030792 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm @@ -124,6 +124,11 @@ sub load_myopac_prefs { } else { $self->ctx->{valid_billing_address} = 0; } + if ($self->ctx->{user}->mailing_address) { + $self->ctx->{valid_mailing_address} = $self->ctx->{user}->mailing_address->valid; + } else { + $self->ctx->{valid_mailing_address} = 0; + } $self->check_account_exp(); my $lock_usernames = $self->ctx->{get_org_setting}->($e->requestor->home_ou, 'opac.lock_usernames'); @@ -2573,6 +2578,11 @@ sub load_myopac_main { } else { $self->ctx->{valid_billing_address} = 0; } + if ($self->ctx->{user}->mailing_address) { + $self->ctx->{valid_mailing_address} = $self->editor->retrieve_actor_user_address($self->ctx->{user}->mailing_address)->valid; + } else { + $self->ctx->{valid_mailing_address} = 0; + } $self->check_account_exp(); return $self->prepare_fines($limit, $offset) || Apache2::Const::OK; @@ -3537,7 +3547,9 @@ sub check_account_exp { $ctx->{hasproblem} = 1; } elsif ($ctx->{user}->barred eq 't') { #user is barred $ctx->{hasproblem} = 1; - } elsif ($ctx->{valid_billing_address} ne 't') { #user has invalid address + } elsif ($ctx->{valid_billing_address} ne 't') { #user has invalid billing address + $ctx->{hasproblem} = 1; + } elsif ($ctx->{valid_mailing_address} ne 't') { #user has invalid mailing address $ctx->{hasproblem} = 1; } else { $ctx->{hasproblem} = 0; -- 2.11.0