From: Lebbeous Fogle-Weekley <lebbeous@esilibrary.com> Date: Mon, 11 Jul 2011 21:43:51 +0000 (-0400) Subject: Staff can now place title-type holds for patrons X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=a473e68540e532916eda31d35635bbba2dc54137;p=contrib%2FConifer.git Staff can now place title-type holds for patrons Still need to put in copy, volume and issuance (and parts? maybe later) -type holds. Still need to deal with overridable events. Signed-off-by: Lebbeous Fogle-Weekley <lebbeous@esilibrary.com> --- 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 efaeb28fb5..371ce14f50 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm @@ -366,10 +366,28 @@ sub load_place_hold { $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 @@ -385,8 +403,8 @@ sub load_place_hold { 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.. diff --git a/Open-ILS/web/css/skin/default/opac/style.css b/Open-ILS/web/css/skin/default/opac/style.css index 0e7ffda077..cf2088b731 100644 --- a/Open-ILS/web/css/skin/default/opac/style.css +++ b/Open-ILS/web/css/skin/default/opac/style.css @@ -1002,3 +1002,4 @@ a.dash-link:hover { text-decoration: underline !important; } .invisible { visibility: hidden; } .rdetail-extras-summary { margin: 10px; } +.staff-hold { background-color: #eee; } diff --git a/Open-ILS/web/js/ui/default/opac/staff.js b/Open-ILS/web/js/ui/default/opac/staff.js index abb8ce83d3..533258cb6a 100644 --- a/Open-ILS/web/js/ui/default/opac/staff.js +++ b/Open-ILS/web/js/ui/default/opac/staff.js @@ -14,6 +14,10 @@ function runEvt(scope, name) { 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+)/); diff --git a/Open-ILS/web/templates/default/opac/parts/place_hold.tt2 b/Open-ILS/web/templates/default/opac/parts/place_hold.tt2 index 8f56aa5ba7..3e372446e8 100644 --- a/Open-ILS/web/templates/default/opac/parts/place_hold.tt2 +++ b/Open-ILS/web/templates/default/opac/parts/place_hold.tt2 @@ -3,39 +3,6 @@ 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> @@ -69,6 +36,25 @@ <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].