Bug 32894: Remove incorrect caching from bundle_items

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
This commit is contained in:
Martin Renvoize 2023-04-21 11:18:35 +01:00 committed by Tomas Cohen Arazi
parent 45d882de53
commit 8e2d841a29
No known key found for this signature in database
GPG Key ID: 0A272EA1B2F3C15F
2 changed files with 5 additions and 9 deletions

View File

@ -1622,15 +1622,8 @@ Returns the items associated with this bundle
sub bundle_items {
my ($self) = @_;
if ( !$self->{_bundle_items_cached} ) {
my $bundle_items = Koha::Items->search(
{ 'item_bundles_item.host' => $self->itemnumber },
{ join => 'item_bundles_item' } );
$self->{_bundle_items} = $bundle_items;
$self->{_bundle_items_cached} = 1;
}
return $self->{_bundle_items};
my $rs = $self->_result->bundle_items;
return Koha::Items->_new_from_dbic($rs);
}
=head3 is_bundle

View File

@ -982,6 +982,9 @@ __PACKAGE__->has_many(
}
);
# Relationship with bundled items
__PACKAGE__->many_to_many( bundle_items => 'item_bundles_hosts', 'item' );
__PACKAGE__->might_have(
"last_returned_by",
"Koha::Schema::Result::ItemsLastBorrower",