When running: > sudo koha-shell -v -c "/usr/share/koha/bin/import_patrons.pl --file /home/kohasync/incomingfile/borrowers.csv --matchpoint userid --confirm --overwrite --verbose" our_instance_name We get a bunch of: > Argument "" isn't numeric in numeric eq (==) at /usr/share/perl5/DBIx/Class/Row.pm line 1018, <$handle> line 490. per import row. When I add some say STDERR lines just before it, I get: > Argument "" isn't numeric in numeric eq (==) at /usr/share/perl5/DBIx/Class/Row.pm line 1019, <$handle> line 490. > OLD: 0, NEW: , COL: lost > > Argument "" isn't numeric in numeric eq (==) at /usr/share/perl5/DBIx/Class/Row.pm line 1019, <$handle> line 490. > OLD: 0, NEW: , COL: privacy_guarantor_checkouts > > Argument "" isn't numeric in numeric eq (==) at /usr/share/perl5/DBIx/Class/Row.pm line 1019, <$handle> line 490. > OLD: 0, NEW: , COL: lost > None of those fields (privacy_guarantor_checkouts, lost, etc.) are included in the CSV import.
I am expecting to see these warnings removed by bug 21596, but the patches will not be backported into 18.05.x I will try to confirm that later.
Just FYI - I've upgraded to 18.11.01.000 and the behaviour seems the same.
I do not recreate against master, can you share an example file?
I would expect the warnings to appear if you are doing an update, not an insert.
I see these warnings for updates, on 18.11.05.000. When I do this: elsif ($self->_is_column_numeric($col)) { # do a numeric comparison if datatype allows it warn $col; return $old == $new; } it seems that the privacy_guarantor_checkouts field is the culprit. All the borrowers in the database have a 0 value for this column, do maybe there is a false assumption that the new patron data will always have a numeric value for this field, but in fact it is just empty if it is not included in the imported data?
Could something like this be a solution? elsif ($new && $self->_is_column_numeric($col)) { # do a numeric comparison if datatype allows it return $old == $new; }
Updating the version according to comments.
Had another look at this, and it looks like the "Argument "" isn't numeric in numeric" is triggered for culumns that have a default_value of 0.
Created attachment 100755 [details] [review] Bug 22025: Add a regression test
Created attachment 100756 [details] [review] 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
Created attachment 100893 [details] [review] Bug 22025: Add a regression test Signed-off-by: Magnus Enger <magnus@libriotech.no>
Created attachment 100894 [details] [review] 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 <magnus@libriotech.no> Applied the patch on a live server and the warnings went away.
I do get a bunch of errors when I try to run the tests in kohadevbox, but that might be caused by bad data in my instance? $ sudo koha-shell -c "prove t/db_dependent/Koha/Patrons/Import.t" kohadev t/db_dependent/Koha/Patrons/Import.t .. 1/157 # Failed test 'Got the expected 0 size error array from import_patrons with no matchpoint defined' # at t/db_dependent/Koha/Patrons/Import.t line 105. # got: '2' # expected: '0' # Failed test 'Got the expected second feedback from import_patrons with no matchpoint defined' # at t/db_dependent/Koha/Patrons/Import.t line 111. # got: undef # expected: '1' # Failed test 'Got the expected last imported name from import_patrons with no matchpoint defined' # at t/db_dependent/Koha/Patrons/Import.t line 112. # got: undef # expected: 'lastimported' # Failed test 'Got the expected second header row value from import_patrons with no matchpoint defined' # at t/db_dependent/Koha/Patrons/Import.t line 113. # undef # doesn't match '(?^u:^Nancy / \d+)' # Failed test 'Got the expected 1 imported result from import_patrons with no matchpoint defined' # at t/db_dependent/Koha/Patrons/Import.t line 115. # got: '0' # expected: '1' # Failed test 'Got the expected 0 invalid result from import_patrons with no matchpoint defined' # at t/db_dependent/Koha/Patrons/Import.t line 116. # got: '1' # expected: '0' # Failed test 'Got the expected 1000 card number from import patrons with invalid card number' # at t/db_dependent/Koha/Patrons/Import.t line 130. # got: undef # expected: '1000' # Failed test 'Got the expected invalid card number from import patrons with invalid card number' # at t/db_dependent/Koha/Patrons/Import.t line 131. # got: undef # expected: '1' # Failed test 'Got the expected 1 already_in_db from import_patrons with duplicate userid' # at t/db_dependent/Koha/Patrons/Import.t line 150. # got: '0' # expected: '1' # Failed test 'Got the expected 0 invalid result from import_patrons' # at t/db_dependent/Koha/Patrons/Import.t line 159. # got: '1' # expected: '0' # Failed test 'Got the expected 0 invalid result from import_patrons' # at t/db_dependent/Koha/Patrons/Import.t line 180. # got: '1' # expected: '0' # Failed test 'Got the expected 1 overwritten result from import_patrons that matched' # at t/db_dependent/Koha/Patrons/Import.t line 181. # got: '0' # expected: '1' # Failed test 'Got the expected duplicate userid error from import patrons with duplicate userid' # at t/db_dependent/Koha/Patrons/Import.t line 193. # got: undef # expected: '1' # Failed test 'Got the expected userid error from import patrons with duplicate userid' # at t/db_dependent/Koha/Patrons/Import.t line 194. # got: undef # expected: 'jjenkins0' t/db_dependent/Koha/Patrons/Import.t .. 57/157 # Failed test 'Got the expected 0 size error array from import_patrons with extended user' # at t/db_dependent/Koha/Patrons/Import.t line 220. # got: '2' # expected: '0' # Failed test 'Got the expected third feedback from import_patrons with extended user' # at t/db_dependent/Koha/Patrons/Import.t line 230. # got: undef # expected: '1' # Failed test 'Got the expected last imported name from import_patrons with extended user' # at t/db_dependent/Koha/Patrons/Import.t line 231. # got: undef # expected: 'lastimported' # Failed test 'Got the expected third feedback value from import_patrons with extended user' # at t/db_dependent/Koha/Patrons/Import.t line 232. # undef # doesn't match '(?^u:^Donna / \d+)' # Failed test 'Got the expected 1 imported result from import_patrons with extended user' # at t/db_dependent/Koha/Patrons/Import.t line 234. # got: '0' # expected: '1' # Failed test 'Got the expected 0 invalid result from import_patrons with extended user' # at t/db_dependent/Koha/Patrons/Import.t line 235. # got: '1' # expected: '0' # Failed test 'Got the expected 1 already_in_db from import_patrons with extended user matched' # at t/db_dependent/Koha/Patrons/Import.t line 240. # got: '0' # expected: '1' # Failed test 'Got the expected 0 size error array from import_patrons with extended user matched' # at t/db_dependent/Koha/Patrons/Import.t line 241. # got: '2' # expected: '0' # Failed test 'Got the expected already_in_db from import_patrons with extended user matched' # at t/db_dependent/Koha/Patrons/Import.t line 251. # got: undef # expected: '1' # Failed test 'Got the expected third feedback value from import_patrons with extended user matched' # at t/db_dependent/Koha/Patrons/Import.t line 252. # undef # doesn't match '(?^u:^Donna / \d+)' # Failed test 'Got the expected 0 invalid result from import_patrons with extended user matched' # at t/db_dependent/Koha/Patrons/Import.t line 255. # got: '1' # expected: '0' # Failed test 'Got the expected undef borrower number error from import patrons for branch tests' # at t/db_dependent/Koha/Patrons/Import.t line 282. # got: undef # expected: 'UNDEF' # Failed test 'Got the expected 1 branchmap error from import patrons for branch tests' # at t/db_dependent/Koha/Patrons/Import.t line 283. # got: undef # expected: '1' # Failed test 'Got the expected branch code key from import patrons for branch tests' # at t/db_dependent/Koha/Patrons/Import.t line 284. # got: undef # expected: 'branchcode' # Failed test 'Got the expected 4 line number error from import patrons for branch tests' # at t/db_dependent/Koha/Patrons/Import.t line 285. # got: undef # expected: '4' # Failed test 'Got the expected lineraw error from import patrons for branch tests' # at t/db_dependent/Koha/Patrons/Import.t line 286. Wide character in print at /usr/share/perl5/Test2/Formatter/TAP.pm line 105, <$handle_5> line 4. # got: undef # expected: '1005,Chloé❤,Greene,Mr,Michael,RG,3,Avenue,Grim,Peoria,Jacksonville,Illinois,61614,United States,mgreene5@seesaa.net,3-(941)565-5752,1-(483)885-8138,4-(979)577-6908,02/09/1957,ZZZ,ST,04/02/2015,07/01/2015,mgreene5,or4ORT6JH # ' # Failed test 'Got the expected surname error from import patrons for branch tests' # at t/db_dependent/Koha/Patrons/Import.t line 287. Wide character in print at /usr/share/perl5/Test2/Formatter/TAP.pm line 105, <$handle_5> line 4. # got: undef # expected: 'Chloé❤' # Failed test 'Got the expected ZZZ value error from import patrons for branch tests' # at t/db_dependent/Koha/Patrons/Import.t line 288. # got: undef # expected: 'ZZZ' # Failed test 'Got the expected 1 feedback from import_patrons for branch tests' # at t/db_dependent/Koha/Patrons/Import.t line 294. # got: undef # expected: '1' # Failed test 'Got the expected lastimported name from import_patrons for branch tests' # at t/db_dependent/Koha/Patrons/Import.t line 295. # got: undef # expected: 'lastimported' # Failed test 'Got the expected last imported value from import_patrons with for branch tests' # at t/db_dependent/Koha/Patrons/Import.t line 296. Wide character in print at /usr/share/perl5/Test2/Formatter/TAP.pm line 105, <$handle_5> line 4. # undef # doesn't match '(?^u:^Chloé❤ / \d+)' # Failed test 'Got the expected 1 imported result from import patrons for branch tests' # at t/db_dependent/Koha/Patrons/Import.t line 298. # got: '0' # expected: '1' # Failed test 'Got the expected 2 invalid result from import patrons for branch tests' # at t/db_dependent/Koha/Patrons/Import.t line 299. # got: '3' # expected: '2' # Failed test 'Got the expected undef borrower number error from import patrons for category tests' # at t/db_dependent/Koha/Patrons/Import.t line 323. # got: undef # expected: 'UNDEF' # Failed test 'Got the expected 1 category_map error from import patrons for category tests' # at t/db_dependent/Koha/Patrons/Import.t line 324. # got: undef # expected: '1' # Failed test 'Got the expected category code key from import patrons for category tests' # at t/db_dependent/Koha/Patrons/Import.t line 325. # got: undef # expected: 'categorycode' # Failed test 'Got the expected 4 line number error from import patrons for category tests' # at t/db_dependent/Koha/Patrons/Import.t line 326. # got: undef # expected: '4' # Failed test 'Got the expected lineraw error from import patrons for category tests' # at t/db_dependent/Koha/Patrons/Import.t line 327. # got: undef # expected: '1008,Emily,Richards,Ms,Judy,ER,73,Way,Kedzie,Fort Wayne,Phoenix,Indiana,46825,United States,jrichards8@arstechnica.com,5-(266)658-8957,3-(550)500-9107,7-(816)675-9822,08/09/1984,FFL,ZZ,11/09/2014,07/01/2015,jrichards8,D5PvU6H2R # ' # Failed test 'Got the expected surname error from import patrons for category tests' # at t/db_dependent/Koha/Patrons/Import.t line 328. # got: undef # expected: 'Emily' # Failed test 'Got the expected ZZ value error from import patrons for category tests' # at t/db_dependent/Koha/Patrons/Import.t line 329. # got: undef # expected: 'ZZ' # Failed test 'Got the expected 1 feedback from import_patrons for category tests' # at t/db_dependent/Koha/Patrons/Import.t line 335. # got: undef # expected: '1' # Failed test 'Got the expected lastimported name from import_patrons for category tests' # at t/db_dependent/Koha/Patrons/Import.t line 336. # got: undef # expected: 'lastimported' # Failed test 'Got the expected last imported value from import_patrons with for category tests' # at t/db_dependent/Koha/Patrons/Import.t line 337. # undef # doesn't match '(?^u:^Peter / \d+)' # Failed test 'Got the expected 1 imported result from import patrons for category tests' # at t/db_dependent/Koha/Patrons/Import.t line 339. # got: '0' # expected: '1' # Failed test 'Got the expected 2 invalid result from import patrons for category tests' # at t/db_dependent/Koha/Patrons/Import.t line 340. # got: '3' # expected: '2' # Failed test 'Got the expected 1 error array size from import_patrons for dates tests' # at t/db_dependent/Koha/Patrons/Import.t line 356. # got: '3' # expected: '1' # Failed test 'Got the expected 3 missing critical errors from import_patrons for dates tests' # at t/db_dependent/Koha/Patrons/Import.t line 357. # got: '0' # expected: '3' # Failed test 'Got the expected 1 bad_date error from import patrons for dates tests' # at t/db_dependent/Koha/Patrons/Import.t line 359. # got: undef # expected: '1' # Failed test 'Got the expected undef borrower number error from import patrons for dates tests' # at t/db_dependent/Koha/Patrons/Import.t line 360. # got: undef # expected: 'UNDEF' # Failed test 'Got the expected dateofbirth key from import patrons for dates tests' # at t/db_dependent/Koha/Patrons/Import.t line 361. # got: undef # expected: 'dateofbirth' # Failed test 'Got the expected 2 line number error from import patrons for dates tests' # at t/db_dependent/Koha/Patrons/Import.t line 362. # got: undef # expected: '3' # Failed test 'Got the expected lineraw error from import patrons for dates tests' # at t/db_dependent/Koha/Patrons/Import.t line 363. # got: undef # expected: '1010,Ralph,Warren,Ms,Linda,RW,6,Way,Barby,Orlando,Albany,Florida,32803,United States,lwarrena@multiply.com,7-(579)753-7752,6-(847)086-7566,9-(122)729-8226,26/01/2001,LPL,T,25/01/2001,24/01/2001,lwarrena,tJ56RD4uV # ' # Failed test 'Got the expected surname error from import patrons for dates tests' # at t/db_dependent/Koha/Patrons/Import.t line 364. # got: undef # expected: 'Ralph' # Failed test 'Got the expected dateenrolled key from import patrons for dates tests' # at t/db_dependent/Koha/Patrons/Import.t line 366. # got: undef # expected: 'dateenrolled' # Failed test 'Got the expected dateexpiry key from import patrons for dates tests' # at t/db_dependent/Koha/Patrons/Import.t line 367. # got: undef # expected: 'dateexpiry' # Failed test 'Got the expected 2 feedback from import patrons for dates tests' # at t/db_dependent/Koha/Patrons/Import.t line 369. # got: '1' # expected: '2' # Failed test 'Got the expected 1 feedback from import_patrons for dates tests' # at t/db_dependent/Koha/Patrons/Import.t line 374. # got: undef # expected: '1' # Failed test 'Got the expected lastimported from import_patrons for dates tests' # at t/db_dependent/Koha/Patrons/Import.t line 375. # got: undef # expected: 'lastimported' # Failed test 'Got the expected lastimported value from import_patrons for dates tests' # at t/db_dependent/Koha/Patrons/Import.t line 376. # undef # doesn't match '(?^u:^Christina / \d+)' # Failed test 'Got the expected 1 imported result from import patrons for dates tests' # at t/db_dependent/Koha/Patrons/Import.t line 378. # got: '0' # expected: '1' # Failed test 'Got the expected 1 invalid result from import patrons for dates tests' # at t/db_dependent/Koha/Patrons/Import.t line 379. # got: '2' # expected: '1' t/db_dependent/Koha/Patrons/Import.t .. 149/157 # Looks like you failed 65 tests of 157. t/db_dependent/Koha/Patrons/Import.t .. Dubious, test returned 65 (wstat 16640, 0x4100) Failed 65/157 subtests Test Summary Report ------------------- t/db_dependent/Koha/Patrons/Import.t (Wstat: 16640 Tests: 157 Failed: 65) Failed tests: 10, 14-18, 22-23, 30, 37, 46-47, 49-50 58, 65-69, 71-72, 79-80, 82, 90-96, 100-104 112-118, 122-126, 129-139, 143-147 Non-zero exit status: 65 Files=1, Tests=157, 8 wallclock secs ( 0.04 usr 0.02 sys + 6.90 cusr 0.36 csys = 7.32 CPU) Result: FAIL The test added by the current patch changes this to "Failed 65/158 subtests", so at least it seems the added test is passing.
Created attachment 101106 [details] [review] Bug 22025: Add a regression test Signed-off-by: Magnus Enger <magnus@libriotech.no> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Created attachment 101107 [details] [review] 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 <magnus@libriotech.no> Applied the patch on a live server and the warnings went away. Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Nice work everyone! Pushed to master for 20.05
backported to 19.11.x for 19.11.05