Bug 37522: Logging item modification should record the original version of the item
When modifying bibliographic record, Koha records in the log the original version of the record. This allows one to see what has been changed in the record. However, in case of item modification Koha records in the log the the current version of the item (i.e. the version after the edit). This is inconsistent with the biblio modification behavior and makes it difficult or even impossible to trace changes (especially in case of the first modif since the initial version is not being recorded). This patch makes the item modification logging feature work similarly to logging modifications in bibliographic records. Test plan: ========== 1. With CataloguingLog enabled (default in ktd) make a modification of an item. 2. Check the Modification log. You should see as the recorded version the version of the item after the modification. 3. Apply the patch; restart_all. 4. Repeat p. 1. 5. In the Modification log you should see now the version of the item that existed before the recent modification. Sponsored-by: Ignatianum University in Cracow Signed-off-by: Roman Dolny <roman.dolny@jezuici.pl> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
This commit is contained in:
parent
c8594e2194
commit
ca6853cf28
|
|
@ -88,7 +88,7 @@ sub logaction {
|
|||
local $Data::Dumper::Sortkeys = 1;
|
||||
|
||||
if ( $infos->isa('Koha::Item') && $modulename eq 'CATALOGUING' && $actionname eq 'MODIFY' ) {
|
||||
$infos = "item " . Dumper($updated);
|
||||
$infos = "item " . Dumper( $original->unblessed );
|
||||
} else {
|
||||
$infos = Dumper($updated);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -220,11 +220,12 @@ sub store {
|
|||
}
|
||||
}
|
||||
|
||||
my $original = Koha::Items->find( $self->itemnumber ); # $original will be undef if $action eq 'create'
|
||||
my $result = $self->SUPER::store;
|
||||
if ( $log_action && C4::Context->preference("CataloguingLog") ) {
|
||||
$action eq 'create'
|
||||
? logaction( "CATALOGUING", "ADD", $self->itemnumber, "item" )
|
||||
: logaction( "CATALOGUING", "MODIFY", $self->itemnumber, $self );
|
||||
? logaction( "CATALOGUING", "ADD", $self->itemnumber, "item" )
|
||||
: logaction( "CATALOGUING", "MODIFY", $self->itemnumber, $self, undef, $original );
|
||||
}
|
||||
my $indexer = Koha::SearchEngine::Indexer->new({ index => $Koha::SearchEngine::BIBLIOS_INDEX });
|
||||
$indexer->index_records( $self->biblionumber, "specialUpdate", "biblioserver" )
|
||||
|
|
|
|||
Loading…
Reference in New Issue