Lines 134-153
Link Here
|
134 |
<form action="/cgi-bin/koha/opac-reserve.pl" method="post" id="hold-request-form"> |
134 |
<form action="/cgi-bin/koha/opac-reserve.pl" method="post" id="hold-request-form"> |
135 |
<input type="hidden" name="place_reserve" value="1"/> |
135 |
<input type="hidden" name="place_reserve" value="1"/> |
136 |
<!-- These values are set dynamically by js --> |
136 |
<!-- These values are set dynamically by js --> |
137 |
<input type="hidden" name="biblionumbers" id="biblionumbers"/> |
|
|
138 |
<input type="hidden" name="selecteditems" id="selections"/> |
139 |
<div id="bigloop"> |
137 |
<div id="bigloop"> |
140 |
|
138 |
|
141 |
[% FOREACH bibitemloo IN bibitemloop %] |
139 |
[% FOREACH bibitemloo IN bibitemloop %] |
142 |
<div class="holdrow"> |
140 |
<div class="holdrow"> |
|
|
141 |
<input id="remaining_holds_[% bibitemloo.biblionumber %]" type="hidden" value="[% bibitemloo.remaining_holds_for_record %]"/> |
143 |
<p> |
142 |
<p> |
144 |
[% IF ( bibitemloo.holdable ) %] |
143 |
[% IF ( bibitemloo.holdable ) %] |
145 |
<input class="reserve_mode" name="reserve_mode" type="hidden" value="single"/> |
144 |
<span title="[% bibitemloo.biblionumber %]" style="padding:.3em"> |
146 |
<input class="single_bib" name="single_bib" type="hidden" value="[% bibitemloo.biblionumber %]"/> |
145 |
<label> |
147 |
<span class="confirmjs_hold" title="[% bibitemloo.biblionumber %]" style="padding:.3em"></span> |
146 |
<input class="biblionumbers" name="biblionumbers" type="checkbox" value="[% bibitemloo.biblionumber %]" checked="checked"> |
148 |
<span class="confirm_nonjs"> |
147 |
Place a hold on |
149 |
<input type="radio" class="confirmbox checkitem [% bibitemloo.biblionumber %]" name="[% bibitemloo.biblionumber %]" checked="checked" id="single_[% bibitemloo.biblionumber %]" value="any" /> |
148 |
</label> |
150 |
<label class="confirm_label" for="single_[% bibitemloo.biblionumber %]">Place a hold on </label> |
|
|
151 |
</span> |
149 |
</span> |
152 |
[% END # / bibitemloo.holdable %] |
150 |
[% END # / bibitemloo.holdable %] |
153 |
|
151 |
|
Lines 214-220
Link Here
|
214 |
<li class="branch"> |
212 |
<li class="branch"> |
215 |
<label for="branch_[% bibitemloo.biblionumber %]">Pick up location:</label> |
213 |
<label for="branch_[% bibitemloo.biblionumber %]">Pick up location:</label> |
216 |
[% UNLESS ( bibitemloo.holdable ) %] |
214 |
[% UNLESS ( bibitemloo.holdable ) %] |
217 |
<select name="branch" id="branch_[% bibitemloo.biblionumber %]" disabled="disabled"> |
215 |
<select name="branch_[% bibitemloo.biblionumber %]" id="branch_[% bibitemloo.biblionumber %]" disabled="disabled"> |
218 |
[% PROCESS options_for_libraries libraries => Branches.all( selected => branch ) %] |
216 |
[% PROCESS options_for_libraries libraries => Branches.all( selected => branch ) %] |
219 |
</select> |
217 |
</select> |
220 |
[% ELSE %] |
218 |
[% ELSE %] |
Lines 288-316
Link Here
|
288 |
</li> |
286 |
</li> |
289 |
[% END # / IF OpacHoldNotes %] |
287 |
[% END # / IF OpacHoldNotes %] |
290 |
|
288 |
|
291 |
[% IF bibitemloo.itemholdable %] |
289 |
<!-- ITEM HOLDS --> |
292 |
<!-- ITEM HOLDS --> |
290 |
<li class="lradio place_on_type" style="display:none;"> |
293 |
<li class="lradio place_on_type" style="display:none;"> |
291 |
<label class="radio inline" for="reqany_[% bibitemloo.biblionumber %]">Next available item</label> |
294 |
[% IF NOT bibitemloo.force_hold %] |
|
|
295 |
<label class="radio inline" for="reqany_[% bibitemloo.biblionumber %]">Next available item</label> |
296 |
<input type="radio" name="reqtype_[% bibitemloo.biblionumber %]" |
297 |
id="reqany_[% bibitemloo.biblionumber %]" |
298 |
class="selectany" |
299 |
value="Any" |
300 |
checked="checked" |
301 |
/> |
302 |
[% END %] |
303 |
<label class="radio inline" for="reqspecific_[% bibitemloo.biblionumber %]">A specific item</label> |
304 |
<input type="radio" name="reqtype_[% bibitemloo.biblionumber %]" |
292 |
<input type="radio" name="reqtype_[% bibitemloo.biblionumber %]" |
305 |
id="reqspecific_[% bibitemloo.biblionumber %]" |
293 |
id="reqany_[% bibitemloo.biblionumber %]" |
306 |
class="selectspecific" |
294 |
class="selectany" |
307 |
value="Specific" |
295 |
value="Any" |
|
|
296 |
checked="checked" |
308 |
/> |
297 |
/> |
309 |
</li> |
298 |
<label class="radio inline" for="reqspecific_[% bibitemloo.biblionumber %]">A specific item</label> |
310 |
[% END # / IF bibitemloo.itemholdable %] |
299 |
<input type="radio" name="reqtype_[% bibitemloo.biblionumber %]" |
|
|
300 |
id="reqspecific_[% bibitemloo.biblionumber %]" |
301 |
class="selectspecific" |
302 |
value="Specific" |
303 |
/> |
304 |
</li> |
311 |
</ul> |
305 |
</ul> |
312 |
|
306 |
|
313 |
[% IF bibitemloo.itemholdable %] |
307 |
[% IF bibitemloo.remaining_holds_for_record > 1 %] |
|
|
308 |
[% SET count = 1 %] |
309 |
<div id="holds_to_place_[% bibitemloo.biblionumber %]" class="hold-options holds-to-place"> |
310 |
<label>Holds to place (count)</label> |
311 |
<select name="holds_to_place_count_[% bibitemloo.biblionumber %]"> |
312 |
[% WHILE count <= bibitemloo.remaining_holds_for_record %] |
313 |
<option value="[% count %]">[% count %]</option> |
314 |
[% SET count = count + 1 %] |
315 |
[% END %] |
316 |
</select> |
317 |
</div> |
318 |
[% ELSE %] |
319 |
<input type="hidden" name="holds_to_place_count_[% bibitemloo.biblionumber %]" value="1" /> |
320 |
[% END %] |
321 |
|
314 |
<table class="copiesrow table table-bordered table-striped" id="copiesrow_[% bibitemloo.biblionumber %]"> |
322 |
<table class="copiesrow table table-bordered table-striped" id="copiesrow_[% bibitemloo.biblionumber %]"> |
315 |
<caption>Select a specific item:</caption> |
323 |
<caption>Select a specific item:</caption> |
316 |
<tr> |
324 |
<tr> |
Lines 334-342
Link Here
|
334 |
<tr class="[% itemLoo.backgroundcolor %]"> |
342 |
<tr class="[% itemLoo.backgroundcolor %]"> |
335 |
<td class="copynumber"> |
343 |
<td class="copynumber"> |
336 |
[% IF ( itemLoo.available ) %] |
344 |
[% IF ( itemLoo.available ) %] |
337 |
<input type="radio" class="checkitem checkitem_[% bibitemloo.biblionumber %]" name="checkitem_[% bibitemloo.biblionumber %]" value="[% itemLoo.itemnumber %]" /> |
345 |
<input type="checkbox" class="checkitem checkitem_[% bibitemloo.biblionumber %]" name="checkitem_[% bibitemloo.biblionumber %]" value="[% itemLoo.itemnumber %]" /> |
338 |
[% ELSE %] |
346 |
[% ELSE %] |
339 |
<input disabled="disabled" type="radio" class="checkitem" name="checkitem" value="[% itemLoo.itemnumber %]" |
347 |
<input disabled="disabled" type="checkbox" class="checkitem" name="checkitem" value="[% itemLoo.itemnumber %]" |
340 |
style="display:none;" /> |
348 |
style="display:none;" /> |
341 |
<img src="[% interface %]/lib/famfamfam/silk/cross.png" alt="Cannot be put on hold" title="Cannot be put on hold" /> |
349 |
<img src="[% interface %]/lib/famfamfam/silk/cross.png" alt="Cannot be put on hold" title="Cannot be put on hold" /> |
342 |
[% END %] |
350 |
[% END %] |
Lines 410-416
Link Here
|
410 |
</tr> |
418 |
</tr> |
411 |
[% END # / FOREACH itemLoo IN bibitemloo.itemLoop%] |
419 |
[% END # / FOREACH itemLoo IN bibitemloo.itemLoop%] |
412 |
</table> <!-- / #copiesrow_[% bibitemloo.biblionumber %] --> |
420 |
</table> <!-- / #copiesrow_[% bibitemloo.biblionumber %] --> |
413 |
[% END # / IF ( bibitemloo.itemholdable )%] |
|
|
414 |
</div> <!-- / #hold-options-[% bibitemloo.biblionumber %] --> |
421 |
</div> <!-- / #hold-options-[% bibitemloo.biblionumber %] --> |
415 |
</fieldset> |
422 |
</fieldset> |
416 |
[% END # / IF ( bibitemloo.holdable ) %] |
423 |
[% END # / IF ( bibitemloo.holdable ) %] |
Lines 433-438
Link Here
|
433 |
<script type="text/javascript"> |
440 |
<script type="text/javascript"> |
434 |
// <![CDATA[ |
441 |
// <![CDATA[ |
435 |
var MSG_NO_ITEM_SELECTED = _("Expecting a specific item selection."); |
442 |
var MSG_NO_ITEM_SELECTED = _("Expecting a specific item selection."); |
|
|
443 |
var MSG_MAX_HOLDS_EXCEEDED = _("Maximum number of reserve exceded."); |
436 |
|
444 |
|
437 |
// Clear the contents of an input field |
445 |
// Clear the contents of an input field |
438 |
$(".clearfield").on("click",function(e){ |
446 |
$(".clearfield").on("click",function(e){ |
Lines 442-449
Link Here
|
442 |
|
450 |
|
443 |
// Select the first item available |
451 |
// Select the first item available |
444 |
function select_first_available(id){ |
452 |
function select_first_available(id){ |
445 |
var radios = $("input:radio[name='checkitem_" + id + "']"); |
453 |
var checkboxes = $("input:checkbox[name='checkitem_" + id + "']"); |
446 |
$(radios).first().attr("checked", "checked"); |
454 |
$(checkboxes).first().attr("checked", "checked"); |
447 |
} |
455 |
} |
448 |
|
456 |
|
449 |
$(document).ready(function() { |
457 |
$(document).ready(function() { |
Lines 464-477
Link Here
|
464 |
} |
472 |
} |
465 |
}); |
473 |
}); |
466 |
|
474 |
|
467 |
// click on a first td check the confirmjs checkbox |
475 |
$('.checkitem').click(function(e) { |
468 |
$("td.hold").click(function(e){ |
476 |
var bibNum = suffixOf($(this).attr("name"), "_"); |
469 |
if(e.target.tagName.toLowerCase() == 'td'){ |
477 |
var nbCheked = $("input[name='checkitem_"+bibNum+"']:checked").length; |
470 |
$(this).find("input.confirmjs").each( function() { |
478 |
var remaining = $("input[id='remaining_holds_"+bibNum+"']").val(); |
471 |
$(this).attr('checked', !$(this).attr('checked')); |
479 |
if (nbCheked >= remaining) { |
472 |
$(this).change(); |
480 |
$("input[name='checkitem_"+bibNum+"']:not(:checked)").attr('disabled', 'disabled'); |
473 |
}); |
481 |
} |
474 |
} |
482 |
else { |
|
|
483 |
$('.checkitem_'+bibNum).attr('disabled', false); |
484 |
} |
475 |
}); |
485 |
}); |
476 |
|
486 |
|
477 |
$(".toggle-hold-options").on("click",function(e){ |
487 |
$(".toggle-hold-options").on("click",function(e){ |
Lines 486-500
Link Here
|
486 |
// Hides all 'specific copy' table rows on load. |
496 |
// Hides all 'specific copy' table rows on load. |
487 |
$(".copiesrow").hide(); |
497 |
$(".copiesrow").hide(); |
488 |
|
498 |
|
|
|
499 |
$(".holds-to-place").show(); |
489 |
[% FOREACH bibitemloo IN bibitemloop %] |
500 |
[% FOREACH bibitemloo IN bibitemloop %] |
490 |
[% IF bibitemloo.force_hold %] |
501 |
[% IF bibitemloo.force_hold %] |
491 |
$("#toggle-hold-options-[% bibitemloo.biblionumber %]").click(); |
502 |
[% IF bibitemloo.force_hold == 'item' %] |
492 |
$("#reqspecific_[% bibitemloo.biblionumber %]").click(); |
503 |
$("#toggle-hold-options-[% bibitemloo.biblionumber %]").click(); |
493 |
$("#copiesrow_[% bibitemloo.biblionumber %]").show(); |
504 |
$("#reqspecific_[% bibitemloo.biblionumber %]").attr('checked', true); |
494 |
[% END %] |
505 |
$("#holds_to_place_[% bibitemloo.biblionumber %]").hide(); |
495 |
[% IF bibitemloo.reqholdnotes %] |
506 |
$("#copiesrow_[% bibitemloo.biblionumber %]").show(); |
496 |
$("#holdnotes_[% bibitemloo.biblionumber %]").attr( 'required', true ); |
507 |
[% ELSIF bibitemloo.force_hold == 'record' %] |
497 |
[% END %] |
508 |
$("#toggle-hold-options-[% bibitemloo.biblionumber %]").click(); |
|
|
509 |
$("#reqany_[% bibitemloo.biblionumber %]").attr('checked', true); |
510 |
[% END %] |
511 |
$("#reqany_[% bibitemloo.biblionumber %]").attr('disabled', 'disabled'); |
512 |
$("#reqspecific_[% bibitemloo.biblionumber %]").attr('disabled', 'disabled'); |
513 |
[% END %] |
514 |
[% IF bibitemloo.reqholdnotes %] |
515 |
$("#holdnotes_[% bibitemloo.biblionumber %]").attr( 'required', true ); |
516 |
[% END %] |
498 |
[% END %] |
517 |
[% END %] |
499 |
|
518 |
|
500 |
$(".date-format").each(function(){ |
519 |
$(".date-format").each(function(){ |
Lines 511-550
Link Here
|
511 |
$("#" + op + fieldID).val(""); |
530 |
$("#" + op + fieldID).val(""); |
512 |
}); |
531 |
}); |
513 |
|
532 |
|
514 |
// Replace non-JS single-selection with multi-selection capability. |
|
|
515 |
$(".reserve_mode").val("multi"); |
516 |
$(".confirm_nonjs").remove(); |
517 |
$(".confirmjs_hold").each(function(){ |
518 |
var bib = $(this).attr("title"); |
519 |
var html = "<label><input type =\"checkbox\" class=\"confirmjs\" checked=\"checked\""; |
520 |
html += "value=\"" + bib + "\" id=\"" + bib + "\" /> " + _("Place a hold on") + " </label> "; |
521 |
$(this).html(html); |
522 |
}); |
523 |
$(".confirmjs_nohold").each(function(){ |
524 |
var bib = $(this).attr("title"); |
525 |
var html = "<label><input type =\"checkbox\" class=\"confirmjs\" disabled=\"disabled\""; |
526 |
html += "value=\"" + bib + "\" id=\"" + bib + "\" />" + _("Place a hold on: ") + "</label>"; |
527 |
$(this).html(html); |
528 |
}); |
529 |
|
530 |
// expand or collapse the copiesrow tr |
533 |
// expand or collapse the copiesrow tr |
531 |
function toggle_copiesrow(biblioNum) { |
534 |
function toggle_copiesrow(biblioNum) { |
532 |
var checkbox = $("input:checkbox[value='"+biblioNum+"']"); |
535 |
var checkbox = $("input:checkbox[value='"+biblioNum+"']"); |
533 |
newCopiesRowId = "#copiesrow_" + biblioNum; |
536 |
newCopiesRowId = "#copiesrow_" + biblioNum; |
|
|
537 |
holdsToPlaceCountId = "#holds_to_place_" + biblioNum; |
534 |
var select_specific = $("#reqspecific_"+biblioNum).is(":checked"); |
538 |
var select_specific = $("#reqspecific_"+biblioNum).is(":checked"); |
535 |
// If the checkbox is checked AND we want a specific item, we display the items block |
539 |
// If the checkbox is checked AND we want a specific item, we display the items block |
536 |
if ( $(checkbox).is(":checked") && select_specific ) { |
540 |
if ( $(checkbox).is(":checked") && select_specific ) { |
537 |
$(newCopiesRowId).show(); |
541 |
$(newCopiesRowId).show(); |
|
|
542 |
$(holdsToPlaceCountId).hide(); |
538 |
} else { |
543 |
} else { |
539 |
$(newCopiesRowId).hide(); |
544 |
$(newCopiesRowId).hide(); |
|
|
545 |
$(holdsToPlaceCountId).show(); |
540 |
} |
546 |
} |
541 |
}; |
547 |
}; |
542 |
|
548 |
|
543 |
$("#place_on_hdr").show(); |
549 |
function total_requested() { |
|
|
550 |
var total = 0; |
551 |
$("input[name='biblionumbers']:checked").each(function() { |
552 |
var biblioNum = $(this).val(); |
553 |
if ($("#reqspecific_" + biblioNum + ":checked").size() > 0) { |
554 |
total += parseInt($("input[name='checkitem_'"+biblioNum+"]:checked").length); |
555 |
} else { |
556 |
total += parseInt($("select[name='holds_to_place_count_"+biblioNum+"']").val()); |
557 |
} |
558 |
}); |
559 |
return total; |
560 |
} |
544 |
|
561 |
|
545 |
$(".place_on_type").show(); |
562 |
$(".place_on_type").show(); |
546 |
// onload, selectany is checked |
563 |
// onload, selectany is checked |
547 |
$(".selectany").attr("checked", "checked"); |
|
|
548 |
|
564 |
|
549 |
// If the user is *allowed* to choose a specific item |
565 |
// If the user is *allowed* to choose a specific item |
550 |
// The first one is preselected |
566 |
// The first one is preselected |
Lines 553-560
Link Here
|
553 |
select_first_available(id); |
569 |
select_first_available(id); |
554 |
}); |
570 |
}); |
555 |
|
571 |
|
556 |
// On confirmsjs change |
572 |
// On biblionumbers change |
557 |
$(".confirmjs").change(function(){ |
573 |
$(".biblionumbers").change(function(){ |
558 |
var id = suffixOf($(this).attr("id"), "_"); |
574 |
var id = suffixOf($(this).attr("id"), "_"); |
559 |
// If I m checked, I enable radio buttons |
575 |
// If I m checked, I enable radio buttons |
560 |
if ( $(this).is(":checked") ) { |
576 |
if ( $(this).is(":checked") ) { |
Lines 576-610
Link Here
|
576 |
toggle_copiesrow(id); |
592 |
toggle_copiesrow(id); |
577 |
}); |
593 |
}); |
578 |
|
594 |
|
579 |
// Show or hide holds notes |
|
|
580 |
$(".shownotes").click(function(){ |
581 |
biblioNum = suffixOf($(this).attr("id"), "_"); |
582 |
$("#notesrow_"+biblioNum).toggle(); |
583 |
}); |
584 |
|
585 |
// When 'Place Hold' button is clicked |
595 |
// When 'Place Hold' button is clicked |
586 |
$(".placehold").click(function(){ |
596 |
$(".placehold").click(function(){ |
587 |
var biblionumbers = ""; |
597 |
if (total_requested() + [% reserves_count %] > [% maxreserves %]) { |
588 |
var selections = ""; |
598 |
alert(MSG_MAX_HOLDS_EXCEEDED); |
589 |
|
599 |
return false; |
590 |
[% IF new_reserves_allowed %] |
600 |
} |
591 |
if ($(".confirmjs:checked").size() > [% new_reserves_allowed %] ) { |
|
|
592 |
alert(MSG_MAX_HOLDS_EXCEEDED); |
593 |
return false; |
594 |
} |
595 |
[% END %] |
596 |
|
601 |
|
597 |
if ($(".confirmjs:checked").size() == 0) { |
602 |
if ($("input[name='biblionumbers']:checked").size() == 0) { |
598 |
alert(MSG_NO_RECORD_SELECTED); |
603 |
alert(MSG_NO_RECORD_SELECTED); |
599 |
return false; |
604 |
return false; |
600 |
} |
605 |
} |
601 |
|
606 |
|
602 |
// Find the items with the 'Hold' box checked |
607 |
// Find the items with the 'Hold' box checked |
603 |
var badBib = null; |
608 |
var badBib = null; |
604 |
$(".confirmjs:checked").each(function() { |
609 |
$("input[name='biblionumbers']:checked").each(function() { |
605 |
var biblioNum = $(this).val(); |
610 |
var biblioNum = $(this).val(); |
606 |
biblionumbers += biblioNum + "/"; |
|
|
607 |
selections += biblioNum + "/"; |
608 |
|
611 |
|
609 |
// If required hold note is empty, make it visible |
612 |
// If required hold note is empty, make it visible |
610 |
if( $("#holdnotes_"+biblioNum).attr( 'required' ) && $("#holdnotes_"+biblioNum).val() == '' ) { |
613 |
if( $("#holdnotes_"+biblioNum).attr( 'required' ) && $("#holdnotes_"+biblioNum).val() == '' ) { |
Lines 621-638
Link Here
|
621 |
alert(MSG_NO_ITEM_SELECTED); |
624 |
alert(MSG_NO_ITEM_SELECTED); |
622 |
badBib = biblioNum; |
625 |
badBib = biblioNum; |
623 |
return false; |
626 |
return false; |
624 |
} else { |
|
|
625 |
selections += $(item).val(); |
626 |
} |
627 |
} |
627 |
} |
628 |
} |
628 |
selections += "/"; |
|
|
629 |
|
630 |
// Add the pickup location |
631 |
var branchSel = $("#branch_" + biblioNum); |
632 |
if (branchSel.size() > 0) { |
633 |
selections += $(branchSel).val(); |
634 |
} |
635 |
selections += "/"; |
636 |
return true; |
629 |
return true; |
637 |
}); |
630 |
}); |
638 |
|
631 |
|
Lines 640-648
Link Here
|
640 |
return false; |
633 |
return false; |
641 |
} |
634 |
} |
642 |
|
635 |
|
643 |
$("#selections").val(selections); |
|
|
644 |
$("#biblionumbers").val(biblionumbers); |
645 |
|
646 |
return true; |
636 |
return true; |
647 |
}); |
637 |
}); |
648 |
|
638 |
|