Summary: | Command line utility for exporting borrowers | ||
---|---|---|---|
Product: | Koha | Reporter: | Julian Maurice <julian.maurice> |
Component: | Command-line Utilities | Assignee: | Julian Maurice <julian.maurice> |
Status: | CLOSED FIXED | QA Contact: | |
Severity: | enhancement | ||
Priority: | P5 - low | CC: | gaetan.boisson, jonathan.druart, paul.poulain, robin |
Version: | 3.10 | ||
Hardware: | All | ||
OS: | All | ||
Change sponsored?: | --- | Patch complexity: | --- |
Documentation contact: | Documentation submission: | ||
Text to go in the release notes: | Version(s) released in: | ||
Circulation function: | |||
Bug Depends on: | |||
Bug Blocks: | 9045 | ||
Attachments: |
Bug 8376: New script to export borrowers misc/export_borrowers.pl
[SIGNED-OFF] Bug 8376: New script to export borrowers misc/export_borrowers.pl Bug 8376: New script to export borrowers misc/export_borrowers.pl |
Description
Julian Maurice
2012-07-06 10:30:21 UTC
Created attachment 10665 [details] [review] Bug 8376: New script to export borrowers misc/export_borrowers.pl This script prints to standard output what is returned by GetMemberDetails in CSV format. Exported fields can be specified with option -f. If no -f option is specified, all fields are exported. Usage: misc/export_borrowers.pl [--field=FIELD [--field=FIELD [...]]] [--show-header] misc/export_borrowers.pl -h -f, --field=FIELD Field to export. It is repeatable and has to match keys returned by the GetMemberDetails function. If no field is specified, then all fields will be exported. -H, --show-header Print field names on first row -h, --help Show this help Created attachment 10672 [details] [review] [SIGNED-OFF] Bug 8376: New script to export borrowers misc/export_borrowers.pl This script prints to standard output what is returned by GetMemberDetails in CSV format. Exported fields can be specified with option -f. If no -f option is specified, all fields are exported. Signed-off-by: Gaetan Boisson <gaetan.boisson@biblibre.com> Tested various exciting possiblities : - Exporting borrowers with or without headers - Exporting data with commas inside the fields - Exporting a specified set of fields - Specifying a field that doesn't exist (you'll just get an empty column in the csv) It all works really well. Signing off! Found an issue: if a record contains an invalid character (e.g. a newline), a blank line is output. It's possible to see that something went wrong by noting that $csv->string is empty/undefined. It's also possible to make it deal with these by putting {binary=>1} in the contructor for Text::CSV. I've added some code to improve handling of funny data, and announcing that something is wrong when it can't be handled. Created attachment 11033 [details] [review] Bug 8376: New script to export borrowers misc/export_borrowers.pl This script prints to standard output what is returned by GetMemberDetails in CSV format. Exported fields can be specified with option -f. If no -f option is specified, all fields are exported. Signed-off-by: Gaetan Boisson <gaetan.boisson@biblibre.com> Signed-off-by: Robin Sheat <robin@catalyst.net.nz> Amended with some code to better handle bad data. QA Comments: Works well, code clean. Marking as Passed QA. It would be great to specify a list of borrowernumber (or cardnumber) to export (with a file given in parameter for example). QA comment: passes perlcritic (In reply to comment #6) > It would be great to specify a list of borrowernumber (or cardnumber) to > export (with a file given in parameter for example). Other possible enhancements : * provide the separator in a parameter * add a WHERE clause to filter, for example, on a given zipcode, categorycode, email,... Another comment: we don't have a coding guideline for that, but I think we should: the help should be in POD, like what we have, for example, in: misc/maintenance/touch_all_biblios.pl use Pod::Usage; sub usage { pod2usage( -verbose => 2 ); exit; } i'll send a mail to koha-devel to propose this rule. Patch pushed, though Ok in master. |