Bug 33497: Add a filter relationship for branchtransfers

This uses the new relationship from bug 33493 to fetch the transfers for items

To test:
1 - Transfer some items on a bib
2 - View the biblio details page in the staff interface
3 - Apply patch
4 - Confirm  the view is the same

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 2fe2a0aa03)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit f3890f6cb2)
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
This commit is contained in:
Nick Clemens 2023-03-10 16:14:50 +00:00 committed by Matt Blenkinsop
parent 9e780aaf84
commit da2bdbb726
2 changed files with 4 additions and 5 deletions

View File

@ -479,11 +479,10 @@ sub items {
return Koha::Items->_new_from_dbic( $items_rs ) unless $params->{host_items};
my @itemnumbers = $items_rs->get_column('itemnumber')->all;
my $host_itemnumbers = $self->_host_itemnumbers();
my $search_params = { -or => [biblionumber => $self->id] };
push @{$search_params->{'-or'}}, itemnumber => { -in => $host_itemnumbers } if $host_itemnumbers;
return Koha::Items->search($search_params);
push @itemnumbers, @{ $host_itemnumbers };
return Koha::Items->search({ "me.itemnumber" => { -in => \@itemnumbers } });
}
=head3 host_items

View File

@ -194,7 +194,7 @@ my $all_items = $biblio->items->search_ordered;
my @items;
my $patron = Koha::Patrons->find( $borrowernumber );
$params->{ itemlost } = 0 if $patron->category->hidelostitems && !$showallitems;
my $items = $biblio->items({ host_items => 1 })->search_ordered( $params, { prefetch => ['issue','branchtransfers'] } );
my $items = $biblio->items({ host_items => 1 })->search_ordered( $params, { prefetch => ['issue','branchtransfer'] } );
# flag indicating existence of at least one item linked via a host record
my $hostrecords = $biblio->host_items->count;