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

--- Comment #20 from David Nind <[email protected]> ---
Created attachment 203503
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=203503&action=edit
Bug 41620: Introduce Koha::CSV::ItemSearch for CSV exports

This patch introduces Koha::CSV::ItemSearch, a thin subclass of
Koha::CSV that defines the column schema for item search CSV exports.

The class only overrides columns() with 21 column definitions,
leveraging the base class export workflow for serialization, UTF-8
output, and row iteration.

Changes:
- Add Koha::CSV::ItemSearch with column definitions using:
  - Koha::AuthorisedValues->description_for for AV fields (cached)
  - Koha::Libraries->name_for for library resolution (cached)
  - Koha::ItemTypes->description_for for item types (cached)
  - __x() with named placeholders for UNIMARC title translatability
  - DateFormat system preference for date formatting
- Update itemsearch.pl to use $csv->export()
- Update item-export.pl to use $csv->export()
- Remove obsolete CSV templates

Test plan:
1. Apply patches
2. Run:
   $ ktd --shell
   k$ prove t/Koha/CSV.t t/db_dependent/Koha/CSV/ItemSearch.t
=> SUCCESS: Tests pass!
3. Set DateFormat to dd/mm/yyyy
4. Go to Cataloging > Item search, search, export CSV
5. Open in LibreOffice (select UTF-8 encoding on import)
=> SUCCESS: Diacritics display correctly
=> SUCCESS: Dates use dd/mm/yyyy format
=> SUCCESS: Status columns empty for available items
=> SUCCESS: All 21 columns present
6. Test item-export.pl from record detail page
=> SUCCESS: Same correct output
7. Sign off :-D

Signed-off-by: David Nind <[email protected]>

-- 
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