[Bug 41622] New: Make patron export use Koha::CSV
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41622 Bug ID: 41622 Summary: Make patron export use Koha::CSV Initiative type: --- Sponsorship --- status: Product: Koha Version: Main Hardware: All OS: All Status: NEW Severity: enhancement Priority: P5 - low Component: Architecture, internals, and plumbing Assignee: koha-bugs@lists.koha-community.org Reporter: tomascohen@gmail.com QA Contact: testopia@bugs.koha-community.org -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41622 Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |41621 Status|NEW |ASSIGNED Assignee|koha-bugs@lists.koha-commun |tomascohen@gmail.com |ity.org | CC| |tomascohen@gmail.com Depends on| |41619 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41619 [Bug 41619] Add `Koha::CSV` https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41621 [Bug 41621] Use Koha::CSV everywhere [UMBRELLA] -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41622 Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|ASSIGNED |Needs Signoff Patch complexity|--- |Small patch -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41622 --- Comment #1 from Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> --- Created attachment 191469 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=191469&action=edit 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 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41622 David Cook <dcook@prosentient.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |dcook@prosentient.com.au -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41622 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Signed Off -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41622 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #191469|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41622 --- Comment #2 from David Nind <david@davidnind.com> --- Created attachment 191548 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=191548&action=edit 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 Signed-off-by: David Nind <david@davidnind.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41622 Bug 41622 depends on bug 41619, which changed state. Bug 41619 Summary: Add `Koha::CSV` https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41619 What |Removed |Added ---------------------------------------------------------------------------- Status|Needs documenting |RESOLVED Resolution|--- |FIXED -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41622 Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Depends on| |41620 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41620 [Bug 41620] Make itemsearch.pl use Koha::CSV for CSV generation -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41622 Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |Needs Signoff -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41622 Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #191548|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41622 --- Comment #3 from Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> --- 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.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41622 John Vinke <jvinke@austinseminary.edu> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Signed Off --- Comment #4 from John Vinke <jvinke@austinseminary.edu> --- Tested in Excel, not Libre, if that matters. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41622 John Vinke <jvinke@austinseminary.edu> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #203468|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41622 --- Comment #5 from John Vinke <jvinke@austinseminary.edu> --- Created attachment 203813 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=203813&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 Signed-off-by: John Vinke <jvinke@austinseminary.edu> -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org