Bugzilla – Attachment 53200 Details for
Bug 16829
action_logs should have an 'interface' column
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 16829: make logaction and GetLogs aware of the interface column
Bug-16829-make-logaction-and-GetLogs-aware-of-the-.patch (text/plain), 2.71 KB, created by
Nicole C. Engard
on 2016-07-07 19:19:30 UTC
(
hide
)
Description:
Bug 16829: make logaction and GetLogs aware of the interface column
Filename:
MIME Type:
Creator:
Nicole C. Engard
Created:
2016-07-07 19:19:30 UTC
Size:
2.71 KB
patch
obsolete
>From 1d06aa7aaaaa50a548646f5190638c989c403f72 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Fri, 1 Jul 2016 18:26:13 -0300 >Subject: [PATCH] Bug 16829: make logaction and GetLogs aware of the interface > column > >This patch changes the logaction API so it accepts a new 'interface' param. >Current code calling logaction is not changed, and this parameter can be ommited >in most contexts, and it will correctly fall-back to C4::Context->interface. > >Unit tests are provided on a different patch. > >GetLogs gets patched as well, so it can be required to filter by 'interface' param. > >Sponsored-by: NEKLS > >Signed-off-by: Nicole C Engard <nengard@bywatersolutions.com> >--- > C4/Log.pm | 13 ++++++++++--- > 1 file changed, 10 insertions(+), 3 deletions(-) > >diff --git a/C4/Log.pm b/C4/Log.pm >index de5f1d0..0ee08cf 100644 >--- a/C4/Log.pm >+++ b/C4/Log.pm >@@ -64,7 +64,7 @@ number is set to 0, which is the same as the superlibrarian's number. > > #' > sub logaction { >- my ($modulename, $actionname, $objectnumber, $infos)=@_; >+ my ($modulename, $actionname, $objectnumber, $infos, $interface)=@_; > > # Get ID of logged in user. if called from a batch job, > # no user session exists and C4::Context->userenv() returns >@@ -72,10 +72,11 @@ sub logaction { > my $userenv = C4::Context->userenv(); > my $usernumber = (ref($userenv) eq 'HASH') ? $userenv->{'number'} : 0; > $usernumber ||= 0; >+ $interface //= C4::Context->interface; > > my $dbh = C4::Context->dbh; >- my $sth=$dbh->prepare("Insert into action_logs (timestamp,user,module,action,object,info) values (now(),?,?,?,?,?)"); >- $sth->execute($usernumber,$modulename,$actionname,$objectnumber,$infos); >+ my $sth=$dbh->prepare("Insert into action_logs (timestamp,user,module,action,object,info,interface) values (now(),?,?,?,?,?,?)"); >+ $sth->execute($usernumber,$modulename,$actionname,$objectnumber,$infos,$interface); > $sth->finish; > } > >@@ -217,6 +218,7 @@ sub GetLogs { > my $action = shift; > my $object = shift; > my $info = shift; >+ my $interfaces = shift; > > my $iso_datefrom = $datefrom ? output_pref({ dt => dt_from_string( $datefrom ), dateformat => 'iso', dateonly => 1 }) : undef; > my $iso_dateto = $dateto ? output_pref({ dt => dt_from_string( $dateto ), dateformat => 'iso', dateonly => 1 }) : undef; >@@ -258,6 +260,11 @@ sub GetLogs { > $query .= " AND info LIKE ? "; > push( @parameters, "%" . $info . "%" ); > } >+ if ( $interfaces && scalar(@$interfaces) ) { >+ $query .= >+ " AND interface IN (" . join( ",", map { "?" } @$interfaces ) . ") "; >+ push( @parameters, @$interfaces ); >+ } > > my $sth = $dbh->prepare($query); > $sth->execute(@parameters); >-- >2.1.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 16829
:
53060
|
53061
|
53062
|
53063
|
53064
|
53199
|
53200
|
53201
|
53202
|
53203
|
54294
|
54295
|
54296
|
54297
|
54298