From: Terran McCanna Date: Thu, 1 Dec 2022 01:03:42 +0000 (-0500) Subject: Online Renewal - Add check for valid mailing address X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=5d1b430df19770ec29520ee39f46efc7a70378bd;p=evergreen%2Fpines.git 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 --- 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;