Lines 151-170
Link Here
|
151 |
<form action="/cgi-bin/koha/opac-reserve.pl" method="post" id="hold-request-form"> |
151 |
<form action="/cgi-bin/koha/opac-reserve.pl" method="post" id="hold-request-form"> |
152 |
<input type="hidden" name="place_reserve" value="1"/> |
152 |
<input type="hidden" name="place_reserve" value="1"/> |
153 |
<!-- These values are set dynamically by js --> |
153 |
<!-- These values are set dynamically by js --> |
154 |
<input type="hidden" name="biblionumbers" id="biblionumbers"/> |
|
|
155 |
<input type="hidden" name="selecteditems" id="selections"/> |
156 |
<div id="bigloop"> |
154 |
<div id="bigloop"> |
157 |
|
155 |
|
158 |
[% FOREACH bibitemloo IN bibitemloop %] |
156 |
[% FOREACH bibitemloo IN bibitemloop %] |
159 |
<div class="holdrow"> |
157 |
<div class="holdrow"> |
|
|
158 |
<input id="remaining_holds_[% bibitemloo.biblionumber %]" type="hidden" value="[% bibitemloo.remaining_holds_for_record %]"/> |
160 |
<p> |
159 |
<p> |
161 |
[% IF ( bibitemloo.holdable ) %] |
160 |
[% IF ( bibitemloo.holdable ) %] |
162 |
<input class="reserve_mode" name="reserve_mode" type="hidden" value="single"/> |
161 |
<span title="[% bibitemloo.biblionumber %]" style="padding:.3em"> |
163 |
<input class="single_bib" name="single_bib" type="hidden" value="[% bibitemloo.biblionumber | html %]"/> |
162 |
<label> |
164 |
<span class="confirmjs_hold" title="[% bibitemloo.biblionumber | html %]" style="padding:.3em"></span> |
163 |
<input class="biblionumbers" name="biblionumbers" type="checkbox" value="[% bibitemloo.biblionumber %]" checked="checked"> |
165 |
<span class="confirm_nonjs"> |
164 |
Place a hold on |
166 |
<input type="radio" class="confirmbox checkitem [% bibitemloo.biblionumber | html %]" name="[% bibitemloo.biblionumber | html %]" checked="checked" id="single_[% bibitemloo.biblionumber | html %]" value="any" /> |
165 |
</label> |
167 |
<label class="confirm_label" for="single_[% bibitemloo.biblionumber | html %]">Place a hold on </label> |
|
|
168 |
</span> |
166 |
</span> |
169 |
[% END # / bibitemloo.holdable %] |
167 |
[% END # / bibitemloo.holdable %] |
170 |
|
168 |
|
Lines 230-236
Link Here
|
230 |
<li class="branch"> |
228 |
<li class="branch"> |
231 |
<label for="branch_[% bibitemloo.biblionumber | html %]">Pick up location:</label> |
229 |
<label for="branch_[% bibitemloo.biblionumber | html %]">Pick up location:</label> |
232 |
[% UNLESS ( bibitemloo.holdable ) %] |
230 |
[% UNLESS ( bibitemloo.holdable ) %] |
233 |
<select name="branch" id="branch_[% bibitemloo.biblionumber | html %]" disabled="disabled"> |
231 |
<select name="branch_[% bibitemloo.biblionumber %]" id="branch_[% bibitemloo.biblionumber | html %]" disabled="disabled"> |
234 |
[% PROCESS options_for_libraries libraries => Branches.pickup_locations( biblio => bibitemloo.biblionumber, selected => branch ) %] |
232 |
[% PROCESS options_for_libraries libraries => Branches.pickup_locations( biblio => bibitemloo.biblionumber, selected => branch ) %] |
235 |
</select> |
233 |
</select> |
236 |
[% ELSE %] |
234 |
[% ELSE %] |
Lines 304-333
Link Here
|
304 |
</li> |
302 |
</li> |
305 |
[% END # / IF OpacHoldNotes %] |
303 |
[% END # / IF OpacHoldNotes %] |
306 |
|
304 |
|
307 |
[% IF bibitemloo.itemholdable %] |
305 |
<!-- ITEM HOLDS --> |
308 |
<!-- ITEM HOLDS --> |
306 |
<li class="lradio place_on_type" style="display:none;"> |
309 |
<li class="lradio place_on_type" style="display:none;"> |
307 |
<label class="radio inline" for="reqany_[% bibitemloo.biblionumber %]">Next available item</label> |
310 |
[% IF NOT bibitemloo.force_hold %] |
308 |
<input type="radio" name="reqtype_[% bibitemloo.biblionumber %]" |
311 |
<label class="radio inline" for="reqany_[% bibitemloo.biblionumber | html %]">Next available item</label> |
309 |
id="reqany_[% bibitemloo.biblionumber %]" |
312 |
<input type="radio" name="reqtype_[% bibitemloo.biblionumber | html %]" |
310 |
class="selectany" |
313 |
id="reqany_[% bibitemloo.biblionumber | html %]" |
311 |
value="Any" |
314 |
class="selectany" |
312 |
checked="checked" |
315 |
value="Any" |
|
|
316 |
checked="checked" |
317 |
/> |
318 |
[% END %] |
319 |
<label class="radio inline" for="reqspecific_[% bibitemloo.biblionumber | html %]">A specific item</label> |
320 |
<input type="radio" name="reqtype_[% bibitemloo.biblionumber | html %]" |
321 |
id="reqspecific_[% bibitemloo.biblionumber | html %]" |
322 |
class="selectspecific" |
323 |
value="Specific" |
324 |
/> |
313 |
/> |
325 |
</li> |
314 |
<label class="radio inline" for="reqspecific_[% bibitemloo.biblionumber %]">A specific item</label> |
326 |
[% END # / IF bibitemloo.itemholdable %] |
315 |
<input type="radio" name="reqtype_[% bibitemloo.biblionumber %]" |
|
|
316 |
id="reqspecific_[% bibitemloo.biblionumber %]" |
317 |
class="selectspecific" |
318 |
value="Specific" |
319 |
/> |
320 |
</li> |
327 |
</ul> |
321 |
</ul> |
328 |
|
322 |
|
329 |
[% IF bibitemloo.itemholdable %] |
323 |
[% IF bibitemloo.remaining_holds_for_record > 1 %] |
330 |
<table class="copiesrow table table-bordered table-striped" id="copiesrow_[% bibitemloo.biblionumber | html %]"> |
324 |
[% SET count = 1 %] |
|
|
325 |
<div id="holds_to_place_[% bibitemloo.biblionumber %]" class="hold-options holds-to-place"> |
326 |
<label>Holds to place (count)</label> |
327 |
<select name="holds_to_place_count_[% bibitemloo.biblionumber %]"> |
328 |
[% WHILE count <= bibitemloo.remaining_holds_for_record %] |
329 |
<option value="[% count %]">[% count %]</option> |
330 |
[% SET count = count + 1 %] |
331 |
[% END %] |
332 |
</select> |
333 |
</div> |
334 |
[% ELSE %] |
335 |
<input type="hidden" name="holds_to_place_count_[% bibitemloo.biblionumber %]" value="1" /> |
336 |
[% END %] |
337 |
|
338 |
<table class="copiesrow table table-bordered table-striped" id="copiesrow_[% bibitemloo.biblionumber %]"> |
331 |
<caption>Select a specific item:</caption> |
339 |
<caption>Select a specific item:</caption> |
332 |
<tr> |
340 |
<tr> |
333 |
<th>Copy number</th> |
341 |
<th>Copy number</th> |
Lines 353-361
Link Here
|
353 |
<tr class="[% itemLoo.backgroundcolor | html %]"> |
361 |
<tr class="[% itemLoo.backgroundcolor | html %]"> |
354 |
<td class="copynumber"> |
362 |
<td class="copynumber"> |
355 |
[% IF ( itemLoo.available ) %] |
363 |
[% IF ( itemLoo.available ) %] |
356 |
<input type="radio" class="checkitem checkitem_[% bibitemloo.biblionumber | html %]" name="checkitem_[% bibitemloo.biblionumber | html %]" value="[% itemLoo.itemnumber | html %]" /> |
364 |
<input type="checkbox" class="checkitem checkitem_[% bibitemloo.biblionumber %]" name="checkitem_[% bibitemloo.biblionumber %]" value="[% itemLoo.itemnumber %]" /> |
357 |
[% ELSE %] |
365 |
[% ELSE %] |
358 |
<input disabled="disabled" type="radio" class="checkitem" name="checkitem" value="[% itemLoo.itemnumber | html %]" |
366 |
<input disabled="disabled" type="checkbox" class="checkitem" name="checkitem" value="[% itemLoo.itemnumber %]" |
359 |
style="display:none;" /> |
367 |
style="display:none;" /> |
360 |
<img src="[% interface | html %]/lib/famfamfam/cross.png" alt="Cannot be put on hold" title="Cannot be put on hold" /> |
368 |
<img src="[% interface | html %]/lib/famfamfam/cross.png" alt="Cannot be put on hold" title="Cannot be put on hold" /> |
361 |
[% END %] |
369 |
[% END %] |
Lines 431-439
Link Here
|
431 |
</td> |
439 |
</td> |
432 |
</tr> |
440 |
</tr> |
433 |
[% END # / FOREACH itemLoo IN bibitemloo.itemLoop%] |
441 |
[% END # / FOREACH itemLoo IN bibitemloo.itemLoop%] |
434 |
</table> <!-- / #copiesrow_[% bibitemloo.biblionumber | html %] --> |
442 |
</table> <!-- / #copiesrow_[% bibitemloo.biblionumber %] --> |
435 |
[% END # / IF ( bibitemloo.itemholdable )%] |
443 |
</div> <!-- / #hold-options-[% bibitemloo.biblionumber %] --> |
436 |
</div> <!-- / #hold-options-[% bibitemloo.biblionumber | html %] --> |
|
|
437 |
</fieldset> |
444 |
</fieldset> |
438 |
[% END # / IF ( bibitemloo.holdable ) %] |
445 |
[% END # / IF ( bibitemloo.holdable ) %] |
439 |
</div> <!-- / .holdrow --> |
446 |
</div> <!-- / .holdrow --> |
Lines 455-460
Link Here
|
455 |
<script> |
462 |
<script> |
456 |
// <![CDATA[ |
463 |
// <![CDATA[ |
457 |
var MSG_NO_ITEM_SELECTED = _("Expecting a specific item selection."); |
464 |
var MSG_NO_ITEM_SELECTED = _("Expecting a specific item selection."); |
|
|
465 |
var MSG_MAX_HOLDS_EXCEEDED = _("Maximum number of reserve exceded."); |
458 |
|
466 |
|
459 |
// Clear the contents of an input field |
467 |
// Clear the contents of an input field |
460 |
$(".clearfield").on("click",function(e){ |
468 |
$(".clearfield").on("click",function(e){ |
Lines 464-471
Link Here
|
464 |
|
472 |
|
465 |
// Select the first item available |
473 |
// Select the first item available |
466 |
function select_first_available(id){ |
474 |
function select_first_available(id){ |
467 |
var radios = $("input:radio[name='checkitem_" + id + "']"); |
475 |
var checkboxes = $("input:checkbox[name='checkitem_" + id + "']"); |
468 |
$(radios).first().attr("checked", "checked"); |
476 |
$(checkboxes).first().attr("checked", "checked"); |
469 |
} |
477 |
} |
470 |
|
478 |
|
471 |
$(document).ready(function() { |
479 |
$(document).ready(function() { |
Lines 486-499
Link Here
|
486 |
} |
494 |
} |
487 |
}); |
495 |
}); |
488 |
|
496 |
|
489 |
// click on a first td check the confirmjs checkbox |
497 |
$('.checkitem').click(function(e) { |
490 |
$("td.hold").click(function(e){ |
498 |
var bibNum = suffixOf($(this).attr("name"), "_"); |
491 |
if(e.target.tagName.toLowerCase() == 'td'){ |
499 |
var nbCheked = $("input[name='checkitem_"+bibNum+"']:checked").length; |
492 |
$(this).find("input.confirmjs").each( function() { |
500 |
var remaining = $("input[id='remaining_holds_"+bibNum+"']").val(); |
493 |
$(this).attr('checked', !$(this).attr('checked')); |
501 |
if (nbCheked >= remaining) { |
494 |
$(this).change(); |
502 |
$("input[name='checkitem_"+bibNum+"']:not(:checked)").attr('disabled', 'disabled'); |
495 |
}); |
503 |
} |
496 |
} |
504 |
else { |
|
|
505 |
$('.checkitem_'+bibNum).attr('disabled', false); |
506 |
} |
497 |
}); |
507 |
}); |
498 |
|
508 |
|
499 |
$(".toggle-hold-options").on("click",function(e){ |
509 |
$(".toggle-hold-options").on("click",function(e){ |
Lines 508-522
Link Here
|
508 |
// Hides all 'specific copy' table rows on load. |
518 |
// Hides all 'specific copy' table rows on load. |
509 |
$(".copiesrow").hide(); |
519 |
$(".copiesrow").hide(); |
510 |
|
520 |
|
|
|
521 |
$(".holds-to-place").show(); |
511 |
[% FOREACH bibitemloo IN bibitemloop %] |
522 |
[% FOREACH bibitemloo IN bibitemloop %] |
512 |
[% IF bibitemloo.force_hold %] |
523 |
[% IF bibitemloo.force_hold %] |
513 |
$("#toggle-hold-options-[% bibitemloo.biblionumber | html %]").click(); |
524 |
[% IF bibitemloo.force_hold == 'item' %] |
514 |
$("#reqspecific_[% bibitemloo.biblionumber | html %]").click(); |
525 |
$("#toggle-hold-options-[% bibitemloo.biblionumber %]").click(); |
515 |
$("#copiesrow_[% bibitemloo.biblionumber | html %]").show(); |
526 |
$("#reqspecific_[% bibitemloo.biblionumber %]").attr('checked', true); |
516 |
[% END %] |
527 |
$("#holds_to_place_[% bibitemloo.biblionumber %]").hide(); |
517 |
[% IF bibitemloo.reqholdnotes %] |
528 |
$("#copiesrow_[% bibitemloo.biblionumber %]").show(); |
518 |
$("#holdnotes_[% bibitemloo.biblionumber | html %]").attr( 'required', true ); |
529 |
[% ELSIF bibitemloo.force_hold == 'record' %] |
519 |
[% END %] |
530 |
$("#toggle-hold-options-[% bibitemloo.biblionumber %]").click(); |
|
|
531 |
$("#reqany_[% bibitemloo.biblionumber %]").attr('checked', true); |
532 |
[% END %] |
533 |
$("#reqany_[% bibitemloo.biblionumber %]").attr('disabled', 'disabled'); |
534 |
$("#reqspecific_[% bibitemloo.biblionumber %]").attr('disabled', 'disabled'); |
535 |
[% END %] |
536 |
[% IF bibitemloo.reqholdnotes %] |
537 |
$("#holdnotes_[% bibitemloo.biblionumber %]").attr( 'required', true ); |
538 |
[% END %] |
520 |
[% END %] |
539 |
[% END %] |
521 |
|
540 |
|
522 |
$(".date-format").each(function(){ |
541 |
$(".date-format").each(function(){ |
Lines 533-572
Link Here
|
533 |
$("#" + op + fieldID).val(""); |
552 |
$("#" + op + fieldID).val(""); |
534 |
}); |
553 |
}); |
535 |
|
554 |
|
536 |
// Replace non-JS single-selection with multi-selection capability. |
|
|
537 |
$(".reserve_mode").val("multi"); |
538 |
$(".confirm_nonjs").remove(); |
539 |
$(".confirmjs_hold").each(function(){ |
540 |
var bib = $(this).attr("title"); |
541 |
var html = "<label><input type =\"checkbox\" class=\"confirmjs\" checked=\"checked\""; |
542 |
html += "value=\"" + bib + "\" id=\"" + bib + "\" /> " + _("Place a hold on") + " </label> "; |
543 |
$(this).html(html); |
544 |
}); |
545 |
$(".confirmjs_nohold").each(function(){ |
546 |
var bib = $(this).attr("title"); |
547 |
var html = "<label><input type =\"checkbox\" class=\"confirmjs\" disabled=\"disabled\""; |
548 |
html += "value=\"" + bib + "\" id=\"" + bib + "\" />" + _("Place a hold on: ") + "</label>"; |
549 |
$(this).html(html); |
550 |
}); |
551 |
|
552 |
// expand or collapse the copiesrow tr |
555 |
// expand or collapse the copiesrow tr |
553 |
function toggle_copiesrow(biblioNum) { |
556 |
function toggle_copiesrow(biblioNum) { |
554 |
var checkbox = $("input:checkbox[value='"+biblioNum+"']"); |
557 |
var checkbox = $("input:checkbox[value='"+biblioNum+"']"); |
555 |
newCopiesRowId = "#copiesrow_" + biblioNum; |
558 |
newCopiesRowId = "#copiesrow_" + biblioNum; |
|
|
559 |
holdsToPlaceCountId = "#holds_to_place_" + biblioNum; |
556 |
var select_specific = $("#reqspecific_"+biblioNum).is(":checked"); |
560 |
var select_specific = $("#reqspecific_"+biblioNum).is(":checked"); |
557 |
// If the checkbox is checked AND we want a specific item, we display the items block |
561 |
// If the checkbox is checked AND we want a specific item, we display the items block |
558 |
if ( $(checkbox).is(":checked") && select_specific ) { |
562 |
if ( $(checkbox).is(":checked") && select_specific ) { |
559 |
$(newCopiesRowId).show(); |
563 |
$(newCopiesRowId).show(); |
|
|
564 |
$(holdsToPlaceCountId).hide(); |
560 |
} else { |
565 |
} else { |
561 |
$(newCopiesRowId).hide(); |
566 |
$(newCopiesRowId).hide(); |
|
|
567 |
$(holdsToPlaceCountId).show(); |
562 |
} |
568 |
} |
563 |
}; |
569 |
}; |
564 |
|
570 |
|
565 |
$("#place_on_hdr").show(); |
571 |
function total_requested() { |
|
|
572 |
var total = 0; |
573 |
$("input[name='biblionumbers']:checked").each(function() { |
574 |
var biblioNum = $(this).val(); |
575 |
if ($("#reqspecific_" + biblioNum + ":checked").size() > 0) { |
576 |
total += parseInt($("input[name='checkitem_'"+biblioNum+"]:checked").length); |
577 |
} else { |
578 |
total += parseInt($("select[name='holds_to_place_count_"+biblioNum+"']").val()); |
579 |
} |
580 |
}); |
581 |
return total; |
582 |
} |
566 |
|
583 |
|
567 |
$(".place_on_type").show(); |
584 |
$(".place_on_type").show(); |
568 |
// onload, selectany is checked |
585 |
// onload, selectany is checked |
569 |
$(".selectany").attr("checked", "checked"); |
|
|
570 |
|
586 |
|
571 |
// If the user is *allowed* to choose a specific item |
587 |
// If the user is *allowed* to choose a specific item |
572 |
// The first one is preselected |
588 |
// The first one is preselected |
Lines 575-582
Link Here
|
575 |
select_first_available(id); |
591 |
select_first_available(id); |
576 |
}); |
592 |
}); |
577 |
|
593 |
|
578 |
// On confirmsjs change |
594 |
// On biblionumbers change |
579 |
$(".confirmjs").change(function(){ |
595 |
$(".biblionumbers").change(function(){ |
580 |
var id = suffixOf($(this).attr("id"), "_"); |
596 |
var id = suffixOf($(this).attr("id"), "_"); |
581 |
// If I m checked, I enable radio buttons |
597 |
// If I m checked, I enable radio buttons |
582 |
if ( $(this).is(":checked") ) { |
598 |
if ( $(this).is(":checked") ) { |
Lines 598-632
Link Here
|
598 |
toggle_copiesrow(id); |
614 |
toggle_copiesrow(id); |
599 |
}); |
615 |
}); |
600 |
|
616 |
|
601 |
// Show or hide holds notes |
|
|
602 |
$(".shownotes").click(function(){ |
603 |
biblioNum = suffixOf($(this).attr("id"), "_"); |
604 |
$("#notesrow_"+biblioNum).toggle(); |
605 |
}); |
606 |
|
607 |
// When 'Place Hold' button is clicked |
617 |
// When 'Place Hold' button is clicked |
608 |
$(".placehold").click(function(){ |
618 |
$(".placehold").click(function(){ |
609 |
var biblionumbers = ""; |
619 |
if (total_requested() + [% reserves_count %] > [% maxreserves %]) { |
610 |
var selections = ""; |
620 |
alert(MSG_MAX_HOLDS_EXCEEDED); |
611 |
|
621 |
return false; |
612 |
[% IF new_reserves_allowed %] |
622 |
} |
613 |
if ($(".confirmjs:checked").size() > [% new_reserves_allowed | html %] ) { |
|
|
614 |
alert(MSG_MAX_HOLDS_EXCEEDED); |
615 |
return false; |
616 |
} |
617 |
[% END %] |
618 |
|
623 |
|
619 |
if ($(".confirmjs:checked").size() == 0) { |
624 |
if ($("input[name='biblionumbers']:checked").size() == 0) { |
620 |
alert(MSG_NO_RECORD_SELECTED); |
625 |
alert(MSG_NO_RECORD_SELECTED); |
621 |
return false; |
626 |
return false; |
622 |
} |
627 |
} |
623 |
|
628 |
|
624 |
// Find the items with the 'Hold' box checked |
629 |
// Find the items with the 'Hold' box checked |
625 |
var badBib = null; |
630 |
var badBib = null; |
626 |
$(".confirmjs:checked").each(function() { |
631 |
$("input[name='biblionumbers']:checked").each(function() { |
627 |
var biblioNum = $(this).val(); |
632 |
var biblioNum = $(this).val(); |
628 |
biblionumbers += biblioNum + "/"; |
|
|
629 |
selections += biblioNum + "/"; |
630 |
|
633 |
|
631 |
// If required hold note is empty, make it visible |
634 |
// If required hold note is empty, make it visible |
632 |
if( $("#holdnotes_"+biblioNum).attr( 'required' ) && $("#holdnotes_"+biblioNum).val() == '' ) { |
635 |
if( $("#holdnotes_"+biblioNum).attr( 'required' ) && $("#holdnotes_"+biblioNum).val() == '' ) { |
Lines 643-660
Link Here
|
643 |
alert(MSG_NO_ITEM_SELECTED); |
646 |
alert(MSG_NO_ITEM_SELECTED); |
644 |
badBib = biblioNum; |
647 |
badBib = biblioNum; |
645 |
return false; |
648 |
return false; |
646 |
} else { |
|
|
647 |
selections += $(item).val(); |
648 |
} |
649 |
} |
649 |
} |
650 |
} |
650 |
selections += "/"; |
|
|
651 |
|
652 |
// Add the pickup location |
653 |
var branchSel = $("#branch_" + biblioNum); |
654 |
if (branchSel.size() > 0) { |
655 |
selections += $(branchSel).val(); |
656 |
} |
657 |
selections += "/"; |
658 |
return true; |
651 |
return true; |
659 |
}); |
652 |
}); |
660 |
|
653 |
|
Lines 662-670
Link Here
|
662 |
return false; |
655 |
return false; |
663 |
} |
656 |
} |
664 |
|
657 |
|
665 |
$("#selections").val(selections); |
|
|
666 |
$("#biblionumbers").val(biblionumbers); |
667 |
|
668 |
return true; |
658 |
return true; |
669 |
}); |
659 |
}); |
670 |
|
660 |
|