@@ -, +, @@ when placing hold --- .../prog/en/modules/reserve/request.tt | 50 ++++++++++++++++--- reserve/request.pl | 2 +- 2 files changed, 45 insertions(+), 7 deletions(-) --- a/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt @@ -415,12 +415,13 @@
  • - + + [% ELSE %] +
  • @@ -1208,6 +1209,43 @@ templateResult: display_pickup_location }); }); + $("#pickup").each( function () { + var this_dropdown = $(this); + var patron_id = $(this).data('patron-id'); + var biblio_id = $(this).data('biblio-id'); + + this_dropdown.select2({ + allowClear: false, + ajax: { + url: '/api/v1/biblios/' + encodeURIComponent(biblio_id) + '/pickup_locations', + delay: 300, // wait 300 milliseconds before triggering the request + dataType: 'json', + data: function (params) { + var search_term = (params.term === undefined) ? '' : params.term; + var query = { + "q": JSON.stringify({"name":{"-like":search_term+'%'}}), + "_order_by": "name", + "patron_id": patron_id + }; + return query; + }, + processResults: function (data) { + var results = []; + data.forEach( function ( pickup_location ) { + results.push( + { + "id": pickup_location.library_id.escapeHtml(), + "text": pickup_location.name.escapeHtml(), + "needs_override": pickup_location.needs_override + } + ); + }); + return { "results": results }; + } + }, + templateResult: display_pickup_location + }); + }); }); function check() { --- a/reserve/request.pl +++ a/reserve/request.pl @@ -67,7 +67,7 @@ my ( $template, $borrowernumber, $cookie, $flags ) = get_template_and_user( ); my $showallitems = $input->param('showallitems'); -my $pickup = $input->param('pickup'); +my $pickup = $input->param('pickup') || C4::Context->userenv->{'branch'}; my $itemtypes = { map { $_->{itemtype} => $_ } @{ Koha::ItemTypes->search_with_localization->unblessed } }; --