From 78f10451101b38bb160bb50941f377f5c41ea49e Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Mon, 16 Mar 2020 15:43:49 +0100 Subject: [PATCH] Bug 22025: Remove warnings when importing patrons The following warning is raised when importing patrons Argument "" isn't numeric in numeric eq (==) at /usr/share/perl5/DBIx/Class/Row.pm line 1018 if one of the following headers is passed but does not have a value: * privacy * privacy_guarantor_fines * privacy_guarantor_checkouts * anonymized Test plan: - Do not apply the patch - Generated a csv file with at least one those headers - Import it using the import_patrons.pl script (or using the GUI) - Notice the warnings without the patch - Apply the patch - Confirm that the warnings do not longer appear Signed-off-by: Magnus Enger Signed-off-by: Kyle M Hall Signed-off-by: Martin Renvoize Signed-off-by: Joy Nelson --- Koha/Patrons/Import.pm | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Koha/Patrons/Import.pm b/Koha/Patrons/Import.pm index f63d95e316..adc1d35a2b 100644 --- a/Koha/Patrons/Import.pm +++ b/Koha/Patrons/Import.pm @@ -222,6 +222,15 @@ sub import_patrons { delete $borrower{relationship}; delete $borrower{guarantor_id}; + # Remove warning for int datatype that cannot be null + # Argument "" isn't numeric in numeric eq (==) at /usr/share/perl5/DBIx/Class/Row.pm line 1018 + for my $field ( + qw( privacy privacy_guarantor_fines privacy_guarantor_checkouts anonymized )) + { + delete $borrower{$field} + if exists $borrower{$field} and $borrower{$field} eq ""; + } + if ($borrowernumber) { # borrower exists -- 2.20.1