Bugzilla – Attachment 193970 Details for
Bug 33886
Flatpickr calendar - year controls for date of birth on memberentry.pl are not intuitive
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 33886: Replace DateInputStyle syspref with data-flatpickr-split attribute
4540dd2.patch (text/plain), 9.10 KB, created by
Martin Renvoize (ashimema)
on 2026-02-26 07:15:54 UTC
(
hide
)
Description:
Bug 33886: Replace DateInputStyle syspref with data-flatpickr-split attribute
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2026-02-26 07:15:54 UTC
Size:
9.10 KB
patch
obsolete
>From 4540dd2a5af825ad94f55b49bcf93afa787d371b Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@openfifth.co.uk> >Date: Thu, 26 Feb 2026 06:53:35 +0000 >Subject: [PATCH] Bug 33886: Replace DateInputStyle syspref with > data-flatpickr-split attribute > >Remove the DateInputStyle system preference and instead control split >date input mode via a data-flatpickr-split="true" attribute on individual >fields. This allows per-field control rather than a global setting. > >Apply split inputs to fields where they are most appropriate: >- dateofbirth (memorable date, typically far in the past) >- dateexpiry (far-future date, analogous to card expiry) > >The atomicupdate is updated to delete the preference on upgrade. >--- > installer/data/mysql/atomicupdate/bug_33886.pl | 13 +++---------- > .../intranet-tmpl/prog/en/includes/calendar.inc | 3 +-- > .../en/modules/admin/preferences/i18n_l10n.pref | 8 -------- > .../prog/en/modules/members/memberentrygen.tt | 5 +++-- > .../opac-tmpl/bootstrap/en/includes/calendar.inc | 3 +-- > .../bootstrap/en/modules/opac-memberentry.tt | 1 + > 6 files changed, 9 insertions(+), 24 deletions(-) > >diff --git a/installer/data/mysql/atomicupdate/bug_33886.pl b/installer/data/mysql/atomicupdate/bug_33886.pl >index 4a0474580c2..c3d9ac1aadb 100644 >--- a/installer/data/mysql/atomicupdate/bug_33886.pl >+++ b/installer/data/mysql/atomicupdate/bug_33886.pl >@@ -3,24 +3,17 @@ use Koha::Installer::Output qw(say_warning say_success say_info); > > return { > bug_number => "33886", >- description => "Add DateInputStyle system preference", >+ description => "Remove DateInputStyle system preference", > up => sub { > my ($args) = @_; > my ( $dbh, $out ) = @$args{qw(dbh out)}; > > $dbh->do( > q{ >- INSERT IGNORE INTO systempreferences ( variable, value, options, explanation, type ) >- VALUES ( >- 'DateInputStyle', >- 'single', >- 'single|split', >- 'Controls how date input fields are displayed. "single" uses the standard flatpickr calendar widget with maskito input masking. "split" shows three separate inputs for day, month, and year (order follows the dateformat preference) with an optional calendar button; does not apply to time, datetime, or booking date range fields.', >- 'Choice' >- ) >+ DELETE FROM systempreferences WHERE variable = 'DateInputStyle' > } > ); > >- say_success( $out, "Added new system preference 'DateInputStyle'" ); >+ say_success( $out, "Removed system preference 'DateInputStyle'" ); > }, > }; >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/calendar.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/calendar.inc >index d785927a4fc..ad50ca43bfd 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/calendar.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/calendar.inc >@@ -31,7 +31,6 @@ > delimiter = "-"; > } > var sentmsg = 0; >- var dateInputStyle = "[% Koha.Preference('DateInputStyle') | html %]"; > var bidi = [% IF(bidi) %] true[% ELSE %] false[% END %]; > var calendarFirstDayOfWeek = '[% Koha.Preference('CalendarFirstDayOfWeek') | html %]'; > var flatpickr_timeformat_string = [% IF Koha.Preference('TimeFormat') == '12hr' %]"G:i K"[% ELSE %]"H:i"[% END %]; >@@ -277,7 +276,7 @@ > } > > let fp; >- if ( dateInputStyle === 'split' && !is_time && !is_time_only && !is_period ) { >+ if ( $(input).data('flatpickr-split') && !is_time && !is_time_only && !is_period ) { > fp = apply_split_date_widget(input, options); > } else { > fp = $(input).flatpickr(options); >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/i18n_l10n.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/i18n_l10n.pref >index 3e625e732e1..be78a5088a8 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/i18n_l10n.pref >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/i18n_l10n.pref >@@ -10,14 +10,6 @@ I18N/L10N: > dmydot: dd.mm.yyyy > iso: yyyy-mm-dd > - . >- - >- - Use >- - pref: DateInputStyle >- default: single >- choices: >- single: single input field with calendar picker >- split: split inputs (day, month, year) with optional calendar button >- - "style for date entry fields. The split option follows the dateformat preference for field order and is recommended for accessibility; it does not apply to time, datetime, or booking date range fields." > - > - Format times in > - pref: TimeFormat >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt >index d6dbd0954fc..a1c4b7ce257 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt >@@ -393,6 +393,7 @@ > size="20" > value="[% borrower_data.dateofbirth | html UNLESS op == 'duplicate' %]" > class="flatpickr" >+ data-flatpickr-split="true" > data-flatpickr-pastinclusive="true" > /> > [% IF ( mandatorydateofbirth ) %] >@@ -1127,9 +1128,9 @@ > <li [% IF nodateexpiry %]style="display:none"[% END %]> > <label for="to" [% IF mandatorydateexpiry %]class="required"[% END %]> Expiry date (leave blank for auto calc): </label> > [% UNLESS ( op == 'add_form' ) %] >- <input type="text" id="to" name="dateexpiry" maxlength="10" size="10" value="[% borrower_data.dateexpiry | html UNLESS op == 'duplicate' %]" class="flatpickr" /> >+ <input type="text" id="to" name="dateexpiry" maxlength="10" size="10" value="[% borrower_data.dateexpiry | html UNLESS op == 'duplicate' %]" class="flatpickr" data-flatpickr-split="true" /> > [% ELSE %] >- <input type="text" id="to" name="dateexpiry" maxlength="10" size="10" value="[% borrower_data.dateexpiry | html %]" class="flatpickr" /> >+ <input type="text" id="to" name="dateexpiry" maxlength="10" size="10" value="[% borrower_data.dateexpiry | html %]" class="flatpickr" data-flatpickr-split="true" /> > [% END %] > [% IF ( mandatorydateexpiry ) %] > <span class="required">Required</span> >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/calendar.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/calendar.inc >index 437067dd25c..757ddbdb355 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/calendar.inc >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/calendar.inc >@@ -13,7 +13,6 @@ > }; > var debug = "[% debug | html %]"; > var dateformat_pref = "[% Koha.Preference('dateformat') | html %]"; >- var dateInputStyle = "[% Koha.Preference('DateInputStyle') | html %]"; > var sentmsg = 0; > if (debug > 1) {alert("dateformat: " + dateformat_pref + "\ndebug is on (level " + debug + ")");} > var calendarFirstDayOfWeek = '[% Koha.Preference('CalendarFirstDayOfWeek') | html %]'; >@@ -394,7 +393,7 @@ > } > > let fp; >- if (typeof dateInputStyle !== "undefined" && dateInputStyle === "split" && !is_time && !is_period) { >+ if ($(this).data("flatpickr-split") && !is_time && !is_period) { > fp = apply_split_date_widget(this, options); > } else { > fp = $(this).flatpickr(options); >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-memberentry.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-memberentry.tt >index 1e6f167b59d..27f310cec65 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-memberentry.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-memberentry.tt >@@ -490,6 +490,7 @@ > value="[% borrower.dateofbirth | html %]" > size="10" > class="[% required.dateofbirth | html %] flatpickr pastdate" >+ data-flatpickr-split="true" > [% IF required.dateofbirth %]required[% END %] > /> > <div class="required_label [% required.dateofbirth | html %]">Required</div> >-- >2.53.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 33886
:
193933
| 193970 |
193971