From 91122f420524b64fcbf7e112e6692963cc4f1f05 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Mon, 13 May 2019 10:36:14 -0500 Subject: [PATCH] Bug 10352: Display the correct modification logs for bibliographic records The 'Modification log" link in the cataloguing module returns confusing results. The 'object' parameter is the biblionumber, but the all log from itemnumber=biblionumber will be displayed as well. Since bug 11473 we have the action_logs.info column that is prefixed by 'item ' or 'biblio ' to disociated an item modification from a biblio modif. This patch suggests a quick and dirty approach, use this column to make sure we are searching for the correct logs. /!\ As bug 11473 did not update the existing rows, we will no longer display the logs created prior to this change. Test plan: Make sure you have at least 2 bibliographic records with some items Make sure you have the biblionumbers of those records that match existing itemnumbers Edit them (no matter what you change) Go to the bibliographic detail page (staff) and click "Modification log" You should see the correct changes. Signed-off-by: hc Signed-off-by: Nick Clemens Signed-off-by: Marcel de Rooy Signed-off-by: Martin Renvoize Signed-off-by: Joy Nelson (cherry picked from commit 536053d468d87a94544eb013cb7d4d9effae9445) Signed-off-by: Lucas Gass --- tools/viewlog.pl | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/tools/viewlog.pl b/tools/viewlog.pl index f8463c0be1..40e1c6658a 100755 --- a/tools/viewlog.pl +++ b/tools/viewlog.pl @@ -132,10 +132,21 @@ if ($do_it) { $search_params{user} = $user if $user; $search_params{module} = { -in => [ @modules ] } if ( defined $modules[0] and $modules[0] ne '' ) ; $search_params{action} = { -in => [ @actions ] } if ( defined $actions[0] && $actions[0] ne '' ); - $search_params{object} = $object if $object; - $search_params{info} = $info if $info; $search_params{interface} = { -in => [ @interfaces ] } if ( defined $interfaces[0] && $interfaces[0] ne '' ); + + if ( @modules == 1 && $modules[0] eq 'CATALOGUING' ) { + # Handle 'Modification log' from cataloguing + my @itemnumbers = Koha::Items->search({ biblionumber => $object })->get_column('itemnumber'); + $search_params{'-or'} = [ + { -and => { object => $object, info => { -like => 'biblio %' }}}, + { -and => { object => \@itemnumbers, info => { -like => 'item %' }}}, + ]; + } else { + $search_params{info} = $info if $info; + $search_params{object} = $object if $object; + } + my @logs = Koha::ActionLogs->search(\%search_params); my @data; -- 2.39.5