Org unit setting and behavior for blocking hold requests if hold recipient has expire...
authorphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Fri, 11 Jun 2010 15:16:34 +0000 (15:16 +0000)
committerphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Fri, 11 Jun 2010 15:16:34 +0000 (15:16 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@16679 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/src/perlmods/OpenILS/Application/Circ/Holds.pm
Open-ILS/src/perlmods/OpenILS/Const.pm
Open-ILS/src/sql/Pg/002.schema.config.sql
Open-ILS/src/sql/Pg/950.data.seed-values.sql
Open-ILS/src/sql/Pg/upgrade/0305.data.org-setting-circ.holds.expired_patron_block.sql [new file with mode: 0644]

index 8e540d1..1cf8756 100644 (file)
@@ -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;
index be45167..1838efe 100644 (file)
@@ -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';
 
 
 
index bd03c24..d7a201a 100644 (file)
@@ -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,
index 2527fd8..02c14a4 100644 (file)
@@ -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 (file)
index 0000000..7245a19
--- /dev/null
@@ -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;