Bugzilla – Attachment 169855 Details for
Bug 37522
Logging item modification should record the original version of the item
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 37522: Logging item modification should record the original version of the item
Bug-37522-Logging-item-modification-should-record-.patch (text/plain), 2.77 KB, created by
Janusz Kaczmarek
on 2024-07-30 11:20:19 UTC
(
hide
)
Description:
Bug 37522: Logging item modification should record the original version of the item
Filename:
MIME Type:
Creator:
Janusz Kaczmarek
Created:
2024-07-30 11:20:19 UTC
Size:
2.77 KB
patch
obsolete
>From dcd917c11f0444e188f560ee591c77133055e2f8 Mon Sep 17 00:00:00 2001 >From: Janusz Kaczmarek <januszop@gmail.com> >Date: Tue, 30 Jul 2024 11:03:54 +0000 >Subject: [PATCH] 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 varsion > 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 >--- > C4/Log.pm | 2 +- > Koha/Item.pm | 5 +++-- > 2 files changed, 4 insertions(+), 3 deletions(-) > >diff --git a/C4/Log.pm b/C4/Log.pm >index d7ad162c4c..cf0fd34de7 100644 >--- a/C4/Log.pm >+++ b/C4/Log.pm >@@ -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); > } >diff --git a/Koha/Item.pm b/Koha/Item.pm >index b9e35ae352..22aac385a1 100644 >--- a/Koha/Item.pm >+++ b/Koha/Item.pm >@@ -215,11 +215,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" ) >-- >2.39.2
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 37522
:
169855
|
169862
|
171520
|
171566
|
171567
|
173547
|
173548