Bug 42033

Summary: Add diff support to patron restriction and circ message 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:36:49 UTC
Several MEMBERS action log calls in Koha do not pass the $original parameter to logaction(), so no structured diff is generated in the action_logs.diff column.

Affected calls:
1. Koha/Patron/Debarments.pm - CREATE_RESTRICTION (~line 89):
   logaction( "MEMBERS", "CREATE_RESTRICTION", $borrowernumber, $restriction )
   (no $original; $restriction hashref is the new state)

2. Koha/Patron/Debarments.pm - DELETE_RESTRICTION (~line 113):
   logaction( "MEMBERS", "DELETE_RESTRICTION", $borrowernumber, $restriction )
   (no $original; $restriction hashref is the state being deleted)

3. Koha/Patron/Message.pm - MODCIRCMESSAGE (~line 58):
   C4::Log::logaction( "MEMBERS", "MODCIRCMESSAGE", $self->borrowernumber, $self->message )
   (passes new message text; should also pass original for diff)

4. Koha/Patron/Message.pm - ADDCIRCMESSAGE (~line 60):
   C4::Log::logaction( "MEMBERS", "ADDCIRCMESSAGE", $self->borrowernumber, $self->message )

5. Koha/Patron/Message.pm - DELCIRCMESSAGE (~line 74):
   C4::Log::logaction( "MEMBERS", "DELCIRCMESSAGE", $self->borrowernumber, $self->message )

This bug covers updating these calls to pass structured data so the diff mechanism can generate proper before/after comparisons.