From 18e87ecd63026ec9a604e4bc34b5e4423ad034af Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Wed, 10 Feb 2021 11:55:22 +0000 Subject: [PATCH] Bug 14233: Add filtering of NOTICES type action logs to the logviewer This patch adds handling for the new 'NOTICES' type action_logs to the logviewer page. Test plan 1/ Add some 'Notice' action logs by adding a new notice or updateing an existing notice 2/ Go to the 'Log viewer' under 'Tools' 3/ Note you can filter by 'Notices' 4/ Confirm the changes you made appear in the logs and that the 'Object' field links back to the updated notice ready for editing. 5/ Signoff Signed-off-by: Kelly McElligott Signed-off-by: David Nind Signed-off-by: Kyle M Hall --- .../prog/en/modules/tools/viewlog.tt | 44 ++++++++++--------- tools/viewlog.pl | 10 +++++ 2 files changed, 33 insertions(+), 21 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/viewlog.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/viewlog.tt index 961f3cc08e..fe25a98dfc 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/viewlog.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/viewlog.tt @@ -96,6 +96,7 @@ [% CASE 'SEARCHENGINE' %]Search engine +[% CASE 'NOTICES' %]Notices [% CASE %][% module | html %] [% END %] [% END %] @@ -133,6 +134,7 @@ [% CASE 'COMMANDLINE' %]Command-line [% CASE 'API' %]REST API [% CASE 'CRON' %]Cron job +[% CASE 'UPGRADE' %]Upgrade [% CASE %][% log_interface | html %] [% END %] [% END %] @@ -172,7 +174,7 @@ [% ELSE %] [% END %] - [% FOREACH modx IN [ 'AUTH' 'CATALOGUING' 'AUTHORITIES' 'MEMBERS' 'ACQUISITIONS' 'SERIAL' 'HOLDS' 'ILL' 'CIRCULATION' 'LETTER' 'FINES' 'SYSTEMPREFERENCE' 'CRONJOBS', 'REPORTS', 'SEARCHENGINE' ] %] + [% FOREACH modx IN [ 'AUTH' 'CATALOGUING' 'AUTHORITIES' 'MEMBERS' 'ACQUISITIONS' 'SERIAL' 'HOLDS' 'ILL' 'CIRCULATION' 'LETTER' 'FINES' 'SYSTEMPREFERENCE' 'CRONJOBS', 'REPORTS', 'SEARCHENGINE', 'NOTICES' ] %] [% IF modules.grep(modx).size %] [% ELSE %] @@ -306,27 +308,27 @@ [% ELSE %] [% loopro.object | html %] [% END %] + [% ELSIF ( loopro.module == 'CATALOGUING' ) %] + [% IF ( loopro.info.substr(0, 4) == 'item' ) %] + Item [% loopro.object | html %] from + Biblio [% loopro.biblionumber | html %] + [% ELSIF ( loopro.info.substr(0, 6) == 'biblio' ) %] + Biblio [% loopro.object | html %] + [% ELSE %] + [% loopro.object | html %] + [% END %] + [% ELSIF ( loopro.module == 'SERIAL' ) %] + Subscription [% loopro.object | html %] + [% ELSIF ( loopro.module == 'AUTHORITIES' ) %] + Authority [% loopro.object | html %] + [% ELSIF ( loopro.module == 'NOTICES' ) %] + [% IF ( loopro.notice ) %] + Notice [% loopro.notice.title | html %] + [% ELSE %] + [% loopro.object | html %] + [% END %] [% ELSE %] - [% IF ( loopro.module == 'CATALOGUING' ) %] - [% IF ( loopro.info.substr(0, 4) == 'item' ) %] - Item [% loopro.object | html %] from - Biblio [% loopro.biblionumber | html %] - [% ELSIF ( loopro.info.substr(0, 6) == 'biblio' ) %] - Biblio [% loopro.object | html %] - [% ELSE %] - [% loopro.object | html %] - [% END %] - [% ELSE %] - [% IF ( loopro.module == 'SERIAL' ) %] - Subscription [% loopro.object | html %] - [% ELSE %] - [% IF ( loopro.module == 'AUTHORITIES' ) %] - Authority [% loopro.object | html %] - [% ELSE %] - [% loopro.object | html %] - [% END %] - [% END %] - [% END %] + [% loopro.object | html %] [% END %] diff --git a/tools/viewlog.pl b/tools/viewlog.pl index b58dcbacac..e67e911c40 100755 --- a/tools/viewlog.pl +++ b/tools/viewlog.pl @@ -186,6 +186,16 @@ if ($do_it) { } } } + + if ( $log->module eq 'NOTICES' ) { + if ( $log->object ) { + my $notice = Koha::Notice::Templates->find( { id => $log->object } ); + if ($notice && $output eq 'screen') { + $result->{notice} = $notice->unblessed; + } + } + } + push @data, $result; } if ( $output eq "screen" ) { -- 2.24.1 (Apple Git-126)