Bug 39628

Summary: Display 'diff' in action logs
Product: Koha Reporter: Andrew Fuerste-Henry <andrew>
Component: ToolsAssignee: Andrew Fuerste-Henry <andrew>
Status: Needs documenting --- QA Contact: Emily Lamancusa (emlam) <emily.lamancusa>
Severity: enhancement    
Priority: P5 - low CC: angela.berrett, caroline.cyr-la-rose, emily.lamancusa, fridolin.somers, roman.dolny
Version: Main   
Hardware: All   
OS: All   
See Also: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=35645
GIT URL: Initiative type: ---
Sponsorship status: --- Crowdfunding goal: 0
Patch complexity: Trivial patch Documentation contact:
Documentation submission: Text to go in the release notes:
Adds a "diff" column to the action logs viewer. This column will display the old (O) and new (N) values of the fields that were changed, for modules that store that information.
Version(s) released in:
25.05.00
Circulation function:
Bug Depends on:    
Bug Blocks: 36698, 39908    
Attachments: Bug 39628: Show diff in log viewer and column settings
Bug 39628: Show diff in log viewer and column settings
Bug 39628: Show diff in log viewer and column settings
screenshot of item modification log

Description Andrew Fuerste-Henry 2025-04-14 15:34:15 UTC
Bug 36698 wants to display the diff nicely. As a stopgap, how about we just make it possible to display them as-is?
Comment 1 Andrew Fuerste-Henry 2025-04-14 15:39:33 UTC
Created attachment 180922 [details] [review]
Bug 39628: Show diff in log viewer and column settings

To test:
1 - apply patch
2 - search the log viewer for item edits or something else that records a diff value
3 - see that diff in the new column
4 - confirm the diff value is present in exports and prints
5 - confirm you can use column config to hide that diff value
Comment 2 Roman Dolny 2025-04-14 18:23:39 UTC
Yes, it is good start to show data from diff col.

I modified an item and can confirm p. 1-4 test plan, but not p. 5.

There is no "Diff" in cols list for "Columns" button.
There is no "diff" in configure table (/cgi-bin/koha/admin/columns_settings.pl?module=tools&page=logviewer&table=logst) to hide it by default.
Comment 3 Andrew Fuerste-Henry 2025-04-14 19:05:57 UTC
(In reply to Roman Dolny from comment #2)
> Yes, it is good start to show data from diff col.
> 
> I modified an item and can confirm p. 1-4 test plan, but not p. 5.
> 
> There is no "Diff" in cols list for "Columns" button.
> There is no "diff" in configure table
> (/cgi-bin/koha/admin/columns_settings.
> pl?module=tools&page=logviewer&table=logst) to hide it by default.

Did you restart_all after applying the patch? I forgot to specify that in the test plan, but I do see Diff in the table config after restarting services.
Comment 4 Roman Dolny 2025-04-14 20:05:27 UTC
(In reply to Andrew Fuerste-Henry from comment #3)
> ...
> Did you restart_all after applying the patch? I forgot to specify that in
> the test plan, but I do see Diff in the table config after restarting
> services.

I'm pretty sure I did, but now it works... checked twice, with another browser and incognito. Thanks for suggestion.
Comment 5 Roman Dolny 2025-04-14 20:06:03 UTC
Created attachment 180937 [details] [review]
Bug 39628: Show diff in log viewer and column settings

To test:
1 - apply patch
2 - search the log viewer for item edits or something else that records a diff value
3 - see that diff in the new column
4 - confirm the diff value is present in exports and prints
5 - confirm you can use column config to hide that diff value

Signed-off-by: Roman Dolny <roman.dolny@jezuici.pl>
Comment 6 Emily Lamancusa (emlam) 2025-05-09 15:20:12 UTC
Created attachment 182190 [details] [review]
Bug 39628: Show diff in log viewer and column settings

To test:
1 - apply patch
2 - search the log viewer for item edits or something else that records a diff value
3 - see that diff in the new column
4 - confirm the diff value is present in exports and prints
5 - confirm you can use column config to hide that diff value

Signed-off-by: Roman Dolny <roman.dolny@jezuici.pl>
Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov>
Comment 7 Emily Lamancusa (emlam) 2025-05-09 15:26:02 UTC
I agree it's worth displaying the raw diff in the meantime. Thanks, Andrew!
Comment 8 Katrin Fischer 2025-05-15 06:42:27 UTC
This is a bit scary looking. Could we agree to hide the column by default in the table configuration settings? (these are also missing, please follow-up!)
Comment 9 Katrin Fischer 2025-05-15 06:45:17 UTC
I need to clarify, the "Diff" was not showing up initially in my column configuration settings above the table. After some restarting etc. it does now. 
It still might be nice to hide it by default, but leaving that for a simple follow-up.
Comment 10 Katrin Fischer 2025-05-15 07:21:44 UTC
Pushed for 25.05!

Well done everyone, thank you!
Comment 11 Andrew Fuerste-Henry 2025-05-15 12:31:16 UTC
> It still might be nice to hide it by default, but leaving that for a simple
> follow-up.

Follow-up filed: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39908
Comment 12 Fridolin Somers 2025-08-04 14:25:26 UTC
Enhancement not pushed to 24.11.x
Comment 13 Caroline Cyr La Rose 2025-10-20 19:57:47 UTC
Does anyone have a list of "something that records a diff value"? I'm trying to document this and I tried editing an item and editing a patron and even if I unhide the diff column, I only see the regular JSON entry. I tried both in ktd and a "vintage" install of 25.05.02.
Comment 14 Andrew Fuerste-Henry 2025-10-21 15:30:32 UTC
Created attachment 188229 [details]
screenshot of item modification log

I've attached a screenshot of this diff info as it shows on an item modification.
This patch makes it possible to see the diff column in the action logs but does not format it in any way. Previously the diff column was not available here and the diff could only be seen via SQL.
Comment 15 Angela Berrett 2025-10-23 19:10:52 UTC
(In reply to Caroline Cyr La Rose from comment #13)
> Does anyone have a list of "something that records a diff value"? I'm trying
> to document this and I tried editing an item and editing a patron and even
> if I unhide the diff column, I only see the regular JSON entry. I tried both
> in ktd and a "vintage" install of 25.05.02.

Bug 35645 discusses further cleaning up the JSON so it is easier to read.  Now that the JSON is viewable we need it to be readable for those of us who are coding-deficient. :)
Comment 16 Andrew Fuerste-Henry 2025-10-23 19:36:42 UTC
(In reply to Angela Berrett from comment #15)
> (In reply to Caroline Cyr La Rose from comment #13)
> > Does anyone have a list of "something that records a diff value"? I'm trying
> > to document this and I tried editing an item and editing a patron and even
> > if I unhide the diff column, I only see the regular JSON entry. I tried both
> > in ktd and a "vintage" install of 25.05.02.
> 
> Bug 35645 discusses further cleaning up the JSON so it is easier to read. 
> Now that the JSON is viewable we need it to be readable for those of us who
> are coding-deficient. :)

I filed this bug as a "good enough (and within my coding ability)" alternative to Bug 36698: "Display 'diff' nicely in action logs"