Bugzilla – Attachment 173547 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.94 KB, created by
Martin Renvoize (ashimema)
on 2024-10-28 15:00:23 UTC
(
hide
)
Description:
Bug 37522: Logging item modification should record the original version of the item
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2024-10-28 15:00:23 UTC
Size:
2.94 KB
patch
obsolete
>From e1f8965153e2f9bb81be204ebf91659abafd969f 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 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> >--- > 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 d7ad162c4cb..cf0fd34de78 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 16f66a8c68e..a72c0b2ec6e 100644 >--- a/Koha/Item.pm >+++ b/Koha/Item.pm >@@ -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" ) >-- >2.47.0
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