From 9dde8c1632983606f6ffac8a23314a3885473ba9 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Mon, 26 Oct 2015 13:59:06 +0000 Subject: [PATCH] Bug 14778: Make Search.t pass - replace SHOW COLUMNS For an unkown reason, when executed from a test file, the 'SHOW COLUMNS' statement does not return anything. We need to retrieve the column list from the DBIx::Class resultset. Signed-off-by: Tomas Cohen Arazi --- C4/Search.pm | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/C4/Search.pm b/C4/Search.pm index e0f34bf80e..1a8bba03ad 100644 --- a/C4/Search.pm +++ b/C4/Search.pm @@ -1889,10 +1889,9 @@ sub searchResults { my ($itemtag, undef) = &GetMarcFromKohaField( "items.itemnumber", "" ); ## find column names of items related to MARC - my $sth2 = $dbh->prepare("SHOW COLUMNS FROM items"); - $sth2->execute; my %subfieldstosearch; - while ( ( my $column ) = $sth2->fetchrow ) { + my @columns = Koha::Database->new()->schema()->resultset('Item')->result_source->columns; + for my $column ( @columns ) { my ( $tagfield, $tagsubfield ) = &GetMarcFromKohaField( "items." . $column, "" ); if ( defined $tagsubfield ) { -- 2.39.5