Bug 42188: Use to_json for biblio action log info column

Replace Dumper with to_json for the biblio info column in logaction,
fixing UTF-8 encoding and extending coverage to ADD and DELETE actions
which previously logged only the literal string "biblio".

All three actions (ADD, MODIFY, DELETE) now log "biblio " followed by
a pretty-printed JSON representation of the relevant state: pre-change
for MODIFY, new state for ADD, and deleted state for DELETE.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Lisette Scheer <lisette@bywatersolutions.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
This commit is contained in:
Martin Renvoize 2026-03-27 11:56:33 +01:00 committed by Lucas Gass
parent 3d78340552
commit 1846433ffb
No known key found for this signature in database
GPG Key ID: 60B447398B0D36CA
1 changed files with 3 additions and 3 deletions

View File

@ -94,9 +94,9 @@ sub logaction {
}
} else {
$updated = $infos;
if ( ref $infos eq 'HASH' && $modulename eq 'CATALOGUING' && $actionname eq 'MODIFY' ) {
local $Data::Dumper::Sortkeys = 1;
$infos = "biblio " . Dumper( ref $original eq 'HASH' ? $original : {} );
if ( $modulename eq 'CATALOGUING' && ref $original eq 'HASH' ) {
my $prefix = ref $infos eq 'HASH' ? 'biblio' : $infos;
$infos = "$prefix " . to_json( $original, { utf8 => 1, pretty => 1 } );
}
}