@@ -, +, @@ column --- C4/Log.pm | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) --- a/C4/Log.pm +++ a/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); --