Bug 30395 - Internal server error at reserve/request.pl on a biblio with non-ISO formatted date in publicationyear
Summary: Internal server error at reserve/request.pl on a biblio with non-ISO formatte...
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Hold requests (show other bugs)
Version: Main
Hardware: All All
: P5 - low major (vote)
Assignee: Julian Maurice
QA Contact: Nick Clemens
URL:
Keywords:
Depends on: 29660
Blocks:
  Show dependency treegraph
 
Reported: 2022-03-29 11:25 UTC by Julian Maurice
Modified: 2022-12-12 21:24 UTC (History)
4 users (show)

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


Attachments
Bug 30395: Fix TT filtering of publicationyear in reserve/request.tt (1.66 KB, patch)
2022-03-29 11:32 UTC, Julian Maurice
Details | Diff | Splinter Review
Bug 30395: Fix TT filtering of publicationyear in reserve/request.tt (1.71 KB, patch)
2022-03-30 11:45 UTC, Biblibre Sandboxes
Details | Diff | Splinter Review
Bug 30395: Fix TT filtering of publicationyear in reserve/request.tt (1.77 KB, patch)
2022-03-31 11:39 UTC, Nick Clemens
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Julian Maurice 2022-03-29 11:25:31 UTC
Steps to reproduce:
1. Verify that in the default MARC framework there is a field linked to biblioitems.publicationyear (typically it's 210$d for UNIMARC)
2. Create a biblio with a non ISO-formatted date in this field. It can be a "YYYY" year for instance. Create an item for this biblio.
3. Try to place a hold on this biblio. You should get an internal server error and the following message in the logs:
Template process failed: undef error - The given date (2013) does not match the date format (iso) at /home/koha/src/Koha/DateUtils.pm line 204.

It looks like the problem was introduced by bug 29660 which replaces an 'html' filter by a '$KohaDates' filter for publicationyear
Comment 1 Julian Maurice 2022-03-29 11:32:23 UTC
Created attachment 132390 [details] [review]
Bug 30395: Fix TT filtering of publicationyear in reserve/request.tt

biblioitems.publicationyear is not a date (it can be, but we cannot
guarantee that) so the $KohaDates filter should not be used on this data

Test plan:
1. Verify that in the default MARC framework there is a field linked to
   biblioitems.publicationyear (typically it's 210$d for UNIMARC)
2. Create a biblio with a non ISO-formatted date in this field. It
   can be a "YYYY" year for instance. Create an item for this biblio.
3. Try to place a hold on this biblio. If it works, you can sign off
Comment 2 Biblibre Sandboxes 2022-03-30 11:45:08 UTC
Created attachment 132560 [details] [review]
Bug 30395: Fix TT filtering of publicationyear in reserve/request.tt

biblioitems.publicationyear is not a date (it can be, but we cannot
guarantee that) so the $KohaDates filter should not be used on this data

Test plan:
1. Verify that in the default MARC framework there is a field linked to
   biblioitems.publicationyear (typically it's 210$d for UNIMARC)
2. Create a biblio with a non ISO-formatted date in this field. It
   can be a "YYYY" year for instance. Create an item for this biblio.
3. Try to place a hold on this biblio. If it works, you can sign off

Signed-off-by: Sonia <sonia.bouis@univ-lyon3.fr>
Comment 3 Koha Team University Lyon 3 2022-03-30 11:53:22 UTC
Hi,
I checked the MARC mapping, and I have biblioitems.publicationyear -> 210$d
I chose a biblio record where 210$d = 2003
I went to place a hold from the biblio and I didn't have an "internal server error"
\o/
Comment 4 Nick Clemens 2022-03-31 11:39:00 UTC
Created attachment 132698 [details] [review]
Bug 30395: Fix TT filtering of publicationyear in reserve/request.tt

biblioitems.publicationyear is not a date (it can be, but we cannot
guarantee that) so the $KohaDates filter should not be used on this data

Test plan:
1. Verify that in the default MARC framework there is a field linked to
   biblioitems.publicationyear (typically it's 210$d for UNIMARC)
2. Create a biblio with a non ISO-formatted date in this field. It
   can be a "YYYY" year for instance. Create an item for this biblio.
3. Try to place a hold on this biblio. If it works, you can sign off

Signed-off-by: Sonia <sonia.bouis@univ-lyon3.fr>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 5 Fridolin Somers 2022-04-05 15:29:22 UTC
Pushed to master for 22.05, thanks to everybody involved 🦄