From: Terran McCanna Date: Tue, 22 Nov 2022 22:04:47 +0000 (-0500) Subject: Online Renewal - Remove perm group ID references X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=1635190417858ba4fd618e7917da61a4646ab0c5;p=evergreen%2Fpines.git Online Renewal - Remove perm group ID references Look up permission groups by name or by e-renewal eligibility flag instead of by specific permission group ID. 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 94e7cd4a03..182d17966e 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm @@ -3439,6 +3439,8 @@ sub has_penalties { my $ctx = $self->ctx; my $user = $self->ctx->{user}; my $e = new_editor(xact => 1); + + #I'm sure there is a way to combine the following standing penalty checks, but this is working for now #check for INVALID_PATRON_ADDRESS my $findpenalty_address = $e->search_config_standing_penalty({name => 'INVALID_PATRON_ADDRESS'})->[0]; @@ -3517,8 +3519,9 @@ sub check_account_exp { $self->update_dashboard_stats(); #make sure patron is in an eligible perm group for renewal - #On gapines.org production: 2 = Patron, 14 = Friend, 56 = GLS, 53 = Homebound, 22 = Trustee, 64 = Quipu, 60 = Digital Only - if ($ctx->{user}->profile eq '2' || $ctx->{user}->profile eq '14' || $ctx->{user}->profile eq '56' || $ctx->{user}->profile eq '53' || $ctx->{user}->profile eq '22' || $ctx->{user}->profile eq '64' || $ctx->{user}->profile eq '60') { + my $grp = new_editor()->retrieve_permission_grp_tree($ctx->{user}->profile); + + if ($grp->erenew eq 't') { $ctx->{eligible_permgroup} = 1; } else { $ctx->{eligible_permgroup} = 0; diff --git a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Ecard.pm b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Ecard.pm index afd9a7e781..9fa3a5ffaa 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Ecard.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Ecard.pm @@ -380,19 +380,18 @@ sub update_user { } # Temp renewal is only 30 days, otherwise use perm_interval - # If perm group is Homebound (53) or GLS (56), allow full renewal + # If perm group is Homebound or GLS, allow full renewal my $temp_renewal = $cgi->param('temp_renewal'); - my $perm_grp = $au->profile; + my $grp = new_editor()->retrieve_permission_grp_tree($au->profile); - if ($temp_renewal eq '1' && $perm_grp ne '53' && $perm_grp ne '56') { + if ($temp_renewal eq '1' && $grp->name ne 'GLS' && $grp->name ne 'Homebound') { $au->expire_date( DateTime->now(time_zone => 'local')->add( seconds => interval_to_seconds('30 days'))->iso8601() ); - # Add standing penalty to account + # Add temp renewal standing penalty to account $self->apply_temp_renewal_penalty; } else { - my $grp = new_editor()->retrieve_permission_grp_tree($perm_grp); $au->expire_date( DateTime->now(time_zone => 'local')->add( seconds => interval_to_seconds($grp->perm_interval))->iso8601()