};
} elsif ($status[2]) {
my $n = scalar @{$status[2]};
- return {"success" => 0, "last_event" => $status[2]->[$n - 1]};
+ return {"success" => 0, "last_event" => $status[2]->[$n - 1], "age_protected_copy" => $status[3]};
} else {
- return {"success" => 0};
+ return {"success" => 0, "age_protected_copy" => $status[3]};
}
}
my $title;
my %seen;
my @status;
+ my $age_protect_only = 0;
OUTER: for my $key (@keys) {
my @cps = @{$buckets{$key}};
@status = verify_copy_for_hold(
$patron, $requestor, $title, $copy, $pickup_lib, $request_lib);
+ $age_protect_only ||= $status[3];
last OUTER if $status[0];
}
}
+ $status[3] = $age_protect_only;
return @status;
}
my $title;
my %seen;
my @status;
+ my $age_protect_only = 0;
OUTER: for my $key (@keys) {
my @cps = @{$buckets{$key}};
@status = verify_copy_for_hold(
$patron, $requestor, $title, $copy, $pickup_lib, $request_lib);
+ $age_protect_only ||= $status[3];
last OUTER if $status[0];
}
}
return (1,0) if ($empty_ok);
}
+ $status[3] = $age_protect_only;
return @status;
}
my $title;
my %seen;
my @status;
+ my $age_protect_only = 0;
OUTER: for my $key (@keys) {
my @cps = @{$buckets{$key}};
@status = verify_copy_for_hold(
$patron, $requestor, $title, $copy, $pickup_lib, $request_lib);
+ $age_protect_only ||= $status[3];
last OUTER if $status[0];
}
}
return (1,0) if ($empty_ok);
}
+ $status[3] = $age_protect_only;
return @status;
}
) unless @$copies;
my @status;
+ my $age_protect_only = 0;
for my $copy ( @$copies ) {
@status = verify_copy_for_hold(
$patron, $requestor, $title, $copy, $pickup_lib, $request_lib );
+ $age_protect_only ||= $status[3];
last if $status[0];
}
+ $status[3] = $age_protect_only;
return @status;
}
show_event_list => 1
}
);
+ my $age_protect_only = 0;
+ if (@$permitted == 1 && @$permitted[0]->{textcode} eq 'ITEM_AGE_PROTECTED') {
+ $age_protect_only = 1;
+ }
return (
(not scalar @$permitted), # true if permitted is an empty arrayref
($copy->circ_lib == $pickup_lib) and
($copy->status == OILS_COPY_STATUS_AVAILABLE)
),
- $permitted
+ $permitted,
+ $age_protect_only
);
}
$hdata->{hold_failed_event} = pop @$result;
}
- $hdata->{could_override} = $self->test_could_override($hdata->{hold_failed_event});
+ if($result->{age_protected_copy}) {
+ $hdata->{could_override} = 1;
+ $hdata->{age_protect} = 1;
+ } else {
+ $hdata->{could_override} = $self->test_could_override($hdata->{hold_failed_event});
+ }
}
}
}
event_key = hdata.hold_failed_event.textcode;
# display:
- FAIL_PART_MSG_MAP.$fail_part_key ||
- EVENT_MSG_MAP.$event_key ||
- l(hdata.hold_failed_event.desc) ||
- hdata.hold_failed_event.payload.fail_part ||
- hdata.hold_failed_event.textcode ||
- (hdata.hold_local_alert ?
- l("There is already a copy available at your local library.") :
- l("Unknown problem")) | html
+ (hdata.age_protect ?
+ l("All available copies are temporarily unavailable at your pickup library. Placing this hold could result in longer wait times.") :
+ FAIL_PART_MSG_MAP.$fail_part_key ||
+ EVENT_MSG_MAP.$event_key ||
+ l(hdata.hold_failed_event.desc) ||
+ hdata.hold_failed_event.payload.fail_part ||
+ hdata.hold_failed_event.textcode ||
+ (hdata.hold_local_alert ?
+ l("There is already a copy available at your local library.") :
+ l("Unknown problem"))) | html
%]</em>
[% IF event_key == 'PERM_FAILURE' %]
<div>[% l('Permission: "[_1]"', hdata.hold_failed_event.ilsperm) | html %]</div>
<!ENTITY common.hold.checked_out.override "This item is already checked out. Would you like to place the hold anyway?">
<!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.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;;
if(checkILSEvent(res) || res.success != 1) {
- if(res.success != 1) {
-
- if(!holdArgs.partsSuggestionMade && holdArgs.recordParts &&
- holdArgs.recordParts.length && holdArgs.type == 'T') {
- // T holds on records that have parts are OK, but if the record has no non-part
- // copies, the hold will ultimately fail. Suggest selecting a part to the user.
- addCSSClass($('holds_parts_selector'), 'parts-warning');
- holdArgs.partsSuggestionMade = true;
- alert($('hold_has_parts').innerHTML);
+ 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 {
- alert($('hold_not_allowed').innerHTML);
+ swapCanvas($('holds_box'));
+ return;
}
- } else {
- if( res.textcode == 'PATRON_BARRED' ) {
- alertId('hold_failed_patron_barred');
- } else {
- alert($('hold_not_allowed').innerHTML);
- }
- }
- swapCanvas($('holds_box'));
- return;
+ }
+ if(!age_protect_override) {
+ if(res.success != 1) {
+
+ if(!holdArgs.partsSuggestionMade && holdArgs.recordParts &&
+ holdArgs.recordParts.length && holdArgs.type == 'T') {
+ // T holds on records that have parts are OK, but if the record has no non-part
+ // copies, the hold will ultimately fail. Suggest selecting a part to the user.
+ addCSSClass($('holds_parts_selector'), 'parts-warning');
+ holdArgs.partsSuggestionMade = true;
+ alert($('hold_has_parts').innerHTML);
+ } else {
+ alert($('hold_not_allowed').innerHTML);
+ }
+ } else {
+ if( res.textcode == 'PATRON_BARRED' ) {
+ alertId('hold_failed_patron_barred');
+ } else {
+ alert($('hold_not_allowed').innerHTML);
+ }
+ }
+ swapCanvas($('holds_box'));
+ return;
+ }
}
r._hold.selection_depth(res.depth);
}
<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 id='hold_failed_patron_barred' class='hide_me'>&common.hold.barred;</span>