Bugzilla – Attachment 157233 Details for
Bug 35000
OPACMandatoryHoldDates does not work well with flatpickr
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 35000: Fix OPACMandatoryHoldDates feature in opac-reserve
Bug-35000-Fix-OPACMandatoryHoldDates-feature-in-op.patch (text/plain), 6.46 KB, created by
Martin Renvoize (ashimema)
on 2023-10-17 12:20:59 UTC
(
hide
)
Description:
Bug 35000: Fix OPACMandatoryHoldDates feature in opac-reserve
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2023-10-17 12:20:59 UTC
Size:
6.46 KB
patch
obsolete
>From c022d32ea4fcbbc4930c155188bcb4baab5bf2b1 Mon Sep 17 00:00:00 2001 >From: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Date: Tue, 10 Oct 2023 13:36:45 +0200 >Subject: [PATCH] Bug 35000: Fix OPACMandatoryHoldDates feature in opac-reserve > >Somewhere (perhaps after bug 29012) this feature has been broken >somehow. >The fact that we have two inputs for the date and the active one >is one level deeper, requires a few adjustments in the jquery >selectors etc. (Note that two Required lines were visible too.) >The corrected jquery constructs become a bit complexer now. > >Test plan: >Enable AllowHoldDateInFuture + OPACAllowHoldDateInFuture. >Set circ rule for book to test with allows item level holds. >Set OPACMandatoryHoldDates to no hold dates. >Place hold on a book in OPAC. Check that More options is collapsed. >(If you force item level holds, it will open.) >Set OPACMandatoryHoldDates to Hold start date. >Refresh place hold page. More options is expanded now. >Click Place hold. You should see an alert and focus goes to start date. >Set OPACMandatoryHoldDates to Hold end date. Repeat place hold. >Set OPACMandatoryHoldDates to Both hold dates. Fill one. Place hold. >Bonus: Place hold on multiple biblios. Repeat former steps. > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > .../bootstrap/en/modules/opac-reserve.tt | 27 +++++++++---------- > 1 file changed, 12 insertions(+), 15 deletions(-) > >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 bc497b17f0e..e2918332a3a 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 @@ > <label for="from[% bibitemloo.biblionumber | html %]">Hold starts on date:</label> > <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" /> > <span class="date-format from" data-biblionumber="[% bibitemloo.biblionumber | html %]">[% INCLUDE 'date-format.inc' %]</span> >+ <div class="required_label" style="display:none;">Required</div> > </li> > [% END %] > >@@ -300,6 +301,7 @@ > <label for="to[% bibitemloo.biblionumber | html %]">Hold not needed after:</label> > <input type="text" name="expiration_date_[% bibitemloo.biblionumber | html %]" id="to[% bibitemloo.biblionumber | html %]" size="10" class="flatpickr futuredate" /> > <span class="date-format to" data-biblionumber="[% bibitemloo.biblionumber | html %]">[% INCLUDE 'date-format.inc' %]</span> >+ <div class="required_label" style="display:none;">Required</div> > </li> > > [% IF Koha.Preference('AllowHoldItemTypeSelection') %] >@@ -519,16 +521,11 @@ > $(".toggle-hold-options").show(); > $(".hold-options").hide(); > var OPACMandatoryHoldDates = "[% Koha.Preference('OPACMandatoryHoldDates') | html %]"; >- var requiredDiv = "<div class=\"required_label required\">" + _("Required") + "</div>"; >- 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; > } > >-- >2.41.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 35000
:
156790
|
157213
| 157233