When creating a framework for a form type other than book, it does not seem possible to autogenerate the date correctly. The 00-05 ‘date entered on file’ in the 008 field, can almost be auto-filled by using the code <<YYYY>><<MM>><<DD>>. However it doesn’t quite work because the 008 field expects a 6 digit date [YYMMDD] – this code inserts an 8 digit date [YYYYMMDD]. e.g. <<YY>><<MM>><<DD>> b at |||p |||||00| eng d = entered on the date <<29>><<11>><<25>> This creates the following data in a record: <<YY>>1125 b at |||p |||||00| eng d Is it possible to make this date code work to insert a date comprising 6 digits?
See bug 7045 for the other placeholders already available. At the moment we support: <<DD>> - 2 digit day of month <<MM>> - 2 digit number of month <<YYYY>> - 4 digit year <<USER>> - user adding the record
Created attachment 96106 [details] [review] Bug 24134: Add placeholder for 2 digit years to allow autogeneration of dates in 008 This patch modifies the code for parsing MARC framework configurations so that the placeholder "<<YY>>" translates to a two-year date. To test, apply the patch and modify a framework to include placeholders. For example, in MARC21: - Administration -> MARC structure -> 952 -> Edit subfields -> d - Expand "Advanced constraints" and add a default value: <<YYYY>> <<YY>> <<MM>> <<DD>> <<USER>> - Save your configuration and go to Cataloging. - Go to the add/edit items page for a record which uses the framework you edited. - In the "Add item" form, in the "Date aquired" field, you should see the correct values. For example: '2019 19 12 03 Leonard' Perform the same test when adding an item during the Acquisitions process (depending on your AcqCreateItem setting). Note that acqui/neworderempty.pl has been modified because the placeholder-replacement code is repeated there, but I couldn't discover how to test it (if it is used at all?)
Created attachment 96113 [details] [review] Bug 24134: Add placeholder for 2 digit years to allow autogeneration of dates in 008 This patch modifies the code for parsing MARC framework configurations so that the placeholder "<<YY>>" translates to a two-year date. To test, apply the patch and modify a framework to include placeholders. For example, in MARC21: - Administration -> MARC structure -> 952 -> Edit subfields -> d - Expand "Advanced constraints" and add a default value: <<YYYY>> <<YY>> <<MM>> <<DD>> <<USER>> - Save your configuration and go to Cataloging. - Go to the add/edit items page for a record which uses the framework you edited. - In the "Add item" form, in the "Date aquired" field, you should see the correct values. For example: '2019 19 12 03 Leonard' Perform the same test when adding an item during the Acquisitions process (depending on your AcqCreateItem setting). Note that acqui/neworderempty.pl has been modified because the placeholder-replacement code is repeated there, but I couldn't discover how to test it (if it is used at all?) Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
This works great int he cataloguing editor, but the replacement doesn't work in the ACQ framework. To test: - Activate UseACQFrameworkForBiblioRecords - Add 008 with a default using placeholders to the ACQ framework - Add a basket - Add a new po line to the basket using 'new record' - Verify that the default is printed as is And we have a log full of those - but before the patch too: Use of uninitialized value $value in substitution (s///) at /home/vagrant/kohaclone/acqui/neworderempty.pl line 236. Use of uninitialized value $value in substitution (s///) at /home/vagrant/kohaclone/acqui/neworderempty.pl line 237. Use of uninitialized value $value in substitution (s///) at /home/vagrant/kohaclone/acqui/neworderempty.pl line 238. Use of uninitialized value $value in substitution (s///) at /home/vagrant/kohaclone/acqui/neworderempty.pl line 239. Use of uninitialized value $value in substitution (s///) at /home/vagrant/kohaclone/acqui/neworderempty.pl line 246. It would be great if it could be fixed, but also contemplating if we should move this into another bug? Adding Tomas for the connection to UseACQFrameworkForBiblioRecords.
I'd really like to see this one moving. Jonathan fixes the default value behaviour on controlfields in bug 24294, but the placeholders are not replaced. Maybe we could treat this as a preexisting bug - meaning, we let this move in, but file a new bug for fixing the placeholder behaviour in acquisitions?
I've filed bug 25599 for the issue with the ACQ framework.
Created attachment 105430 [details] [review] Bug 24134: Add placeholder for 2 digit years to allow autogeneration of dates in 008 This patch modifies the code for parsing MARC framework configurations so that the placeholder "<<YY>>" translates to a two-year date. To test, apply the patch and modify a framework to include placeholders. For example, in MARC21: - Administration -> MARC structure -> 952 -> Edit subfields -> d - Expand "Advanced constraints" and add a default value: <<YYYY>> <<YY>> <<MM>> <<DD>> <<USER>> - Save your configuration and go to Cataloging. - Go to the add/edit items page for a record which uses the framework you edited. - In the "Add item" form, in the "Date aquired" field, you should see the correct values. For example: '2019 19 12 03 Leonard' Perform the same test when adding an item during the Acquisitions process (depending on your AcqCreateItem setting). Note that acqui/neworderempty.pl has been modified because the placeholder-replacement code is repeated there, but I couldn't discover how to test it (if it is used at all?) Signed-off-by: Lucas Gass <lucas@bywatersolutions.com> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Ok, so with bug 25599 fixing neworderempty, we can now move this one on as well. It applies cleanly on top and I have verified it works. Moving to blocked until the dependency moves to PQA.
Unblocking as dependency is in now.
(In reply to Katrin Fischer from comment #9) > Unblocking as dependency is in now. With Lucas SO and your SO, should it be PQA?
Created attachment 108072 [details] [review] Bug 24134: Add placeholder for 2 digit years to allow autogeneration of dates in 008 This patch modifies the code for parsing MARC framework configurations so that the placeholder "<<YY>>" translates to a two-year date. To test, apply the patch and modify a framework to include placeholders. For example, in MARC21: - Administration -> MARC structure -> 952 -> Edit subfields -> d - Expand "Advanced constraints" and add a default value: <<YYYY>> <<YY>> <<MM>> <<DD>> <<USER>> - Save your configuration and go to Cataloging. - Go to the add/edit items page for a record which uses the framework you edited. - In the "Add item" form, in the "Date aquired" field, you should see the correct values. For example: '2019 19 12 03 Leonard' Perform the same test when adding an item during the Acquisitions process (depending on your AcqCreateItem setting). Note that acqui/neworderempty.pl has been modified because the placeholder-replacement code is repeated there, but I couldn't discover how to test it (if it is used at all?) Signed-off-by: Lucas Gass <lucas@bywatersolutions.com> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Pushed to master for 20.11, thanks to everybody involved!
not backporting enhancement to 20.05.x