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

(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt (-7 / +44 lines)
Lines 441-452 Link Here
441
                            </li>
441
                            </li>
442
                            <li>
442
                            <li>
443
                                <label for="pickup">Pickup at:</label>
443
                                <label for="pickup">Pickup at:</label>
444
                                <select name="pickup" id="pickup">
444
                            [% UNLESS ( multi_hold ) %]
445
                                    [% UNLESS ( multi_hold ) %]
445
                                <select name="pickup" size="1" id="pickup" data-biblio-id="[% biblio.biblionumber | html %]" data-patron-id="[% patron.borrowernumber | html %]">
446
                                        [% PROCESS options_for_libraries libraries => Branches.pickup_locations({ search_params => { biblio => biblionumber, patron => patron }, selected => pickup }) %]
446
                                    <option selected="selected" value="[% pickup | html %]">[% Branches.GetName(pickup) | html %]</option>
447
                                    [% ELSE %]
447
                            [% ELSE %]
448
                                        [% PROCESS options_for_libraries libraries => Branches.all({ selected => pickup, search_params => { pickup_location => 1 } }) %]
448
                                <select name="pickup" size="1" id="pickup" data-patron-id="[% patron.borrowernumber | html %]">
449
                                    [% END %]
449
                                    [% PROCESS options_for_libraries libraries => Branches.all({ selected => pickup, search_params => { pickup_location => 1 } }) %]
450
                            [% END %]
450
                                </select>
451
                                </select>
451
                            </li>
452
                            </li>
452
453
Lines 1237-1242 Link Here
1237
                    templateResult: display_pickup_location
1238
                    templateResult: display_pickup_location
1238
                });
1239
                });
1239
            });
1240
            });
1241
            $("#pickup").each( function () {
1242
                var this_dropdown = $(this);
1243
                var patron_id = $(this).data('patron-id');
1244
                var biblio_id = $(this).data('biblio-id');
1245
1246
                this_dropdown.select2({
1247
                    allowClear: false,
1248
                    ajax: {
1249
                        url: '/api/v1/biblios/' + encodeURIComponent(biblio_id) + '/pickup_locations',
1250
                        delay: 300, // wait 300 milliseconds before triggering the request
1251
                        dataType: 'json',
1252
                        data: function (params) {
1253
                            var search_term = (params.term === undefined) ? '' : params.term;
1254
                            var query = {
1255
                                "q": JSON.stringify({"name":{"-like":search_term+'%'}}),
1256
                                "_order_by": "name",
1257
                                "patron_id": patron_id
1258
                            };
1259
                            return query;
1260
                        },
1261
                        processResults: function (data) {
1262
                            var results = [];
1263
                            data.forEach( function ( pickup_location ) {
1264
                                results.push(
1265
                                    {
1266
                                        "id": pickup_location.library_id.escapeHtml(),
1267
                                        "text": pickup_location.name.escapeHtml(),
1268
                                        "needs_override": pickup_location.needs_override
1269
                                    }
1270
                                );
1271
                            });
1272
                            return { "results": results };
1273
                        }
1274
                    },
1275
                    templateResult: display_pickup_location
1276
                });
1277
            });
1240
        });
1278
        });
1241
1279
1242
        function check() {
1280
        function check() {
1243
- 

Return to bug 27864