Bugzilla – Attachment 83243 Details for
Bug 22003
Remove unused subroutines displaylog and GetLogStatus from in C4::Log
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 22003: Remove unused subroutines displaylog and GetLogStatus from C4::Log
Bug-22003-Remove-unused-subroutines-displaylog-and.patch (text/plain), 5.45 KB, created by
Pierre-Marc Thibault
on 2018-12-14 19:29:43 UTC
(
hide
)
Description:
Bug 22003: Remove unused subroutines displaylog and GetLogStatus from C4::Log
Filename:
MIME Type:
Creator:
Pierre-Marc Thibault
Created:
2018-12-14 19:29:43 UTC
Size:
5.45 KB
patch
obsolete
>From 0ef437e3aba9a4b1cf542f360365abfb7ca6c88a Mon Sep 17 00:00:00 2001 >From: Josef Moravec <josef.moravec@gmail.com> >Date: Fri, 14 Dec 2018 16:50:39 +0000 >Subject: [PATCH] Bug 22003: Remove unused subroutines displaylog and > GetLogStatus from C4::Log > >These two routines are not used > >Test plan: >0) Apply the patch >1) git grep GetLogStatus should return no occurence >2) git grep displaylog should return no occurence >3) prove t/Log.t should return green > >Signed-off-by: Pierre-Marc Thibault <pierre-marc.thibault@inLibro.com> >--- > C4/Log.pm | 107 +------------------------------------------------------------- > t/Log.t | 19 ++--------- > 2 files changed, 4 insertions(+), 122 deletions(-) > >diff --git a/C4/Log.pm b/C4/Log.pm >index 0a14dfe..3a1e93e 100644 >--- a/C4/Log.pm >+++ b/C4/Log.pm >@@ -35,7 +35,7 @@ use vars qw(@ISA @EXPORT); > BEGIN { > require Exporter; > @ISA = qw(Exporter); >- @EXPORT = qw(&logaction &cronlogaction &GetLogStatus &displaylog &GetLogs); >+ @EXPORT = qw(&logaction &cronlogaction &GetLogs); > } > > =head1 NAME >@@ -120,111 +120,6 @@ sub cronlogaction { > logaction( 'CRONJOBS', 'Run', undef, $loginfo ) if C4::Context->preference('CronjobLog'); > } > >- >-=item GetLogStatus >- >- $status = GetLogStatus; >- >-C<$status> is a hasref like this example: >- $hash = { >- BorrowersLog => 1, >- CataloguingLog => 0, >- IssueLog => 0, >- ... >- } >- >-=cut >- >-#' >-sub GetLogStatus { >- my %hash; >- $hash{BorrowersLog} = C4::Context->preference("BorrowersLog"); >- $hash{CataloguingLog} = C4::Context->preference("CataloguingLog"); >- $hash{HoldsLog} = C4::Context->preference("HoldsLog"); >- $hash{IssueLog} = C4::Context->preference("IssueLog"); >- $hash{ReturnLog} = C4::Context->preference("ReturnLog"); >- $hash{SubscriptionLog} = C4::Context->preference("SubscriptionLog"); >- $hash{LetterLog} = C4::Context->preference("LetterLog"); >- $hash{FinesLog} = C4::Context->preference("FinesLog"); >- return \%hash; >-} >- >-=item displaylog >- >- &displaylog($modulename, @filters); >- $modulename is the name of the module on which the user wants to display logs >- @filters is an optional table of hash containing : >- - name : the name of the variable to filter >- - value : the value of the filter.... May be with * joker >- >-returns a table of hash containing who did what on which object at what time >- >-=cut >- >-#' >-sub displaylog { >- my ($modulename, @filters) = @_; >- my $dbh = C4::Context->dbh; >- my $strsth=qq| >- SELECT action_logs.timestamp, action_logs.action, action_logs.info, >- borrowers.cardnumber, borrowers.surname, borrowers.firstname, borrowers.userid, >- biblio.biblionumber, biblio.title, biblio.author >- FROM action_logs >- LEFT JOIN borrowers ON borrowers.borrowernumber=action_logs.user >- LEFT JOIN biblio ON action_logs.object=biblio.biblionumber >- WHERE action_logs.module = 'cataloguing' >- |; >- my %filtermap = (); >- if ($modulename eq "catalogue" or $modulename eq "acqui") { >- %filtermap = ( >- user => 'borrowers.surname', >- title => 'biblio.title', >- author => 'biblio.author', >- ); >- } elsif ($modulename eq "members") { >- $strsth=qq| >- SELECT action_logs.timestamp, action_logs.action, action_logs.info, >- borrowers.cardnumber, borrowers.surname, borrowers.firstname, borrowers.userid, >- bor2.cardnumber, bor2.surname, bor2.firstname, bor2.userid >- FROM action_logs >- LEFT JOIN borrowers ON borrowers.borrowernumber=action_logs.user >- LEFT JOIN borrowers as bor2 ON action_logs.object=bor2.borrowernumber >- WHERE action_logs.module = 'members' >- |; >- %filtermap = ( >- user => 'borrowers.surname', >- surname => 'bor2.surname', >- firstname => 'bor2.firstname', >- cardnumber => 'bor2.cardnumber', >- ); >- } else { >- return 0; >- } >- >- if (@filters) { >- foreach my $filter (@filters) { >- my $tempname = $filter->{name} or next; >- (grep {/^$tempname$/} keys %filtermap) or next; >- $filter->{value} =~ s/\*/%/g; >- $strsth .= " AND " . $filtermap{$tempname} . " LIKE " . $filter->{value}; >- } >- } >- my $sth=$dbh->prepare($strsth); >- $sth->execute; >- my @results; >- my $count; >- my $hilighted=1; >- while (my $data = $sth->fetchrow_hashref){ >- $data->{hilighted} = ($hilighted>0); >- $data->{info} =~ s/\n/<br\/>/g; >- $data->{day} = output_pref({ str => $data->{timestamp} }); >- push @results, $data; >- $count++; >- $hilighted = -$hilighted; >- } >- return ($count, \@results); >-} >- > =item GetLogs > > $logs = GetLogs($datefrom,$dateto,$user,\@modules,$action,$object,$info); >diff --git a/t/Log.t b/t/Log.t >index 601b909..d53386b 100755 >--- a/t/Log.t >+++ b/t/Log.t >@@ -3,24 +3,11 @@ > # This Koha test module is a stub! > # Add more tests here!!! > >-use strict; >-use warnings; >+use Modern::Perl; > >-use Test::More tests => 3; >-use t::lib::Mocks; >+use Test::More tests => 1; > > BEGIN { >- use_ok('C4::Log'); >+ use_ok('C4::Log'); > } > >-t::lib::Mocks::mock_preference('BorrowersLog', 1); >-t::lib::Mocks::mock_preference('CataloguingLog', 1); >-t::lib::Mocks::mock_preference('IssueLog', 1); >-t::lib::Mocks::mock_preference('ReturnLog', 1); >-t::lib::Mocks::mock_preference('SubscriptionLog', 1); >-t::lib::Mocks::mock_preference('LetterLog', 1); >-t::lib::Mocks::mock_preference('FinesLog', 1); >- >-ok( my $hash=GetLogStatus(),"Testing GetLogStatus"); >- >-ok( $hash->{BorrowersLog}, 'Testing hash is non empty'); >-- >2.7.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 22003
:
83233
|
83243
|
83311