Bug 9045 - Adding some parameters to export_borrowers.pl

Followup : Adding test if results has some records and usage example for
--where clause

Signed-off-by: Owen Leonard <oleonard@myacpl.org>

I infer from the bug comments that a proper test for this patch is to
check how the script reacts if it returns no results with a --where
clause, and to verify that there is a good usage example for the --where
option. These are both true, so I think this passes.

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
All tests and QA script pass.

Tests done:
- tested -s option with \;
- tested -f surname -f borrowernumber to have multiple fields specified
- tested -w with "borrowernumber > 100" and similar with and without
  results - if no results a message is shown
- tested -h shows documentation for new options
Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
This commit is contained in:
Sophie Meynieux 2013-03-18 15:29:42 +01:00 committed by Jared Camins-Esakov
parent 74090b8d39
commit e8b470ede4
1 changed files with 5 additions and 2 deletions

View File

@ -50,7 +50,10 @@ $0 -h
If no separator is specifield, a comma will be used.
-H, --show-header Print field names on first row
-w, --where=CONDITION Condition to filter borrowers to export
(SQL where clause)
(SQL where clause).
CONDITION must be enclosed by double quotes and
if needed, where value by single quotes.
example : --where "surname='De Lattre'"
-h, --help Show this help
USAGE
@ -88,7 +91,7 @@ my $csv = Text::CSV->new( { sep_char => $separator, binary => 1 } );
# If the user did not specify any field to export, we assume he wants them all
# We retrieve the first borrower informations to get field names
my ($borrowernumber) = $sth->fetchrow_array;
my ($borrowernumber) = $sth->fetchrow_array or die "No borrower to export";
my $member = GetMemberDetails($borrowernumber);
@fields = keys %$member unless (@fields);