Bug 39559 - YY is not interpreted as a default value for authorities
Summary: YY is not interpreted as a default value for authorities
Status: Pushed to main
Alias: None
Product: Koha
Classification: Unclassified
Component: Cataloging (show other bugs)
Version: unspecified
Hardware: All All
: P5 - low trivial
Assignee: Janusz Kaczmarek
QA Contact: Marcel de Rooy
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-04-04 08:13 UTC by Janusz Kaczmarek
Modified: 2025-04-14 06:53 UTC (History)
2 users (show)

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


Attachments
Bug 39559: YY is not interpreted as a default value for authorities (1.42 KB, patch)
2025-04-04 08:21 UTC, Janusz Kaczmarek
Details | Diff | Splinter Review
Bug 39559: YY is not interpreted as a default value for authorities (1.47 KB, patch)
2025-04-04 15:49 UTC, ByWater Sandboxes
Details | Diff | Splinter Review
Bug 39559: YY is not interpreted as a default value for authorities (1.57 KB, patch)
2025-04-11 07:09 UTC, Marcel de Rooy
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Janusz Kaczmarek 2025-04-04 08:13:19 UTC
Strings as YYYY, MM, DD put as part of default value for authorities are interpreted as year (four digits), month and day. YY is missing (two digits year).  BTW, for bibliographic records it is <YYYY>, <YY>, <MM>, <DD> (in Koha/UI/Form/Builder/Biblio.pm).
Comment 1 Janusz Kaczmarek 2025-04-04 08:21:37 UTC
Created attachment 180615 [details] [review]
Bug 39559: YY is not interpreted as a default value for authorities

Strings as YYYY, MM, DD put as part of default value for authorities
are interpreted as year (four digits), month and day. YY is missing
(two digits year).  BTW, for bibliographic records it is <YYYY>, <YY>,
<MM>, <DD> (in Koha/UI/Form/Builder/Biblio.pm).

Test plan:
==========
1. Edit an authority framework of your choice
   (/cgi-bin/koha/admin/authtypes.pl), inserting a default value that
   contains YY for a known field.
2. Create a new authority record of the chosen type. Control the field
   for which a default value was defined. You should see YY.
3. Apply the patch ; restart_all.
4. Repeat p. 2. There should be a current year (two digits, like '25')
   in place of YY.
Comment 2 ByWater Sandboxes 2025-04-04 15:49:36 UTC
Created attachment 180647 [details] [review]
Bug 39559: YY is not interpreted as a default value for authorities

Strings as YYYY, MM, DD put as part of default value for authorities
are interpreted as year (four digits), month and day. YY is missing
(two digits year).  BTW, for bibliographic records it is <YYYY>, <YY>,
<MM>, <DD> (in Koha/UI/Form/Builder/Biblio.pm).

Test plan:
==========
1. Edit an authority framework of your choice
   (/cgi-bin/koha/admin/authtypes.pl), inserting a default value that
   contains YY for a known field.
2. Create a new authority record of the chosen type. Control the field
   for which a default value was defined. You should see YY.
3. Apply the patch ; restart_all.
4. Repeat p. 2. There should be a current year (two digits, like '25')
   in place of YY.

Signed-off-by: esther <esther@bywatersolutions.com>
Comment 3 Esther Melander 2025-04-04 15:50:09 UTC
The patch appears to work.
Comment 4 Marcel de Rooy 2025-04-11 07:09:16 UTC
Created attachment 180811 [details] [review]
Bug 39559: YY is not interpreted as a default value for authorities

Strings as YYYY, MM, DD put as part of default value for authorities
are interpreted as year (four digits), month and day. YY is missing
(two digits year).  BTW, for bibliographic records it is <YYYY>, <YY>,
<MM>, <DD> (in Koha/UI/Form/Builder/Biblio.pm).

Test plan:
==========
1. Edit an authority framework of your choice
   (/cgi-bin/koha/admin/authtypes.pl), inserting a default value that
   contains YY for a known field.
2. Create a new authority record of the chosen type. Control the field
   for which a default value was defined. You should see YY.
3. Apply the patch ; restart_all.
4. Repeat p. 2. There should be a current year (two digits, like '25')
   in place of YY.

Signed-off-by: esther <esther@bywatersolutions.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Comment 5 Marcel de Rooy 2025-04-11 07:10:23 UTC
The /e modifier is harmless here, just running substr. But should be used with 
caution..
Comment 6 Katrin Fischer 2025-04-14 06:53:02 UTC
Pushed for 25.05!

Well done everyone, thank you!