Bugzilla – Attachment 165910 Details for
Bug 35977
Display current date in hold starts on when placing a hold in the OPAC
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 35977: (follow-up) Cleaner working approach
Bug-35977-follow-up-Cleaner-working-approach.patch (text/plain), 4.77 KB, created by
Martin Renvoize (ashimema)
on 2024-04-30 15:16:59 UTC
(
hide
)
Description:
Bug 35977: (follow-up) Cleaner working approach
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2024-04-30 15:16:59 UTC
Size:
4.77 KB
patch
obsolete
>From 4596fbd356f3ac9042ef894940ac69f0127fea54 Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Tue, 30 Apr 2024 16:13:25 +0100 >Subject: [PATCH] Bug 35977: (follow-up) Cleaner working approach > >This patch removes the Date_from_syspref recently added and replaces it >with the correct parseDate call as per bug 35559. We also clean up the >code around setting the input value in the first place and use iso which >is what the rest of flatpickr expects and now is handled correctly in >futuredate pickers. > >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > .../bootstrap/en/includes/calendar.inc | 24 +------------------ > .../bootstrap/en/modules/opac-reserve.tt | 2 +- > opac/opac-reserve.pl | 1 - > 3 files changed, 2 insertions(+), 25 deletions(-) > >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/calendar.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/calendar.inc >index 103e03264f7..cb8ec7804e3 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/calendar.inc >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/calendar.inc >@@ -157,28 +157,6 @@ > } > } > >- function Date_from_syspref(dstring) { >- var dateX = dstring.split(/[-/.]/); >- if (debug > 1 && sentmsg < 1) { >- sentmsg++; >- alert("Date_from_syspref(" + dstring + ") splits to:\n" + dateX.join("\n")); >- } >- if (dateformat_pref === "iso") { >- return new Date(dateX[0], (dateX[1] - 1), dateX[2]); // YYYY-MM-DD to (YYYY,m(0-11),d) >- } else if (dateformat_pref === "us") { >- return new Date(dateX[2], (dateX[0] - 1), dateX[1]); // MM/DD/YYYY to (YYYY,m(0-11),d) >- } else if (dateformat_pref === "metric") { >- return new Date(dateX[2], (dateX[1] - 1), dateX[0]); // DD/MM/YYYY to (YYYY,m(0-11),d) >- } else if (dateformat_pref === "dmydot") { >- return new Date(dateX[2], (dateX[1] - 1), dateX[0]); // DD.MM.YYYY to (YYYY,m(0-11),d) >- } else { >- if (debug > 0) { >- alert("KOHA ERROR - Unrecognized date format: " + dateformat_pref); >- } >- return 0; >- } >- } >- > $(document).ready(function(){ > $(".flatpickr").each(function(){ > let options = {}; >@@ -189,7 +167,7 @@ > || $(this).data("flatpickr-futuredate") === true ) { > let original_date = $(this).val(); > if ( original_date ) { >- original_date = Date_from_syspref( original_date ).getTime(); >+ original_date = flatpickr.parseDate(original_date, 'Y-m-d').getTime(); > let tomorrow = new Date().fp_incr(1).getTime(); > > options['enable'] = [function(date){ >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 34d1f4ff5b8..7a736184c0a 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-reserve.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-reserve.tt >@@ -288,7 +288,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 %]" data-flatpickr-futureinclusive="true" size="10" class="flatpickr holddatefrom" value="[% today | $raw %]" /> >+ <input type="text" name="reserve_date_[% bibitemloo.biblionumber | html %]" id="from[% bibitemloo.biblionumber | html %]" data-start_for="to[% bibitemloo.biblionumber | html %]" data-flatpickr-futureinclusive="true" size="10" class="flatpickr holddatefrom" value="[% KohaDates.datetime_from_string | $KohaDates dateformat => 'iso' %]" /> > <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> >diff --git a/opac/opac-reserve.pl b/opac/opac-reserve.pl >index fe1d38fbe9b..bbc016cb794 100755 >--- a/opac/opac-reserve.pl >+++ b/opac/opac-reserve.pl >@@ -624,7 +624,6 @@ if ( C4::Context->preference('AllowHoldDateInFuture') > { > $template->param( > reserve_in_future => 1, >- today => dt_from_string, > ); > } > >-- >2.44.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 35977
:
161814
|
161928
|
162125
|
162126
|
164217
|
164220
|
164221
|
165535
|
165536
|
165725
| 165910