From 5811093b6b10a3ddd7552f93bc78da4bc4a06196 Mon Sep 17 00:00:00 2001 From: Emily Lamancusa Date: Fri, 20 Dec 2024 12:12:14 -0500 Subject: [PATCH] Bug 38765: Parse dates correctly Some dates in invoices.tt are being formatted to the system DateFormat when they are not being displayed, which causes processing errors when the code expects ISO format. Dates should be formatted for local format only when they are being displayed. To test: 1. Go to Acquisitions and create some invoices i. Search for a vendor (can submit a blank search box) ii. Click on vendor name iii. Click "Receive shipments" button iv. In the "Receive a new shipment" section, enter any value in the "Vendor invoice" field and click "Next" v. Click the "My Vendor" breadcrumb and repeat iii-iv a few times 2. Go to Acquisitions > Invoices 3. Search for some invoices (can submit with all blank filters) 4. Select the checkboxes by two or more invoices 5. Click "Merge selected invoices" 6. Click "Merge" without editing the input data at all --> Internal server error! "The given date does not match the date format (iso)" 7. Apply patch 8. Repeat steps 2-6 --> The invoices are merged successfully! Signed-off-by: Brendan Lawlor --- koha-tmpl/intranet-tmpl/prog/en/modules/acqui/invoices.tt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/invoices.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/invoices.tt index 6c46799d2a..69083c1ad6 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/invoices.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/invoices.tt @@ -5,6 +5,7 @@ [% USE Branches %] [% SET footerjs = 1 %] [% PROCESS 'i18n.inc' %] +[% INCLUDE 'js-date-format.inc' %] [% INCLUDE 'doc-head-open.inc' %] [% FILTER collapse %] [% t("Invoices") | html %] › @@ -70,7 +71,7 @@ </thead> <tbody> [% FOREACH invoice IN invoices %] - <tr data-invoiceid="[% invoice.invoiceid | html %]" data-booksellerid="[% invoice.booksellerid | html %]" data-shipmentdate="[% invoice.shipmentdate | $KohaDates %]" data-billingdate="[% invoice.billingdate | $KohaDates %]" data-shipmentcost="[% invoice.shipmentcost | html %]" data-shipment_budgetid="[% invoice.shipmentcost_budgetid | html %]" data-closedate="[% invoice.closedate | $KohaDates %]"> + <tr data-invoiceid="[% invoice.invoiceid | html %]" data-booksellerid="[% invoice.booksellerid | html %]" data-shipmentdate="[% invoice.shipmentdate | html %]" data-billingdate="[% invoice.billingdate | html %]" data-shipmentcost="[% invoice.shipmentcost | html %]" data-shipment_budgetid="[% invoice.shipmentcost_budgetid | html %]" data-closedate="[% invoice.closedate | html %]"> [% IF CAN_user_acquisition_merge_invoices %] <td>[% invoice.is_linked_to_subscriptions | html %]</td> [% END %] @@ -506,7 +507,7 @@ } else { $('#merge_table tbody').empty(); $.each(invoices, function (idx, invoice) { - var row = $('<tr data-invoiceid="' + invoice.invoiceid + '"><td>' + invoice.invoicenumber + '</td><td>' + invoice.shipmentdate + '</td><td>' + invoice.billingdate + '</td><td>' + invoice.shipmentcost + '</td></tr>'); + var row = $('<tr data-invoiceid="' + invoice.invoiceid + '"><td>' + invoice.invoicenumber + '</td><td>' + $date(invoice.shipmentdate) + '</td><td>' + $date(invoice.billingdate) + '</td><td>' + invoice.shipmentcost + '</td></tr>'); $(row).appendTo('#merge_table tbody'); $(row).click(function () { $('#merge_table tbody tr').removeClass('active'); -- 2.39.5