From 83e2c3888dcaf7fe523ca89c53d3768b0836b92d Mon Sep 17 00:00:00 2001 From: Emily Lamancusa Date: Mon, 23 Mar 2026 10:24:23 -0400 Subject: [PATCH] Bug 42147: Log all relevant hold data on hold creation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When logging a hold create action, include all hold fields that may be defined at hold creation. Fields that are not defined until later (such as found status, waiting date, etc) are not included to avoid clutter. To test: 1. System preference setup i. Enable HoldsLog system preference ii. Set AllowHoldPolicyOverride to Allow 2. Place a hold in the staff interface 3. View the action logs entry for that hold creation i. Go to Tools > Log viewer ii. Select Modules: Holds and Action: Create iii. Click Submit --> Note that the "info" column only shows the hold id 4. Apply patch and restart_all 5. Repeat steps 2-3 --> The "info" column should now show hold details Signed-off-by: Emmanuel Bétemps Signed-off-by: Andrew Fuerste Henry Signed-off-by: Martin Renvoize --- C4/Reserves.pm | 38 ++++++++++++++++++++++++-------------- 1 file changed, 24 insertions(+), 14 deletions(-) diff --git a/C4/Reserves.pm b/C4/Reserves.pm index e2d372e8da..4fa195bf6e 100644 --- a/C4/Reserves.pm +++ b/C4/Reserves.pm @@ -264,20 +264,30 @@ sub AddReserve { # Log the hold creation if ( C4::Context->preference('HoldsLog') ) { - my $info = $hold->id; - if ( defined($confirmations) || defined($forced) ) { - $info = to_json( - { - hold => $hold->id, - branchcode => $hold->branchcode, - biblionumber => $hold->biblionumber, - itemnumber => $hold->itemnumber, - confirmations => $confirmations, - forced => $forced - }, - { pretty => 1, canonical => 1 } - ); - } + + my $info = to_json( + { + hold => $hold->id, + branchcode => $hold->branchcode, + biblionumber => $hold->biblionumber, + borrowernumber => $hold->borrowernumber, + itemnumber => $hold->itemnumber, + desk_id => $hold->desk_id, + hold_group_id => $hold->hold_group_id, + item_group_id => $hold->item_group_id, + item_level_hold => $hold->item_level_hold, + itemtype => $hold->itemtype, + lowestPriority => $hold->lowestPriority, + non_priority => $hold->non_priority, + patron_expiration_date => $hold->patron_expiration_date, + priority => $hold->priority, + reservenotes => $hold->reservenotes, + confirmations => $confirmations, + forced => $forced + }, + { pretty => 1, canonical => 1 } + ); + logaction( 'HOLDS', 'CREATE', $hold->id, $info ); }