diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-reserve.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-reserve.tt index fbd63ff335..942eb98d58 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-reserve.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-reserve.tt @@ -293,6 +293,7 @@ [% INCLUDE 'date-format.inc' %] + [% END %] @@ -300,6 +301,7 @@ [% INCLUDE 'date-format.inc' %] + [% IF Koha.Preference('AllowHoldItemTypeSelection') %] @@ -519,16 +521,11 @@ $(".toggle-hold-options").show(); $(".hold-options").hide(); var OPACMandatoryHoldDates = "[% Koha.Preference('OPACMandatoryHoldDates') | html %]"; - var requiredDiv = "
" + _("Required") + "
"; - if( OPACMandatoryHoldDates ) { - if( OPACMandatoryHoldDates == "start" || OPACMandatoryHoldDates == "both" ) { - $(".holddatefrom").prop( 'required', true ); - $(".holddatefrom").parent().append(requiredDiv); - } - if( OPACMandatoryHoldDates == "end" || OPACMandatoryHoldDates == "both" ) { - $(".futuredate").prop( 'required', true ); - $(".futuredate").parent().append(requiredDiv); - } + if( OPACMandatoryHoldDates == "start" || OPACMandatoryHoldDates == "both" ) { + $(".holddatefrom").prop( 'required', true ).siblings(".required_label").addClass('required').show(); + } + if( OPACMandatoryHoldDates == "end" || OPACMandatoryHoldDates == "both" ) { + $(".futuredate").prop( 'required', true ).siblings(".required_label").addClass('required').show(); } $(".checkitem").parent().click(function(e){ @@ -564,7 +561,7 @@ [% FOREACH bibitemloo IN bibitemloop %] [% IF bibitemloo.force_hold %] - if( $("#to[% bibitemloo.biblionumber | html %]:hidden").length ) + if( $("#to[% bibitemloo.biblionumber | html %]").parent(":hidden").length ) $("#toggle-hold-options-[% bibitemloo.biblionumber | html %]").click(); $("#reqspecific_[% bibitemloo.biblionumber | html %]").click(); $("#copiesrow_[% bibitemloo.biblionumber | html %]").show(); @@ -676,14 +673,14 @@ if( $(".holddatefrom").prop('required') && $("#from"+ biblioNum).val() == '' ) { alert(MSG_EMPTY_START_DATE); badBib = biblioNum; - if( $("#from"+biblioNum+":hidden").length ) $("#toggle-hold-options-"+biblioNum).click(); - $("#from"+ biblioNum).focus(); + if( $("#from"+biblioNum).parent(":hidden").length ) $("#toggle-hold-options-"+biblioNum).trigger('click'); + $("#from"+biblioNum).siblings('.flatpickr_wrapper').find('.flatpickr-input').trigger('focus'); return false; } else if( $(".futuredate").prop('required') && $("#to"+ biblioNum).val() == '' ) { alert(MSG_EMPTY_END_DATE); badBib = biblioNum; - if( $("#to"+biblioNum+":hidden").length ) $("#toggle-hold-options-"+biblioNum).click(); - $("#to"+ biblioNum).focus(); + if( $("#to"+biblioNum).parent(":hidden").length ) $("#toggle-hold-options-"+biblioNum).trigger('click'); + $("#to"+biblioNum).siblings('.flatpickr_wrapper').find('.flatpickr-input').trigger('focus'); return false; }