Bugzilla – Attachment 133464 Details for
Bug 30108
Allow making hold dates required
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 30108: Allow making hold dates required
Bug-30108-Allow-making-hold-dates-required.patch (text/plain), 5.48 KB, created by
Tomás Cohen Arazi (tcohen)
on 2022-04-20 12:25:52 UTC
(
hide
)
Description:
Bug 30108: Allow making hold dates required
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2022-04-20 12:25:52 UTC
Size:
5.48 KB
patch
obsolete
>From 785d1e22ed72806e5ee6427768590f58e0c99bb0 Mon Sep 17 00:00:00 2001 >From: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Date: Tue, 15 Feb 2022 16:25:59 +0100 >Subject: [PATCH] Bug 30108: Allow making hold dates required > >Side note: Template still referred to class holddateto while not >being used any longer. Replaced this occurrence by futuredate. > >Test plan: >[1] Disable OPACAllowHoldDateInFuture. >[2] Set pref OPACMandatoryHoldDates to "end date". >[3] Verify that the end date is mandatory on opac-reserve. >[4] Set pref OPACMandatoryHoldDates to "start date". >[5] Verify that no dates are required. >[6] Enable OPACAllowHoldDateInFuture. >[7] Verify that start dates are required. >[8] Set pref OPACMandatoryHoldDates to "no dates". >[9] Verify that no dates are required again. > >Bonus: >Check that more options box is opened when a date still is required. >In case of item level being forced, verify that more options is opened >regardless of pref setting. > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> > >Signed-off-by: Lucas Gass <lucas@bywatersolutions.com> >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >--- > .../bootstrap/en/modules/opac-reserve.tt | 28 +++++++++++++++++-- > 1 file changed, 25 insertions(+), 3 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 45e7b2041cf..7c8b8c77dd0 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-reserve.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-reserve.tt >@@ -283,7 +283,7 @@ > [% IF ( reserve_in_future ) %] > <li> > <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" /> >+ <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> > </li> > [% END %] >@@ -498,6 +498,7 @@ > [% INCLUDE 'datatables.inc' %] > <script> > var MSG_NO_ITEM_SELECTED = _("Expecting a specific item selection."); >+ var MSG_EMPTY_DATE = _("Date should be filled."); > > $(document).ready(function() { > >@@ -513,7 +514,12 @@ > > $(".toggle-hold-options").show(); > $(".hold-options").hide(); >- $(".holddatefrom,.holddateto").prop("readOnly", true); >+ var OPACMandatoryHoldDates = "[% Koha.Preference('OPACMandatoryHoldDates') | html %]"; >+ if( OPACMandatoryHoldDates ) { >+ if( OPACMandatoryHoldDates == "start" || OPACMandatoryHoldDates == "both" ) $(".holddatefrom").prop( 'required', true ); >+ if( OPACMandatoryHoldDates == "end" || OPACMandatoryHoldDates == "both" ) $(".futuredate").prop( 'required', true ); >+ } >+ $(".holddatefrom,.futuredate").prop("readOnly", true); > > $(".checkitem").parent().click(function(e){ > if(e.target.tagName.toLowerCase() == 'td'){ >@@ -541,13 +547,15 @@ > toggleLink.text($(this).is(':visible') ? _("Hide options") : _("Show more options")); > }); > }); >+ if( $(".holddatefrom").prop('required') || $(".futuredate").prop('required') ) $(".toggle-hold-options").click(); > > // Hides all 'specific copy' table rows on load. > $(".copiesrow").hide(); > > [% FOREACH bibitemloo IN bibitemloop %] > [% IF bibitemloo.force_hold %] >- $("#toggle-hold-options-[% bibitemloo.biblionumber | html %]").click(); >+ if( $("#to[% bibitemloo.biblionumber | html %]:hidden").length ) >+ $("#toggle-hold-options-[% bibitemloo.biblionumber | html %]").click(); > $("#reqspecific_[% bibitemloo.biblionumber | html %]").click(); > $("#copiesrow_[% bibitemloo.biblionumber | html %]").show(); > [% END %] >@@ -652,6 +660,20 @@ > } > } > >+ if( $(".holddatefrom").prop('required') && $("#from"+ biblioNum).val() == '' ) { >+ alert(MSG_EMPTY_DATE); >+ badBib = biblioNum; >+ if( $("#from"+biblioNum+":hidden").length ) $("#toggle-hold-options-"+biblioNum).click(); >+ $("#from"+ biblioNum).focus(); >+ return false; >+ } else if( $(".futuredate").prop('required') && $("#to"+ biblioNum).val() == '' ) { >+ alert(MSG_EMPTY_DATE); >+ badBib = biblioNum; >+ if( $("#to"+biblioNum+":hidden").length ) $("#toggle-hold-options-"+biblioNum).click(); >+ $("#to"+ biblioNum).focus(); >+ return false; >+ } >+ > // If the 'specific copy' radio button is checked > if ($("#reqspecific_" + biblioNum + ":checked").size() > 0) { > // Find the selected copy >-- >2.34.1
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 30108
:
130745
|
130746
|
130747
|
131372
|
131376
|
131377
|
131378
|
131379
|
133462
|
133463
| 133464 |
133465
|
134476