https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=44015 Bug ID: 44015 Summary: Log additional contents changes as a single action with a diff Initiative type: --- Sponsorship --- status: 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: lisette@bywatersolutions.com QA Contact: testopia@bugs.koha-community.org Depends on: 43988 Blocks: 39538 Target Milestone: --- When AdditionalContentLog is enabled, tools/additional-contents.pl logs one NEWS action per translation, as a pipe-separated string with no object id. Editing an entry with several translations creates several log lines, changes to the display settings (location, library, dates, position) are not logged at all, and the log viewer cannot show a diff or meaningfully compare entries. This was originally part of bug 39538 (CSS snippets) and has been split out, as it affects all additional contents (news, HTML customizations, pages). These patches: - Move the logging into Koha::AdditionalContent / Koha::AdditionalContentsLocalization, so saving a content with its translations is logged as a single ADD, MODIFY or DELETE action, with the content id as object and a JSON diff (ACTN1). - Only record the changed settings and translations in MODIFY actions; saving without changes logs nothing. - Update translations in place instead of deleting and re-creating them, so unchanged ones keep their updated_on. - Diff the nested fields of added and deleted entries field by field (NEWS only in C4::Log), so ADD/DELETE diffs have the same shape as MODIFY ones. - Format the NEWS info and diff in the log viewer and fix the compare checkboxes for these entries. Test plan: 1. Enable AdditionalContentLog 2. Go to Tools > News, add a news item with a default and a translated title/content 3. Edit it: change only the default content, save 4. Edit it again: change only the position and the expiration date, save 5. Save it again without any changes 6. Edit it and remove the translation, save 7. Delete it 8. Repeat 2-7 with an HTML customization (Tools > HTML customizations) 9. Go to Tools > Log viewer, select only the Additional contents module and submit 10. Confirm there is exactly one line per add/edit/delete (none for step 5), the Object column holds the content id, and the Info column only lists what changed 11. Show the Diff column: the ADD, MODIFY and DELETE diffs list the title and content of each language separately, title before content 12. Tick two entries for the same content and click 'View comparison' 13. prove t/db_dependent/Log.t t/db_dependent/Koha/AdditionalContents.t t/db_dependent/AuthoritiesMarc.t t/db_dependent/Koha/Biblio.t Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39538 [Bug 39538] Replace UserCSS system preference with snippets https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43988 [Bug 43988] Setting an additional contents number/position to 0 isn't handled consistently -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.