From 28552e5db0233a10dfccefcd48de268b858426cb Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Mon, 20 Jul 2020 15:16:29 +0200 Subject: [PATCH] Bug 24379: Fix failing tests (19.05: fix warnings) 19.05: The warning fix wasn't in 19.05 so not it was introduced in it's 2nd version. kohadev-koha@kohadevbox:/kohadevbox/koha$ prove t/db_dependent/Koha/Patrons/Import.t t/db_dependent/Koha/Patrons/Import.t .. 2/159 # Failed test 'No warning raised by import_patrons' # at t/db_dependent/Koha/Patrons/Import.t line 171. # found warning: Argument "" isn't numeric in numeric eq (==) at /usr/share/perl5/DBIx/Class/Row.pm line 1018, <$handle_3a> line 2. # found warning: Argument "" isn't numeric in numeric eq (==) at /usr/share/perl5/DBIx/Class/Row.pm line 1018, <$handle_3a> line 2. # didn't expect to find a warning Argument "" isn't numeric in numeric eq (==) at /usr/share/perl5/DBIx/Class/Row.pm line 1018, <$handle_2> line 2. Argument "" isn't numeric in numeric eq (==) at /usr/share/perl5/DBIx/Class/Row.pm line 1018, <$handle_2> line 2. Argument "" isn't numeric in numeric eq (==) at /usr/share/perl5/DBIx/Class/Row.pm line 1018, <$handle_3> line 2. Argument "" isn't numeric in numeric eq (==) at /usr/share/perl5/DBIx/Class/Row.pm line 1018, <$handle_3> line 2. Argument "" isn't numeric in numeric eq (==) at /usr/share/perl5/DBIx/Class/Row.pm line 1018, <$handle_4> line 2. Argument "" isn't numeric in numeric eq (==) at /usr/share/perl5/DBIx/Class/Row.pm line 1018, <$handle_4> line 2. t/db_dependent/Koha/Patrons/Import.t .. 152/159 # Looks like you failed 1 test of 159. t/db_dependent/Koha/Patrons/Import.t .. Dubious, test returned 1 (wstat 256, 0x100) Failed 1/159 subtests Test Summary Report ------------------- t/db_dependent/Koha/Patrons/Import.t (Wstat: 256 Tests: 159 Failed: 1) Failed test: 39 Non-zero exit status: 1 Files=1, Tests=159, 3 wallclock secs ( 0.04 usr 0.01 sys + 2.11 cusr 0.24 csys = 2.40 CPU) Result: FAIL Signed-off-by: Jonathan Druart (cherry picked from commit 545e03c173c789241eb21773a939b4ab7dcc6da4) Signed-off-by: Lucas Gass (cherry picked from commit c0e665aeccbc028f4289e7b1c144f844c05b5198) Signed-off-by: Aleisha Amohia (cherry picked from commit 493a0f2d540361ed4fef2157a9b852a1a57e126e) Signed-off-by: Victor Grousset/tuxayo --- Koha/Patrons/Import.pm | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/Koha/Patrons/Import.pm b/Koha/Patrons/Import.pm index 3437f38c35..f1bb06e3a9 100644 --- a/Koha/Patrons/Import.pm +++ b/Koha/Patrons/Import.pm @@ -217,6 +217,20 @@ sub import_patrons { next LINE; } + my $relationship = $borrower{relationship}; + my $guarantor_id = $borrower{guarantor_id}; + 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 login_attempts )) + { + delete $borrower{$field} + if exists $borrower{$field} and $borrower{$field} eq ""; + } + if ($borrowernumber) { # borrower exists -- 2.39.5