TPAC auto-override permissable patron hold fail events
authorBill Erickson <berick@esilibrary.com>
Tue, 22 May 2012 21:40:04 +0000 (17:40 -0400)
committerMike Rylander <mrylander@gmail.com>
Fri, 25 May 2012 15:15:19 +0000 (11:15 -0400)
This adds a new org unit setting which tells the tpac to automatically
override hold placement failure events in cases where the patron has the
permission to do so.  The goal is to skip the confirmation step
currently required by patrons when overridding a tpac hold.

Signed-off-by: Bill Erickson <berick@esilibrary.com>
Signed-off-by: Mike Rylander <mrylander@gmail.com>

Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm
Open-ILS/src/sql/Pg/950.data.seed-values.sql
Open-ILS/src/sql/Pg/upgrade/XXXX.data.tpac-override-hold-ou-setting.sql [new file with mode: 0644]

index e349f3f..85fee15 100644 (file)
@@ -852,7 +852,15 @@ sub attempt_hold_placement {
     }
 
     my $method = 'open-ils.circ.holds.test_and_create.batch';
-    $method .= '.override' if $cgi->param('override');
+
+    if ($cgi->param('override')) {
+        $method .= '.override';
+
+    } elsif (!$ctx->{is_staff})  {
+
+        $method .= '.override' if $self->ctx->{get_org_setting}->(
+            $e->requestor->home_ou, "opac.patron.auto_overide_hold_events");
+    }
 
     my @create_targets = map {$_->{target_id}} (grep { !$_->{hold_failed} } @hold_data);
 
index 1dd5b5d..033b3f0 100644 (file)
@@ -11610,4 +11610,25 @@ INSERT INTO config.org_unit_setting_type ( name, label, description, datatype, g
         'gui'
     );
 
+INSERT into config.org_unit_setting_type 
+    (name, grp, label, description, datatype) 
+    VALUES ( 
+        'opac.patron.auto_overide_hold_events', 
+        'opac',
+        oils_i18n_gettext(
+            'opac.patron.auto_overide_hold_events',
+            'Auto-Override Permitted Hold Blocks (Patrons)',
+            'coust', 
+            'label'
+        ),
+        oils_i18n_gettext(
+            'opac.patron.auto_overide_hold_events',
+            'When a patron places a hold that fails and the patron has the correct permission ' || 
+            'to override the hold, automatically override the hold without presenting a message ' || 
+            'to the patron and requiring that the patron make a decision to override',
+            'coust', 
+            'description'
+        ),
+        'bool'
+    );
 
diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.data.tpac-override-hold-ou-setting.sql b/Open-ILS/src/sql/Pg/upgrade/XXXX.data.tpac-override-hold-ou-setting.sql
new file mode 100644 (file)
index 0000000..9c9da8b
--- /dev/null
@@ -0,0 +1,28 @@
+
+BEGIN;
+
+SELECT evergreen.upgrade_deps_block_check('XXXX', :eg_version);
+
+INSERT into config.org_unit_setting_type 
+    (name, grp, label, description, datatype) 
+    VALUES ( 
+        'opac.patron.auto_overide_hold_events', 
+        'opac',
+        oils_i18n_gettext(
+            'opac.patron.auto_overide_hold_events',
+            'Auto-Override Permitted Hold Blocks (Patrons)',
+            'coust', 
+            'label'
+        ),
+        oils_i18n_gettext(
+            'opac.patron.auto_overide_hold_events',
+            'When a patron places a hold that fails and the patron has the correct permission ' ||
+            'to override the hold, automatically override the hold without presenting a message ' ||
+            'to the patron and requiring that the patron make a decision to override',
+            'coust', 
+            'description'
+        ),
+        'bool'
+    );
+
+COMMIT;