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