From cf1a43e2a12fd6816799072b1edaba03095ec3fc Mon Sep 17 00:00:00 2001 From: Kyle Hall Date: Tue, 20 Dec 2022 09:21:34 -0500 Subject: [PATCH] Bug 32057: Replace insert query with use of Koha::ActionLogs Signed-off-by: David Nind Signed-off-by: Marcel de Rooy Signed-off-by: Tomas Cohen Arazi --- C4/Log.pm | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/C4/Log.pm b/C4/Log.pm index 6cddc5ac80..08194a0530 100644 --- a/C4/Log.pm +++ b/C4/Log.pm @@ -31,6 +31,7 @@ use File::Basename qw( basename ); use C4::Context; use Koha::Logger; +use Koha::ActionLogs; use vars qw(@ISA @EXPORT); @@ -111,10 +112,19 @@ sub logaction { } my $trace = @trace ? to_json( \@trace, { utf8 => 1, pretty => 1 } ) : undef; - my $dbh = C4::Context->dbh; - my $sth=$dbh->prepare("Insert into action_logs (timestamp,user,module,action,object,info,interface,script,trace) values (now(),?,?,?,?,?,?,?,?)"); - $sth->execute( $usernumber, $modulename, $actionname, $objectnumber, $infos, $interface, $script, $trace ); - $sth->finish; + Koha::ActionLog->new( + { + timestamp => \'NOW()', + user => $usernumber, + module => $modulename, + action => $actionname, + object => $objectnumber, + info => $infos, + interface => $interface, + script => $script, + trace => $trace, + } + )->store(); my $logger = Koha::Logger->get( { -- 2.39.5