@@ -, +, @@
---
.../prog/en/modules/tools/viewlog.tt | 2 +-
tools/koha-news.pl | 16 ++++++++++++++++
2 files changed, 17 insertions(+), 1 deletion(-)
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/viewlog.tt
+++ a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/viewlog.tt
@@ -362,7 +362,7 @@
[% IF ( loopro.module == 'CIRCULATION' ) %]
Item [% loopro.barcode | html %]
[% ELSE %]
- [% IF loopro.module == "SYSTEMPREFERENCE" || loopro.module == "REPORTS" || loopro.module == "OPACNEWS" %]
+ [% IF loopro.module == "SYSTEMPREFERENCE" || loopro.module == "REPORTS" || loopro.module == "NEWS" %]
[% loopro.info | trim | html %]
--- a/tools/koha-news.pl
+++ a/tools/koha-news.pl
@@ -30,6 +30,7 @@ use C4::Output qw( output_html_with_http_headers );
use C4::Languages qw( getTranslatedLanguages );
use Koha::DateUtils qw( dt_from_string output_pref );
use Koha::News;
+use C4::Log qw(logaction);
my $cgi = CGI->new;
@@ -115,6 +116,10 @@ elsif ( $op eq 'add' ) {
branchcode => $branchcode,
borrowernumber => $borrowernumber,
})->store;
+ #log news addition
+ if (C4::Context->preference("NewsLog")) {
+ logaction('NEWS', 'ADD' , undef, $lang . ' | ' . $content);
+ }
print $cgi->redirect("/cgi-bin/koha/tools/koha-news.pl");
}
else {
@@ -134,10 +139,21 @@ elsif ( $op eq 'edit' ) {
branchcode => $branchcode,
})->store;
}
+ #log news modification
+ if (C4::Context->preference("NewsLog")) {
+ logaction('NEWS', 'MODIFY' , undef, $lang . ' | ' . $content);
+ }
print $cgi->redirect("/cgi-bin/koha/tools/koha-news.pl");
}
elsif ( $op eq 'del' ) {
my @ids = $cgi->multi_param('ids');
+ #log news deletion then delete it
+ if (C4::Context->preference("NewsLog")) {
+ foreach my $newsid ( @ids ) {
+ my $n = Koha::News->find( $newsid );
+ logaction('NEWS', 'DELETE', undef, $n->lang . ' | ' . $n->content );
+ }
+ }
Koha::News->search({ idnew => \@ids })->delete;
print $cgi->redirect("/cgi-bin/koha/tools/koha-news.pl");
}
--