Bug 43168: Check if there are errors, not if variable defined

$errors is an array ref returned from a blank array variable

if( $errors ){ #this will be true

if( scalar @$errors ){ #only true when array has members

To test:
1 - tail -f /var/log/koha/kohadev/intranet-error.log
2 - Stage a marc file
3 - Note the error:
==> /var/log/koha/kohadev/intranet-error.log <==
[2026/07/23 19:11:37] [WARN] The following error(s) occurred during ISO2709 record import:
ERROR:  Koha::ImportBatch::try {...}  /kohadevbox/koha/Koha/ImportBatch.pm (105)
4 - Apply patch
5 - Restart all
6 - Stage a file
7 - No error!

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Pedro Amorim <pedro.amorim@openfifth.co.uk>
This commit is contained in:
Nick Clemens 2026-07-23 19:16:28 +00:00 committed by Pedro Amorim
parent d5715ed753
commit c13096326f
No known key found for this signature in database
GPG Key ID: 06B75BA7F3894D55
1 changed files with 1 additions and 1 deletions

View File

@ -102,7 +102,7 @@ sub new_from_file {
);
}
if ($errors) {
if ( scalar @$errors ) {
Koha::Logger->get->warn( 'The following error(s) occurred during '
. ( defined $format ? ( $format . " " ) : "" )
. "record import:\nERROR: "