Bugzilla – Attachment 76926 Details for
Bug 14493
export_borrowers.pl - Export patron attributes
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 14493: export_borrowers.pl - Export patron attributes
Bug-14493-exportborrowerspl---Export-patron-attrib.patch (text/plain), 2.96 KB, created by
Jason Etheridge
on 2018-07-12 19:32:41 UTC
(
hide
)
Description:
Bug 14493: export_borrowers.pl - Export patron attributes
Filename:
MIME Type:
Creator:
Jason Etheridge
Created:
2018-07-12 19:32:41 UTC
Size:
2.96 KB
patch
obsolete
>From c3df53f5692c134d2cebc88c58b79097c3969535 Mon Sep 17 00:00:00 2001 >From: Vitor Fernandes <vfernandes@keep.pt> >Date: Thu, 12 Jul 2018 15:17:38 -0400 >Subject: [PATCH] Bug 14493: export_borrowers.pl - Export patron attributes > >Tweaked Vitor's original patch to accomodate changes to the file. > >--- > >export_borrowers.pl changed to support patron attributes > >Test plan: > >- Use export_borrowers.pl to export all patron and all fields >- The patrons extended attributes are not exported >- Apply the patch >- Use export_borrowers.pl with the no fields specified or with the field patron_attributes >- The patrons extended attributes will be exported in one column > >Create by: Vitor Fernandes <vfernandes@keep.pt> >Sponsored by: KEEP SOLUTIONS > >Signed-off-by: Jason Etheridge <jason@equinoxinitiative.org> >--- > misc/export_borrowers.pl | 10 +++++++--- > 1 file changed, 7 insertions(+), 3 deletions(-) > >diff --git a/misc/export_borrowers.pl b/misc/export_borrowers.pl >index 5f5c7f7..1ac7454 100755 >--- a/misc/export_borrowers.pl >+++ b/misc/export_borrowers.pl >@@ -24,6 +24,7 @@ use Text::CSV; > use Getopt::Long qw(:config no_ignore_case); > > use C4::Context; >+use C4::Members::Attributes qw(GetBorrowerAttributes); > use Koha::Patrons; > > binmode STDOUT, ":encoding(UTF-8)"; >@@ -41,9 +42,10 @@ $0 [--field=FIELD [--field=FIELD [...]]] [--separator=CHAR] [--show-header] [--w > $0 -h > > -f, --field=FIELD Field to export. It is repeatable and has to match >- column names of the borrower table (also as 'description' and 'category_type' >- If no field is specified, then all fields will be >- exported. >+ column names of the borrower table (with 'description', >+ 'category_type', and 'patron_attributes' also being >+ options). 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 > in the parameter setting, like -s=\\| or -s=\\; >@@ -105,6 +107,7 @@ my $category = $patron->category; > my $member = $patron->unblessed; > $member->{description} = $category->description; > $member->{category_type} = $category->category_type; >+$member->{'patron_attributes'} = join (",", map { $_->{code}.":".$_->{value} } @{GetBorrowerAttributes($borrowernumber)}); > > @fields = keys %$member unless (@fields); > >@@ -131,6 +134,7 @@ while ( my $borrowernumber = $sth->fetchrow_array ) { > my $member = $patron->unblessed; > $member->{description} = $category->description; > $member->{category_type} = $category->category_type; >+ $member->{'patron_attributes'} = join (",", map { $_->{code}.":".$_->{value} } @{GetBorrowerAttributes($borrowernumber)}); > $csv->combine( > map { > ( defined $member->{$_} and !ref $member->{$_} ) >-- >1.9.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 14493
:
40802
|
41340
|
41341
|
76926
|
89574