From 826eda128e98f39e989a7da3af92e7f8b500eb75 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Sun, 17 Mar 2019 21:09:29 -0300 Subject: [PATCH] Bug 23463: Replace SearchItemsByField by SearchItems The subroutine SearchItemsByField is only called once and can be replaced easily with SearchItems Signed-off-by: Tomas Cohen Arazi Signed-off-by: Nick Clemens Signed-off-by: Martin Renvoize --- acqui/check_uniqueness.pl | 2 +- t/db_dependent/Items.t | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/acqui/check_uniqueness.pl b/acqui/check_uniqueness.pl index 70d95ddd7b..8b36e68af6 100755 --- a/acqui/check_uniqueness.pl +++ b/acqui/check_uniqueness.pl @@ -43,7 +43,7 @@ my @value = $input->multi_param('value[]'); my $r = {}; my $i = 0; for ( my $i=0; $i<@field; $i++ ) { - my $items = C4::Items::SearchItemsByField($field[$i], $value[$i]); + my ($items) = C4::Items::SearchItems({ field => $field[$i], query => $value[$i]}); if ( @$items ) { push @{ $r->{$field[$i]} }, $value[$i]; diff --git a/t/db_dependent/Items.t b/t/db_dependent/Items.t index da4b6f0400..981fa86e9e 100755 --- a/t/db_dependent/Items.t +++ b/t/db_dependent/Items.t @@ -439,7 +439,7 @@ subtest 'SearchItems test' => sub { }); t::lib::Mocks::mock_preference('marcflavour', 'MARC21'); - my $cpl_items_before = SearchItemsByField( 'homebranch', $library1->{branchcode}); + my ($cpl_items_before) = SearchItems( { field => 'homebranch', query => $library1->{branchcode} } ); my $biblio = $builder->build_sample_biblio({ title => 'Silence in the library' }); $builder->build_sample_biblio({ title => 'Silence in the shadow' }); @@ -595,8 +595,8 @@ subtest 'SearchItems test' => sub { ($items, $total_results) = SearchItems($filter); ok(scalar @$items == 1, 'found 1 item with itemnotes = "foobar"'); - my $cpl_items_after = SearchItemsByField( 'homebranch', $library1->{branchcode}); - is( ( scalar( @$cpl_items_after ) - scalar ( @$cpl_items_before ) ), 1, 'SearchItemsByField should return something' ); + my ($cpl_items_after) = SearchItems( { field => 'homebranch', query => $library1->{branchcode} } ); + is( ( scalar( @$cpl_items_after ) - scalar ( @$cpl_items_before ) ), 1, 'SearchItems should return something' ); # Issues count may be NULL $filter = { -- 2.39.5