[Bug 42044] New: Automatically update LDR/5 for modified records
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42044 Bug ID: 42044 Summary: Automatically update LDR/5 for modified records Initiative type: --- Sponsorship --- status: Product: Koha Version: Main Hardware: All OS: All Status: NEW Severity: enhancement Priority: P5 - low Component: MARC Bibliographic data support Assignee: koha-bugs@lists.koha-community.org Reporter: januszop@gmail.com QA Contact: testopia@bugs.koha-community.org According to https://loc.gov/marc/bibliographic/bdleader.html, the 5th byte of the leader, Record status, could/should be system generated: "System-Generated Elements - Following Leader elements are usually system generated: [...] 05 Record status" Same for authority records. At present, Koha does not automatically update LDR/5 after a record has been modified. -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42044 Janusz Kaczmarek <januszop@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Patch complexity|--- |Small patch Status|NEW |Needs Signoff -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42044 --- Comment #1 from Janusz Kaczmarek <januszop@gmail.com> --- Created attachment 195137 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=195137&action=edit Bug 42044: Add new system preference 'AutoUpdateRecordStatus' -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42044 --- Comment #2 from Janusz Kaczmarek <januszop@gmail.com> --- Created attachment 195138 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=195138&action=edit Bug 42044: Automatically update record status (LDR/5) for modified records When a record is modified, record status (LDR/5) should be automatically set to 'c' (Corrected or revised), unless: a) the librarian has manually changed the value to something different from the original one; b) the record was created on the same day by the same librarian (when this can be determined) and the MARC 21 record has no 040 $d subfield. Test plan ========= 1. Create a new bibliographic record. Verify that LDR/5 = 'n' (default). 2. Save the record and modify it. 3. Add 040 $d. 4. Modify the record as a different user. 5. At each step, verify that LDR/5 remains 'n'. 6. Apply the patch; updatedatabase; restart_all. 7. Set AutoUpdateRecordStatus system preference to 'Do'. 8. Repeat steps 1-4 and verify that LDR/5 is set to 'c' when: a) 040 $d is present; b) the record is modified by a different user; c) 008/0–5 is changed to a different date (simulating a modification date different from the creation date). 9. Repeat the whole test procedure for authority records. 10. Set AutoUpdateRecordStatus system preference to 'Don't'. Repeat steps 1-4 and verify that LDR/5 does not change automatically. 11. Check it also for authority records. Sponsored-by: Pontificia Università di San Tommaso d'Aquino (Angelicum) -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42044 --- Comment #3 from Janusz Kaczmarek <januszop@gmail.com> --- Created attachment 195139 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=195139&action=edit Bug 42044: Unit tests -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42044 Janusz Kaczmarek <januszop@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |m.de.rooy@rijksmuseum.nl Sponsorship status|--- |Sponsored Assignee|koha-bugs@lists.koha-commun |januszop@gmail.com |ity.org | Summary|Automatically update LDR/5 |Automatically update record |for modified records |status (LDR/5) for modified | |records Comma delimited| |Pontificia Università di list of Sponsors| |San Tommaso d'Aquino | |(Angelicum) -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42044 Janusz Kaczmarek <januszop@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Comma delimited|Pontificia Università di |Pontificia Università di list of Sponsors|San Tommaso d'Aquino |San Tommaso d'Aquino |(Angelicum) |(Angelicum), Pontificia | |Università di San Tommaso | |d'Aquino (Angelicum) -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42044 Janusz Kaczmarek <januszop@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #195137|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42044 Janusz Kaczmarek <januszop@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #195138|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42044 Janusz Kaczmarek <januszop@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #195139|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42044 --- Comment #4 from Janusz Kaczmarek <januszop@gmail.com> --- Created attachment 196269 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=196269&action=edit Bug 42044: Add new system preference 'AutoUpdateRecordStatus' Patch from commit 72eb3ff -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42044 --- Comment #5 from Janusz Kaczmarek <januszop@gmail.com> --- Created attachment 196270 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=196270&action=edit Bug 42044: Automatically update record status (LDR/5) for modified records When a record is modified, record status (LDR/5) should be automatically set to 'c' (Corrected or revised), unless: a) the librarian has manually changed the value to something different from the original one; b) the record was created on the same day by the same librarian (when this can be determined) and the MARC 21 record has no 040 $d subfield. Test plan ========= 1. Create a new bibliographic record. Verify that LDR/5 = 'n' (default). 2. Save the record and modify it. 3. Add 040 $d. 4. Modify the record as a different user. 5. At each step, verify that LDR/5 remains 'n'. 6. Apply the patch; updatedatabase; restart_all. 7. Set AutoUpdateRecordStatus system preference to 'Do'. 8. Repeat steps 1-4 and verify that LDR/5 is set to 'c' when: a) 040 $d is present; b) the record is modified by a different user; c) 008/0–5 is changed to a different date (simulating a modification date different from the creation date). 9. Repeat the whole test procedure for authority records. 10. Set AutoUpdateRecordStatus system preference to 'Don't'. Repeat steps 1-4 and verify that LDR/5 does not change automatically. 11. Check it also for authority records. Sponsored-by: Pontificia Università di San Tommaso d'Aquino (Angelicum) -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42044 --- Comment #6 from Janusz Kaczmarek <januszop@gmail.com> --- Created attachment 196271 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=196271&action=edit Bug 42044: Unit tests Patch from commit a4ad86c -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42044 Janusz Kaczmarek <januszop@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |42039 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42039 [Bug 42039] Properly set LDR/5 for deleted bibliographic records -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42044 Janusz Kaczmarek <januszop@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jonathan.druart@gmail.com, | |tomascohen@gmail.com -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42044 Janusz Kaczmarek <januszop@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #196271|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42044 --- Comment #7 from Janusz Kaczmarek <januszop@gmail.com> --- Created attachment 196333 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=196333&action=edit Bug 42044: Unit tests Patch from commit d4c9edc -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42044 Janusz Kaczmarek <januszop@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Comma delimited|Pontificia Università di |Pontificia Università di list of Sponsors|San Tommaso d'Aquino |San Tommaso d'Aquino |(Angelicum), Pontificia |(Angelicum) |Università di San Tommaso | |d'Aquino (Angelicum) | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42044 Janusz Kaczmarek <januszop@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #196270|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42044 Janusz Kaczmarek <januszop@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #196333|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42044 --- Comment #8 from Janusz Kaczmarek <januszop@gmail.com> --- Created attachment 196382 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=196382&action=edit Bug 42044: Automatically update record status (LDR/5) for modified records When a record is modified, record status (LDR/5) should be automatically set to 'c' (Corrected or revised), unless: a) the librarian has manually changed the value to something different from the original one; b) the record was created on the same day by the same librarian (when this can be determined) and the MARC 21 record has no 040 $d subfield. Test plan ========= 1. Create a new bibliographic record. Verify that LDR/5 = 'n' (default). 2. Save the record and modify it. 3. Add 040 $d. 4. Modify the record as a different user. 5. At each step, verify that LDR/5 remains 'n'. 6. Apply the patch; updatedatabase; restart_all. 7. Set AutoUpdateRecordStatus system preference to 'Do'. 8. Repeat steps 1-4 and verify that LDR/5 is set to 'c' when: a) 040 $d is present; b) the record is modified by a different user; c) 008/0–5 is changed to a different date (simulating a modification date different from the creation date). 9. Repeat the whole test procedure for authority records. 10. Set AutoUpdateRecordStatus system preference to 'Don't'. Repeat steps 1-4 and verify that LDR/5 does not change automatically. 11. Check it also for authority records. Sponsored-by: Pontificia Università di San Tommaso d'Aquino (Angelicum) -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42044 --- Comment #9 from Janusz Kaczmarek <januszop@gmail.com> --- Created attachment 196383 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=196383&action=edit Bug 42044: Unit tests Patch from commit 6163e26 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42044 Phil Ringnalda <phil@chetcolibrary.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |phil@chetcolibrary.org Status|Needs Signoff |Patch doesn't apply --- Comment #10 from Phil Ringnalda <phil@chetcolibrary.org> --- I think this is the first time I've seen a patch still apply perfectly after three months *except* for the unit tests. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42044 Janusz Kaczmarek <januszop@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Patch doesn't apply |Needs Signoff -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42044 Janusz Kaczmarek <januszop@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #196269|0 |1 is obsolete| | Attachment #196382|0 |1 is obsolete| | Attachment #196383|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42044 --- Comment #11 from Janusz Kaczmarek <januszop@gmail.com> --- Created attachment 207437 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=207437&action=edit Bug 42044: Add new system preference 'AutoUpdateRecordStatus' -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42044 --- Comment #12 from Janusz Kaczmarek <januszop@gmail.com> --- Created attachment 207438 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=207438&action=edit Bug 42044: Automatically update record status (LDR/5) for modified records When a record is modified, record status (LDR/5) should be automatically set to 'c' (Corrected or revised), unless: a) the librarian has manually changed the value to something different from the original one; b) the record was created on the same day by the same librarian (when this can be determined) and the MARC 21 record has no 040 $d subfield. Test plan ========= 1. Create a new bibliographic record. Verify that LDR/5 = 'n' (default). 2. Save the record and modify it. 3. Add 040 $d. 4. Modify the record as a different user. 5. At each step, verify that LDR/5 remains 'n'. 6. Apply the patch; updatedatabase; restart_all. 7. Set AutoUpdateRecordStatus system preference to 'Do'. 8. Repeat steps 1-4 and verify that LDR/5 is set to 'c' when: a) 040 $d is present; b) the record is modified by a different user; c) 008/0–5 is changed to a different date (simulating a modification date different from the creation date). 9. Repeat the whole test procedure for authority records. 10. Set AutoUpdateRecordStatus system preference to 'Don't'. Repeat steps 1-4 and verify that LDR/5 does not change automatically. 11. Check it also for authority records. Sponsored-by: Pontificia Università di San Tommaso d'Aquino (Angelicum) -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42044 --- Comment #13 from Janusz Kaczmarek <januszop@gmail.com> --- Created attachment 207439 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=207439&action=edit Bug 42044: Unit tests -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42044 --- Comment #14 from Janusz Kaczmarek <januszop@gmail.com> --- Rebased. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42044 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- See Also| |https://bugs.koha-community | |.org/bugzilla3/show_bug.cgi | |?id=43792 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42044 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #207437|0 |1 is obsolete| | Attachment #207438|0 |1 is obsolete| | Attachment #207439|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42044 --- Comment #15 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- Created attachment 207871 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=207871&action=edit Bug 42044: Add new system preference 'AutoUpdateRecordStatus' -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42044 --- Comment #16 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- Created attachment 207872 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=207872&action=edit Bug 42044: Automatically update record status (LDR/5) for modified records -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42044 --- Comment #17 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- Created attachment 207873 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=207873&action=edit Bug 42044: Unit tests -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42044 --- Comment #18 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- Thanks for this, Janusz. I have attached my signed-off version of the patches (the only change is the Signed-off-by line), but I am deliberately leaving the status at Needs Signoff until we have discussed the points below. What I tested (current main, 80f504edd9b): - Patches apply cleanly; the atomic update runs and is safe to re-run. - t/Koha/Util/MARC.t, t/db_dependent/Koha/Policy/Record.t, t/db_dependent/Biblio.t and t/db_dependent/AuthoritiesMarc.t pass. - The 17 db_dependent tests that call ModBiblio all pass. - The QA script passes (only a spelling false positive, 'acn', in t/db_dependent/Biblio.t). - A deliberate cataloguer change to LDR/5 is respected: n->p, n->d and c->n are all stored as entered. Not tested by me: the preference page in the browser, the authority steps of the test plan by hand, and UNIMARC. Points to discuss (none of them blocking by my reading): 1. Records already marked 'd'. A record whose LDR/5 is already 'd' becomes 'c' on any ordinary edit, because "unchanged from the old value" is treated like any other value. That silently un-deletes a record that has been flagged for misc/cronjobs/delete_records_via_leader.pl (bug 11084). Should 'd' be left alone, so that it is only changed by the cataloguer on purpose? 2. Retyping the same value. If the cataloguer deliberately sets LDR/5 to the value it already had (for example 'n' to 'n'), we cannot tell that from not touching it, so it becomes 'c'. This is probably acceptable, but worth a line in the preference description or the manual. 3. Same-day edits with logging off. With CataloguingLog (or AuthoritiesLog) off, a record created today and edited today still gets 'c', because we cannot establish who created it. That follows the code's stated rule ("if not sure, set LDR/5"), but the preference text does not mention it. 4. Small code nits in Koha/Policy/Record.pm: 'return unless $oldrecord' can never be reached because oldrecord is a mandatory parameter, and the record_type regex (/biblio|authority/) is not anchored. 5. POD typo in Koha/Util/MARC.pm: '=cut;' should be '=cut'. 6. update_record_status only accepts [acdnp]. UNIMARC also defines 'o'. Not used by this bug, but worth keeping in mind if the helper is reused (see also bug 43792). Happy to sign off once you have had a chance to look at 1 and 3 in particular. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42044 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |martin.renvoize@openfifth.c | |o.uk Status|Needs Signoff |Signed Off -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org