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>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Joy Nelson <joy@bywatersolutions.com>
This commit is contained in:
Jonathan Druart 2020-03-16 15:43:49 +01:00 committed by Joy Nelson
parent 32e0e6dafd
commit 78f1045110
1 changed files with 9 additions and 0 deletions

View File

@ -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