Bugzilla – Attachment 171421 Details for
Bug 37398
Initialize a datepicker on all date/datetime fields when adding/editing items
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 37398: Make date and date time fields have date picker by default
Bug-37398-Make-date-and-date-time-fields-have-date.patch (text/plain), 4.23 KB, created by
Lucas Gass (lukeg)
on 2024-09-12 17:49:26 UTC
(
hide
)
Description:
Bug 37398: Make date and date time fields have date picker by default
Filename:
MIME Type:
Creator:
Lucas Gass (lukeg)
Created:
2024-09-12 17:49:26 UTC
Size:
4.23 KB
patch
obsolete
>From d80fcc891ddd6341715d6fd8f638c8e7db85ab6c Mon Sep 17 00:00:00 2001 >From: Lucas Gass <lucas@bywatersolutions.com> >Date: Thu, 12 Sep 2024 16:06:18 +0000 >Subject: [PATCH] Bug 37398: Make date and date time fields have date picker by > default > >To test: >1. APPLY PATCH, restart_all >2. Pick a framework, I choose BKS in k-t-d >3. Make sure that a few date and datetime fields are exposed in the editor. >4. On additem.tt a date picker should be instantiated on the date or datetime fields. >5. Make sure the date pickers work on each field. >6. If it is a datetime field you should have the option to add hours and minutes. ( datelastseen ) >7. Edit the framework and remove the dateaccessioned.pl plugin from any of these date fields. >8. Even without the dateaccessioned.pl plugin a date picker should be present on the field. >9. Add the dateaccessioned.pl plugin to a non date/datetime field. >10. Make sure the dateaccessioned.pl plugin works properly on the non date/datetime field. >11. Mark one of the date/datetime fields as mandatory, make sure it still acts as mandatory. >12. Hide date/datetime from the editor, make sure it hides properly. > >+----------------------+-------------+ >| COLUMN_NAME | COLUMN_TYPE | >+----------------------+-------------+ >| dateaccessioned | date | >| replacementpricedate | date | >| datelastborrowed | date | >| datelastseen | datetime | >| onloan | date | >+----------------------+-------------+ >--- > Koha/UI/Form/Builder/Item.pm | 23 ++++++++++++++++++- > .../prog/en/includes/html_helpers.inc | 4 ++++ > 2 files changed, 26 insertions(+), 1 deletion(-) > >diff --git a/Koha/UI/Form/Builder/Item.pm b/Koha/UI/Form/Builder/Item.pm >index 2ab9fb3bb50..9a2011c1773 100644 >--- a/Koha/UI/Form/Builder/Item.pm >+++ b/Koha/UI/Form/Builder/Item.pm >@@ -145,6 +145,14 @@ sub generate_subfield_form { > } > } > >+ if ($subfield->{kohafield} =~ /items\.(replacementpricedate|dateaccessioned|datelastborrowed|onloan)/) { >+ $subfield_data{datetype} = 'date'; >+ } >+ >+ if ($subfield->{kohafield} =~ /items\.(datelastseen|damaged_on|itemlost_on|withdrawn_on|deleted_on)/) { >+ $subfield_data{datetype} = 'datetime'; >+ } >+ > $subfield_data{visibility} = "display:none;" > if ( ( $subfield->{hidden} > 4 ) || ( $subfield->{hidden} <= -4 ) ); > >@@ -309,7 +317,20 @@ sub generate_subfield_form { > authtypecode => $subfield->{authtypecode}, > }; > } >- >+ elsif ( $subfield_data{datetype} eq 'date' ) { >+ $subfield_data{marc_value} = { >+ type => 'date_field', >+ id => $subfield_data{id}, >+ value => $value, >+ } >+ } >+ elsif ( $subfield_data{datetype} eq 'datetime' ) { >+ $subfield_data{marc_value} = { >+ type => 'datetime_field', >+ id => $subfield_data{id}, >+ value => $value, >+ } >+ } > # it's a plugin field > elsif ( $subfield->{value_builder} ) { # plugin > require Koha::FrameworkPlugin; >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers.inc >index 609dc3f0d03..72e30303156 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers.inc >@@ -166,6 +166,10 @@ > [% ELSE %] > <textarea id="[%- mv.id | html -%]" name="[% kohafield | html %]" class="input_marceditor [% kohafield | html %]" rows="5" cols="64" >[% mv.value | html %]</textarea> > [% END %] >+ [% ELSIF ( mv.type == 'date_field' ) %] >+ <input type="text" id="[% mv.id | html %]" name="[% kohafield | html %]" class="input_marceditor [% kohafield | html %] flatpickr" value="[% mv.value | html %]" class="flatpickr" /> >+ [% ELSIF ( mv.type == 'datetime_field' ) %] >+ <input type="text" id="[% mv.id | html %]" name="[% kohafield | html %]" class="input_marceditor [% kohafield | html %] flatpickr" value="[% mv.value | html %]" data-flatpickr-enable-time="true" /> > [% END %] > > [% IF subfield.kohafield == 'items.more_subfields_xml' %] >-- >2.39.2
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 37398
:
171416
|
171417
|
171419
|
171420
|
171421
|
171422
|
171423
|
171424
|
171881
|
171882
|
171919
|
171963
|
172187
|
172188
|
172189
|
172190
|
172191
|
172192
|
172193
|
172194
|
172195
|
172196
|
174558
|
174559
|
174560
|
174561
|
174562
|
174563
|
174564
|
174565
|
174566