Lines 624-629
Link Here
|
624 |
Only pickup locations within the same hold group are allowed |
624 |
Only pickup locations within the same hold group are allowed |
625 |
[% ELSIF itemloo.not_holdable == 'noReservesAllowed' %] |
625 |
[% ELSIF itemloo.not_holdable == 'noReservesAllowed' %] |
626 |
No reserves are allowed on this item |
626 |
No reserves are allowed on this item |
|
|
627 |
[% ELSIF itemloo.not_holdable == 'no_valid_pickup_location' %] |
628 |
No valid pickup location |
627 |
[% ELSE %] |
629 |
[% ELSE %] |
628 |
[% itemloo.not_holdable | html %] |
630 |
[% itemloo.not_holdable | html %] |
629 |
[% END %] |
631 |
[% END %] |
Lines 721-730
Link Here
|
721 |
[% END %] |
723 |
[% END %] |
722 |
</td> |
724 |
</td> |
723 |
<td> |
725 |
<td> |
724 |
[% IF itemloo.any_pickup_location %] |
726 |
[% IF (itemloo.pickup_locations_count > 0) %] |
725 |
Any library |
727 |
<select name="item_pickup" class="pickup_locations" |
726 |
[% ELSE %] |
728 |
data-item-id="[% itemloo.itemnumber | html %]" |
727 |
[% itemloo.pickup_locations | html %] |
729 |
data-patron-id="[% patron.borrowernumber | html %]"></select> |
728 |
[% END %] |
730 |
[% END %] |
729 |
</td> |
731 |
</td> |
730 |
</tr> |
732 |
</tr> |
Lines 1187-1193
Link Here
|
1187 |
|
1189 |
|
1188 |
[% UNLESS ( multi_hold ) %] |
1190 |
[% UNLESS ( multi_hold ) %] |
1189 |
$("#hold-request-form").on("submit", function(){ |
1191 |
$("#hold-request-form").on("submit", function(){ |
1190 |
return check(); |
1192 |
return check($(this)); |
1191 |
}); |
1193 |
}); |
1192 |
[% ELSE %] |
1194 |
[% ELSE %] |
1193 |
$("#hold-request-form").on("submit", function(){ |
1195 |
$("#hold-request-form").on("submit", function(){ |
Lines 1288-1322
Link Here
|
1288 |
templateResult: display_pickup_location |
1290 |
templateResult: display_pickup_location |
1289 |
}); |
1291 |
}); |
1290 |
}); |
1292 |
}); |
|
|
1293 |
$(".pickup_locations").each( function () { |
1294 |
var this_dropdown = $(this); |
1295 |
var patron_id = $(this).data('patron-id'); |
1296 |
var item_id = $(this).data('item-id'); |
1297 |
|
1298 |
this_dropdown.select2({ |
1299 |
allowClear: true, |
1300 |
ajax: { |
1301 |
url: '/api/v1/items/' + encodeURIComponent(item_id) + '/pickup_locations', |
1302 |
delay: 300, // wait 300 milliseconds before triggering the request |
1303 |
dataType: 'json', |
1304 |
data: function (params) { |
1305 |
var search_term = (params.term === undefined) ? '' : params.term; |
1306 |
var query = { |
1307 |
"q": JSON.stringify({"name":{"-like":search_term+'%'}}), |
1308 |
"_order_by": "name", |
1309 |
"patron_id": patron_id |
1310 |
}; |
1311 |
return query; |
1312 |
}, |
1313 |
processResults: function (data) { |
1314 |
var results = []; |
1315 |
data.forEach( function ( pickup_location ) { |
1316 |
results.push( |
1317 |
{ |
1318 |
"id": pickup_location.library_id.escapeHtml(), |
1319 |
"text": pickup_location.name.escapeHtml(), |
1320 |
"needs_override": pickup_location.needs_override |
1321 |
} |
1322 |
); |
1323 |
}); |
1324 |
return { "results": results }; |
1325 |
} |
1326 |
}, |
1327 |
templateResult: display_pickup_location |
1328 |
}); |
1329 |
}); |
1291 |
}); |
1330 |
}); |
1292 |
|
1331 |
|
1293 |
function check() { |
1332 |
function check( table ) { |
|
|
1333 |
|
1294 |
var msg = ""; |
1334 |
var msg = ""; |
1295 |
var count_reserv = 0; |
|
|
1296 |
|
1335 |
|
1297 |
// check if we have checkitem form |
1336 |
if ( $("#requestany").attr("checked") !== "checked" ) { |
1298 |
if (document.form.checkitem){ |
1337 |
// requestany not selected, go through the item-specific cases |
1299 |
for (i=0;i<document.form.checkitem.length;i++){ |
1338 |
if ( $('input[type="radio"]:checked').length > 0 ) { |
1300 |
if (document.form.checkitem[i].checked == true) { |
1339 |
// got item-specific hold requests in the form! |
1301 |
count_reserv++ ; |
1340 |
// verify they have a pickup location selected |
|
|
1341 |
|
1342 |
if (table.find('input[type="radio"]:checked') |
1343 |
.closest('tr') |
1344 |
.find(".pickup_locations").val() === null) { |
1345 |
|
1346 |
msg = _("- Please select a pickup location for the item" + "\n") |
1302 |
} |
1347 |
} |
1303 |
} |
1348 |
} |
1304 |
// for only one item, check the checkitem without consider the loop checkitem |
1349 |
else { |
1305 |
if (i==0){ |
1350 |
msg = (_("- Please select an item to place a hold") + "\n"); |
1306 |
if (document.form.checkitem.checked == true) { |
|
|
1307 |
count_reserv++; |
1308 |
} |
1309 |
} |
1351 |
} |
1310 |
} |
1352 |
} |
1311 |
|
1353 |
|
1312 |
if (document.form.requestany.checked == true){ |
|
|
1313 |
count_reserv++ ; |
1314 |
} |
1315 |
|
1316 |
if (count_reserv == "0"){ |
1317 |
msg += (_("- Please select an item to place a hold") + "\n"); |
1318 |
} |
1319 |
|
1320 |
if (msg == "") { |
1354 |
if (msg == "") { |
1321 |
$('#hold-request-form').preventDoubleFormSubmit(); |
1355 |
$('#hold-request-form').preventDoubleFormSubmit(); |
1322 |
return(true); |
1356 |
return(true); |