https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41622

--- Comment #3 from Tomás Cohen Arazi (tcohen) <[email protected]> ---
Created attachment 203468
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=203468&action=edit
Bug 41622: Make patron export use Koha::CSV

This patch introduces Koha::CSV::Patrons, a subclass of Koha::CSV
that follows the columns() contract for patron CSV exports.

The class accepts a dynamic list of patron fields at construction
time and builds columns() from them. Each field becomes a column
with a value coderef that extracts it from the Koha::Patron object.

Virtual fields (description, category_type) are supported by
accessing the patron category directly.

Changes:
- Add Koha::CSV::Patrons following the columns() contract
- Update misc/export_borrowers.pl to use the new class
- Use export() with no_headers option
- Remove manual Text::CSV usage

Test plan:
1. Apply patches (depends on bug 41620)
2. Run:
   $ ktd --shell
   k$ prove t/db_dependent/Koha/CSV/Patrons.t
=> SUCCESS: Tests pass!
3. Test patron export:
   k$ perl misc/export_borrowers.pl --show-header > patrons.csv
=> SUCCESS: CSV generated with all fields
4. Test with specific fields:
   k$ perl misc/export_borrowers.pl -H -f cardnumber -f surname -f firstname >
patrons.csv
=> SUCCESS: Only specified fields exported
5. Test without header:
   k$ perl misc/export_borrowers.pl -f surname -f firstname > patrons.csv
=> SUCCESS: No header row, data only
6. Open CSV in LibreOffice
=> SUCCESS: Fields display correctly, diacritics preserved
7. Sign off :-D

-- 
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list -- [email protected]
To unsubscribe send an email to [email protected]
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to