Bugzilla – Attachment 122941 Details for
Bug 28717
NewsLog doesn't work
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 28717: Add logging logic to koha-news.pl
Bug-28717-Add-logging-logic-to-koha-newspl.patch (text/plain), 3.96 KB, created by
Jonathan Druart
on 2021-07-19 12:16:45 UTC
(
hide
)
Description:
Bug 28717: Add logging logic to koha-news.pl
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2021-07-19 12:16:45 UTC
Size:
3.96 KB
patch
obsolete
>From cc29318f2c8767257c1671936e39af51d01d599e Mon Sep 17 00:00:00 2001 >From: Lucas Gass <lucas@bywatersolutions.com> >Date: Fri, 16 Jul 2021 16:00:44 +0000 >Subject: [PATCH] Bug 28717: Add logging logic to koha-news.pl > >To test: >1. have some news items >2. make sure NewsLog is turned on >3. Add, modify, and delete some news >4. Check the action logs, nothing is logged >5. Apply patch >6. do step 3 again >7. now changes should be logged >8. make sure you try deleting multiple news items at once and confirm that all deletions are logged >--- > .../prog/en/modules/tools/viewlog.tt | 2 +- > tools/koha-news.pl | 18 +++++++++++++++++- > 2 files changed, 18 insertions(+), 2 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 3b0886d3690..6ea33bed706 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/viewlog.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/viewlog.tt >@@ -362,7 +362,7 @@ > [% IF ( loopro.module == 'CIRCULATION' ) %] > <a href="/cgi-bin/koha/catalogue/moredetail.pl?itemnumber=[% loopro.info | uri %]&biblionumber=[% loopro.biblionumber | uri %]&bi=[% loopro.biblioitemnumber | uri %]#item[% loopro.info | uri %]" title="Display detail for this item">Item [% loopro.barcode | html %]</a> > [% ELSE %] >- [% IF loopro.module == "SYSTEMPREFERENCE" || loopro.module == "REPORTS" || loopro.module == "OPACNEWS" %] >+ [% IF loopro.module == "SYSTEMPREFERENCE" || loopro.module == "REPORTS" || loopro.module == "NEWS" %] > <div class="loginfo" id="loginfo[% loopro.action_id | html %]">[% loopro.info | trim | html %]</div> > <div class="compare_info" id="compare_info[% loopro.action_id | html %]"> > <label><input type="checkbox" name="diff" id="action_id[% loopro.action_id | html %]" data-actionid="[% loopro.action_id | html %]" data-filter="[% FOREACH info IN loopro.info.split(' \| ') %][% IF loop.first %][% info | html %][% END %][% END %]" class="compare" /> Compare</label> >diff --git a/tools/koha-news.pl b/tools/koha-news.pl >index ef615a4e0df..6187df17d7d 100755 >--- a/tools/koha-news.pl >+++ b/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,11 +139,22 @@ 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'); >- Koha::News->search({ idnew => \@ids })->delete; >+ #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"); > } > >-- >2.20.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 28717
:
122864
|
122921
|
122927
|
122941
|
122943
|
122944
|
122955
|
123964
|
125471
|
125543
|
125637
|
125659