From 56195db216d3dd55549a166fdd9e61987b0e9f45 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 --- Koha/Patrons/Import.pm | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Koha/Patrons/Import.pm b/Koha/Patrons/Import.pm index 91ab8fbc4c..3b3d5865a8 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.39.5