From 645e44dbd61c36dc084623d68999a1e5ac5b503d Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Mon, 26 Oct 2015 16:22:56 +0000 Subject: [PATCH] Bug 15032: Make sure the filehandle is not close on background mode With Plack, when a file is uploaded for import, the fh created on this file in Koha::Upload is closed. To be sure we are using an opened one, we need to open it in the current scope. Test plan: 1) Go to Tools --> Stage MARC records for import. 2) Upload file and click Import. 3) Click Stage for Import. You should not get any error and the records have been correctly staged. --- tools/stage-marc-import.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/stage-marc-import.pl b/tools/stage-marc-import.pl index 8d94cdd..8b73877 100755 --- a/tools/stage-marc-import.pl +++ b/tools/stage-marc-import.pl @@ -85,7 +85,7 @@ if ($completedJobID) { $template->param(map { $_ => $results->{$_} } keys %{ $results }); } elsif ($fileID) { my $upload = Koha::Upload->new->get({ id => $fileID, filehandle => 1 }); - my $fh = $upload->{fh}; + open my $fh, '<', $upload->{path}; my $filename = $upload->{name}; # filename only, no path my $marcrecord=''; $/ = "\035"; -- 2.1.0