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 498-504 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
    var MSG_EMPTY_START_DATE = _("Hold start date should be filled.");
502
    var MSG_EMPTY_END_DATE   = _("Hold expiration date should be filled.");
502
503
503
    $(document).ready(function() {
504
    $(document).ready(function() {
504
505
Lines 516-523 Link Here
516
        $(".hold-options").hide();
517
        $(".hold-options").hide();
517
        var OPACMandatoryHoldDates = "[% Koha.Preference('OPACMandatoryHoldDates') | html %]";
518
        var OPACMandatoryHoldDates = "[% Koha.Preference('OPACMandatoryHoldDates') | html %]";
518
        if( OPACMandatoryHoldDates ) {
519
        if( OPACMandatoryHoldDates ) {
519
            if( OPACMandatoryHoldDates == "start" || OPACMandatoryHoldDates == "both" ) $(".holddatefrom").prop( 'required', true );
520
            if( OPACMandatoryHoldDates == "start" || OPACMandatoryHoldDates == "both" ) {
520
            if( OPACMandatoryHoldDates == "end"   || OPACMandatoryHoldDates == "both" ) $(".futuredate").prop( 'required', true );
521
                $(".holddatefrom").prop( 'required', true );
522
                $(".holddatefrom").parent().append('<div class="required_label required">Required</div>');
523
            }
524
            if( OPACMandatoryHoldDates == "end"   || OPACMandatoryHoldDates == "both" ) {
525
                $(".futuredate").prop( 'required', true );
526
                $(".futuredate").parent().append('<div class="required_label required">Required</div>');
527
            }
521
        }
528
        }
522
        $(".holddatefrom,.futuredate").prop("readOnly", true);
529
        $(".holddatefrom,.futuredate").prop("readOnly", true);
523
530
Lines 661-673 Link Here
661
                }
668
                }
662
669
663
                if( $(".holddatefrom").prop('required') && $("#from"+ biblioNum).val() == '' ) {
670
                if( $(".holddatefrom").prop('required') && $("#from"+ biblioNum).val() == '' ) {
664
                    alert(MSG_EMPTY_DATE);
671
                    alert(MSG_EMPTY_START_DATE);
665
                    badBib = biblioNum;
672
                    badBib = biblioNum;
666
                    if( $("#from"+biblioNum+":hidden").length ) $("#toggle-hold-options-"+biblioNum).click();
673
                    if( $("#from"+biblioNum+":hidden").length ) $("#toggle-hold-options-"+biblioNum).click();
667
                    $("#from"+ biblioNum).focus();
674
                    $("#from"+ biblioNum).focus();
668
                    return false;
675
                    return false;
669
                } else if( $(".futuredate").prop('required') && $("#to"+ biblioNum).val() == '' ) {
676
                } else if( $(".futuredate").prop('required') && $("#to"+ biblioNum).val() == '' ) {
670
                    alert(MSG_EMPTY_DATE);
677
                    alert(MSG_EMPTY_END_DATE);
671
                    badBib = biblioNum;
678
                    badBib = biblioNum;
672
                    if( $("#to"+biblioNum+":hidden").length ) $("#toggle-hold-options-"+biblioNum).click();
679
                    if( $("#to"+biblioNum+":hidden").length ) $("#toggle-hold-options-"+biblioNum).click();
673
                    $("#to"+ biblioNum).focus();
680
                    $("#to"+ biblioNum).focus();
674
- 

Return to bug 30108