Bugzilla – Attachment 12676 Details for
Bug 8874
export_borrowers.pl : add a separator parameter
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
proposed patch
0001-Bug-8874-adds-a-separator-parameter-for-patron-expor.patch (text/plain), 1.94 KB, created by
Adrien SAURAT
on 2012-10-04 10:04:58 UTC
(
hide
)
Description:
proposed patch
Filename:
MIME Type:
Creator:
Adrien SAURAT
Created:
2012-10-04 10:04:58 UTC
Size:
1.94 KB
patch
obsolete
>From 079df9a4d46aefd1be1f54cb396b7ca4e5ff468e Mon Sep 17 00:00:00 2001 >From: Adrien Saurat <adrien.saurat@biblibre.com> >Date: Thu, 4 Oct 2012 12:00:07 +0200 >Subject: [PATCH] Bug 8874: adds a separator parameter for patron export > >Adds a --separator parameter to export_borrowers.pl >Default separator stays the comma. >--- > misc/export_borrowers.pl | 9 ++++++++- > 1 files changed, 8 insertions(+), 1 deletions(-) > >diff --git a/misc/export_borrowers.pl b/misc/export_borrowers.pl >index c4b3e40..2540995 100755 >--- a/misc/export_borrowers.pl >+++ b/misc/export_borrowers.pl >@@ -44,6 +44,11 @@ $0 -h > keys returned by the GetMemberDetails function. > If no field is specified, then all fields will be > exported. >+ -s, --separator=CHAR This character will be used to separate fields. >+ Some characters like | or ; will need to be escaped >+ or surrounded by quotes in the parameter setting, >+ like -s=\\| or -s='|'; >+ If no separator is specified, a comma will be used. > -H, --show-header Print field names on first row > -h, --help Show this help > >@@ -52,11 +57,13 @@ USAGE > > # Getting parameters > my @fields; >+my $separator; > my $show_header; > my $help; > > GetOptions( > 'field|f=s' => \@fields, >+ 'separator|s=s' => \$separator, > 'show-header|H' => \$show_header, > 'help|h' => \$help > ) or print_usage, exit 1; >@@ -72,7 +79,7 @@ my $query = "SELECT borrowernumber FROM borrowers ORDER BY borrowernumber"; > my $sth = $dbh->prepare($query); > $sth->execute; > >-my $csv = Text::CSV->new( { binary => 1 } ); >+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 >-- >1.7.4.1 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 8874
: 12676