From f0a90567ee4f57851ff9f6547ee6061f93865fd9 Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Tue, 22 May 2012 17:40:04 -0400 Subject: [PATCH] TPAC auto-override permissable patron hold fail events 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 Signed-off-by: Mike Rylander --- .../lib/OpenILS/WWW/EGCatLoader/Account.pm | 10 +++++++- Open-ILS/src/sql/Pg/950.data.seed-values.sql | 21 ++++++++++++++++ .../XXXX.data.tpac-override-hold-ou-setting.sql | 28 ++++++++++++++++++++++ 3 files changed, 58 insertions(+), 1 deletion(-) create mode 100644 Open-ILS/src/sql/Pg/upgrade/XXXX.data.tpac-override-hold-ou-setting.sql 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 e349f3f96b..85fee15205 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm @@ -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); 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 1dd5b5d7cc..033b3f0556 100644 --- a/Open-ILS/src/sql/Pg/950.data.seed-values.sql +++ b/Open-ILS/src/sql/Pg/950.data.seed-values.sql @@ -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 index 0000000000..9c9da8b895 --- /dev/null +++ b/Open-ILS/src/sql/Pg/upgrade/XXXX.data.tpac-override-hold-ou-setting.sql @@ -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; -- 2.11.0