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

(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-reserve.tt (-6 / +12 lines)
Lines 495-501 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
    var MSG_EMPTY_START_DATE = _("Hold start date should be filled.");
499
    var MSG_EMPTY_END_DATE   = _("Hold expiration date should be filled.");
499
500
500
        // Clear the contents of an input field
501
        // Clear the contents of an input field
501
        $(".clearfield").on("click",function(e){
502
        $(".clearfield").on("click",function(e){
Lines 525-532 Link Here
525
        $(".hold-options").hide();
526
        $(".hold-options").hide();
526
        var OPACMandatoryHoldDates = "[% Koha.Preference('OPACMandatoryHoldDates') | html %]";
527
        var OPACMandatoryHoldDates = "[% Koha.Preference('OPACMandatoryHoldDates') | html %]";
527
        if( OPACMandatoryHoldDates ) {
528
        if( OPACMandatoryHoldDates ) {
528
            if( OPACMandatoryHoldDates == "start" || OPACMandatoryHoldDates == "both" ) $(".holddatefrom").prop( 'required', true );
529
            if( OPACMandatoryHoldDates == "start" || OPACMandatoryHoldDates == "both" ) {
529
            if( OPACMandatoryHoldDates == "end"   || OPACMandatoryHoldDates == "both" ) $(".futuredate").prop( 'required', true );
530
                $(".holddatefrom").prop( 'required', true );
531
                $(".holddatefrom").parent().append('<div class="required_label required">Required</div>');
532
            }
533
            if( OPACMandatoryHoldDates == "end"   || OPACMandatoryHoldDates == "both" ) {
534
                $(".futuredate").prop( 'required', true );
535
                $(".futuredate").parent().append('<div class="required_label required">Required</div>');
536
            }
530
        }
537
        }
531
        $(".holddatefrom,.futuredate").prop("readOnly", true);
538
        $(".holddatefrom,.futuredate").prop("readOnly", true);
532
539
Lines 676-688 Link Here
676
                }
683
                }
677
684
678
                if( $(".holddatefrom").prop('required') && $("#from"+ biblioNum).val() == '' ) {
685
                if( $(".holddatefrom").prop('required') && $("#from"+ biblioNum).val() == '' ) {
679
                    alert(MSG_EMPTY_DATE);
686
                    alert(MSG_EMPTY_START_DATE);
680
                    badBib = biblioNum;
687
                    badBib = biblioNum;
681
                    if( $("#from"+biblioNum+":hidden").length ) $("#toggle-hold-options-"+biblioNum).click();
688
                    if( $("#from"+biblioNum+":hidden").length ) $("#toggle-hold-options-"+biblioNum).click();
682
                    $("#from"+ biblioNum).focus();
689
                    $("#from"+ biblioNum).focus();
683
                    return false;
690
                    return false;
684
                } else if( $(".futuredate").prop('required') && $("#to"+ biblioNum).val() == '' ) {
691
                } else if( $(".futuredate").prop('required') && $("#to"+ biblioNum).val() == '' ) {
685
                    alert(MSG_EMPTY_DATE);
692
                    alert(MSG_EMPTY_END_DATE);
686
                    badBib = biblioNum;
693
                    badBib = biblioNum;
687
                    if( $("#to"+biblioNum+":hidden").length ) $("#toggle-hold-options-"+biblioNum).click();
694
                    if( $("#to"+biblioNum+":hidden").length ) $("#toggle-hold-options-"+biblioNum).click();
688
                    $("#to"+ biblioNum).focus();
695
                    $("#to"+ biblioNum).focus();
689
- 

Return to bug 30108