From 1c461f3063e8b77d52f35f1e4e5b22e487c66981 Mon Sep 17 00:00:00 2001 From: Fridolin Somers Date: Mon, 18 Mar 2024 15:18:27 +0100 Subject: [PATCH] Bug 36317: Add unit test If fails it shows : DBIx::Class::Storage::DBI::_dbh_execute(): DBI Exception: DBD::mysql::st execute failed: Column 'itemnumber' in where clause is ambiguous at /kohadevbox/koha/Koha/Objects.pm line 399 --- t/db_dependent/Koha/Biblio.t | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/t/db_dependent/Koha/Biblio.t b/t/db_dependent/Koha/Biblio.t index 017aeecc9f..701e0650cf 100755 --- a/t/db_dependent/Koha/Biblio.t +++ b/t/db_dependent/Koha/Biblio.t @@ -915,7 +915,7 @@ subtest 'get_marc_notes() UNIMARC tests' => sub { }; subtest 'host_items() tests' => sub { - plan tests => 7; + plan tests => 8; $schema->storage->txn_begin; @@ -946,6 +946,27 @@ subtest 'host_items() tests' => sub { is_deeply( [ $host_items->get_column('itemnumber') ], [ $host_item_1->itemnumber, $host_item_2->itemnumber ] ); + my $transfer = $builder->build_object( + { + class => 'Koha::Item::Transfers', + value => { + itemnumber => $host_item_1->itemnumber, + frombranch => $host_item_1->holdingbranch, + } + } + ); + ok( + $host_items->search( + {}, + { + join => 'branchtransfers', + order_by => 'branchtransfers.daterequested' + } + )->as_list, + "host_items can be used with a join query on itemnumber" + ); + $transfer->delete; + t::lib::Mocks::mock_preference( 'EasyAnalyticalRecords', 0 ); $host_items = $biblio->host_items; is( ref($host_items), 'Koha::Items' ); -- 2.44.0