$ctx->{marc_xml} = XML::LibXML->new->parse_string($ctx->{record}->marc);
- if(my $pickup_lib = $cgi->param('pickup_lib')) {
+ if (my $pickup_lib = $cgi->param('pickup_lib')) {
+ my $requestor = $e->requestor->id;
+ my $usr;
+
+ if ((not $ctx->{"is_staff"}) or
+ ($cgi->param("hold_usr_is_requestor"))) {
+ $usr = $requestor;
+ } else {
+ my $actor = create OpenSRF::AppSession("open-ils.actor");
+ $usr = $actor->request(
+ "open-ils.actor.user.retrieve_id_by_barcode_or_username",
+ $e->authtoken, $cgi->param("hold_usr")
+ )->gather(1);
+
+ if (defined $U->event_code($usr)) {
+ $ctx->{hold_failed} = 1;
+ $ctx->{hold_failed_event} = $usr;
+ }
+ }
my $args = {
- patronid => $e->requestor->id,
+ patronid => $usr,
titleid => $ctx->{hold_target}, # XXX
pickup_lib => $pickup_lib,
depth => 0, # XXX
my $hold = Fieldmapper::action::hold_request->new;
$hold->pickup_lib($pickup_lib);
- $hold->requestor($e->requestor->id);
- $hold->usr($e->requestor->id); # XXX staff
+ $hold->requestor($requestor);
+ $hold->usr($usr);
$hold->target($ctx->{hold_target});
$hold->hold_type($ctx->{hold_type});
# frozen, expired, etc..
for(var i in evt) {evt[i].apply(evt[i], args);}
}
}
+function staff_hold_nicety(thing) {
+ document.getElementById("hold_usr_input").disabled =
+ Boolean(Number(thing.value));
+}
window.onload = function() {
// record details page events
var rec = location.href.match(/\/opac\/record\/(\d+)/);
PROCESS get_marc_attrs args=attrs;
%]
<div>
- <div id='xulholds_box' class='hide_me canvas' style='margin-top: 6px;'>
- <!-- XXX TODO staff will need this to work ("advanced" hold placement)
- later -->
- <center>
- <table class='data_grid' style='margin-top: 20px;'>
- <tbody>
- <tr>
- <td>[% l("Enter recipient barcode") %]:</td>
- <td>
- <input type='text' id='xul_recipient_barcode' />
- </td>
- <td>
- <input type='submit' value='[% l("Submit") %]'
- id='xul_recipient_barcode_submit' />
- </td>
- <td>
- <input type='submit' value='[% l("Cancel") %]' />
- </td>
- <td>
- <input type='submit'
- value='[% l("Place hold for my account") %]'
- id='xul_recipient_me' />
- </td>
- </tr>
- </tbody>
- </table>
- </center>
- </div>
- <div id='check_holds_box' class='hide_me canvas'
- style='margin-top: 6px; width: 100%; text-align: center'>
- <br/><br/><br/>
- <b>[% l("Checking for possibility of hold fulfillment...") %]</b>
- </div>
<div id='holds_box' class='canvas' style='margin-top: 6px;'>
[% IF ctx.hold_success %]
<div><big><strong>[% l("Hold was successfully placed"); %]</strong></big></div>
<input type="hidden" name="redirect_to"
value="[% new_redirect_to | html %]" />
<h1>Place Hold</h1>
+ [% IF ctx.is_staff %]
+ <p class="staff-hold">
+ <input type="radio" id="hold_usr_is_requestor_not"
+ onchange="staff_hold_nicety(this);"
+ name="hold_usr_is_requestor" value="0" />
+ <label for="hold_usr_is_requestor_not">
+ [% l("Place hold for patron by barcode:") %]
+ </label>
+ <input type="text" name="hold_usr" id="hold_usr_input" /><br />
+
+ <input type="radio" id="hold_usr_is_requestor"
+ onchange="staff_hold_nicety(this);"
+ name="hold_usr_is_requestor" value="1" />
+ <label for="hold_usr_is_requestor">
+ [% l("Place this hold for me ([_1] [_2])",
+ ctx.user.first_given_name, ctx.user.family_name) %]
+ </label>
+ </p>
+ [% END %]
<p>
[% | l(attrs.title, ctx.get_aou(ctx.default_pickup_lib).name) %]
You would like to place a hold on <strong><q>[_1]</q></strong> to be picked up at [_2].