This date field will be used to set the date used in the script, instead of today.
Created attachment 94860 [details] [review] Bug 23924: Add --date-field to add_date_fields_to_marc_records.pl The date used in the script will use this parameter, instead of today. Test plan: Use the POD of the script to understand how this flag works. Then use the script to create fields with a date contained in a specific MARC field.
I am testing the patch and It works fine but I have a doubt regarding the where clausule... according the help it claims that where limit the search, but I guess the where clausule doens't affect on the search.... becuase it takes the same time using and non usiing where clausule I guess where is limiting where the perl applies the action, not limiting the the bibs to check and apply, right?
(In reply to Hugo Agud from comment #2) > I am testing the patch and It works fine but I have a doubt regarding the > where clausule... according the help it claims that where limit the search, > but I guess the where clausule doens't affect on the search.... becuase it > takes the same time using and non usiing where clausule > > I guess where is limiting where the perl applies the action, not limiting > the the bibs to check and apply, right? It should, if you have biblionumbers from 1 to 1000 and the --where is biblionumber < 500, then only the first 500 records will be processed.
Created attachment 95621 [details] [review] Bug 23924: Add --date-field to add_date_fields_to_marc_records.pl The date used in the script will use this parameter, instead of today. Test plan: Use the POD of the script to understand how this flag works. Then use the script to create fields with a date contained in a specific MARC field. Signed-off-by: Hugo Agud <hagud@orex.es>
when processing more than one record, the firts records creates propertly 905 field, but the second one doubles de 905 field with the info from record 1 and record 3
Created attachment 98217 [details] [review] Bug 23924: Reset the fields to add We do not want to copy fields from the previous records!
(In reply to Hugo Agud from comment #5) > when processing more than one record, the firts records creates propertly > 905 field, but the second one doubles de 905 field with the info from record > 1 and record 3 That was a silly mistake, sorry about that!
Could you please provide a test plan?
Created attachment 149739 [details] [review] Bug 23924: Add --date-field to add_date_fields_to_marc_records.pl The date used in the script will use this parameter, instead of today. Test plan: Use the POD of the script to understand how this flag works. Then use the script to create fields with a date contained in a specific MARC field. Signed-off-by: Hugo Agud <hagud@orex.es> Signed-off-by: David Nind <david@davidnind.com>
Created attachment 149740 [details] [review] Bug 23924: Reset the fields to add We do not want to copy fields from the previous records! Signed-off-by: David Nind <david@davidnind.com>
How I tested (using KTD): 1. Made 905$a and 908$a and visible in editor for the BKS framework. 2. Select a record and added a date in 908$a using default format e.g. 02/02/2023 (for example record 1) 3. Select another record and added a date in 908$a using ISO format e.g. 2023-04-01 (for example record 262) 4. Applied the patch. 5. Ran these examples, including output from change: - perl misc/add_date_fields_to_marc_records.pl --field='905$a=0/%Y' --field='905$a=1/%Y/%b-%m' --field='905$a=2/%Y/%b-%m/%d' --unless-exists='905$a' --where "biblionumber=1" --date-field='908$a' --verbose --confirm 02/02/2023 at misc/add_date_fields_to_marc_records.pl line 82. The following MARC fields will be added to record 1: 905 _a0/2023 905 _a1/2023/Feb-02 905 _a2/2023/Feb-02/02 Bibliographic record 1 has been modified - perl misc/add_date_fields_to_marc_records.pl --field='905$a=0/%Y' --field='905$a=1/%Y/%b-%m' --field='905$a=2/%Y/%b-%m/%d' --unless-exists='905$a' --where "biblionumber=262" --date-field='908$a' --verbose --confirm 2023-04-01 at misc/add_date_fields_to_marc_records.pl line 82. The following MARC fields will be added to record 262: 905 _a0/2023 905 _a1/2023/Apr-04 905 _a2/2023/Apr-04/01 Bibliographic record 262 has been modified I hope that is sufficent to test!
What I did (and please provide test plans yourself...): 1) Updated dateformat to DD.MM.YYYY 2) Added 505$a 01.01.2024 to a record 3) Ran: ./misc/add_date_fields_to_marc_records.pl --field='505$g=0/%Y' --date-field='505$a' --verbose --confirm 505$g was created. In my tests it seems like --unless-exists='505$g' didn't have any effect, but that is out of scope here.
Created attachment 150131 [details] [review] Bug 23924: Add --date-field to add_date_fields_to_marc_records.pl The date used in the script will use this parameter, instead of today. Test plan: Use the POD of the script to understand how this flag works. Then use the script to create fields with a date contained in a specific MARC field. Signed-off-by: Hugo Agud <hagud@orex.es> Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Created attachment 150132 [details] [review] Bug 23924: Reset the fields to add We do not want to copy fields from the previous records! Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Pushed to master for 23.05. Nice work everyone, thanks!
Enhancement, no backport for 22.11.x