From: Kyle Huckins Date: Thu, 19 Mar 2020 23:04:29 +0000 (+0000) Subject: lp1861319 Expired Patron Item Renewal X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=refs%2Fheads%2Fuser%2Fkhuckins%2Flp1861319-expired-patron-item-renewal;p=working%2FEvergreen.git lp1861319 Expired Patron Item Renewal - SQL Upgrade for the new Org Unit Setting - Perl Constant for new Org Unit Setting - Include YAOUS to allow/disallow renewal of items to expired patrons Signed-off-by: Kyle Huckins Changes to be committed: modified: Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Circulate.pm modified: Open-ILS/src/perlmods/lib/OpenILS/Const.pm modified: Open-ILS/src/sql/Pg/950.data.seed-values.sql new file: Open-ILS/src/sql/Pg/upgrade/XXXX.data.org-setting-circ-renew-expired.sql --- diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Circulate.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Circulate.pm index d99d5259c4..d9ec74c2ca 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Circulate.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Circulate.pm @@ -1027,9 +1027,14 @@ sub mk_env { my $expire = DateTime::Format::ISO8601->new->parse_datetime( clean_ISO8601($patron->expire_date)); - - $self->bail_on_events(OpenILS::Event->new('PATRON_ACCOUNT_EXPIRED')) - if( CORE::time > $expire->epoch ) ; + + # An expired patron can renew with the assistance of an OUS. + my $expire_setting = $U->ou_ancestor_setting_value($self->circ_lib, OILS_SETTING_ALLOW_RENEW_FOR_EXPIRED_PATRON); + unless ($self->is_renewal and $expire_setting) { + if(CORE::time > $expire->epoch) { + $self->bail_on_events(OpenILS::Event->new('PATRON_ACCOUNT_EXPIRED')) + } + } } } @@ -1533,7 +1538,7 @@ sub override_events { if(!$self->override) { return $self->bail_out(1) if( @events > 1 or $events[0]->{textcode} ne 'SUCCESS' ); - } + } $self->events([]); @@ -4053,7 +4058,7 @@ sub do_renew { unless( $circ->usr eq $self->editor->requestor->id ) { return $self->bail_on_events($self->editor->events) unless $self->editor->allowed('RENEW_CIRC', $circ->circ_lib); - } + } $self->push_events(OpenILS::Event->new('MAX_RENEWALS_REACHED')) if $circ->renewal_remaining < 1; diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Const.pm b/Open-ILS/src/perlmods/lib/OpenILS/Const.pm index 7c5fb7b2dc..85e8b71889 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Const.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Const.pm @@ -95,6 +95,7 @@ econst OILS_SETTING_VOID_LOST_PROCESS_FEE_ON_CHECKIN => 'circ.void_lost_proc_ econst OILS_SETTING_RESTORE_OVERDUE_ON_LOST_RETURN => 'circ.restore_overdue_on_lost_return'; econst OILS_SETTING_LOST_IMMEDIATELY_AVAILABLE => 'circ.lost_immediately_available'; econst OILS_SETTING_BLOCK_HOLD_FOR_EXPIRED_PATRON => 'circ.holds.expired_patron_block'; +econst OILS_SETTING_ALLOW_RENEW_FOR_EXPIRED_PATRON => 'circ.renew.expired_patron_allow'; econst OILS_SETTING_GENERATE_OVERDUE_ON_LOST_RETURN => 'circ.lost.generate_overdue_on_checkin'; econst OILS_SETTING_MAX_DUPLICATE_HOLDS => 'circ.holds.max_duplicate_holds'; diff --git a/Open-ILS/src/sql/Pg/950.data.seed-values.sql b/Open-ILS/src/sql/Pg/950.data.seed-values.sql index b6959bb20e..d123385d67 100644 --- a/Open-ILS/src/sql/Pg/950.data.seed-values.sql +++ b/Open-ILS/src/sql/Pg/950.data.seed-values.sql @@ -3568,6 +3568,15 @@ INSERT into config.org_unit_setting_type 'coust', 'description'), 'bool', null) +,( 'circ.renew.expired_patron_allow', 'circ', + oils_i18n_gettext('circ.renew.expired_patron_allow', + 'Allow renewal request if renewal recipient privileges have expired', + 'coust', 'label'), + oils_i18n_gettext('circ.renew.expired_patron_allow', + 'If enabled, users within the org unit who are expired may still renew items.', + 'coust', 'description'), + 'bool', null) + ,( 'circ.holds.hold_has_copy_at.alert', 'holds', oils_i18n_gettext('circ.holds.hold_has_copy_at.alert', 'Has Local Copy Alert', diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.data.org-setting-circ-renew-expired.sql b/Open-ILS/src/sql/Pg/upgrade/XXXX.data.org-setting-circ-renew-expired.sql new file mode 100644 index 0000000000..cd248b9967 --- /dev/null +++ b/Open-ILS/src/sql/Pg/upgrade/XXXX.data.org-setting-circ-renew-expired.sql @@ -0,0 +1,24 @@ +BEGIN; + +SELECT evergreen.upgrade_deps_block_check('XXXX', :eg_version); + +INSERT INTO config.org_unit_setting_type + (grp, name, datatype, label, description) +VALUES ( + 'circ', + 'circ.renew.expired_patron_allow', 'bool', + oils_i18n_gettext( + 'circ.renew.expired_patron_allow', + 'Allow renewal request if renewal recipient privileges have expired', + 'coust', + 'label' + ), + oils_i18n_gettext( + 'circ.renew.expired_patron_allow', + 'If enabled, users within the org unit who are expired may still renew items.', + 'coust', + 'description' + ) +); + +COMMIT;