Bug 30395

Summary: Internal server error at reserve/request.pl on a biblio with non-ISO formatted date in publicationyear
Product: Koha Reporter: Julian Maurice <julian.maurice>
Component: Hold requestsAssignee: Julian Maurice <julian.maurice>
Status: CLOSED FIXED QA Contact: Nick Clemens (kidclamp) <nick>
Severity: major    
Priority: P5 - low CC: gmcharlt, koha, kyle, nick
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Trivial patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
22.05.00
Circulation function:
Bug Depends on: 29660    
Bug Blocks:    
Attachments: Bug 30395: Fix TT filtering of publicationyear in reserve/request.tt
Bug 30395: Fix TT filtering of publicationyear in reserve/request.tt
Bug 30395: Fix TT filtering of publicationyear in reserve/request.tt

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 (kidclamp) 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 ﷐[U+1F984]﷑