@@ -, +, @@ of the diff format generated by Struct::Diff --- C4/Reserves.pm | 19 ++++++++++++------- Koha/Hold.pm | 16 ++++++++++++---- 2 files changed, 24 insertions(+), 11 deletions(-) --- a/C4/Reserves.pm +++ a/C4/Reserves.pm @@ -1129,20 +1129,20 @@ sub ModReserve { # FIXME Other calls may fail Koha::Exceptions::ObjectNotFound->throw( 'No hold with id ' . $reserve_id ) unless $hold; + my $original = C4::Context->preference('HoldsLog') ? $hold->unblessed : undef; + if ( $rank eq "del" ) { $hold->cancel({ cancellation_reason => $cancellation_reason }); } elsif ($hold->found && $hold->priority eq '0' && $date) { - logaction( 'HOLDS', 'MODIFY', $hold->reserve_id, $hold ) - if C4::Context->preference('HoldsLog'); # The only column that can be updated for a found hold is the expiration date $hold->expirationdate($date)->store(); + + logaction( 'HOLDS', 'MODIFY', $hold->reserve_id, $hold, undef, $original ) + if C4::Context->preference('HoldsLog'); } elsif ($rank =~ /^\d+/ and $rank > 0) { - logaction( 'HOLDS', 'MODIFY', $hold->reserve_id, $hold ) - if C4::Context->preference('HoldsLog'); - my $properties = { priority => $rank, branchcode => $branchcode, @@ -1169,7 +1169,10 @@ sub ModReserve { } } - _FixPriority({ reserve_id => $reserve_id, rank =>$rank }); + _FixPriority( { reserve_id => $reserve_id, rank => $rank } ); + + logaction( 'HOLDS', 'MODIFY', $hold->reserve_id, $hold, undef, $original ) + if C4::Context->preference('HoldsLog'); } } @@ -1243,6 +1246,8 @@ sub ModReserveAffect { return unless $hold; + my $original = $hold->unblessed; + my $already_on_shelf = $hold->found && $hold->found eq 'W'; $hold->itemnumber($itemnumber); @@ -1283,7 +1288,7 @@ sub ModReserveAffect { }); $std->execute($hold->reserve_id); - logaction( 'HOLDS', 'MODIFY', $hold->reserve_id, $hold ) + logaction( 'HOLDS', 'MODIFY', $hold->reserve_id, $hold, undef, $original ) if C4::Context->preference('HoldsLog'); return; --- a/Koha/Hold.pm +++ a/Koha/Hold.pm @@ -92,6 +92,8 @@ my $hold = $hold->suspend_hold( $suspend_until ); sub suspend_hold { my ( $self, $date ) = @_; + my $original = C4::Context->preference('HoldsLog') ? $self->unblessed : undef; + $date &&= dt_from_string($date)->truncate( to => 'day' )->datetime; if ( $self->is_found ) { # We can't suspend found holds @@ -126,7 +128,7 @@ sub suspend_hold { } ); - logaction( 'HOLDS', 'SUSPEND', $self->reserve_id, $self ) + logaction( 'HOLDS', 'SUSPEND', $self->reserve_id, $self, undef, $original ) if C4::Context->preference('HoldsLog'); Koha::BackgroundJob::BatchUpdateBiblioHoldsQueue->new->enqueue( @@ -147,6 +149,8 @@ my $hold = $hold->resume(); sub resume { my ( $self ) = @_; + my $original = C4::Context->preference('HoldsLog') ? $self->unblessed : undef; + $self->suspend(0); $self->suspend_until( undef ); @@ -160,7 +164,7 @@ sub resume { } ); - logaction( 'HOLDS', 'RESUME', $self->reserve_id, $self ) + logaction( 'HOLDS', 'RESUME', $self->reserve_id, $self, undef, $original ) if C4::Context->preference('HoldsLog'); Koha::BackgroundJob::BatchUpdateBiblioHoldsQueue->new->enqueue( @@ -697,6 +701,8 @@ sub cancel { my $autofill_next = $params->{autofill} && $self->itemnumber && $self->found && $self->found eq 'W'; + my $original = C4::Context->preference('HoldsLog') ? $self->unblessed : undef; + $self->_result->result_source->schema->txn_do( sub { my $patron = $self->patron; @@ -784,7 +790,7 @@ sub cancel { ); } - C4::Log::logaction( 'HOLDS', 'CANCEL', $self->reserve_id, $self ) + C4::Log::logaction( 'HOLDS', 'CANCEL', $self->reserve_id, $self, undef, $original ) if C4::Context->preference('HoldsLog'); Koha::BackgroundJob::BatchUpdateBiblioHoldsQueue->new->enqueue( @@ -824,6 +830,8 @@ sub fill { sub { my $patron = $self->patron; + my $original = C4::Context->preference('HoldsLog') ? $self->unblessed : undef; + $self->set( { found => 'F', @@ -868,7 +876,7 @@ sub fill { } } - C4::Log::logaction( 'HOLDS', 'FILL', $self->id, $self ) + C4::Log::logaction( 'HOLDS', 'FILL', $self->id, $self, undef, $original ) if C4::Context->preference('HoldsLog'); Koha::BackgroundJob::BatchUpdateBiblioHoldsQueue->new->enqueue( --