Bug 42034

Summary: Add diff support to system preference action logs
Product: Koha Reporter: Martin Renvoize (ashimema) <martin.renvoize>
Component: Transaction logsAssignee: Bugs List <koha-bugs>
Status: NEW --- QA Contact: Testopia <testopia>
Severity: enhancement    
Priority: P5 - low    
Version: Main   
Hardware: All   
OS: All   
GIT URL: Initiative type: ---
Sponsorship status: --- Comma delimited list of Sponsors:
Crowdfunding goal: 0 Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:
Bug Depends on:    
Bug Blocks: 37940    

Description Martin Renvoize (ashimema) 2026-03-09 15:37:00 UTC
The action logging in Koha/Config/SysPref.pm does not pass the $original parameter to logaction(), so no structured diff is generated in the action_logs.diff column.

Affected calls in Koha/Config/SysPref.pm:
- SYSTEMPREFERENCE/MODIFY or ADD (~line 47):
  C4::Log::logaction( 'SYSTEMPREFERENCE', $action, undef, $self->variable . ' | ' . $self->value );
  (concatenates variable name and new value into a string; no before state)

- SYSTEMPREFERENCE/DELETE (~line 63):
  C4::Log::logaction( 'SYSTEMPREFERENCE', 'DELETE', undef, " $variable | $value" );

System preference changes are important for configuration audit trails. This bug covers updating store() in Koha::Config::SysPref to capture the pre-change value and pass it as $original, and to pass a structured hashref (e.g. { variable => ..., value => ... }) as $infos so the diff mechanism can produce a clear before/after comparison.