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 283-289 Link Here
283
                                                [% IF ( reserve_in_future ) %]
283
                                                [% IF ( reserve_in_future ) %]
284
                                                    <li>
284
                                                    <li>
285
                                                        <label for="from[% bibitemloo.biblionumber | html %]">Hold starts on date:</label>
285
                                                        <label for="from[% bibitemloo.biblionumber | html %]">Hold starts on date:</label>
286
                                                        <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" />
286
                                                        <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" />
287
                                                        <span class="date-format from" data-biblionumber="[% bibitemloo.biblionumber | html %]">[% INCLUDE 'date-format.inc' %]</span>
287
                                                        <span class="date-format from" data-biblionumber="[% bibitemloo.biblionumber | html %]">[% INCLUDE 'date-format.inc' %]</span>
288
                                                    </li>
288
                                                    </li>
289
                                                [% END %]
289
                                                [% END %]
Lines 498-503 Link Here
498
[% INCLUDE 'datatables.inc' %]
498
[% INCLUDE 'datatables.inc' %]
499
<script>
499
<script>
500
    var MSG_NO_ITEM_SELECTED = _("Expecting a specific item selection.");
500
    var MSG_NO_ITEM_SELECTED = _("Expecting a specific item selection.");
501
    var MSG_EMPTY_DATE = _("Date should be filled.");
501
502
502
    $(document).ready(function() {
503
    $(document).ready(function() {
503
504
Lines 513-519 Link Here
513
514
514
        $(".toggle-hold-options").show();
515
        $(".toggle-hold-options").show();
515
        $(".hold-options").hide();
516
        $(".hold-options").hide();
516
        $(".holddatefrom,.holddateto").prop("readOnly", true);
517
        var OPACMandatoryHoldDates = "[% Koha.Preference('OPACMandatoryHoldDates') | html %]";
518
        if( OPACMandatoryHoldDates ) {
519
            if( OPACMandatoryHoldDates == "start" || OPACMandatoryHoldDates == "both" ) $(".holddatefrom").prop( 'required', true );
520
            if( OPACMandatoryHoldDates == "end"   || OPACMandatoryHoldDates == "both" ) $(".futuredate").prop( 'required', true );
521
        }
522
        $(".holddatefrom,.futuredate").prop("readOnly", true);
517
523
518
        $(".checkitem").parent().click(function(e){
524
        $(".checkitem").parent().click(function(e){
519
            if(e.target.tagName.toLowerCase() == 'td'){
525
            if(e.target.tagName.toLowerCase() == 'td'){
Lines 541-553 Link Here
541
                toggleLink.text($(this).is(':visible') ? _("Hide options") : _("Show more options"));
547
                toggleLink.text($(this).is(':visible') ? _("Hide options") : _("Show more options"));
542
            });
548
            });
543
        });
549
        });
550
        if( $(".holddatefrom").prop('required') || $(".futuredate").prop('required') ) $(".toggle-hold-options").click();
544
551
545
        // Hides all 'specific copy' table rows on load.
552
        // Hides all 'specific copy' table rows on load.
546
        $(".copiesrow").hide();
553
        $(".copiesrow").hide();
547
554
548
        [% FOREACH bibitemloo IN bibitemloop %]
555
        [% FOREACH bibitemloo IN bibitemloop %]
549
          [% IF bibitemloo.force_hold %]
556
          [% IF bibitemloo.force_hold %]
550
            $("#toggle-hold-options-[% bibitemloo.biblionumber | html %]").click();
557
            if( $("#to[% bibitemloo.biblionumber | html %]:hidden").length )
558
                $("#toggle-hold-options-[% bibitemloo.biblionumber | html %]").click();
551
            $("#reqspecific_[% bibitemloo.biblionumber | html %]").click();
559
            $("#reqspecific_[% bibitemloo.biblionumber | html %]").click();
552
            $("#copiesrow_[% bibitemloo.biblionumber | html %]").show();
560
            $("#copiesrow_[% bibitemloo.biblionumber | html %]").show();
553
          [% END %]
561
          [% END %]
Lines 652-657 Link Here
652
                    }
660
                    }
653
                }
661
                }
654
662
663
                if( $(".holddatefrom").prop('required') && $("#from"+ biblioNum).val() == '' ) {
664
                    alert(MSG_EMPTY_DATE);
665
                    badBib = biblioNum;
666
                    if( $("#from"+biblioNum+":hidden").length ) $("#toggle-hold-options-"+biblioNum).click();
667
                    $("#from"+ biblioNum).focus();
668
                    return false;
669
                } else if( $(".futuredate").prop('required') && $("#to"+ biblioNum).val() == '' ) {
670
                    alert(MSG_EMPTY_DATE);
671
                    badBib = biblioNum;
672
                    if( $("#to"+biblioNum+":hidden").length ) $("#toggle-hold-options-"+biblioNum).click();
673
                    $("#to"+ biblioNum).focus();
674
                    return false;
675
                }
676
655
                // If the 'specific copy' radio button is checked
677
                // If the 'specific copy' radio button is checked
656
                if ($("#reqspecific_" + biblioNum + ":checked").size() > 0) {
678
                if ($("#reqspecific_" + biblioNum + ":checked").size() > 0) {
657
                    // Find the selected copy
679
                    // Find the selected copy
658
- 

Return to bug 30108