View | Details | Raw Unified | Return to bug 27932
Collapse All | Expand All

(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt (-6 / +44 lines)
Lines 415-426 Link Here
415
                            </li>
415
                            </li>
416
                            <li>
416
                            <li>
417
                                <label for="pickup">Pickup at:</label>
417
                                <label for="pickup">Pickup at:</label>
418
                                <select name="pickup" size="1" id="pickup">
418
                            [% UNLESS ( multi_hold ) %]
419
                                    [% UNLESS ( multi_hold ) %]
419
                                <select name="pickup" size="1" id="pickup" data-biblio-id="[% biblio.biblionumber | html %]" data-patron-id="[% patron.borrowernumber | html %]">
420
                                        [% PROCESS options_for_libraries libraries => Branches.pickup_locations({ search_params => { biblio => biblionumber, patron => patron }, selected => pickup }) %]
420
                                    <option selected="selected" value="[% pickup | html %]">[% Branches.GetName(pickup) | html %]</option>
421
                                    [% ELSE %]
421
                            [% ELSE %]
422
                                        [% PROCESS options_for_libraries libraries => Branches.all({ selected => pickup, search_params => { pickup_location => 1 } }) %]
422
                                <select name="pickup" size="1" id="pickup" data-patron-id="[% patron.borrowernumber | html %]">
423
                                    [% END %]
423
                                    [% PROCESS options_for_libraries libraries => Branches.all({ selected => pickup, search_params => { pickup_location => 1 } }) %]
424
                            [% END %]
424
                                </select>
425
                                </select>
425
                            </li>
426
                            </li>
426
427
Lines 1208-1213 Link Here
1208
                    templateResult: display_pickup_location
1209
                    templateResult: display_pickup_location
1209
                });
1210
                });
1210
            });
1211
            });
1212
            $("#pickup").each( function () {
1213
                var this_dropdown = $(this);
1214
                var patron_id = $(this).data('patron-id');
1215
                var biblio_id = $(this).data('biblio-id');
1216
1217
                this_dropdown.select2({
1218
                    allowClear: false,
1219
                    ajax: {
1220
                        url: '/api/v1/biblios/' + encodeURIComponent(biblio_id) + '/pickup_locations',
1221
                        delay: 300, // wait 300 milliseconds before triggering the request
1222
                        dataType: 'json',
1223
                        data: function (params) {
1224
                            var search_term = (params.term === undefined) ? '' : params.term;
1225
                            var query = {
1226
                                "q": JSON.stringify({"name":{"-like":search_term+'%'}}),
1227
                                "_order_by": "name",
1228
                                "patron_id": patron_id
1229
                            };
1230
                            return query;
1231
                        },
1232
                        processResults: function (data) {
1233
                            var results = [];
1234
                            data.forEach( function ( pickup_location ) {
1235
                                results.push(
1236
                                    {
1237
                                        "id": pickup_location.library_id.escapeHtml(),
1238
                                        "text": pickup_location.name.escapeHtml(),
1239
                                        "needs_override": pickup_location.needs_override
1240
                                    }
1241
                                );
1242
                            });
1243
                            return { "results": results };
1244
                        }
1245
                    },
1246
                    templateResult: display_pickup_location
1247
                });
1248
            });
1211
        });
1249
        });
1212
1250
1213
        function check() {
1251
        function check() {
(-)a/reserve/request.pl (-2 / +1 lines)
Lines 67-73 my ( $template, $borrowernumber, $cookie, $flags ) = get_template_and_user( Link Here
67
);
67
);
68
68
69
my $showallitems = $input->param('showallitems');
69
my $showallitems = $input->param('showallitems');
70
my $pickup = $input->param('pickup');
70
my $pickup = $input->param('pickup') || C4::Context->userenv->{'branch'};
71
71
72
my $itemtypes = { map { $_->{itemtype} => $_ } @{ Koha::ItemTypes->search_with_localization->unblessed } };
72
my $itemtypes = { map { $_->{itemtype} => $_ } @{ Koha::ItemTypes->search_with_localization->unblessed } };
73
73
74
- 

Return to bug 27932