Bug 41883: logaction when batch modifying holds

To test:
-APPLY PATCH and restart_all
-Place a hold
-Run the Holds log using the hold's reserve_id. There will be a single entry for the hold's creation.
-Find the hold using the batch hold modification tool, and update its pickup location
-Look at the action log, the chnage should be logged
-Try batch modding holds in other ways, ensure the changes are logged
-Turn off HoldsLog and batch modify some holds, the changes should NOT be logged.

Signed-off-by: Anneli Österman <anneli.osterman@koha-suomi.fi>
Signed-off-by: Andrew Fuerste Henry <andrew@bywatersolutions.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
This commit is contained in:
Lucas Gass 2026-02-18 22:15:32 +00:00
parent 894e144303
commit d345453a23
No known key found for this signature in database
GPG Key ID: 60B447398B0D36CA
1 changed files with 6 additions and 0 deletions

View File

@ -25,6 +25,7 @@ use JSON qw( to_json );
use C4::Auth qw( get_template_and_user );
use C4::Output qw( output_html_with_http_headers );
use C4::Log qw( logaction );
use Koha::DateUtils qw( dt_from_string );
use Koha::Holds;
@ -65,6 +66,7 @@ if ( $op eq 'cud-form' ) {
Koha::Holds->search( { reserve_id => { -in => \@hold_ids } }, { join => [ "item", "biblio" ] } );
while ( my $hold = $holds_to_update->next ) {
my $hold_before_mod = $hold->unblessed;
if ($new_expiration_date) {
$hold->expirationdate($new_expiration_date)->store;
@ -98,6 +100,10 @@ if ( $op eq 'cud-form' ) {
if ($clear_hold_notes) {
$hold->reservenotes(undef)->store;
}
logaction( 'HOLDS', 'MODIFY', $hold->reserve_id, $hold, undef, $hold_before_mod )
if C4::Context->preference('HoldsLog');
push @holds_data, $hold;
}