Bug 38766 - Opening, closing, or deleting and invoice from the Action drop-down can cause internal server error
Summary: Opening, closing, or deleting and invoice from the Action drop-down can cause...
Status: Pushed to main
Alias: None
Product: Koha
Classification: Unclassified
Component: Acquisitions (show other bugs)
Version: Main
Hardware: All All
: P5 - low normal
Assignee: Emily Lamancusa (emlam)
QA Contact: Katrin Fischer
URL:
Keywords:
Depends on: 38155 38765
Blocks:
  Show dependency treegraph
 
Reported: 2024-12-20 17:31 UTC by Emily Lamancusa (emlam)
Modified: 2025-01-01 00:05 UTC (History)
1 user (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
This fixes closing and reopening of invoices using the action button options (Acquisitions > [Vendor] > Invoices > Actions) - when used from the search results when using invoice filters (for example, shipment to and from dates). This caused an internal server error with the message "The given date <date> does not match the date format (iso)...". It also adds a confirmation message when deleting an invoice.
Version(s) released in:
25.05.00
Circulation function:


Attachments
Bug 38766: Use uri filter for all parameters in referer link (8.14 KB, patch)
2024-12-20 17:54 UTC, Emily Lamancusa (emlam)
Details | Diff | Splinter Review
Bug 38766: Use uri filter for all parameters in referer link (8.19 KB, patch)
2024-12-20 20:03 UTC, Brendan Lawlor
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Emily Lamancusa (emlam) 2024-12-20 17:31:21 UTC
The links to perform invoice actions from the Action menu on invoices.pl pass the search url, so that the page can redirect back to the search results after performing the action. This url includes the selected search filter values.

However, if dates were used to filter the search, the url includes the dates formatted according to the local DateFormat system preference, instead of ISO format. This causes a parsing error when redirecting back.

Similar errors were fixed on bug 38765 and bug 38155. Building this patch on top of those patches, to make it easier to confirm that all such errors in this template have been fixed.
Comment 1 Emily Lamancusa (emlam) 2024-12-20 17:54:22 UTC
Created attachment 175851 [details] [review]
Bug 38766: Use uri filter for all parameters in referer link

Also fixes the confirmation message for deleting.

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. Specify search filters for shipment to/from dates (that include the
   invoices you entered) and search for invoices
4. Try opening, closing, and deleting individual invoices using the
   Action menu
--> Internal server error! "The given date <date> does not match the
    date format (iso)".
--> Also, note that there is no confirmation dialog when deleting
5. Apply patch
6. Repeat steps 2-4
--> Confirm that invoices can be opened and closed using the drop-down
    menu with no issue
--> Confirm that both open and closed invoices can be deleted with no
    issue, and that a confirmation message displays before deleting

Note for QA: search for $KohaDates within invoices.tt, and confirm that
the $KohaDates filter is now only used for display, never for Internal
data storage/flow
Comment 2 Brendan Lawlor 2024-12-20 20:03:06 UTC
Created attachment 175854 [details] [review]
Bug 38766: Use uri filter for all parameters in referer link

Also fixes the confirmation message for deleting.

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. Specify search filters for shipment to/from dates (that include the
   invoices you entered) and search for invoices
4. Try opening, closing, and deleting individual invoices using the
   Action menu
--> Internal server error! "The given date <date> does not match the
    date format (iso)".
--> Also, note that there is no confirmation dialog when deleting
5. Apply patch
6. Repeat steps 2-4
--> Confirm that invoices can be opened and closed using the drop-down
    menu with no issue
--> Confirm that both open and closed invoices can be deleted with no
    issue, and that a confirmation message displays before deleting

Note for QA: search for $KohaDates within invoices.tt, and confirm that
the $KohaDates filter is now only used for display, never for Internal
data storage/flow

Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org>
Comment 3 Katrin Fischer 2024-12-30 10:53:36 UTC
I've added a follow-up for a transatability issue:
data-confirmation-msg="Are you sure you want to delete this invoice?

Following the existing pattern:
data-confirmation-msg="[% t('...') | html %]
Comment 4 Katrin Fischer 2024-12-30 11:10:21 UTC
Pushed for 25.05!

Well done everyone, thank you!