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 <tomascohen@theke.io>
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 ) {