https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=44015
--- Comment #1 from Lisette Scheer <[email protected]> --- Created attachment 210772 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=210772&action=edit Bug 44015: Log additional contents changes as a single action with a diff When AdditionalContentLog is enabled, tools/additional-contents.pl logs one NEWS action per localization, 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 compare entries. This patch moves the logging into the objects: - Koha::AdditionalContent->store accepts translated_contents, so the display settings and the localizations are saved and logged as a single ADD or MODIFY action. A new content without a code gets its default code there. - Localizations are updated in place (matched on lang) instead of being deleted and re-created, so unchanged ones keep their updated_on. - Koha::AdditionalContent->delete deletes the localizations with the content and logs a single DELETE action. - Storing or deleting a localization directly is logged as a MODIFY of its content, unless log_action => 0 is passed. - Only the changed settings and localizations are recorded in MODIFY actions, with the content id as object and a JSON diff. - The log viewer formats the NEWS info, collapses long content, and the compare checkboxes work for these entries. To test: 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 (click 'Show content' to expand it) 11. Show the Diff column and confirm it shows the changes 12. Tick two entries for the same content and click 'View comparison' 13. prove t/db_dependent/Koha/AdditionalContents.t -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes. _______________________________________________ Koha-bugs mailing list -- [email protected] To unsubscribe send an email to [email protected] website : http://www.koha-community.org/ git : http://git.koha-community.org/ bugs : http://bugs.koha-community.org/
