[Koha-bugs] [Bug 31933] New: import patrons fails when patron attribute value contains a comma
bugzilla-daemon at bugs.koha-community.org
bugzilla-daemon at bugs.koha-community.org
Mon Oct 24 11:18:07 CEST 2022
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=31933
Bug ID: 31933
Summary: import patrons fails when patron attribute value
contains a comma
Change sponsored?: ---
Product: Koha
Version: 21.11
Hardware: All
OS: All
Status: NEW
Severity: enhancement
Priority: P5 - low
Component: Tools
Assignee: koha-bugs at lists.koha-community.org
Reporter: bernard.scaife at ptfs-europe.com
QA Contact: testopia at bugs.koha-community.org
Created attachment 142475
-->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=142475&action=edit
patron upload file with the comma
If patron attribute value contains a comma, the record is not imported
Test:
1. create test.csv with unique cardnumber, mandatory fields surname, branchcode
and categorycode and patron attributes
2. Patron attributes to contain a value which includes a comma each key/value
pair surrounded by double-quotes
"COURSE:Government, Economics and Commerce","CSCODE:ABC1234"
3. Ensure patron attribute types COURSE and CSCODE exist
4. Import with default values via patron import tool (cardnumber match)
5. If fails to import
Import results :
0 imported records
0 overwritten
0 not imported because already in borrowers table and overwrite disabled
1 not imported because they are not in the expected format
1 records parsed
Back to Tools
Feedback:
headerrow : cardnumber, surname, branchcode, categorycode, patron_attributes
attribute string : COURSE:Government, Economics and Commerce
Content-Type : text/csv
Content-Disposition : form-data; name="uploadborrowers";
filename="patron_import_test.csv"
Parsing upload file patron_import_test.csv
Error analysis:
Patron attribute Economics and Commerce is invalid for patron A12364162383.
Repeat above but with file that doesn't have the comma:
"COURSE:Government Economics and Commerce","CSCODE:ABC1234"
Import succeeds
comment: I was able to resolve as follows
$string =~ s/,//g; on line 563 within sub generate_patron_attributes of
/usr/share/koha/lib/Koha/Patrons/Import.pm
# Fixup double quotes in case we are passed smart quotes
$string =~ s/\xe2\x80\x9c/"/g;
$string =~ s/\xe2\x80\x9d/"/g;
+$string =~ s/,//g;
--
You are receiving this mail because:
You are the assignee for the bug.
You are watching all bug changes.
More information about the Koha-bugs
mailing list