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 <hc@interleaf.ie>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
This commit is contained in:
Jonathan Druart 2019-05-13 10:36:14 -05:00 committed by Martin Renvoize
parent 3015fc1bae
commit 602d9c836b
Signed by: martin.renvoize
GPG key ID: 422B469130441A0F

View file

@ -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;