View | Details | Raw Unified | Return to bug 8874
Collapse All | Expand All

(-)a/misc/export_borrowers.pl (-2 / +8 lines)
Lines 44-49 $0 -h Link Here
44
                            keys returned by the GetMemberDetails function.
44
                            keys returned by the GetMemberDetails function.
45
                            If no field is specified, then all fields will be
45
                            If no field is specified, then all fields will be
46
                            exported.
46
                            exported.
47
    -s, --separator=CHAR    This character will be used to separate fields.
48
                            Some characters like | or ; will need to be escaped
49
                            or surrounded by quotes in the parameter setting,
50
                            like -s=\\| or -s='|';
51
                            If no separator is specified, a comma will be used.
47
    -H, --show-header       Print field names on first row
52
    -H, --show-header       Print field names on first row
48
    -h, --help              Show this help
53
    -h, --help              Show this help
49
54
Lines 52-62 USAGE Link Here
52
57
53
# Getting parameters
58
# Getting parameters
54
my @fields;
59
my @fields;
60
my $separator;
55
my $show_header;
61
my $show_header;
56
my $help;
62
my $help;
57
63
58
GetOptions(
64
GetOptions(
59
    'field|f=s'     => \@fields,
65
    'field|f=s'     => \@fields,
66
    'separator|s=s' => \$separator,
60
    'show-header|H' => \$show_header,
67
    'show-header|H' => \$show_header,
61
    'help|h'        => \$help
68
    'help|h'        => \$help
62
) or print_usage, exit 1;
69
) or print_usage, exit 1;
Lines 72-78 my $query = "SELECT borrowernumber FROM borrowers ORDER BY borrowernumber"; Link Here
72
my $sth   = $dbh->prepare($query);
79
my $sth   = $dbh->prepare($query);
73
$sth->execute;
80
$sth->execute;
74
81
75
my $csv = Text::CSV->new( { binary => 1 } );
82
my $csv = Text::CSV->new( { sep_char => $separator, binary => 1 } );
76
83
77
# If the user did not specify any field to export, we assume he wants them all
84
# If the user did not specify any field to export, we assume he wants them all
78
# We retrieve the first borrower informations to get field names
85
# We retrieve the first borrower informations to get field names
79
- 

Return to bug 8874