From 99e8fc893a8bf0abc4e1c3b85db06da0742dbbf0 Mon Sep 17 00:00:00 2001 From: Thomas Berezansky Date: Sat, 14 Jan 2012 09:58:33 -0500 Subject: [PATCH] Add PLACE_UNFILLABLE_HOLD permission And hook it up in JSPac and TPac. General idea: If you have the permission you can place holds that will not fill right now, in general, for any reason. In TPac, I replaced the previous "check the last failure code" line. The new permission basically accomplishes the same thing for now, and is less likely to return different results from placement attempt to placement attempt. Also, only checking one failure code of potential hundreds didn't make a lot of sense. In the event of age protected copies the age protected prompt wins out. Signed-off-by: Thomas Berezansky Signed-off-by: Mike Rylander --- .../lib/OpenILS/Application/Circ/Holds.pm | 7 +++-- .../lib/OpenILS/WWW/EGCatLoader/Account.pm | 4 +-- Open-ILS/src/sql/Pg/950.data.seed-values.sql | 4 ++- .../Pg/upgrade/XXXX.place_unfillable_hold.sql | 3 +++ Open-ILS/web/opac/locale/en-US/opac.dtd | 1 + Open-ILS/web/opac/skin/default/js/holds.js | 27 ++++++++++++------- .../opac/skin/default/xml/common/holds.xml | 1 + 7 files changed, 33 insertions(+), 14 deletions(-) create mode 100644 Open-ILS/src/sql/Pg/upgrade/XXXX.place_unfillable_hold.sql diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Holds.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Holds.pm index 5c840c5d10..70325f9788 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Holds.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Holds.pm @@ -2254,6 +2254,9 @@ sub check_title_hold { @status = do_possibility_checks($e, $patron, $request_lib, $params{depth}, %params); } + my $place_unfillable = 0; + $place_unfillable = 1 if $e->allowed('PLACE_UNFILLABLE_HOLD', $e->requestor->ws_ou); + if ($status[0]) { return { "success" => 1, @@ -2262,9 +2265,9 @@ sub check_title_hold { }; } elsif ($status[2]) { my $n = scalar @{$status[2]}; - return {"success" => 0, "last_event" => $status[2]->[$n - 1], "age_protected_copy" => $status[3]}; + return {"success" => 0, "last_event" => $status[2]->[$n - 1], "age_protected_copy" => $status[3], "place_unfillable" => $place_unfillable}; } else { - return {"success" => 0, "age_protected_copy" => $status[3]}; + return {"success" => 0, "age_protected_copy" => $status[3], "place_unfillable" => $place_unfillable}; } } 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 8e1e931bac..72f460195d 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm @@ -904,7 +904,7 @@ sub attempt_hold_placement { $hdata->{could_override} = 1; $hdata->{age_protect} = 1; } else { - $hdata->{could_override} = $self->test_could_override($hdata->{hold_failed_event}); + $hdata->{could_override} = $result->{place_unfillable}; } } elsif (ref $result eq 'ARRAY') { $hdata->{hold_failed_event} = $result->[0]; @@ -913,7 +913,7 @@ sub attempt_hold_placement { $hdata->{could_override} = 1; $hdata->{age_protect} = 1; } else { - $hdata->{could_override} = $self->test_could_override($hdata->{hold_failed_event}); + $hdata->{could_override} = $result->[4]; # place_unfillable } } } 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 b6b88d4295..bd9fc24c7a 100644 --- a/Open-ILS/src/sql/Pg/950.data.seed-values.sql +++ b/Open-ILS/src/sql/Pg/950.data.seed-values.sql @@ -1535,7 +1535,9 @@ INSERT INTO permission.perm_list ( id, code, description ) VALUES ( 522, 'IMPORT_AUTHORITY_MARC', oils_i18n_gettext( 522, 'Allows a user to create new authority records', 'ppl', 'description' )), ( 523, 'ADMIN_TOOLBAR', oils_i18n_gettext( 523, - 'Allows a user to create, edit, and delete custom toolbars', 'ppl', 'description' )); + 'Allows a user to create, edit, and delete custom toolbars', 'ppl', 'description' )), + ( 524, 'PLACE_UNFILLABLE_HOLD', oils_i18n_gettext( 524, + 'Allows a user to place a hold that cannot currently be filled.', 'ppl', 'description' )); SELECT SETVAL('permission.perm_list_id_seq'::TEXT, 1000); diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.place_unfillable_hold.sql b/Open-ILS/src/sql/Pg/upgrade/XXXX.place_unfillable_hold.sql new file mode 100644 index 0000000000..559510efeb --- /dev/null +++ b/Open-ILS/src/sql/Pg/upgrade/XXXX.place_unfillable_hold.sql @@ -0,0 +1,3 @@ +INSERT INTO permission.perm_list ( id, code, description ) VALUES + ( 524, 'PLACE_UNFILLABLE_HOLD', oils_i18n_gettext( 524, + 'Allows a user to place a hold that cannot currently be filled.', 'ppl', 'description' )); diff --git a/Open-ILS/web/opac/locale/en-US/opac.dtd b/Open-ILS/web/opac/locale/en-US/opac.dtd index ef17a459d0..6ac79e61e0 100644 --- a/Open-ILS/web/opac/locale/en-US/opac.dtd +++ b/Open-ILS/web/opac/locale/en-US/opac.dtd @@ -620,6 +620,7 @@ We recommend that you remove this title from any bookbags it may have been added + &common.hold.exists.override; &common.hold.checked_out.override; &common.hold.age_protect.override; + &common.hold.place_unfillable.override; &common.hold.barred; -- 2.43.2