Bugzilla – Attachment 116672 Details for
Bug 14233
Add logging support to notices and slips management
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 14233: Add logging to notice create/update/delete
Bug-14233-Add-logging-to-notice-createupdatedelete.patch (text/plain), 3.34 KB, created by
Martin Renvoize (ashimema)
on 2021-02-10 14:51:51 UTC
(
hide
)
Description:
Bug 14233: Add logging to notice create/update/delete
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2021-02-10 14:51:51 UTC
Size:
3.34 KB
patch
obsolete
>From b72cc4b6464bcaa0d42ed5e2933bf3351577ee69 Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Wed, 10 Feb 2021 12:09:19 +0000 >Subject: [PATCH] Bug 14233: Add logging to notice create/update/delete > >This patch adds the call to logaction to record when a notice is added >or changed. > >Test plan >1/ Add a new notice and check a corresponding line appears in the >action_logs table. >2/ Update a notice and check that a corresponding line appears in the >action_logs table. >3/ Signoff >--- > tools/letter.pl | 39 ++++++++++++++++++++++++++++----------- > 1 file changed, 28 insertions(+), 11 deletions(-) > >diff --git a/tools/letter.pl b/tools/letter.pl >index 0e7d23536d..4321f9ee81 100755 >--- a/tools/letter.pl >+++ b/tools/letter.pl >@@ -46,6 +46,7 @@ use C4::Auth; > use C4::Context; > use C4::Output; > use C4::Letters; >+use C4::Log; > > use Koha::Patron::Attribute::Types; > >@@ -315,6 +316,9 @@ sub add_validate { > next; > } > elsif ( $letter and $letter->{message_transport_type} eq $mtt and $letter->{lang} eq $lang ) { >+ logaction( 'NOTICES', 'MODIFY', $letter->{id}, $letter->{content}, >+ 'Intranet' ) >+ unless ( $content eq $letter->{content} ); > $dbh->do( > q{ > UPDATE letter >@@ -326,11 +330,20 @@ sub add_validate { > $branchcode, $oldmodule, $code, $mtt, $lang > ); > } else { >- $dbh->do( >- q{INSERT INTO letter (branchcode,module,code,name,is_html,title,content,message_transport_type, lang) VALUES (?,?,?,?,?,?,?,?,?)}, >- undef, >- $branchcode || '', $module, $code, $name, $is_html || 0, $title, $content, $mtt, $lang >- ); >+ my $letter = Koha::Notice::Template->new( >+ { >+ branchcode => $branchcode, >+ module => $module, >+ code => $code, >+ name => $name, >+ is_html => $is_html, >+ title => $title, >+ content => $content, >+ message_transport_type => $mtt, >+ lang => $lang >+ } >+ )->store; >+ logaction('NOTICES', 'CREATE', $letter->id, $letter->content, 'Intranet'); > } > } > # set up default display >@@ -351,15 +364,19 @@ sub delete_confirm { > > sub delete_confirmed { > my ($branchcode, $module, $code, $mtt, $lang) = @_; >- C4::Letters::DelLetter( >+ my $letter = Koha::Notice::Templates->find( > { >- branchcode => $branchcode || '', >- module => $module, >- code => $code, >- mtt => $mtt, >- lang => $lang, >+ branchcode => $branchcode || '', >+ module => $module, >+ code => $code, >+ message_transport_type => $mtt, >+ lang => $lang, > } > ); >+ if ( $letter ) { >+ logaction('NOTICES', 'DELETE', $letter->id, $letter->content, 'Intranet'); >+ $letter->delete; >+ } > # setup default display for screen > default_display($branchcode); > return; >-- >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 14233
:
116649
|
116650
|
116651
|
116660
|
116661
|
116662
|
116668
|
116671
|
116672
|
116673
|
116674
|
116713
|
116760
|
116761
|
117251
|
117252
|
117253
|
117254
|
117255
|
117256
|
117257
|
117258
|
117259
|
117294
|
117295
|
117296
|
117297
|
117298
|
117299
|
117300
|
117301
|
117302
|
117303
|
117304
|
117311
|
117312
|
117313
|
117314
|
117315
|
117316
|
117317
|
117318
|
117319
|
117320
|
117321
|
117345
|
118132
|
118133
|
118134
|
118135
|
118136
|
118137
|
118138
|
118139
|
118140
|
118141
|
118142
|
118143
|
118155
|
118156
|
118157
|
118158
|
118159
|
118160
|
118161
|
118162
|
118163
|
118164
|
118165
|
118166
|
118167
|
118323
|
119291
|
119292
|
119293
|
119294
|
119312
|
119313
|
119314
|
119315
|
119359
|
119360
|
119361
|
119362
|
119510