From 7095ef2fa757cca641cd4236878cdec3bbaa8479 Mon Sep 17 00:00:00 2001 From: Marcel de Rooy Date: Fri, 2 Jun 2023 09:10:01 +0000 Subject: [PATCH] Bug 33493: (QA follow-up) Only bless the first transfer No need to do a walk through on all the results. Correcting two test descriptions on the way. Test plan: Run t/db_dependent/Koha/Item.t Run t/db_dependent/Koha/Items.t Signed-off-by: Marcel de Rooy Signed-off-by: Tomas Cohen Arazi --- Koha/Item.pm | 5 ++--- t/db_dependent/Koha/Item.t | 2 +- t/db_dependent/Koha/Items.t | 2 +- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/Koha/Item.pm b/Koha/Item.pm index 7f5362dc68..04428facdd 100644 --- a/Koha/Item.pm +++ b/Koha/Item.pm @@ -565,9 +565,8 @@ we still expect the item to end up at a final location eventually. sub get_transfer { my ($self) = @_; - my $transfer = $self->_result->current_branchtransfers; - - return Koha::Item::Transfers->_new_from_dbic($transfer)->next; + my $transfer = $self->_result->current_branchtransfers->next; + return Koha::Item::Transfer->_new_from_dbic($transfer) if $transfer; } =head3 get_transfers diff --git a/t/db_dependent/Koha/Item.t b/t/db_dependent/Koha/Item.t index c5fd5fec1a..000a7dc7f4 100755 --- a/t/db_dependent/Koha/Item.t +++ b/t/db_dependent/Koha/Item.t @@ -2189,7 +2189,7 @@ subtest 'current_branchtransfers relationship' => sub { ); my $transfers = $item->_result->current_branchtransfers; is( ref($transfers), 'DBIx::Class::ResultSet', - 'current_branchtransfers returns a Koha::Item::Transfers object set' ); + 'current_branchtransfers returns a DBIx::Class::ResultSet' ); is( $transfers->count, 0, "Empty Koha::Item::Transfers set returned if no return_claims" ); my $transfer1 = $builder->build( diff --git a/t/db_dependent/Koha/Items.t b/t/db_dependent/Koha/Items.t index 5676a56596..407425e687 100755 --- a/t/db_dependent/Koha/Items.t +++ b/t/db_dependent/Koha/Items.t @@ -1390,7 +1390,7 @@ subtest 'get_transfer' => sub { ); $transfer = $new_item_1->get_transfer(); - is( ref($transfer), 'Koha::Item::Transfer', 'Koha::Item->get_transfer should return a Koha::Item::Transfers object' ); + is( ref($transfer), 'Koha::Item::Transfer', 'Koha::Item->get_transfer should return a Koha::Item::Transfer object' ); my $transfer_2 = $builder->build_object( { -- 2.39.5