Bugzilla – Attachment 38222 Details for
Bug 14024
Add reports to action logs
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 14024 - add reports to action logs
Bug-14024---add-reports-to-action-logs.patch (text/plain), 6.80 KB, created by
Nicole C. Engard
on 2015-04-20 21:54:10 UTC
(
hide
)
Description:
Bug 14024 - add reports to action logs
Filename:
MIME Type:
Creator:
Nicole C. Engard
Created:
2015-04-20 21:54:10 UTC
Size:
6.80 KB
patch
obsolete
>From 4588d3f0e9208de5eb5384981f7ed873740f1c54 Mon Sep 17 00:00:00 2001 >From: =?UTF-8?q?Marc=20V=C3=A9ron?= <veron@veron.ch> >Date: Mon, 20 Apr 2015 22:13:04 +0200 >Subject: [PATCH] Bug 14024 - add reports to action logs > >This patch sets adds the possibility to log new, update and delete actions for saved reports. > >To test: >-Apply patch >-Run updatedatabase.pl >-Enable system preference ReportsLog >-Create, duplicate, edit and delete saved reports >-Go to Home > Tools > Logs >-Verify that you can select "Reports" in Modules list >-Verify that your actions were logged > >Signed-off-by: Nicole Engard <nengard@bywatersolutions.com> >--- > C4/Reports/Guided.pm | 6 +++++- > .../data/mysql/atomicupdate/bug_14024_add_reportslog_syspref.sql | 1 + > installer/data/mysql/sysprefs.sql | 1 + > .../intranet-tmpl/prog/en/modules/admin/preferences/logs.pref | 6 ++++++ > koha-tmpl/intranet-tmpl/prog/en/modules/tools/viewlog.tt | 3 ++- > reports/guided_reports.pl | 4 ++++ > 6 files changed, 19 insertions(+), 2 deletions(-) > create mode 100644 installer/data/mysql/atomicupdate/bug_14024_add_reportslog_syspref.sql > >diff --git a/C4/Reports/Guided.pm b/C4/Reports/Guided.pm >index 133b1fd..a7e1c16 100644 >--- a/C4/Reports/Guided.pm >+++ b/C4/Reports/Guided.pm >@@ -33,6 +33,7 @@ use XML::Dumper; > use C4::Debug; > # use Smart::Comments; > # use Data::Dumper; >+use C4::Log; > > BEGIN { > # set the version for version checking >@@ -632,6 +633,10 @@ sub format_results { > sub delete_report { > my (@ids) = @_; > return unless @ids; >+ foreach my $id (@ids) { >+ my $data = get_saved_report($id); >+ logaction( "REPORTS", "DELETE", $id, "Name: $data->{'report_name'} SQL: $data->{'savedsql'} " ) if C4::Context->preference("ReportsLog"); >+ } > my $dbh = C4::Context->dbh; > my $query = 'DELETE FROM saved_sql WHERE id IN (' . join( ',', ('?') x @ids ) . ')'; > my $sth = $dbh->prepare($query); >@@ -639,7 +644,6 @@ sub delete_report { > } > > sub get_saved_reports_base_query { >- > my $area_name_sql_snippet = get_area_name_sql_snippet; > return <<EOQ; > SELECT s.*, r.report, r.date_run, $area_name_sql_snippet, av_g.lib AS groupname, av_sg.lib AS subgroupname, >diff --git a/installer/data/mysql/atomicupdate/bug_14024_add_reportslog_syspref.sql b/installer/data/mysql/atomicupdate/bug_14024_add_reportslog_syspref.sql >new file mode 100644 >index 0000000..3cebee0 >--- /dev/null >+++ b/installer/data/mysql/atomicupdate/bug_14024_add_reportslog_syspref.sql >@@ -0,0 +1 @@ >+INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type) VALUES ('ReportsLog','0',NULL,'If ON, log information about reports.','YesNo'); >diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql >index be44611..f16b658 100644 >--- a/installer/data/mysql/sysprefs.sql >+++ b/installer/data/mysql/sysprefs.sql >@@ -353,6 +353,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` > ('RenewSerialAddsSuggestion','0',NULL,'If ON, adds a new suggestion at serial subscription renewal','YesNo'), > ('RentalFeesCheckoutConfirmation', '0', NULL , 'Allow user to confirm when checking out an item with rental fees.', 'YesNo'), > ('RentalsInNoissuesCharge','1',NULL,'Rental charges block checkouts (added to noissuescharge).','YesNo'), >+('ReportsLog','0',NULL,'If ON, log information about reports.','YesNo'), > ('RequestOnOpac','1',NULL,'If ON, globally enables patron holds on OPAC','YesNo'), > ('ReservesControlBranch','PatronLibrary','ItemHomeLibrary|PatronLibrary','Branch checked for members reservations rights','Choice'), > ('ReservesMaxPickUpDelay','7','','Define the Maximum delay to pick up an item on hold','Integer'), >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/logs.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/logs.pref >index b6f22d0..71e2692 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/logs.pref >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/logs.pref >@@ -47,3 +47,9 @@ Logging: > on: Log > off: "Don't log" > - when serials are added, deleted or changed. >+ - >+ - pref: ReportsLog >+ choices: >+ on: Log >+ off: "Don't log" >+ - when reports are added, deleted or changed. >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 634092f..68fd700 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/viewlog.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/viewlog.tt >@@ -25,6 +25,7 @@ > [% CASE 'LETTER' %]Letter > [% CASE 'FINES' %]Fines > [% CASE 'SYSTEMPREFERENCE' %]System prefs >+[% CASE 'REPORTS' %]Reports > [% CASE %][% module %] > [% END %] > [% END %] >@@ -75,7 +76,7 @@ > [% ELSE %] > <option value="">All</option> > [% END %] >- [% FOREACH modx IN [ 'CATALOGUING' 'AUTHORITIES' 'MEMBERS' 'ACQUISITIONS' 'SERIAL' 'CIRCULATION' 'LETTER' 'FINES' 'SYSTEMPREFERENCE' ] %] >+ [% FOREACH modx IN [ 'CATALOGUING' 'AUTHORITIES' 'MEMBERS' 'ACQUISITIONS' 'SERIAL' 'CIRCULATION' 'LETTER' 'FINES' 'SYSTEMPREFERENCE' 'REPORTS' ] %] > [% IF modules.grep(modx).size %] > <option value="[% modx %]" selected="selected">[% PROCESS translate_log_module module=modx %]</option> > [% ELSE %] >diff --git a/reports/guided_reports.pl b/reports/guided_reports.pl >index d90adfb..4f26aca 100755 >--- a/reports/guided_reports.pl >+++ b/reports/guided_reports.pl >@@ -31,6 +31,8 @@ use C4::Dates qw/format_date/; > use C4::Debug; > use C4::Branch; # XXX subfield_is_koha_internal_p > use C4::Koha qw/IsAuthorisedValueCategory GetFrameworksLoop/; >+use C4::Context; >+use C4::Log; > > =head1 NAME > >@@ -236,6 +238,7 @@ elsif ( $phase eq 'Update SQL'){ > 'reportname' => $reportname, > 'id' => $id, > ); >+ logaction( "REPORTS", "MODIFY", $id, "$reportname: SQL: $sql" ) if C4::Context->preference("ReportsLog"); > } > if ( $usecache ) { > $template->param( >@@ -593,6 +596,7 @@ elsif ( $phase eq 'Save Report' ) { > cache_expiry => $cache_expiry, > public => $public, > } ); >+ logaction( "REPORTS", "ADD", 0, "Name: $name: SQL: $sql" ) if C4::Context->preference("ReportsLog"); > $template->param( > 'save_successful' => 1, > 'reportname' => $name, >-- >1.7.10.4
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 14024
:
38217
|
38222
|
38382
|
38383
|
38420
|
38421
|
39841
|
39842