From abca2500818fb12b08feb673623d7297de04de4f Mon Sep 17 00:00:00 2001 From: Vitor Fernandes Date: Mon, 6 Jul 2015 12:22:28 +0100 Subject: [PATCH] export_borrowers.pl changed to support patron attributes http://bugs.koha-community.org/show_bug.cgi?id=14493 --- misc/export_borrowers.pl | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/misc/export_borrowers.pl b/misc/export_borrowers.pl index 6f0985a..03f038e 100755 --- a/misc/export_borrowers.pl +++ b/misc/export_borrowers.pl @@ -43,7 +43,8 @@ $0 -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. + exported. The field patron_attributes exports all + patron_attributes. -s, --separator=CHAR This character will be used to separate fields. Some characters like | or ; will need to be escaped in the parameter setting, like -s=\\| or -s=\\; @@ -100,6 +101,7 @@ my $csv = Text::CSV->new( { sep_char => $separator, binary => 1 } ); # We retrieve the first borrower informations to get field names my ($borrowernumber) = $sth->fetchrow_array or die "No borrower to export"; my $member = GetMemberDetails($borrowernumber); +$member->{'patron_attributes'} = join (",", map { $_->{code}.":".$_->{value} } @{GetBorrowerAttributes($borrowernumber)}); @fields = keys %$member unless (@fields); if ($show_header) { @@ -121,6 +123,7 @@ print $csv->string . "\n"; while ( my $borrowernumber = $sth->fetchrow_array ) { $member = GetMemberDetails($borrowernumber); + $member->{'patron_attributes'} = join (",", map { $_->{code}.":".$_->{value} } @{GetBorrowerAttributes($borrowernumber)}); $csv->combine( map { ( defined $member->{$_} and !ref $member->{$_} ) -- 1.9.1