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 474-479 Link Here
474
[% INCLUDE 'calendar.inc' %]
474
[% INCLUDE 'calendar.inc' %]
475
<script>
475
<script>
476
    var MSG_NO_ITEM_SELECTED = _("Expecting a specific item selection.");
476
    var MSG_NO_ITEM_SELECTED = _("Expecting a specific item selection.");
477
    var MSG_EMPTY_DATE = _("Date should be filled.");
477
478
478
        // Clear the contents of an input field
479
        // Clear the contents of an input field
479
        $(".clearfield").on("click",function(e){
480
        $(".clearfield").on("click",function(e){
Lines 495-501 Link Here
495
496
496
        $(".toggle-hold-options").show();
497
        $(".toggle-hold-options").show();
497
        $(".hold-options").hide();
498
        $(".hold-options").hide();
498
        $(".holddatefrom,.holddateto").prop("readOnly", true);
499
        var OPACMandatoryHoldDates = "[% Koha.Preference('OPACMandatoryHoldDates') | html %]";
500
        if( OPACMandatoryHoldDates ) {
501
            if( OPACMandatoryHoldDates == "start" || OPACMandatoryHoldDates == "both" ) $(".holddatefrom").prop( 'required', true );
502
            if( OPACMandatoryHoldDates == "end"   || OPACMandatoryHoldDates == "both" ) $(".futuredate").prop( 'required', true );
503
        }
504
        $(".holddatefrom,.futuredate").prop("readOnly", true);
499
505
500
        $(".checkitem").parent().click(function(e){
506
        $(".checkitem").parent().click(function(e){
501
            if(e.target.tagName.toLowerCase() == 'td'){
507
            if(e.target.tagName.toLowerCase() == 'td'){
Lines 523-535 Link Here
523
                toggleLink.text($(this).is(':visible') ? _("Hide options") : _("Show more options"));
529
                toggleLink.text($(this).is(':visible') ? _("Hide options") : _("Show more options"));
524
            });
530
            });
525
        });
531
        });
532
        if( $(".holddatefrom").prop('required') || $(".futuredate").prop('required') ) $(".toggle-hold-options").click();
526
533
527
        // Hides all 'specific copy' table rows on load.
534
        // Hides all 'specific copy' table rows on load.
528
        $(".copiesrow").hide();
535
        $(".copiesrow").hide();
529
536
530
        [% FOREACH bibitemloo IN bibitemloop %]
537
        [% FOREACH bibitemloo IN bibitemloop %]
531
          [% IF bibitemloo.force_hold %]
538
          [% IF bibitemloo.force_hold %]
532
            $("#toggle-hold-options-[% bibitemloo.biblionumber | html %]").click();
539
            if( $("#to[% bibitemloo.biblionumber | html %]:hidden").length )
540
                $("#toggle-hold-options-[% bibitemloo.biblionumber | html %]").click();
533
            $("#reqspecific_[% bibitemloo.biblionumber | html %]").click();
541
            $("#reqspecific_[% bibitemloo.biblionumber | html %]").click();
534
            $("#copiesrow_[% bibitemloo.biblionumber | html %]").show();
542
            $("#copiesrow_[% bibitemloo.biblionumber | html %]").show();
535
          [% END %]
543
          [% END %]
Lines 640-645 Link Here
640
                    }
648
                    }
641
                }
649
                }
642
650
651
                if( $(".holddatefrom").prop('required') && $("#from"+ biblioNum).val() == '' ) {
652
                    alert(MSG_EMPTY_DATE);
653
                    badBib = biblioNum;
654
                    if( $("#from"+biblioNum+":hidden").length ) $("#toggle-hold-options-"+biblioNum).click();
655
                    $("#from"+ biblioNum).focus();
656
                    return false;
657
                } else if( $(".futuredate").prop('required') && $("#to"+ biblioNum).val() == '' ) {
658
                    alert(MSG_EMPTY_DATE);
659
                    badBib = biblioNum;
660
                    if( $("#to"+biblioNum+":hidden").length ) $("#toggle-hold-options-"+biblioNum).click();
661
                    $("#to"+ biblioNum).focus();
662
                    return false;
663
                }
664
643
                // If the 'specific copy' radio button is checked
665
                // If the 'specific copy' radio button is checked
644
                if ($("#reqspecific_" + biblioNum + ":checked").size() > 0) {
666
                if ($("#reqspecific_" + biblioNum + ":checked").size() > 0) {
645
                    // Find the selected copy
667
                    // Find the selected copy
646
- 

Return to bug 30108