[Bug 42030] New: Add diff support to SUGGESTION action logs
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42030 Bug ID: 42030 Summary: Add diff support to SUGGESTION action logs Initiative type: --- Sponsorship --- status: Product: Koha Version: Main Hardware: All OS: All Status: NEW Severity: enhancement Priority: P5 - low Component: Transaction logs Assignee: koha-bugs@lists.koha-community.org Reporter: martin.renvoize@openfifth.co.uk QA Contact: testopia@bugs.koha-community.org Blocks: 37940 The action logging for the SUGGESTION module (Koha/Suggestion.pm) currently logs CREATE and MODIFY actions without passing the $original parameter to logaction(). No structured diff is generated in the action_logs.diff column. The relevant logaction() call is in Koha/Suggestion.pm (~line 79): logaction( 'SUGGESTION', $action, $result->suggestionid, $self ); This bug covers updating Koha::Suggestion to capture the pre-change suggestion state and pass it as the sixth argument to logaction(), enabling before/after comparison in the action log viewer. Since Koha::Suggestion is a Koha::Object subclass, $self->get_from_storage (or an equivalent pre-change snapshot) should be captured before store() and passed as $original for MODIFY actions. For CREATE, $self can serve as the single state captured. 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=42030 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |Needs Signoff Sponsorship status|--- |Unsponsored Assignee|koha-bugs@lists.koha-commun |martin.renvoize@openfifth.c |ity.org |o.uk Patch complexity|--- |Trivial patch -- 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=42030 --- Comment #1 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- Created attachment 195032 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=195032&action=edit Bug 42030: Populate diff column for suggestion CREATE/MODIFY/DELETE logs Update suggestion action logging to populate the diff column using the correct before/after semantics: - CREATE: empty before-state ({}), new suggestion data as after-state - MODIFY: pre-change unblessed data as before, post-store object as after - DELETE: log before the SQL DELETE so the object can still be fetched; pass the suggestion as both $infos (info column) and $original (diff before-state), logaction sets after-state to {} Also add tests verifying the diff column is populated for all three actions. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42030 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- 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=42030 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=42030 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #195032|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=42030 --- Comment #2 from David Nind <david@davidnind.com> --- Created attachment 195714 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=195714&action=edit Bug 42030: Populate diff column for suggestion CREATE/MODIFY/DELETE logs Update suggestion action logging to populate the diff column using the correct before/after semantics: - CREATE: empty before-state ({}), new suggestion data as after-state - MODIFY: pre-change unblessed data as before, post-store object as after - DELETE: log before the SQL DELETE so the object can still be fetched; pass the suggestion as both $infos (info column) and $original (diff before-state), logaction sets after-state to {} Also add tests verifying the diff column is populated for all three actions. 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=42030 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 | |for purchase suggestions | |(creating, modifying, and | |deleting). | | | |Previously, no diff was | |recorded (although some | |information was recorded in | |the Info column). --- Comment #3 from David Nind <david@davidnind.com> --- Testing notes (using KTD): 1. Enable the AcquisitionLog and SuggestionsLog system preferences. 2. Create, edit and delete a suggestion from Acquisitions > Suggestions. 3. Go to the log viewer and click submit. 4. Show the 'Diff' column (Columns > Diff). 5. Note that information about the changes is logged in the Info column, but there is no information in the Diff column. 6. Apply the patch and restart everything (restart_all). 7. Repeat steps 2 to 3. 8. Note that there is now a diff in the diff column. Note that there are some qa failures: qa Tag v25.05.00-1 found in /kohadevbox/koha — checking out branch main in /kohadevbox/qa-test-tools Already on 'main' Your branch is up to date with 'origin/main'. testing 1 commit(s) (applied to 7fd796d 'f8 Bug 41510: (RM follow-up) Perltidy') Processing files [RUNNING] C4/Suggestions.pm [RUNNING] Koha/Suggestion.pm [RUNNING] t/db_dependent/Koha/Suggestions.t [PASS] t/db_dependent/Koha/Suggestions.t [FAIL] Koha/Suggestion.pm [PASS] C4/Suggestions.pm Result: [PASS] C4/Suggestions.pm [FAIL] Koha/Suggestion.pm FAIL pod_coverage sub _type has no pod coverage. [PASS] t/db_dependent/Koha/Suggestions.t Processing additional checks PASS! * Was this bug sponsored by anyone? Running tests (1) * Proving /kohadevbox/koha/t/db_dependent/Koha/Suggestions.t PASS -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42030 --- Comment #4 from Lisette Scheer <lisette@bywatersolutions.com> --- In addition to the POD failure, it has a bunch of empty fields on creation. Delete also shows a number of empty fields in the before. Modify correctly only logs changes that were filled before but not now and that weren't filled but now are. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42030 Lisette Scheer <lisette@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |Failed QA -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42030 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=42030 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #195714|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=42030 --- Comment #5 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- Created attachment 196351 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=196351&action=edit Bug 42030: Populate diff column for suggestion CREATE/MODIFY/DELETE logs Update suggestion action logging to populate the diff column using the correct before/after semantics: - CREATE: empty before-state ({}), new suggestion data as after-state - MODIFY: pre-change unblessed data as before, post-store object as after - DELETE: log before the SQL DELETE so the object can still be fetched; pass the suggestion as both $infos (info column) and $original (diff before-state), logaction sets after-state to {} Also add tests verifying the diff column is populated for all three actions. 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=42030 --- Comment #6 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- Created attachment 196352 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=196352&action=edit Bug 42030: (follow-up) Fix POD for Koha::Suggestion Patch from commit 7d78a19 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42030 --- Comment #7 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- Created attachment 196353 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=196353&action=edit Bug 42030: (follow-up) Don't diff undefined fields This patch updates the diff for ADD/CREATE and DELETE logactions to exclude undefined fields from the diff. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42030 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #196353|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=42030 --- Comment #8 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- Created attachment 196359 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=196359&action=edit Bug 42030: (follow-up) Don't diff undefined fields This patch updates the diff for ADD/CREATE and DELETE logactions to exclude undefined fields from the diff. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42030 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #196359|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=42030 --- Comment #9 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- Created attachment 196364 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=196364&action=edit Bug 42030: (follow-up) Don't diff undefined fields This patch updates the diff for ADD/CREATE and DELETE logactions to exclude undefined fields from the diff. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42030 Lisette Scheer <lisette@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |Passed QA --- Comment #10 from Lisette Scheer <lisette@bywatersolutions.com> --- Works great, glad to be getting more of these passed. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42030 Lisette Scheer <lisette@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #196351|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=42030 Lisette Scheer <lisette@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #196352|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=42030 Lisette Scheer <lisette@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #196364|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=42030 --- Comment #11 from Lisette Scheer <lisette@bywatersolutions.com> --- Created attachment 197946 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=197946&action=edit Bug 42030: Populate diff column for suggestion CREATE/MODIFY/DELETE logs Update suggestion action logging to populate the diff column using the correct before/after semantics: - CREATE: empty before-state ({}), new suggestion data as after-state - MODIFY: pre-change unblessed data as before, post-store object as after - DELETE: log before the SQL DELETE so the object can still be fetched; pass the suggestion as both $infos (info column) and $original (diff before-state), logaction sets after-state to {} Also add tests verifying the diff column is populated for all three actions. 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=42030 --- Comment #12 from Lisette Scheer <lisette@bywatersolutions.com> --- Created attachment 197947 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=197947&action=edit Bug 42030: (follow-up) Fix POD for Koha::Suggestion 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=42030 --- Comment #13 from Lisette Scheer <lisette@bywatersolutions.com> --- Created attachment 197948 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=197948&action=edit Bug 42030: (follow-up) Don't diff undefined fields This patch updates the diff for ADD/CREATE and DELETE logactions to exclude undefined fields from the diff. 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=42030 Lucas Gass (lukeg) <lucas@bywatersolutions.com> 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=42030 --- Comment #14 from Lucas Gass (lukeg) <lucas@bywatersolutions.com> --- Nice work everyone! Pushed to main for 26.05 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42030 Jacob O'Mara <jacob.omara@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Pushed to main |Pushed to stable Version(s)|26.05.00 |26.05.00,25.11.05 released in| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42030 --- Comment #15 from Jacob O'Mara <jacob.omara@openfifth.co.uk> --- Thanks all, pushed to 25.11.x -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42030 Wainui Witika-Park <wainuiwitikapark@catalyst.net.nz> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Pushed to stable |Needs documenting CC| |wainuiwitikapark@catalyst.n | |et.nz --- Comment #16 from Wainui Witika-Park <wainuiwitikapark@catalyst.net.nz> --- Enhancement - not backporting to 25.05 -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org