Bug 30738: Log warnings for background MARC import

This change logs warnings from the CGI background MARC import.

Test plan:
0) Apply patch
1) Export a record with an item
2) Update the 952$f subfield to "Circulation" (any value over 10 chars)
3) Import the record and try to add the item
4) The import will stay stuck with "Importing" status and 0% job
progress
5) Check the /var/log/koha/kohadev/intranet-error.log file
and notice there's an error with the following text:
"Data too long for column 'coded_location_qualifier' at row 1"

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
David Cook 2022-05-12 04:09:58 +00:00 committed by Tomas Cohen Arazi
parent 556a910021
commit 9d8d9321e8
Signed by: tomascohen
GPG key ID: 0A272EA1B2F3C15F

View file

@ -35,6 +35,8 @@ use C4::BackgroundJob;
use C4::Labels::Batch; use C4::Labels::Batch;
use Koha::BiblioFrameworks; use Koha::BiblioFrameworks;
use Koha::Logger;
my $script_name = "/cgi-bin/koha/tools/manage-marc-import.pl"; my $script_name = "/cgi-bin/koha/tools/manage-marc-import.pl";
my $input = CGI->new; my $input = CGI->new;
@ -330,6 +332,11 @@ sub put_in_background {
# we're now running in the background # we're now running in the background
close STDOUT; close STDOUT;
close STDERR; close STDERR;
$SIG{__WARN__} = sub {
my ($msg) = @_;
my $logger = Koha::Logger->get;
$logger->warn($msg);
}
} else { } else {
# fork failed, so exit immediately # fork failed, so exit immediately
warn "fork failed while attempting to run tools/manage-marc-import.pl as a background job"; warn "fork failed while attempting to run tools/manage-marc-import.pl as a background job";