From: phasefx Date: Fri, 11 Jun 2010 15:16:34 +0000 (+0000) Subject: Org unit setting and behavior for blocking hold requests if hold recipient has expire... X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=0746ddd9ff2523a2b3dd5adcaaab23296ff2c93c;p=evergreen%2Fbjwebb.git Org unit setting and behavior for blocking hold requests if hold recipient has expired privileges git-svn-id: svn://svn.open-ils.org/ILS/trunk@16679 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- diff --git a/Open-ILS/src/perlmods/OpenILS/Application/Circ/Holds.pm b/Open-ILS/src/perlmods/OpenILS/Application/Circ/Holds.pm index 8e540d132..1cf8756a9 100644 --- a/Open-ILS/src/perlmods/OpenILS/Application/Circ/Holds.pm +++ b/Open-ILS/src/perlmods/OpenILS/Application/Circ/Holds.pm @@ -100,6 +100,18 @@ sub create_hold { $e->allowed('REQUEST_HOLDS', $recipient->home_ou) or return $e->event; } + # If the related org setting tells us to, block if patron privs have expired + my $expire_setting = $U->ou_ancestor_setting_value($recipient->home_ou, OILS_SETTING_BLOCK_HOLD_FOR_EXPIRED_PATRON); + if ($expire_setting) { + my $expire = DateTime::Format::ISO8601->new->parse_datetime( + cleanse_ISO8601($recipient->expire_date)); + + push( @events, OpenILS::Event->new( + 'PATRON_ACCOUNT_EXPIRED', + "payload" => {"fail_part" => "actor.usr.privs_expired"} + )) if( CORE::time > $expire->epoch ) ; + } + # Now make sure the recipient is allowed to receive the specified hold my $porg = $recipient->home_ou; my $rid = $e->requestor->id; diff --git a/Open-ILS/src/perlmods/OpenILS/Const.pm b/Open-ILS/src/perlmods/OpenILS/Const.pm index be451673b..1838efe6c 100644 --- a/Open-ILS/src/perlmods/OpenILS/Const.pm +++ b/Open-ILS/src/perlmods/OpenILS/Const.pm @@ -90,6 +90,7 @@ econst OILS_SETTING_MAX_ACCEPT_RETURN_OF_LOST => 'circ.max_accept_retu econst OILS_SETTING_VOID_LOST_PROCESS_FEE_ON_CHECKIN => 'circ.void_lost_proc_fee_on_checkin'; 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'; diff --git a/Open-ILS/src/sql/Pg/002.schema.config.sql b/Open-ILS/src/sql/Pg/002.schema.config.sql index bd03c244e..d7a201aca 100644 --- a/Open-ILS/src/sql/Pg/002.schema.config.sql +++ b/Open-ILS/src/sql/Pg/002.schema.config.sql @@ -68,7 +68,7 @@ CREATE TABLE config.upgrade_log ( install_date TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW() ); -INSERT INTO config.upgrade_log (version) VALUES ('0304'); -- Scott McKellar +INSERT INTO config.upgrade_log (version) VALUES ('0305'); -- phasefx CREATE TABLE config.bib_source ( id SERIAL PRIMARY KEY, 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 2527fd83e..02c14a40e 100644 --- a/Open-ILS/src/sql/Pg/950.data.seed-values.sql +++ b/Open-ILS/src/sql/Pg/950.data.seed-values.sql @@ -2102,6 +2102,22 @@ INSERT INTO config.org_unit_setting_type ( name, label, description, datatype ) 'bool' ); +-- 0305.data.org-setting-circ.holds.expired_patron_block.sql +INSERT INTO config.org_unit_setting_type ( name, label, description, datatype ) VALUES ( + 'circ.holds.expired_patron_block', + oils_i18n_gettext( + 'circ.holds.expired_patron_block', + 'Circulation: Block hold request if hold recipient privileges have expired', + 'coust', + 'label'), + oils_i18n_gettext( + 'circ.holds.expired_patron_block', + 'Circulation: Block hold request if hold recipient privileges have expired', + 'coust', + 'description'), + 'bool' +); + -- Org_unit_setting_type(s) that need an fm_class: INSERT into config.org_unit_setting_type ( name, label, description, datatype, fm_class ) VALUES diff --git a/Open-ILS/src/sql/Pg/upgrade/0305.data.org-setting-circ.holds.expired_patron_block.sql b/Open-ILS/src/sql/Pg/upgrade/0305.data.org-setting-circ.holds.expired_patron_block.sql new file mode 100644 index 000000000..7245a191b --- /dev/null +++ b/Open-ILS/src/sql/Pg/upgrade/0305.data.org-setting-circ.holds.expired_patron_block.sql @@ -0,0 +1,20 @@ +BEGIN; + +INSERT INTO config.upgrade_log (version) VALUES ('0305'); -- phasefx + +INSERT INTO config.org_unit_setting_type ( name, label, description, datatype ) VALUES ( + 'circ.holds.expired_patron_block', + oils_i18n_gettext( + 'circ.holds.expired_patron_block', + 'Circulation: Block hold request if hold recipient privileges have expired', + 'coust', + 'label'), + oils_i18n_gettext( + 'circ.holds.expired_patron_block', + 'Circulation: Block hold request if hold recipient privileges have expired', + 'coust', + 'description'), + 'bool' +); + +COMMIT;