Bug 28942 - Use Flatpickr on acquisitions pages
Summary: Use Flatpickr on acquisitions pages
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Templates (show other bugs)
Version: master
Hardware: All All
: P5 - low enhancement (vote)
Assignee: Owen Leonard
QA Contact: Testopia
URL:
Keywords:
Depends on: 28937
Blocks: 29239
  Show dependency treegraph
 
Reported: 2021-09-02 14:15 UTC by Owen Leonard
Modified: 2022-06-06 20:25 UTC (History)
4 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Small patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
21.11.00


Attachments
Bug 28942: Use Flatpickr on acquisitions pages (13.53 KB, patch)
2021-09-03 11:22 UTC, Owen Leonard
Details | Diff | Splinter Review
Bug 28942: Use Flatpickr on acquisitions pages (13.58 KB, patch)
2021-09-13 21:57 UTC, Lucas Gass
Details | Diff | Splinter Review
Bug 28942: Use Flatpickr on acquisitions pages (13.64 KB, patch)
2021-09-30 12:48 UTC, Martin Renvoize
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Owen Leonard 2021-09-02 14:15:36 UTC
This bug will cover Flatpickr additions to these pages/files:

- includes/filter-orders.inc
- acqui/invoice.tt
- acqui/invoices.tt
- acqui/lateorders.tt
- acqui/orderreceive.tt
- acqui/parcels.tt
Comment 1 Owen Leonard 2021-09-03 11:22:15 UTC Comment hidden (obsolete)
Comment 2 Lucas Gass 2021-09-13 21:57:07 UTC Comment hidden (obsolete)
Comment 3 Martin Renvoize 2021-09-30 12:48:11 UTC
Created attachment 125493 [details] [review]
Bug 28942: Use Flatpickr on acquisitions pages

This patch modifies several acquisitions pages replacing jQuery
datepickers with Flatpickr widgets.

To test, apply the patch and test datepickers on the following
Acquisitions pages:

 - Acquisitions -> Late orders (linked date fields in the sidebar)
 - Acquisitions -> Invoices (linked date fields in the sidebar)
 - Acquisitions -> Invoices -> Invoice details (shipment date and
   billing date)
 - Acquisitions -> Vendor -> Receive shipment (shipment date)
 - Acquisitions -> Vendor -> Receive shipment -> Receive (on order line)
   -> Date received field under "Accounting details
 - Acquisitions -> Orders search tab in the header -> Advanced search:
   Linked date fields in the search form."

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 4 Martin Renvoize 2021-09-30 12:48:51 UTC
Great to see all these updates..

PQA
Comment 5 Jonathan Druart 2021-10-04 13:37:34 UTC
Question (not related only to this patch, but other flatpickr ones as well):
Why don't you set the flatpickrto class when needed?

For instance:

+            var billingdatefrom = $("#billingdatefrom").flatpickr({
+                onClose: function( selectedDates, dateText, instance) {
+                    validate_date( selectedDates, instance );
+                    billingdateto.set('minDate', selectedDates[0]);
+                }
+            });
+            var billingdateto = $("#billingdateto").flatpickr({
+                onClose: function( selectedDates, dateText, instance) {
+                    validate_date( selectedDates, instance );
+                },
+            });

You need billingdatefrom, but you could use .flatpickrto for #billintdateto.

Also I think we could improve it a bit more, .flatpickrfrom could have a data containing the name of its "to".

We could only have:

  <input type="text" size="10" id="from" name="date_from" value="" class="flatpickrfrom" data-date_to="to" />

  <input type="text" size="10" id="to" name="date_to" value="" class="flatpickrto" />

And a couple of line in calendar.inc to link them.

I won't ofc block this patch series for that, but it would be great to have a follow-up bug on top to clean it.
Comment 6 Jonathan Druart 2021-10-06 08:37:48 UTC
Pushed to master for 21.11, thanks to everybody involved!