@@ -, +, @@ table size --- C4/Log.pm | 11 +++++++++++ C4/Reserves.pm | 8 ++++---- Koha/Hold.pm | 8 ++++---- Koha/Item.pm | 2 +- 4 files changed, 20 insertions(+), 9 deletions(-) --- a/C4/Log.pm +++ a/C4/Log.pm @@ -69,6 +69,17 @@ number is set to 0, which is the same as the superlibrarian's number. sub logaction { my ($modulename, $actionname, $objectnumber, $infos, $interface)=@_; + # Do special transformations if $info came as below-known object: + my $varname; + if ( ref $infos eq 'Koha::Hold' ) { + $varname = 'hold'; + } elsif ( ref $infos eq 'Koha::Item' ) { + $varname = 'item'; + } + if ($varname) { + $infos = Data::Dumper->new( [ $infos->unblessed ], [$varname] )->Indent(0)->Sortkeys(1)->Dump; + } + # Get ID of logged in user. if called from a batch job, # no user session exists and C4::Context->userenv() returns # the scalar '0'. --- a/C4/Reserves.pm +++ a/C4/Reserves.pm @@ -257,7 +257,7 @@ sub AddReserve { )->store(); $hold->set_waiting() if $found && $found eq 'W'; - logaction( 'HOLDS', 'CREATE', $hold->id, Dumper($hold->unblessed) ) + logaction( 'HOLDS', 'CREATE', $hold->id, $hold ) if C4::Context->preference('HoldsLog'); my $reserve_id = $hold->id(); @@ -1046,7 +1046,7 @@ sub ModReserve { $hold->cancel({ cancellation_reason => $cancellation_reason }); } elsif ($rank =~ /^\d+/ and $rank > 0) { - logaction( 'HOLDS', 'MODIFY', $hold->reserve_id, Dumper($hold->unblessed) ) + logaction( 'HOLDS', 'MODIFY', $hold->reserve_id, $hold ) if C4::Context->preference('HoldsLog'); my $properties = { @@ -1108,7 +1108,7 @@ sub ModReserveFill { } ); - logaction( 'HOLDS', 'MODIFY', $hold->reserve_id, Dumper($hold->unblessed) ) + logaction( 'HOLDS', 'MODIFY', $hold->reserve_id, $hold ) if C4::Context->preference('HoldsLog'); # FIXME Must call Koha::Hold->cancel ? => No, should call ->filled and add the correct log @@ -1236,7 +1236,7 @@ sub ModReserveAffect { }); $std->execute($hold->reserve_id); - logaction( 'HOLDS', 'MODIFY', $hold->reserve_id, Dumper($hold->get_from_storage->unblessed) ) + logaction( 'HOLDS', 'MODIFY', $hold->reserve_id, $hold->get_from_storage ) if C4::Context->preference('HoldsLog'); return; --- a/Koha/Hold.pm +++ a/Koha/Hold.pm @@ -114,7 +114,7 @@ sub suspend_hold { $self->suspend_until($date); $self->store(); - logaction( 'HOLDS', 'SUSPEND', $self->reserve_id, Dumper( $self->unblessed ) ) + logaction( 'HOLDS', 'SUSPEND', $self->reserve_id, $self ) if C4::Context->preference('HoldsLog'); return $self; @@ -134,7 +134,7 @@ sub resume { $self->store(); - logaction( 'HOLDS', 'RESUME', $self->reserve_id, Dumper($self->unblessed) ) + logaction( 'HOLDS', 'RESUME', $self->reserve_id, $self ) if C4::Context->preference('HoldsLog'); return $self; @@ -151,7 +151,7 @@ sub delete { my $deleted = $self->SUPER::delete($self); - logaction( 'HOLDS', 'DELETE', $self->reserve_id, Dumper($self->unblessed) ) + logaction( 'HOLDS', 'DELETE', $self->reserve_id, $self ) if C4::Context->preference('HoldsLog'); return $deleted; @@ -569,7 +569,7 @@ sub cancel { ); } - C4::Log::logaction( 'HOLDS', 'CANCEL', $self->reserve_id, Dumper($self->unblessed) ) + C4::Log::logaction( 'HOLDS', 'CANCEL', $self->reserve_id, $self ) if C4::Context->preference('HoldsLog'); } ); --- a/Koha/Item.pm +++ a/Koha/Item.pm @@ -203,7 +203,7 @@ sub store { if ( $log_action && C4::Context->preference("CataloguingLog") ) { $action eq 'create' ? logaction( "CATALOGUING", "ADD", $self->itemnumber, "item" ) - : logaction( "CATALOGUING", "MODIFY", $self->itemnumber, "item " . Dumper( $self->unblessed ) ); + : logaction( "CATALOGUING", "MODIFY", $self->itemnumber, "item " . $self ); } my $indexer = Koha::SearchEngine::Indexer->new({ index => $Koha::SearchEngine::BIBLIOS_INDEX }); $indexer->index_records( $self->biblionumber, "specialUpdate", "biblioserver" ) --