[Bug 40135] New: Record diff in action logs when modifying a biblio
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40135 Bug ID: 40135 Summary: Record diff in action logs when modifying a biblio Change sponsored?: --- Product: Koha Version: Main Hardware: All OS: All Status: NEW Severity: enhancement Priority: P5 - low Component: Tools Assignee: koha-bugs@lists.koha-community.org Reporter: andrew@bywatersolutions.com QA Contact: testopia@bugs.koha-community.org Blocks: 37940 Bibliographic record edits do not yet include a diff in the logs. They should. Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=37940 [Bug 37940] [OMNIBUS] All modification logged via action logs should include original to create JSON diff -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40135 Andreas Roussos <a.roussos@dataly.gr> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |a.roussos@dataly.gr -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40135 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |martin.renvoize@openfifth.c | |o.uk Depends on| |36698 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36698 [Bug 36698] Display 'diff' nicely in action logs -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40135 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|koha-bugs@lists.koha-commun |martin.renvoize@openfifth.c |ity.org |o.uk -- 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=40135 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |ASSIGNED -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40135 --- Comment #1 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- Created attachment 194785 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=194785&action=edit Bug 40135: Populate diff column for biblio ADD/MODIFY/DELETE logs Previously the CATALOGUING action log entries for biblio operations stored minimal data: ADD and DELETE logged just the string "biblio", while MODIFY logged a raw MARC-formatted dump of the pre-change record as a plain text string. None of these populated the diff column. This follow-up updates AddBiblio, ModBiblio and DelBiblio in C4/Biblio.pm to follow the same pattern as Koha::Item::store, passing the Koha::Biblio object and an original unblessed hashref to logaction so that the diff column is automatically populated with Struct::Diff JSON reflecting the changes to the biblio table columns (title, author, frameworkcode, etc.). For ADD, logaction diffs an empty hashref against the new biblio state, producing added-field entries for all columns. For DELETE, it diffs the pre-deletion state against an empty hashref, producing removed-field entries. For MODIFY, the before-state is captured prior to the update and the after-state is read back once ModBiblioMarc and _koha_modify_biblio have completed, so the diff reflects the actual committed changes. The test for ModBiblio on an invalid MARC record is updated to reflect that the MARC decoding error is no longer logged in the info column; the biblio table data is now logged instead. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40135 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|ASSIGNED |Needs Signoff -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40135 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Depends on|36698 | Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36698 [Bug 36698] Display 'diff' nicely in action logs -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40135 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Signed Off -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40135 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #194785|0 |1 is obsolete| | --- Comment #2 from David Nind <david@davidnind.com> --- Created attachment 194941 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=194941&action=edit Bug 40135: Populate diff column for biblio ADD/MODIFY/DELETE logs Previously the CATALOGUING action log entries for biblio operations stored minimal data: ADD and DELETE logged just the string "biblio", while MODIFY logged a raw MARC-formatted dump of the pre-change record as a plain text string. None of these populated the diff column. This follow-up updates AddBiblio, ModBiblio and DelBiblio in C4/Biblio.pm to follow the same pattern as Koha::Item::store, passing the Koha::Biblio object and an original unblessed hashref to logaction so that the diff column is automatically populated with Struct::Diff JSON reflecting the changes to the biblio table columns (title, author, frameworkcode, etc.). For ADD, logaction diffs an empty hashref against the new biblio state, producing added-field entries for all columns. For DELETE, it diffs the pre-deletion state against an empty hashref, producing removed-field entries. For MODIFY, the before-state is captured prior to the update and the after-state is read back once ModBiblioMarc and _koha_modify_biblio have completed, so the diff reflects the actual committed changes. The test for ModBiblio on an invalid MARC record is updated to reflect that the MARC decoding error is no longer logged in the info column; the biblio table data is now logged instead. Signed-off-by: David Nind <david@davidnind.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40135 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |david@davidnind.com Text to go in the| |This enhancement adds a release notes| |'diff' to the action logs | |when modifying a | |bibliographic record | |(creating, modifying, and | |deleting). | | | |Previously, no diff was | |recorded (although some | |information was recorded in | |the Info column). | | | |Note: Details for changes | |to items were already | |recorded a diff. Summary|Record diff in action logs |Record diff in action logs |when modifying a biblio |when modifying a | |bibliographic record --- Comment #3 from David Nind <david@davidnind.com> --- Testing notes (using KTD): 1. Before the patch: - Add a new bibliographic record (and an item) with basic details - Modify a bibliographic record (for example, change the title) - Delete a bibliographic record without any items - Delete a bibliographic record with an item 2. Go the log viewer (Tools > Additional tools > Log viewer) and click submit. 3. In the log viewer, show the 'Diff' column (Columns > Diff). 4. Note that when: - Adding a new record: 'biblio' recorded in the Info column - Modifying a record: 'biblio BEFORE' details recorded in the Info column - Deleting a record: 'biblio' recorded in the Info column - Deleting a record with items: separate entries recorded for the bibliographic record and item, 'biblio' recorded in the Info column for the record, 'item' and a diff recorded for the item 5. Apply the patch and restart everything (restart_all). 6. Repeat steps 1 and 2. 7. Note that there are now details for each action in the Diff column. (Note that when modifying a record, the details of what are recorded in the info column are changed (starts with $VAR1... instead of 'biblio BEFORE...'). -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40135 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #194941|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=40135 --- Comment #4 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- Created attachment 195009 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=195009&action=edit Bug 40135: Populate diff column for biblio ADD/MODIFY/DELETE logs Previously the CATALOGUING action log entries for biblio operations stored minimal data: ADD and DELETE logged just the string "biblio", while MODIFY logged a raw MARC-formatted dump of the pre-change record as a plain text string. None of these populated the diff column. This follow-up updates AddBiblio, ModBiblio and DelBiblio in C4/Biblio.pm to follow the same pattern as Koha::Item::store, passing the Koha::Biblio object and an original unblessed hashref to logaction so that the diff column is automatically populated with Struct::Diff JSON reflecting the changes to the biblio table columns (title, author, frameworkcode, etc.). For ADD, logaction diffs an empty hashref against the new biblio state, producing added-field entries for all columns. For DELETE, it diffs the pre-deletion state against an empty hashref, producing removed-field entries. For MODIFY, the before-state is captured prior to the update and the after-state is read back once ModBiblioMarc and _koha_modify_biblio have completed, so the diff reflects the actual committed changes. The test for ModBiblio on an invalid MARC record is updated to reflect that the MARC decoding error is no longer logged in the info column; the biblio table data is now logged instead. Signed-off-by: David Nind <david@davidnind.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40135 --- Comment #5 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- Created attachment 195010 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=195010&action=edit Bug 40135: Include MARC field changes in CATALOGUING diff logs The previous commit populated the diff column for biblio ADD/MODIFY/DELETE logs with changes to biblio table columns (title, author, frameworkcode, etc.), but lost the MARC-level change tracking that previously stored a pre-change MARC dump in the info column. This follow-up extends the diff to also capture MARC field changes by including a synthetic _marc key in the before/after hashrefs passed to logaction. MARC fields are represented as tag => array-of-formatted-strings (e.g. "10 $a Title" for data fields, scalar for control fields), allowing Struct::Diff to produce readable field-level diffs. The _marc entries appear alongside biblio column changes in the existing diff table in the log viewer, using dotted keys like _marc.245.0. A helper _marc_record_to_diffable() converts a MARC::Record to this diffable hashref. All three functions (AddBiblio, ModBiblio, DelBiblio) use record_strip_nonxml (wrapped in eval) to safely capture the MARC even for records with invalid XML characters, without producing warnings or affecting the success of the main operation. C4/Log.pm is also updated to Dumper() a plain hashref passed as $infos, so the info column contains useful data rather than a stringified ref. Tests are extended to verify that the diff column is populated and that _marc changes are captured when MARC content actually changes. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40135 --- Comment #6 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- I spotted a regression which I've fixed in the extra patch.. thanks David, you're comment reminded me we'd lost the full MARC representation details. So, the second patch adds _marc into the structure we diff now so we're including all details marc changes alongside the database field changes. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40135 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |42032 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42032 [Bug 42032] Add diff support to AUTHORITIES action logs -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40135 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Depends on| |36698 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36698 [Bug 36698] Display 'diff' nicely in action logs -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40135 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks|37940 | Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=37940 [Bug 37940] [OMNIBUS] All modification logged via action logs should include original to create JSON diff -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40135 Lisette Scheer <lisette@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |lisette@bywatersolutions.co | |m QA Contact|testopia@bugs.koha-communit |lisette@bywatersolutions.co |y.org |m -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40135 Lisette Scheer <lisette@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |Failed QA --- Comment #7 from Lisette Scheer <lisette@bywatersolutions.com> --- Adds the diff nicely. However, if you click 'Modification Log' from the bib record/the pages in the bib that show the sidebar, it doesn't show the new logs. Additionally, in the Object column instead of Bibliographic record 6 with a link to the biblio It now shows: 6 There's also a couple failing QA tests: [FAIL] C4/Biblio.pm FAIL tidiness File is not tidy, please run `perl misc/devel/tidy.pl C4/Biblio.pm` [PASS] C4/Log.pm [FAIL] t/db_dependent/Biblio.t FAIL file_permissions File must have the exec flag -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40135 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Failed QA |Signed Off -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40135 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #195009|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=40135 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #195010|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=40135 --- Comment #8 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- Created attachment 195033 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=195033&action=edit Bug 40135: Populate diff column for biblio ADD/MODIFY/DELETE logs Previously the CATALOGUING action log entries for biblio operations stored minimal data: ADD and DELETE logged just the string "biblio", while MODIFY logged a raw MARC-formatted dump of the pre-change record as a plain text string. None of these populated the diff column. This follow-up updates AddBiblio, ModBiblio and DelBiblio in C4/Biblio.pm to follow the same pattern as Koha::Item::store, passing the Koha::Biblio object and an original unblessed hashref to logaction so that the diff column is automatically populated with Struct::Diff JSON reflecting the changes to the biblio table columns (title, author, frameworkcode, etc.). For ADD, logaction diffs an empty hashref against the new biblio state, producing added-field entries for all columns. For DELETE, it diffs the pre-deletion state against an empty hashref, producing removed-field entries. For MODIFY, the before-state is captured prior to the update and the after-state is read back once ModBiblioMarc and _koha_modify_biblio have completed, so the diff reflects the actual committed changes. The test for ModBiblio on an invalid MARC record is updated to reflect that the MARC decoding error is no longer logged in the info column; the biblio table data is now logged instead. Signed-off-by: David Nind <david@davidnind.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40135 --- Comment #9 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- Created attachment 195034 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=195034&action=edit Bug 40135: Include MARC field changes in CATALOGUING diff logs The previous commit populated the diff column for biblio ADD/MODIFY/DELETE logs with changes to biblio table columns (title, author, frameworkcode, etc.), but lost the MARC-level change tracking that previously stored a pre-change MARC dump in the info column. This follow-up extends the diff to also capture MARC field changes by including a synthetic _marc key in the before/after hashrefs passed to logaction. MARC fields are represented as tag => array-of-formatted-strings (e.g. "10 $a Title" for data fields, scalar for control fields), allowing Struct::Diff to produce readable field-level diffs. The _marc entries appear alongside biblio column changes in the existing diff table in the log viewer, using dotted keys like _marc.245.0. A helper _marc_record_to_diffable() converts a MARC::Record to this diffable hashref. All three functions (AddBiblio, ModBiblio, DelBiblio) use record_strip_nonxml (wrapped in eval) to safely capture the MARC even for records with invalid XML characters, without producing warnings or affecting the success of the main operation. C4/Log.pm is also updated to Dumper() a plain hashref passed as $infos, so the info column contains useful data rather than a stringified ref. Tests are extended to verify that the diff column is populated and that _marc changes are captured when MARC content actually changes. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40135 --- Comment #10 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- Created attachment 195035 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=195035&action=edit Bug 40135: Fix info column prefix for biblio MODIFY logs The MODIFY path in logaction received the updated biblio as a plain hashref (not a Koha::Object), so the info column was populated with raw Dumper output instead of the expected "biblio ..." prefix. This broke two things: the 'Modification Log' link from the bib record sidebar (which filters on info LIKE 'biblio%'), and the Object column in the log viewer (which detects biblio entries via info.substr(0,6)). Following the same pattern as the Koha::Item MODIFY special case, add a parallel branch for CATALOGUING MODIFY with a hashref \$infos that sets the info column to "biblio " . Dumper(\$original). This restores backward-compatible detection while keeping the diff column correctly populated from the before/after hashrefs (including _marc changes). -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40135 Lisette Scheer <lisette@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |Failed QA --- Comment #11 from Lisette Scheer <lisette@bywatersolutions.com> --- Tidy fails in QA tools ADD has a bunch of empty fields in the diff, it has the following blank fields: notes part_number unititle frameworkcode serial author copyrightdate seriestitle medium subtitle part_name abstract only these fields have content: opac_suppressed timestamp datecreated title biblionumber _marc content of _marc 245: 0: $a Title 942: 0: $2 ddc $c CF $n 0 999: 0: $c 468 $d 464 008: 260310b |||||||| |||| 00| 0 eng d 005: 20260310151102.0 040: 0: $c bws 003: OSt -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40135 --- Comment #12 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- Ah the fun of empty fields.. I fixed this on the patron bug already but haven't sorted those changes to here.. that challenge is undef Vs "" Vs Missing entirely. The diff algorithm treat all those differently.. we often set empty string or under and that put the key in the hash.. so on add we actually diff {} with { key => '' } So the key is there but it has not content.. the diff is strictly correct as we went from now keys to empty fields.. but it certainly looks messy. As for the tidy.. I'm confused.. ktd should be tidying correctly with the girls hook -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40135 --- Comment #13 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- Created attachment 195183 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=195183&action=edit Bug 40135: (follow-up) Strip undef and empty fields from biblio log data Add _unblessed_for_log to Koha::Biblio, mirroring the same method in Koha::Patron (bug 40136). It excludes undef/empty-string columns and the auto-updated timestamp field so that biblio diffs only contain meaningful values. Update AddBiblio, ModBiblio and DelBiblio in C4/Biblio.pm to use _unblessed_for_log instead of raw unblessed when building the hashrefs passed to logaction, eliminating noise from null columns in ADD/MODIFY/DELETE diffs. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40135 --- Comment #14 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- Created attachment 195184 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=195184&action=edit Bug 40135: (follow-up) Add tests for Koha::Biblio::_unblessed_for_log Add a '_unblessed_for_log() tests' subtest to t/db_dependent/Koha/Biblio.t that verifies: - the method returns a plain hashref - fields with real values (biblionumber, title, author) are present - timestamp is excluded - undef fields are excluded - empty-string fields are excluded - the ADD action log diff column is populated and does not contain timestamp -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40135 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Failed QA |Signed Off -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40135 Lisette Scheer <lisette@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |Passed QA --- Comment #15 from Lisette Scheer <lisette@bywatersolutions.com> --- Worked great! Filing a follow up bug for you to work the empty field magic on the items diff as well. Is it something we could do more generically so we don't need to do it for each? Or do we need to update something in the guidelines to make it store correctly? -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40135 Lisette Scheer <lisette@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #195033|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=40135 Lisette Scheer <lisette@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #195034|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=40135 Lisette Scheer <lisette@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #195035|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=40135 Lisette Scheer <lisette@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #195183|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=40135 Lisette Scheer <lisette@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #195184|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=40135 --- Comment #16 from Lisette Scheer <lisette@bywatersolutions.com> --- Created attachment 195195 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=195195&action=edit Bug 40135: Populate diff column for biblio ADD/MODIFY/DELETE logs Previously the CATALOGUING action log entries for biblio operations stored minimal data: ADD and DELETE logged just the string "biblio", while MODIFY logged a raw MARC-formatted dump of the pre-change record as a plain text string. None of these populated the diff column. This follow-up updates AddBiblio, ModBiblio and DelBiblio in C4/Biblio.pm to follow the same pattern as Koha::Item::store, passing the Koha::Biblio object and an original unblessed hashref to logaction so that the diff column is automatically populated with Struct::Diff JSON reflecting the changes to the biblio table columns (title, author, frameworkcode, etc.). For ADD, logaction diffs an empty hashref against the new biblio state, producing added-field entries for all columns. For DELETE, it diffs the pre-deletion state against an empty hashref, producing removed-field entries. For MODIFY, the before-state is captured prior to the update and the after-state is read back once ModBiblioMarc and _koha_modify_biblio have completed, so the diff reflects the actual committed changes. The test for ModBiblio on an invalid MARC record is updated to reflect that the MARC decoding error is no longer logged in the info column; the biblio table data is now logged instead. Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Lisette Scheer <lisette@bywatersolutions.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40135 --- Comment #17 from Lisette Scheer <lisette@bywatersolutions.com> --- Created attachment 195196 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=195196&action=edit Bug 40135: Include MARC field changes in CATALOGUING diff logs The previous commit populated the diff column for biblio ADD/MODIFY/DELETE logs with changes to biblio table columns (title, author, frameworkcode, etc.), but lost the MARC-level change tracking that previously stored a pre-change MARC dump in the info column. This follow-up extends the diff to also capture MARC field changes by including a synthetic _marc key in the before/after hashrefs passed to logaction. MARC fields are represented as tag => array-of-formatted-strings (e.g. "10 $a Title" for data fields, scalar for control fields), allowing Struct::Diff to produce readable field-level diffs. The _marc entries appear alongside biblio column changes in the existing diff table in the log viewer, using dotted keys like _marc.245.0. A helper _marc_record_to_diffable() converts a MARC::Record to this diffable hashref. All three functions (AddBiblio, ModBiblio, DelBiblio) use record_strip_nonxml (wrapped in eval) to safely capture the MARC even for records with invalid XML characters, without producing warnings or affecting the success of the main operation. C4/Log.pm is also updated to Dumper() a plain hashref passed as $infos, so the info column contains useful data rather than a stringified ref. Tests are extended to verify that the diff column is populated and that _marc changes are captured when MARC content actually changes. Signed-off-by: Lisette Scheer <lisette@bywatersolutions.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40135 --- Comment #18 from Lisette Scheer <lisette@bywatersolutions.com> --- Created attachment 195197 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=195197&action=edit Bug 40135: Fix info column prefix for biblio MODIFY logs The MODIFY path in logaction received the updated biblio as a plain hashref (not a Koha::Object), so the info column was populated with raw Dumper output instead of the expected "biblio ..." prefix. This broke two things: the 'Modification Log' link from the bib record sidebar (which filters on info LIKE 'biblio%'), and the Object column in the log viewer (which detects biblio entries via info.substr(0,6)). Following the same pattern as the Koha::Item MODIFY special case, add a parallel branch for CATALOGUING MODIFY with a hashref \$infos that sets the info column to "biblio " . Dumper(\$original). This restores backward-compatible detection while keeping the diff column correctly populated from the before/after hashrefs (including _marc changes). Signed-off-by: Lisette Scheer <lisette@bywatersolutions.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40135 --- Comment #19 from Lisette Scheer <lisette@bywatersolutions.com> --- Created attachment 195198 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=195198&action=edit Bug 40135: (follow-up) Strip undef and empty fields from biblio log data Add _unblessed_for_log to Koha::Biblio, mirroring the same method in Koha::Patron (bug 40136). It excludes undef/empty-string columns and the auto-updated timestamp field so that biblio diffs only contain meaningful values. Update AddBiblio, ModBiblio and DelBiblio in C4/Biblio.pm to use _unblessed_for_log instead of raw unblessed when building the hashrefs passed to logaction, eliminating noise from null columns in ADD/MODIFY/DELETE diffs. Signed-off-by: Lisette Scheer <lisette@bywatersolutions.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40135 --- Comment #20 from Lisette Scheer <lisette@bywatersolutions.com> --- Created attachment 195199 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=195199&action=edit Bug 40135: (follow-up) Add tests for Koha::Biblio::_unblessed_for_log Add a '_unblessed_for_log() tests' subtest to t/db_dependent/Koha/Biblio.t that verifies: - the method returns a plain hashref - fields with real values (biblionumber, title, author) are present - timestamp is excluded - undef fields are excluded - empty-string fields are excluded - the ADD action log diff column is populated and does not contain timestamp Signed-off-by: Lisette Scheer <lisette@bywatersolutions.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40135 Lisette Scheer <lisette@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |42079 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42079 [Bug 42079] Remove blank entries in items diff -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40135 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Passed QA |Pushed to main Version(s)| |26.05.00 released in| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40135 --- Comment #21 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- Thanks for all the hard work! Pushed to main for the next 26.05.00 release as RM Assistant -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40135 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |42188 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42188 [Bug 42188] Fix display regressions in action logs for biblio changes -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40135 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks|42032 | Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42032 [Bug 42032] Add diff support to AUTHORITIES action logs -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40135 Jacob O'Mara <jacob.omara@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Pushed to main |Needs documenting --- Comment #22 from Jacob O'Mara <jacob.omara@openfifth.co.uk> --- This will not be backported to 25.11.x due to it being deemed an enhancement or a dependancy not being met -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org