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 <tsbere@mvlc.org>
Signed-off-by: Mike Rylander <mrylander@gmail.com>
@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,
};
} 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};
}
}
$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];
$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
}
}
}
( 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);
--- /dev/null
+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' ));
<!ENTITY common.hold.exists "A hold already exists on the requested item.">
<!ENTITY common.hold.exists.override "A hold already exists on the requested item. Would you like to create the hold anyway?">
<!ENTITY common.hold.age_protect.override "This hold may take extra time to fill due to library policies. Would you like to create the hold anyway?">
+<!ENTITY common.hold.place_unfillable.override "The requested hold cannot currently be filled. You have permission to place the hold regardless, but should only do so if you know the hold will eventually be fillable. Would you like to create the hold anyway?">
<!ENTITY common.hold.barred 'PATRON BARRED. Please see any notes in the
"Staff Notes" section of your "My Account" page or contact your local library.'>
<!ENTITY common.hold.item.invalid "This hold is no longer valid. It's likely that the
if(!recurse) {
var res = r.getResultObject();
- var age_protect_override = false;;
+ var place_anyway = false;
if(checkILSEvent(res) || res.success != 1) {
- if(res.success != 1 && res.age_protected_copy == 1) {
- // There is at least one copy that *could* fill the hold, if it were not age-protected.
- if( confirm($('hold_age_protected_override').innerHTML) ) {
- age_protect_override = true;
- } else {
- swapCanvas($('holds_box'));
- return;
+ if(res.success != 1) {
+ if(res.age_protected_copy == 1) {
+ // There is at least one copy that *could* fill the hold, if it were not age-protected.
+ if( confirm($('hold_age_protected_override').innerHTML) ) {
+ place_anyway = true;
+ } else {
+ swapCanvas($('holds_box'));
+ return;
+ }
+ } else if(res.place_unfillable == 1) {
+ if( confirm($('hold_place_unfillable_override').innerHTML) ) {
+ place_anyway = true;
+ } else {
+ swapCanvas($('holds_box'));
+ return;
+ }
}
}
- if(!age_protect_override) {
+ if(!place_anyway) {
if(res.success != 1) {
if(!holdArgs.partsSuggestionMade && holdArgs.recordParts &&
<span class='hide_me' id='hold_dup_exists_override'>&common.hold.exists.override;</span>
<span class='hide_me' id='hold_checked_out_override'>&common.hold.checked_out.override;</span>
<span class='hide_me' id='hold_age_protected_override'>&common.hold.age_protect.override;</span>
+ <span class='hide_me' id='hold_place_unfillable_override'>&common.hold.place_unfillable.override;</span>
<span id='hold_failed_patron_barred' class='hide_me'>&common.hold.barred;</span>