View | Details | Raw Unified | Return to bug 30108
Collapse All | Expand All

(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-reserve.tt (-4 / +25 lines)
Lines 281-287 Link Here
281
                                                [% IF ( reserve_in_future ) %]
281
                                                [% IF ( reserve_in_future ) %]
282
                                                    <li>
282
                                                    <li>
283
                                                        <label for="from[% bibitemloo.biblionumber | html %]">Hold starts on date:</label>
283
                                                        <label for="from[% bibitemloo.biblionumber | html %]">Hold starts on date:</label>
284
                                                        <input type="text" name="reserve_date_[% bibitemloo.biblionumber | html %]" id="from[% bibitemloo.biblionumber | html %]" data-start_for="to[% bibitemloo.biblionumber | html %]" size="10" class="flatpickr" />
284
                                                        <input type="text" name="reserve_date_[% bibitemloo.biblionumber | html %]" id="from[% bibitemloo.biblionumber | html %]" data-start_for="to[% bibitemloo.biblionumber | html %]" size="10" class="flatpickr holddatefrom" />
285
                                                        <span class="date-format from" data-biblionumber="[% bibitemloo.biblionumber | html %]">[% INCLUDE 'date-format.inc' %]</span>
285
                                                        <span class="date-format from" data-biblionumber="[% bibitemloo.biblionumber | html %]">[% INCLUDE 'date-format.inc' %]</span>
286
                                                    </li>
286
                                                    </li>
287
                                                [% END %]
287
                                                [% END %]
Lines 495-500 Link Here
495
[% INCLUDE 'calendar.inc' %]
495
[% INCLUDE 'calendar.inc' %]
496
<script>
496
<script>
497
    var MSG_NO_ITEM_SELECTED = _("Expecting a specific item selection.");
497
    var MSG_NO_ITEM_SELECTED = _("Expecting a specific item selection.");
498
    var MSG_EMPTY_DATE = _("Date should be filled.");
498
499
499
        // Clear the contents of an input field
500
        // Clear the contents of an input field
500
        $(".clearfield").on("click",function(e){
501
        $(".clearfield").on("click",function(e){
Lines 522-528 Link Here
522
523
523
        $(".toggle-hold-options").show();
524
        $(".toggle-hold-options").show();
524
        $(".hold-options").hide();
525
        $(".hold-options").hide();
525
        $(".holddatefrom,.holddateto").prop("readOnly", true);
526
        var OPACMandatoryHoldDates = "[% Koha.Preference('OPACMandatoryHoldDates') | html %]";
527
        if( OPACMandatoryHoldDates ) {
528
            if( OPACMandatoryHoldDates == "start" || OPACMandatoryHoldDates == "both" ) $(".holddatefrom").prop( 'required', true );
529
            if( OPACMandatoryHoldDates == "end"   || OPACMandatoryHoldDates == "both" ) $(".futuredate").prop( 'required', true );
530
        }
531
        $(".holddatefrom,.futuredate").prop("readOnly", true);
526
532
527
        $(".checkitem").parent().click(function(e){
533
        $(".checkitem").parent().click(function(e){
528
            if(e.target.tagName.toLowerCase() == 'td'){
534
            if(e.target.tagName.toLowerCase() == 'td'){
Lines 550-562 Link Here
550
                toggleLink.text($(this).is(':visible') ? _("Hide options") : _("Show more options"));
556
                toggleLink.text($(this).is(':visible') ? _("Hide options") : _("Show more options"));
551
            });
557
            });
552
        });
558
        });
559
        if( $(".holddatefrom").prop('required') || $(".futuredate").prop('required') ) $(".toggle-hold-options").click();
553
560
554
        // Hides all 'specific copy' table rows on load.
561
        // Hides all 'specific copy' table rows on load.
555
        $(".copiesrow").hide();
562
        $(".copiesrow").hide();
556
563
557
        [% FOREACH bibitemloo IN bibitemloop %]
564
        [% FOREACH bibitemloo IN bibitemloop %]
558
          [% IF bibitemloo.force_hold %]
565
          [% IF bibitemloo.force_hold %]
559
            $("#toggle-hold-options-[% bibitemloo.biblionumber | html %]").click();
566
            if( $("#to[% bibitemloo.biblionumber | html %]:hidden").length )
567
                $("#toggle-hold-options-[% bibitemloo.biblionumber | html %]").click();
560
            $("#reqspecific_[% bibitemloo.biblionumber | html %]").click();
568
            $("#reqspecific_[% bibitemloo.biblionumber | html %]").click();
561
            $("#copiesrow_[% bibitemloo.biblionumber | html %]").show();
569
            $("#copiesrow_[% bibitemloo.biblionumber | html %]").show();
562
          [% END %]
570
          [% END %]
Lines 667-672 Link Here
667
                    }
675
                    }
668
                }
676
                }
669
677
678
                if( $(".holddatefrom").prop('required') && $("#from"+ biblioNum).val() == '' ) {
679
                    alert(MSG_EMPTY_DATE);
680
                    badBib = biblioNum;
681
                    if( $("#from"+biblioNum+":hidden").length ) $("#toggle-hold-options-"+biblioNum).click();
682
                    $("#from"+ biblioNum).focus();
683
                    return false;
684
                } else if( $(".futuredate").prop('required') && $("#to"+ biblioNum).val() == '' ) {
685
                    alert(MSG_EMPTY_DATE);
686
                    badBib = biblioNum;
687
                    if( $("#to"+biblioNum+":hidden").length ) $("#toggle-hold-options-"+biblioNum).click();
688
                    $("#to"+ biblioNum).focus();
689
                    return false;
690
                }
691
670
                // If the 'specific copy' radio button is checked
692
                // If the 'specific copy' radio button is checked
671
                if ($("#reqspecific_" + biblioNum + ":checked").size() > 0) {
693
                if ($("#reqspecific_" + biblioNum + ":checked").size() > 0) {
672
                    // Find the selected copy
694
                    // Find the selected copy
673
- 

Return to bug 30108