From: Terran McCanna Date: Tue, 22 Nov 2022 19:10:30 +0000 (-0500) Subject: Online Renewal - Use standing penalty names instead of IDs X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=79840c4a48d40144d26056b23969c073fdebe2c6;p=evergreen%2Fpines.git Online Renewal - Use standing penalty names instead of IDs 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 8805bc82f8..94e7cd4a03 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm @@ -3438,11 +3438,13 @@ sub has_penalties { my $self = shift; my $ctx = $self->ctx; my $user = $self->ctx->{user}; + my $e = new_editor(xact => 1); #check for INVALID_PATRON_ADDRESS - my $searchpenalty_address = new_editor()->search_actor_user_standing_penalty({ + my $findpenalty_address = $e->search_config_standing_penalty({name => 'INVALID_PATRON_ADDRESS'})->[0]; + my $searchpenalty_address = $e->search_actor_user_standing_penalty({ usr => $user->id, - standing_penalty => 29, + standing_penalty => $findpenalty_address->id, '-or' => [ {stop_date => undef}, {stop_date => {'>' => 'now'}} @@ -3450,9 +3452,10 @@ sub has_penalties { }); #check for INVALID_PATRON_DAY_PHONE - my $searchpenalty_phone = new_editor()->search_actor_user_standing_penalty({ + my $findpenalty_phone = $e->search_config_standing_penalty({name => 'INVALID_PATRON_DAY_PHONE'})->[0]; + my $searchpenalty_phone = $e->search_actor_user_standing_penalty({ usr => $user->id, - standing_penalty => 32, + standing_penalty => $findpenalty_phone->id, '-or' => [ {stop_date => undef}, {stop_date => {'>' => 'now'}} @@ -3460,9 +3463,10 @@ sub has_penalties { }); #check for PATRON_IN_COLLECTIONS - my $searchpenalty_coll = new_editor()->search_actor_user_standing_penalty({ + my $findpenalty_coll = $e->search_config_standing_penalty({name => 'PATRON_IN_COLLECTIONS'})->[0]; + my $searchpenalty_coll = $e->search_actor_user_standing_penalty({ usr => $user->id, - standing_penalty => 30, + standing_penalty => $findpenalty_coll->id, '-or' => [ {stop_date => undef}, {stop_date => {'>' => 'now'}} @@ -3470,9 +3474,10 @@ sub has_penalties { }); #check for alerting block - my $searchpenalty_alertblock = new_editor()->search_actor_user_standing_penalty({ + my $findpenalty_alertblock = $e->search_config_standing_penalty({name => 'STAFF_CHR'})->[0]; + my $searchpenalty_alertblock = $e->search_actor_user_standing_penalty({ usr => $user->id, - standing_penalty => 25, + standing_penalty => $findpenalty_alertblock->id, '-or' => [ {stop_date => undef}, {stop_date => {'>' => 'now'}} @@ -3480,11 +3485,10 @@ sub has_penalties { }); #check for PATRON_TEMP_RENEWAL - my $findpenalty = new_editor()->search_config_standing_penalty({name => 'PATRON_TEMP_RENEWAL'})->[0]; - my $penaltyid = $findpenalty->id; - my $searchpenalty_temp = new_editor()->search_actor_user_standing_penalty({ + my $findpenalty_temp = $e->search_config_standing_penalty({name => 'PATRON_TEMP_RENEWAL'})->[0]; + my $searchpenalty_temp = $e->search_actor_user_standing_penalty({ usr => $user->id, - standing_penalty => $penaltyid, + standing_penalty => $findpenalty_temp->id, '-or' => [ {stop_date => undef}, {stop_date => {'>' => 'now'}} @@ -3538,18 +3542,22 @@ sub check_account_exp { #determine which message to show (if any) if ($ctx->{hastemprenew} eq 1) { #user already has active temp renewal - $ctx->{account_renew_message} = '
Your account could only be temporarily renewed because your - address changed. Please visit your nearest PINES library with your current proof of address - to complete your account renewal.
'; + $ctx->{account_renew_message} = '
Your account + could only be temporarily renewed because your address changed. Please visit your nearest PINES + library with your current proof of address to complete your account renewal.
'; } elsif (DateTime->today->add(days=>30) lt $ctx->{user}->expire_date) { #expiration date is too far in future - don't show message $ctx->{account_renew_message} = ''; } elsif ($ctx->{hasproblem} eq 1 or $ctx->{eligible_permgroup} eq 0) { #see other problems above - $ctx->{account_renew_message} = 'Your account is due for renewal, but it is not eligible for online renewal. Please visit your nearest PINES library with your current ID and proof of address to renew your account.'; + $ctx->{account_renew_message} = '
Your account is + due for renewal, but it cannot be renewed online. Please visit your nearest PINES + library with your current ID and proof of address to update and renew your account.
'; } elsif ($ctx->{user_stats}->{fines}->{balance_owed} gt 0) { #user has fines - $ctx->{account_renew_message} = 'Your account expiration date is coming up soon. Please pay your outstanding fines in order to renew your account.'; + $ctx->{account_renew_message} = '
Your account + is due for renewal. Please pay your outstanding fines in order to renew your account.
'; } else { - $ctx->{account_renew_message} = 'Click here to renew your account'; + $ctx->{account_renew_message} = 'Click here to renew your account'; } return;