Bug 32057: Replace insert query with use of Koha::ActionLogs

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
Kyle Hall 2022-12-20 09:21:34 -05:00 committed by Tomas Cohen Arazi
parent 1942dbe881
commit cf1a43e2a1
No known key found for this signature in database
GPG Key ID: 0A272EA1B2F3C15F
1 changed files with 14 additions and 4 deletions

View File

@ -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(
{