https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=44282 Bug ID: 44282 Summary: Import patrons reads columns by position, not by the header row, when a line has every column Initiative type: --- Sponsorship --- status: Product: Koha Version: Main Hardware: All OS: All Status: NEW Severity: major Priority: P5 - low Component: Tools Assignee: koha-bugs@lists.koha-community.org Reporter: babarjunaid1122@gmail.com QA Contact: testopia@bugs.koha-community.org Target Milestone: --- Koha::Patrons::Import->import_patrons reads the header row, but for a line whose number of fields equals the number of importable columns it ignores the header and assigns the values by position: } elsif ( @columns == @columnkeys ) { @borrower{@columnkeys} = @columns; So a file with every column, but not in Koha's own order (columns moved in a spreadsheet, a file from another tool), is imported into the wrong fields, with no warning. Only files that leave out at least one column are read by the header. To reproduce (main): 1. ExtendedPatronAttributes = Don't enable. Take the full column list (the starter CSV on Tools > Import patrons) and swap the surname and firstname headers. 2. Add one line with surname "Headerorder", firstname "Swapped" (under their headers), a card number, a library and a category. 3. Import it: 1 imported, no error. The patron's surname is "Swapped" and the first name "Headerorder". 4. With ExtendedPatronAttributes = Enable (the file then has a patron_attributes column too), the same line is refused with an "unknown error": the positional branch turns the empty patron_attributes cell into undef and generate_patron_attributes dies ("Can't use an undefined value as an ARRAY reference", Import.pm line 452). Expected: the header row always decides which value goes to which field. Reproduced on main (c8e8025). -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.