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

(-)a/misc/export_borrowers.pl (-4 / +7 lines)
Lines 25-30 use Getopt::Long qw(:config no_ignore_case); Link Here
25
25
26
use Koha::Script;
26
use Koha::Script;
27
use C4::Context;
27
use C4::Context;
28
use C4::Members::Attributes qw(GetBorrowerAttributes);
28
use Koha::Patrons;
29
use Koha::Patrons;
29
30
30
binmode STDOUT, ":encoding(UTF-8)";
31
binmode STDOUT, ":encoding(UTF-8)";
Lines 42-50 $0 [--field=FIELD [--field=FIELD [...]]] [--separator=CHAR] [--show-header] [--w Link Here
42
$0 -h
43
$0 -h
43
44
44
    -f, --field=FIELD       Field to export. It is repeatable and has to match
45
    -f, --field=FIELD       Field to export. It is repeatable and has to match
45
                            column names of the borrower table (also as 'description' and 'category_type'
46
                            column names of the borrower table (with 'description',
46
                            If no field is specified, then all fields will be
47
                            'category_type', and 'patron_attributes' also being
47
                            exported.
48
                            options). If no field is specified, then all fields
49
                            will be exported.
48
    -s, --separator=CHAR    This character will be used to separate fields.
50
    -s, --separator=CHAR    This character will be used to separate fields.
49
                            Some characters like | or ; will need to be escaped
51
                            Some characters like | or ; will need to be escaped
50
                            in the parameter setting, like -s=\\| or -s=\\;
52
                            in the parameter setting, like -s=\\| or -s=\\;
Lines 106-111 my $category = $patron->category; Link Here
106
my $member = $patron->unblessed;
108
my $member = $patron->unblessed;
107
$member->{description} = $category->description;
109
$member->{description} = $category->description;
108
$member->{category_type} = $category->category_type;
110
$member->{category_type} = $category->category_type;
111
$member->{'patron_attributes'} = join (",", map { $_->{code}.":".$_->{value} } @{GetBorrowerAttributes($borrowernumber)});
109
112
110
@fields = keys %$member unless (@fields);
113
@fields = keys %$member unless (@fields);
111
114
Lines 132-137 while ( my $borrowernumber = $sth->fetchrow_array ) { Link Here
132
    my $member = $patron->unblessed;
135
    my $member = $patron->unblessed;
133
    $member->{description} = $category->description;
136
    $member->{description} = $category->description;
134
    $member->{category_type} = $category->category_type;
137
    $member->{category_type} = $category->category_type;
138
    $member->{'patron_attributes'} = join (",", map { $_->{code}.":".$_->{value} } @{GetBorrowerAttributes($borrowernumber)});
135
    $csv->combine(
139
    $csv->combine(
136
        map {
140
        map {
137
            ( defined $member->{$_} and !ref $member->{$_} )
141
            ( defined $member->{$_} and !ref $member->{$_} )
138
- 

Return to bug 14493