Lines 124-143
Link Here
|
124 |
<form action="/cgi-bin/koha/opac-reserve.pl" method="post" id="hold-request-form"> |
124 |
<form action="/cgi-bin/koha/opac-reserve.pl" method="post" id="hold-request-form"> |
125 |
<input type="hidden" name="place_reserve" value="1"/> |
125 |
<input type="hidden" name="place_reserve" value="1"/> |
126 |
<!-- These values are set dynamically by js --> |
126 |
<!-- These values are set dynamically by js --> |
127 |
<input type="hidden" name="biblionumbers" id="biblionumbers"/> |
|
|
128 |
<input type="hidden" name="selecteditems" id="selections"/> |
129 |
<div id="bigloop"> |
127 |
<div id="bigloop"> |
130 |
|
128 |
|
131 |
[% FOREACH bibitemloo IN bibitemloop %] |
129 |
[% FOREACH bibitemloo IN bibitemloop %] |
132 |
<div class="holdrow"> |
130 |
<div class="holdrow"> |
|
|
131 |
<input id="remaining_holds_[% bibitemloo.biblionumber %]" type="hidden" value="[% bibitemloo.remaining_holds_for_record %]"/> |
133 |
<p> |
132 |
<p> |
134 |
[% IF ( bibitemloo.holdable ) %] |
133 |
[% IF ( bibitemloo.holdable ) %] |
135 |
<input class="reserve_mode" name="reserve_mode" type="hidden" value="single"/> |
134 |
<span title="[% bibitemloo.biblionumber %]" style="padding:.3em"> |
136 |
<input class="single_bib" name="single_bib" type="hidden" value="[% bibitemloo.biblionumber %]"/> |
135 |
<label> |
137 |
<span class="confirmjs_hold" title="[% bibitemloo.biblionumber %]" style="padding:.3em"></span> |
136 |
<input class="biblionumbers" name="biblionumbers" type="checkbox" value="[% bibitemloo.biblionumber %]" checked="checked"> |
138 |
<span class="confirm_nonjs"> |
137 |
Place a hold on |
139 |
<input type="radio" class="confirmbox checkitem [% bibitemloo.biblionumber %]" name="[% bibitemloo.biblionumber %]" checked="checked" id="single_[% bibitemloo.biblionumber %]" value="any" /> |
138 |
</label> |
140 |
<label class="confirm_label" for="single_[% bibitemloo.biblionumber %]">Place a hold on </label> |
|
|
141 |
</span> |
139 |
</span> |
142 |
[% END # / bibitemloo.holdable %] |
140 |
[% END # / bibitemloo.holdable %] |
143 |
|
141 |
|
Lines 204-210
Link Here
|
204 |
<li class="branch"> |
202 |
<li class="branch"> |
205 |
<label for="branch_[% bibitemloo.biblionumber %]">Pick up location:</label> |
203 |
<label for="branch_[% bibitemloo.biblionumber %]">Pick up location:</label> |
206 |
[% UNLESS ( bibitemloo.holdable ) %] |
204 |
[% UNLESS ( bibitemloo.holdable ) %] |
207 |
<select name="branch" id="branch_[% bibitemloo.biblionumber %]" disabled="disabled"> |
205 |
<select name="branch_[% bibitemloo.biblionumber %]" id="branch_[% bibitemloo.biblionumber %]" disabled="disabled"> |
208 |
[% FOREACH branchloo IN bibitemloo.branchloop %] |
206 |
[% FOREACH branchloo IN bibitemloo.branchloop %] |
209 |
[% IF ( branchloo.selected ) %] |
207 |
[% IF ( branchloo.selected ) %] |
210 |
<option value="[% branchloo.branchcode %]" selected="selected">[% branchloo.branchname %]</option> |
208 |
<option value="[% branchloo.branchcode %]" selected="selected">[% branchloo.branchname %]</option> |
Lines 214-220
Link Here
|
214 |
[% END %] |
212 |
[% END %] |
215 |
</select> |
213 |
</select> |
216 |
[% ELSE %] |
214 |
[% ELSE %] |
217 |
<select name="branch" id="branch_[% bibitemloo.biblionumber %]"> |
215 |
<select name="branch_[% bibitemloo.biblionumber %]" id="branch_[% bibitemloo.biblionumber %]"> |
218 |
[% FOREACH branchloo IN bibitemloo.branchloop %] |
216 |
[% FOREACH branchloo IN bibitemloo.branchloop %] |
219 |
[% IF ( branchloo.selected ) %] |
217 |
[% IF ( branchloo.selected ) %] |
220 |
<option value="[% branchloo.branchcode %]" selected="selected">[% branchloo.branchname %]</option> |
218 |
<option value="[% branchloo.branchcode %]" selected="selected">[% branchloo.branchname %]</option> |
Lines 261-270
Link Here
|
261 |
|
259 |
|
262 |
<li> |
260 |
<li> |
263 |
</li> |
261 |
</li> |
264 |
[% IF bibitemloo.itemholdable %] |
|
|
265 |
<!-- ITEM HOLDS --> |
262 |
<!-- ITEM HOLDS --> |
266 |
<li class="lradio place_on_type" style="display:none;"> |
263 |
<li class="lradio place_on_type" style="display:none;"> |
267 |
[% IF NOT bibitemloo.force_hold %] |
|
|
268 |
<label class="radio inline" for="reqany_[% bibitemloo.biblionumber %]">Next available item</label> |
264 |
<label class="radio inline" for="reqany_[% bibitemloo.biblionumber %]">Next available item</label> |
269 |
<input type="radio" name="reqtype_[% bibitemloo.biblionumber %]" |
265 |
<input type="radio" name="reqtype_[% bibitemloo.biblionumber %]" |
270 |
id="reqany_[% bibitemloo.biblionumber %]" |
266 |
id="reqany_[% bibitemloo.biblionumber %]" |
Lines 272-278
Link Here
|
272 |
value="Any" |
268 |
value="Any" |
273 |
checked="checked" |
269 |
checked="checked" |
274 |
/> |
270 |
/> |
275 |
[% END %] |
|
|
276 |
<label class="radio inline" for="reqspecific_[% bibitemloo.biblionumber %]">A specific item</label> |
271 |
<label class="radio inline" for="reqspecific_[% bibitemloo.biblionumber %]">A specific item</label> |
277 |
<input type="radio" name="reqtype_[% bibitemloo.biblionumber %]" |
272 |
<input type="radio" name="reqtype_[% bibitemloo.biblionumber %]" |
278 |
id="reqspecific_[% bibitemloo.biblionumber %]" |
273 |
id="reqspecific_[% bibitemloo.biblionumber %]" |
Lines 280-289
Link Here
|
280 |
value="Specific" |
275 |
value="Specific" |
281 |
/> |
276 |
/> |
282 |
</li> |
277 |
</li> |
283 |
[% END # / IF bibitemloo.itemholdable %] |
|
|
284 |
</ul> |
278 |
</ul> |
285 |
|
279 |
|
286 |
[% IF bibitemloo.itemholdable %] |
280 |
[% IF bibitemloo.remaining_holds_for_record > 1 %] |
|
|
281 |
[% SET count = 1 %] |
282 |
<div id="holds_to_place_[% bibitemloo.biblionumber %]" class="hold-options holds-to-place"> |
283 |
<label>Holds to place (count)</label> |
284 |
<select name="holds_to_place_count_[% bibitemloo.biblionumber %]"> |
285 |
[% WHILE count <= bibitemloo.remaining_holds_for_record %] |
286 |
<option value="[% count %]">[% count %]</option> |
287 |
[% SET count = count + 1 %] |
288 |
[% END %] |
289 |
</select> |
290 |
</div> |
291 |
[% ELSE %] |
292 |
<input type="hidden" name="holds_to_place_count_[% bibitemloo.biblionumber %]" value="1" /> |
293 |
[% END %] |
294 |
|
287 |
<table class="copiesrow table table-bordered table-striped" id="copiesrow_[% bibitemloo.biblionumber %]"> |
295 |
<table class="copiesrow table table-bordered table-striped" id="copiesrow_[% bibitemloo.biblionumber %]"> |
288 |
<caption>Select a specific item:</caption> |
296 |
<caption>Select a specific item:</caption> |
289 |
<tr> |
297 |
<tr> |
Lines 307-315
Link Here
|
307 |
<tr class="[% itemLoo.backgroundcolor %]"> |
315 |
<tr class="[% itemLoo.backgroundcolor %]"> |
308 |
<td class="copynumber"> |
316 |
<td class="copynumber"> |
309 |
[% IF ( itemLoo.available ) %] |
317 |
[% IF ( itemLoo.available ) %] |
310 |
<input type="radio" class="checkitem checkitem_[% bibitemloo.biblionumber %]" name="checkitem_[% bibitemloo.biblionumber %]" value="[% itemLoo.itemnumber %]" /> |
318 |
<input type="checkbox" class="checkitem checkitem_[% bibitemloo.biblionumber %]" name="checkitem_[% bibitemloo.biblionumber %]" value="[% itemLoo.itemnumber %]" /> |
311 |
[% ELSE %] |
319 |
[% ELSE %] |
312 |
<input disabled="disabled" type="radio" class="checkitem" name="checkitem" value="[% itemLoo.itemnumber %]" |
320 |
<input disabled="disabled" type="checkbox" class="checkitem" name="checkitem" value="[% itemLoo.itemnumber %]" |
313 |
style="display:none;" /> |
321 |
style="display:none;" /> |
314 |
<img src="[% interface %]/lib/famfamfam/silk/cross.png" alt="Cannot be put on hold" title="Cannot be put on hold" /> |
322 |
<img src="[% interface %]/lib/famfamfam/silk/cross.png" alt="Cannot be put on hold" title="Cannot be put on hold" /> |
315 |
[% END %] |
323 |
[% END %] |
Lines 383-389
Link Here
|
383 |
</tr> |
391 |
</tr> |
384 |
[% END # / FOREACH itemLoo IN bibitemloo.itemLoop%] |
392 |
[% END # / FOREACH itemLoo IN bibitemloo.itemLoop%] |
385 |
</table> <!-- / #copiesrow_[% bibitemloo.biblionumber %] --> |
393 |
</table> <!-- / #copiesrow_[% bibitemloo.biblionumber %] --> |
386 |
[% END # / IF ( bibitemloo.itemholdable )%] |
|
|
387 |
</div> <!-- / #hold-options-[% bibitemloo.biblionumber %] --> |
394 |
</div> <!-- / #hold-options-[% bibitemloo.biblionumber %] --> |
388 |
</fieldset> |
395 |
</fieldset> |
389 |
[% END # / IF ( bibitemloo.holdable ) %] |
396 |
[% END # / IF ( bibitemloo.holdable ) %] |
Lines 406-411
Link Here
|
406 |
<script type="text/javascript"> |
413 |
<script type="text/javascript"> |
407 |
// <![CDATA[ |
414 |
// <![CDATA[ |
408 |
var MSG_NO_ITEM_SELECTED = _("Expecting a specific item selection."); |
415 |
var MSG_NO_ITEM_SELECTED = _("Expecting a specific item selection."); |
|
|
416 |
var MSG_MAX_HOLDS_EXCEEDED = _("Maximum number of reserve exceded."); |
409 |
var ForceHoldNotesReasons=new Array( |
417 |
var ForceHoldNotesReasons=new Array( |
410 |
_("This title consists of multiple volumes/parts. Please indicate which part you need. Clicking on specific item information may be helpful."), |
418 |
_("This title consists of multiple volumes/parts. Please indicate which part you need. Clicking on specific item information may be helpful."), |
411 |
"*** Add a new reason above this line ***" ); |
419 |
"*** Add a new reason above this line ***" ); |
Lines 419-426
Link Here
|
419 |
|
427 |
|
420 |
// Select the first item available |
428 |
// Select the first item available |
421 |
function select_first_available(id){ |
429 |
function select_first_available(id){ |
422 |
var radios = $("input:radio[name='checkitem_" + id + "']"); |
430 |
var checkboxes = $("input:checkbox[name='checkitem_" + id + "']"); |
423 |
$(radios).first().attr("checked", "checked"); |
431 |
$(checkboxes).first().attr("checked", "checked"); |
424 |
} |
432 |
} |
425 |
|
433 |
|
426 |
$(document).ready(function() { |
434 |
$(document).ready(function() { |
Lines 441-454
Link Here
|
441 |
} |
449 |
} |
442 |
}); |
450 |
}); |
443 |
|
451 |
|
444 |
// click on a first td check the confirmjs checkbox |
452 |
$('.checkitem').click(function(e) { |
445 |
$("td.hold").click(function(e){ |
453 |
var bibNum = suffixOf($(this).attr("name"), "_"); |
446 |
if(e.target.tagName.toLowerCase() == 'td'){ |
454 |
var nbCheked = $("input[name='checkitem_"+bibNum+"']:checked").length; |
447 |
$(this).find("input.confirmjs").each( function() { |
455 |
var remaining = $("input[id='remaining_holds_"+bibNum+"']").val(); |
448 |
$(this).attr('checked', !$(this).attr('checked')); |
456 |
if (nbCheked >= remaining) { |
449 |
$(this).change(); |
457 |
$("input[name='checkitem_"+bibNum+"']:not(:checked)").attr('disabled', 'disabled'); |
450 |
}); |
458 |
} |
451 |
} |
459 |
else { |
|
|
460 |
$('.checkitem_'+bibNum).attr('disabled', false); |
461 |
} |
452 |
}); |
462 |
}); |
453 |
|
463 |
|
454 |
$(".toggle-hold-options").on("click",function(e){ |
464 |
$(".toggle-hold-options").on("click",function(e){ |
Lines 463-474
Link Here
|
463 |
// Hides all 'specific copy' table rows on load. |
473 |
// Hides all 'specific copy' table rows on load. |
464 |
$(".copiesrow").hide(); |
474 |
$(".copiesrow").hide(); |
465 |
|
475 |
|
|
|
476 |
$(".holds-to-place").show(); |
466 |
[% FOREACH bibitemloo IN bibitemloop %] |
477 |
[% FOREACH bibitemloo IN bibitemloop %] |
467 |
[% IF bibitemloo.force_hold %] |
478 |
[% IF bibitemloo.force_hold %] |
468 |
$("#toggle-hold-options-[% bibitemloo.biblionumber %]").click(); |
479 |
[% IF bibitemloo.force_hold == 'item' %] |
469 |
$("#reqspecific_[% bibitemloo.biblionumber %]").click(); |
480 |
$("#toggle-hold-options-[% bibitemloo.biblionumber %]").click(); |
470 |
$("#copiesrow_[% bibitemloo.biblionumber %]").show(); |
481 |
$("#reqspecific_[% bibitemloo.biblionumber %]").attr('checked', true); |
471 |
[% END %] |
482 |
$("#holds_to_place_[% bibitemloo.biblionumber %]").hide(); |
|
|
483 |
$("#copiesrow_[% bibitemloo.biblionumber %]").show(); |
484 |
[% ELSIF bibitemloo.force_hold == 'record' %] |
485 |
$("#toggle-hold-options-[% bibitemloo.biblionumber %]").click(); |
486 |
$("#reqany_[% bibitemloo.biblionumber %]").attr('checked', true); |
487 |
[% END %] |
488 |
$("#reqany_[% bibitemloo.biblionumber %]").attr('disabled', 'disabled'); |
489 |
$("#reqspecific_[% bibitemloo.biblionumber %]").attr('disabled', 'disabled'); |
490 |
[% END %] |
472 |
[% END %] |
491 |
[% END %] |
473 |
|
492 |
|
474 |
// Insert reasons for forced hold notes |
493 |
// Insert reasons for forced hold notes |
Lines 494-533
Link Here
|
494 |
$("#" + op + fieldID).val(""); |
513 |
$("#" + op + fieldID).val(""); |
495 |
}); |
514 |
}); |
496 |
|
515 |
|
497 |
// Replace non-JS single-selection with multi-selection capability. |
|
|
498 |
$(".reserve_mode").val("multi"); |
499 |
$(".confirm_nonjs").remove(); |
500 |
$(".confirmjs_hold").each(function(){ |
501 |
var bib = $(this).attr("title"); |
502 |
var html = "<label><input type =\"checkbox\" class=\"confirmjs\" checked=\"checked\""; |
503 |
html += "value=\"" + bib + "\" id=\"" + bib + "\" /> " + _("Place a hold on") + " </label> "; |
504 |
$(this).html(html); |
505 |
}); |
506 |
$(".confirmjs_nohold").each(function(){ |
507 |
var bib = $(this).attr("title"); |
508 |
var html = "<label><input type =\"checkbox\" class=\"confirmjs\" disabled=\"disabled\""; |
509 |
html += "value=\"" + bib + "\" id=\"" + bib + "\" />" + _("Place a hold on: ") + "</label>"; |
510 |
$(this).html(html); |
511 |
}); |
512 |
|
513 |
// expand or collapse the copiesrow tr |
516 |
// expand or collapse the copiesrow tr |
514 |
function toggle_copiesrow(biblioNum) { |
517 |
function toggle_copiesrow(biblioNum) { |
515 |
var checkbox = $("input:checkbox[value='"+biblioNum+"']"); |
518 |
var checkbox = $("input:checkbox[value='"+biblioNum+"']"); |
516 |
newCopiesRowId = "#copiesrow_" + biblioNum; |
519 |
newCopiesRowId = "#copiesrow_" + biblioNum; |
|
|
520 |
holdsToPlaceCountId = "#holds_to_place_" + biblioNum; |
517 |
var select_specific = $("#reqspecific_"+biblioNum).is(":checked"); |
521 |
var select_specific = $("#reqspecific_"+biblioNum).is(":checked"); |
518 |
// If the checkbox is checked AND we want a specific item, we display the items block |
522 |
// If the checkbox is checked AND we want a specific item, we display the items block |
519 |
if ( $(checkbox).is(":checked") && select_specific ) { |
523 |
if ( $(checkbox).is(":checked") && select_specific ) { |
520 |
$(newCopiesRowId).show(); |
524 |
$(newCopiesRowId).show(); |
|
|
525 |
$(holdsToPlaceCountId).hide(); |
521 |
} else { |
526 |
} else { |
522 |
$(newCopiesRowId).hide(); |
527 |
$(newCopiesRowId).hide(); |
|
|
528 |
$(holdsToPlaceCountId).show(); |
523 |
} |
529 |
} |
524 |
}; |
530 |
}; |
525 |
|
531 |
|
526 |
$("#place_on_hdr").show(); |
532 |
function total_requested() { |
|
|
533 |
var total = 0; |
534 |
$("input[name='biblionumbers']:checked").each(function() { |
535 |
var biblioNum = $(this).val(); |
536 |
if ($("#reqspecific_" + biblioNum + ":checked").size() > 0) { |
537 |
total += parseInt($("input[name='checkitem_'"+biblioNum+"]:checked").length); |
538 |
} else { |
539 |
total += parseInt($("select[name='holds_to_place_count_"+biblioNum+"']").val()); |
540 |
} |
541 |
}); |
542 |
return total; |
543 |
} |
527 |
|
544 |
|
528 |
$(".place_on_type").show(); |
545 |
$(".place_on_type").show(); |
529 |
// onload, selectany is checked |
546 |
// onload, selectany is checked |
530 |
$(".selectany").attr("checked", "checked"); |
|
|
531 |
|
547 |
|
532 |
// If the user is *allowed* to choose a specific item |
548 |
// If the user is *allowed* to choose a specific item |
533 |
// The first one is preselected |
549 |
// The first one is preselected |
Lines 536-543
Link Here
|
536 |
select_first_available(id); |
552 |
select_first_available(id); |
537 |
}); |
553 |
}); |
538 |
|
554 |
|
539 |
// On confirmsjs change |
555 |
// On biblionumbers change |
540 |
$(".confirmjs").change(function(){ |
556 |
$(".biblionumbers").change(function(){ |
541 |
var id = suffixOf($(this).attr("id"), "_"); |
557 |
var id = suffixOf($(this).attr("id"), "_"); |
542 |
// If I m checked, I enable radio buttons |
558 |
// If I m checked, I enable radio buttons |
543 |
if ( $(this).is(":checked") ) { |
559 |
if ( $(this).is(":checked") ) { |
Lines 559-593
Link Here
|
559 |
toggle_copiesrow(id); |
575 |
toggle_copiesrow(id); |
560 |
}); |
576 |
}); |
561 |
|
577 |
|
562 |
// Show or hide holds notes |
|
|
563 |
$(".shownotes").click(function(){ |
564 |
biblioNum = suffixOf($(this).attr("id"), "_"); |
565 |
$("#notesrow_"+biblioNum).toggle(); |
566 |
}); |
567 |
|
568 |
// When 'Place Hold' button is clicked |
578 |
// When 'Place Hold' button is clicked |
569 |
$(".placehold").click(function(){ |
579 |
$(".placehold").click(function(){ |
570 |
var biblionumbers = ""; |
580 |
if (total_requested() + [% reserves_count %] > [% maxreserves %]) { |
571 |
var selections = ""; |
581 |
alert(MSG_MAX_HOLDS_EXCEEDED); |
572 |
|
582 |
return false; |
573 |
[% IF new_reserves_allowed %] |
583 |
} |
574 |
if ($(".confirmjs:checked").size() > [% new_reserves_allowed %] ) { |
|
|
575 |
alert(MSG_MAX_HOLDS_EXCEEDED); |
576 |
return false; |
577 |
} |
578 |
[% END %] |
579 |
|
584 |
|
580 |
if ($(".confirmjs:checked").size() == 0) { |
585 |
if ($("input[name='biblionumbers']:checked").size() == 0) { |
581 |
alert(MSG_NO_RECORD_SELECTED); |
586 |
alert(MSG_NO_RECORD_SELECTED); |
582 |
return false; |
587 |
return false; |
583 |
} |
588 |
} |
584 |
|
589 |
|
585 |
// Find the items with the 'Hold' box checked |
590 |
// Find the items with the 'Hold' box checked |
586 |
var badBib = null; |
591 |
var badBib = null; |
587 |
$(".confirmjs:checked").each(function() { |
592 |
$("input[name='biblionumbers']:checked").each(function() { |
588 |
var biblioNum = $(this).val(); |
593 |
var biblioNum = $(this).val(); |
589 |
biblionumbers += biblioNum + "/"; |
|
|
590 |
selections += biblioNum + "/"; |
591 |
|
594 |
|
592 |
// If the 'specific copy' radio button is checked |
595 |
// If the 'specific copy' radio button is checked |
593 |
if ($("#reqspecific_" + biblioNum + ":checked").size() > 0) { |
596 |
if ($("#reqspecific_" + biblioNum + ":checked").size() > 0) { |
Lines 596-613
Link Here
|
596 |
if ($(item).size() == 0) { |
599 |
if ($(item).size() == 0) { |
597 |
badBib = biblioNum; |
600 |
badBib = biblioNum; |
598 |
return false; |
601 |
return false; |
599 |
} else { |
|
|
600 |
selections += $(item).val(); |
601 |
} |
602 |
} |
602 |
} |
603 |
} |
603 |
selections += "/"; |
|
|
604 |
|
605 |
// Add the pickup location |
606 |
var branchSel = $("#branch_" + biblioNum); |
607 |
if (branchSel.size() > 0) { |
608 |
selections += $(branchSel).val(); |
609 |
} |
610 |
selections += "/"; |
611 |
return true; |
604 |
return true; |
612 |
}); |
605 |
}); |
613 |
|
606 |
|
Lines 616-624
Link Here
|
616 |
return false; |
609 |
return false; |
617 |
} |
610 |
} |
618 |
|
611 |
|
619 |
$("#selections").val(selections); |
|
|
620 |
$("#biblionumbers").val(biblionumbers); |
621 |
|
622 |
return true; |
612 |
return true; |
623 |
}); |
613 |
}); |
624 |
|
614 |
|