Bug 41622 - Make patron export use Koha::CSV
Summary: Make patron export use Koha::CSV
Status: Needs Signoff
Alias: None
Product: Koha
Classification: Unclassified
Component: Architecture, internals, and plumbing (show other bugs)
Version: Main
Hardware: All All
: P5 - low enhancement
Assignee: Tomás Cohen Arazi (tcohen)
QA Contact: Testopia
URL:
Keywords:
Depends on: 41619
Blocks: 41621
  Show dependency treegraph
 
Reported: 2026-01-14 20:19 UTC by Tomás Cohen Arazi (tcohen)
Modified: 2026-01-14 22:09 UTC (History)
2 users (show)

See Also:
GIT URL:
Initiative type: ---
Sponsorship status: ---
Comma delimited list of Sponsors:
Crowdfunding goal: 0
Patch complexity: Small patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:


Attachments
Bug 41622: Make patron export use Koha::CSV (11.72 KB, patch)
2026-01-14 20:24 UTC, Tomás Cohen Arazi (tcohen)
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Tomás Cohen Arazi (tcohen) 2026-01-14 20:19:36 UTC

    
Comment 1 Tomás Cohen Arazi (tcohen) 2026-01-14 20:24:01 UTC
Created attachment 191469 [details] [review]
Bug 41622: Make patron export use Koha::CSV

This patch introduces Koha::CSV::Patrons and updates misc/export_borrowers.pl
to use it, providing consistent CSV generation with proper quoting and
delimiter handling.

Changes:
- Add Koha::CSV::Patrons with dynamic field support
- Update misc/export_borrowers.pl to use Koha::CSV::Patrons
- Simplify export logic by removing manual CSV handling
- Maintain all existing functionality (field selection, custom separator)

The new class supports configurable field lists, making it flexible for
different patron export scenarios while ensuring consistent CSV formatting.

Test plan:
1. Apply patch
2. Run:
   $ ktd --shell
  k$ prove t/db_dependent/Koha/CSV/Patrons.t
=> SUCCESS: Tests pass!
3. Test patron export:
  k$ misc/export_borrowers.pl --show-header > patrons.csv
=> SUCCESS: CSV generated with all fields
4. Test with specific fields:
  k$ misc/export_borrowers.pl -H -f cardnumber -f surname -f firstname > patrons.csv
=> SUCCESS: Only specified fields exported
5. Test with custom separator:
  k$ misc/export_borrowers.pl -H -s=";" > patrons.csv
=> SUCCESS: Semicolon separator used
6. Open CSV in Excel
=> SUCCESS: Fields display correctly without quote issues
7. Sign off :-D