diff --git a/Koha/BackgroundJob/ImportKBARTFile.pm b/Koha/BackgroundJob/ImportKBARTFile.pm index d17dcf502f..b1da1bb06f 100644 --- a/Koha/BackgroundJob/ImportKBARTFile.pm +++ b/Koha/BackgroundJob/ImportKBARTFile.pm @@ -241,14 +241,16 @@ sub read_file { my $headers_to_check = $csv->getline($fh); my $column_headers = rescue_EBSCO_files($headers_to_check); my $lines = $csv->getline_all( $fh, 0 ); - - my ( $cde, $str, $pos ) = $csv->error_diag(); - my $error = $cde ? "$cde, $str, $pos" : ""; - warn $error if $error; - close($fh); - return ( $column_headers, $lines, $error ); + unless($csv->eof()) { + my ( $cde, $str, $pos ) = $csv->error_diag(); + my $error = $cde ? "$cde, $str, $pos" : ""; + warn $error if $error; + return ( $column_headers, $lines, $error ); + } + + return ( $column_headers, $lines ); } =head3 create_title_hash_from_line_data