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

(-)a/Koha/Patron.pm (+17 lines)
Lines 35-40 use Koha::DateUtils; Link Here
35
use Koha::Exceptions::Password;
35
use Koha::Exceptions::Password;
36
use Koha::Holds;
36
use Koha::Holds;
37
use Koha::Old::Checkouts;
37
use Koha::Old::Checkouts;
38
use Koha::Patron::Attributes;
38
use Koha::Patron::Categories;
39
use Koha::Patron::Categories;
39
use Koha::Patron::HouseboundProfile;
40
use Koha::Patron::HouseboundProfile;
40
use Koha::Patron::HouseboundRole;
41
use Koha::Patron::HouseboundRole;
Lines 1287-1292 sub generate_userid { Link Here
1287
1288
1288
}
1289
}
1289
1290
1291
=head3 attributes
1292
1293
my $attributes = $patron->attributes
1294
1295
Return object of Koha::Patron::Attributes type with all attributes set for this patron
1296
1297
=cut
1298
1299
sub attributes {
1300
    my ( $self ) = @_;
1301
    return Koha::Patron::Attributes->search({
1302
        borrowernumber => $self->borrowernumber,
1303
        branchcode     => $self->branchcode,
1304
    });
1305
}
1306
1290
=head2 Internal methods
1307
=head2 Internal methods
1291
1308
1292
=head3 _type
1309
=head3 _type
(-)a/Koha/Patron/Attribute.pm (+52 lines)
Lines 20-25 use Modern::Perl; Link Here
20
use Koha::Database;
20
use Koha::Database;
21
use Koha::Exceptions::Patron::Attribute;
21
use Koha::Exceptions::Patron::Attribute;
22
use Koha::Patron::Attribute::Types;
22
use Koha::Patron::Attribute::Types;
23
use Koha::AuthorisedValues;
23
24
24
use base qw(Koha::Object);
25
use base qw(Koha::Object);
25
26
Lines 79-84 sub opac_editable { Link Here
79
    return Koha::Patron::Attribute::Types->find( $self->code )->opac_editable;
80
    return Koha::Patron::Attribute::Types->find( $self->code )->opac_editable;
80
}
81
}
81
82
83
=head3 display_checkout
84
85
    my $attribute = Koha::Patron::Attribute->new({ code => 'a_code', ... });
86
    if ( $attribute->display_checkout ) { ... }
87
88
=cut
89
90
sub display_checkout {
91
92
    my $self = shift;
93
94
    return $self->type->display_checkout;
95
}
96
97
=head3 value_description
98
99
    my $description = $attribute->value_description
100
101
    Return authorised value description or free text based on attribute type settings
102
103
=cut
104
105
sub value_description {
106
107
    my $self = shift;
108
109
    if ( $self->type->authorised_value_category ) {
110
        my $av = Koha::AuthorisedValues->search({
111
            category => $self->type->authorised_value_category,
112
            authorised_value => $self->attribute,
113
        });
114
        return $av->next->lib if $av->count
115
    }
116
    return $self->attribute;
117
}
118
119
=head3 type_description
120
121
    my $description = $attribute->type_description
122
123
    Return description of attribute type
124
125
=cut
126
127
sub type_description {
128
129
    my $self = shift;
130
131
    return $self->type->description;
132
}
133
82
=head3 type
134
=head3 type
83
135
84
    my $attribute_type = $attribute->type;
136
    my $attribute_type = $attribute->type;
(-)a/Koha/Patron/Attributes.pm (+32 lines)
Lines 31-36 Koha::Patron::Attributes - Koha Patron Attributes Object set class Link Here
31
31
32
=cut
32
=cut
33
33
34
=head3 search
35
36
my $attributes-> Koha::Patron::Attributes->search( $params );
37
38
=cut
39
40
sub search {
41
    my ( $self, $params, $attributes ) = @_;
42
43
    my $branchcode = $params->{branchcode};
44
    delete( $params->{branchcode} );
45
46
    my $or =
47
        $branchcode
48
        ? {
49
            '-or' => [
50
                'borrower_attribute_types_branches.b_branchcode' => undef,
51
                'borrower_attribute_types_branches.b_branchcode' => $branchcode,
52
            ]
53
        } : {};
54
55
    my $join =
56
        $branchcode
57
        ? {
58
            join => {
59
                'borrower_attribute_types' => 'borrower_attribute_types_branches'
60
            },
61
        } : {};
62
    $attributes //= {};
63
    return $self->SUPER::search( { %$params, %$or }, { %$attributes, %$join } );
64
}
65
34
=head3 _type
66
=head3 _type
35
67
36
=cut
68
=cut
(-)a/Koha/Schema/Result/BorrowerAttribute.pm (+16 lines)
Lines 109-114 __PACKAGE__->belongs_to( Link Here
109
# Created by DBIx::Class::Schema::Loader v0.07042 @ 2016-12-08 04:41:27
109
# Created by DBIx::Class::Schema::Loader v0.07042 @ 2016-12-08 04:41:27
110
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:EarETnedFsmRmAAJAUrKGg
110
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:EarETnedFsmRmAAJAUrKGg
111
111
112
=head2 borrower_attribute_types
113
114
Type: belongs_to
115
116
Related object: L<Koha::Schema::Result::BorrowerAttributeType>
117
118
=cut
119
120
__PACKAGE__->belongs_to(
121
    "borrower_attribute_types",
122
    "Koha::Schema::Result::BorrowerAttributeType",
123
    { "foreign.code" => "self.code" },
124
    { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" },);
125
126
127
112
128
113
# You can replace this text with custom content, and it will be preserved on regeneration
129
# You can replace this text with custom content, and it will be preserved on regeneration
114
1;
130
1;
(-)a/circ/circulation.pl (-8 lines)
Lines 43-49 use C4::Reserves; Link Here
43
use Koha::Holds;
43
use Koha::Holds;
44
use C4::Context;
44
use C4::Context;
45
use CGI::Session;
45
use CGI::Session;
46
use C4::Members::Attributes qw(GetBorrowerAttributes);
47
use Koha::AuthorisedValues;
46
use Koha::AuthorisedValues;
48
use Koha::CsvProfiles;
47
use Koha::CsvProfiles;
49
use Koha::Patrons;
48
use Koha::Patrons;
Lines 552-564 if ( Koha::BiblioFrameworks->find('FA') ) { Link Here
552
    $fast_cataloging = 1 
551
    $fast_cataloging = 1 
553
}
552
}
554
553
555
if (C4::Context->preference('ExtendedPatronAttributes')) {
556
    my $attributes = GetBorrowerAttributes($borrowernumber);
557
    $template->param(
558
        ExtendedPatronAttributes => 1,
559
        extendedattributes => $attributes
560
    );
561
}
562
my $view = $batch
554
my $view = $batch
563
    ?'batch_checkout_view'
555
    ?'batch_checkout_view'
564
    : 'circview';
556
    : 'circview';
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/circ-menu.inc (-5 / +5 lines)
Lines 68-80 Link Here
68
        [% END %]
68
        [% END %]
69
    [% END %]
69
    [% END %]
70
70
71
    [% IF ( ExtendedPatronAttributes ) %][% FOREACH extendedattribute IN extendedattributes %]
71
    [% IF Koha.Preference('ExtendedPatronAttributes') %]
72
        [% IF ( extendedattribute.display_checkout ) %]
72
        [% FOREACH extendedattribute IN patron.attributes %]
73
            [% IF ( extendedattribute.value ) %]
73
            [% IF ( extendedattribute.display_checkout ) %]
74
                <li class="patronattribute"><span class="patronattributelabel">[% extendedattribute.description | html %]</span> : [% IF ( extendedattribute.value_description ) %][% extendedattribute.value_description | html %][% ELSE %][% extendedattribute.value | html %][% END %]</li>
74
                <li class="patronattribute"><span class="patronattributelabel">[% extendedattribute.type_description | html %]</span> : [% IF ( extendedattribute.value_description ) %][% extendedattribute.value_description | html %][% ELSE %][% extendedattribute.attribute | html %][% END %]</li>
75
            [% END %]
75
            [% END %]
76
        [% END %]
76
        [% END %]
77
    [% END %][% END %]
77
    [% END %]
78
    <li class="patroncategory">Category: [% patron.category.description | html %] ([% patron.categorycode | html %])</li>
78
    <li class="patroncategory">Category: [% patron.category.description | html %] ([% patron.categorycode | html %])</li>
79
    <li class="patronlibrary">Home library: [% Branches.GetName( patron.branchcode ) | html %]</li>
79
    <li class="patronlibrary">Home library: [% Branches.GetName( patron.branchcode ) | html %]</li>
80
    <li class="patronborrowernumber">Borrowernumber: [% patron.borrowernumber | html %]</li>
80
    <li class="patronborrowernumber">Borrowernumber: [% patron.borrowernumber | html %]</li>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt (-1 / +1 lines)
Lines 1041-1047 Link Here
1041
[% END # IF step_7 %]
1041
[% END # IF step_7 %]
1042
1042
1043
[% IF ( step_4 ) %]
1043
[% IF ( step_4 ) %]
1044
[% IF ( ExtendedPatronAttributes ) %][% UNLESS ( no_patron_attribute_types ) %]
1044
[% IF Koha.Preference('ExtendedPatronAttributes') %][% UNLESS ( no_patron_attribute_types ) %]
1045
  <fieldset class="rows" id="memberentry_patron_attributes">
1045
  <fieldset class="rows" id="memberentry_patron_attributes">
1046
    <legend id="patron_attributes_lgd">Additional attributes and identifiers</legend>
1046
    <legend id="patron_attributes_lgd">Additional attributes and identifiers</legend>
1047
    <input type="hidden" name="setting_extended_patron_attributes" value="1" />
1047
    <input type="hidden" name="setting_extended_patron_attributes" value="1" />
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt (-1 / +1 lines)
Lines 345-351 Link Here
345
                                </div> [% #/ div#houseboundroles %]
345
                                </div> [% #/ div#houseboundroles %]
346
                            [% END %]
346
                            [% END %]
347
347
348
                            [% IF ( ExtendedPatronAttributes ) %]
348
                            [% IF Koha.Preference('ExtendedPatronAttributes') %]
349
                                [% UNLESS ( no_patron_attribute_types ) %]
349
                                [% UNLESS ( no_patron_attribute_types ) %]
350
                                    <div id="patron-extended-attributes" class="patroninfo-section">
350
                                    <div id="patron-extended-attributes" class="patroninfo-section">
351
                                        [% IF ( attributes_loop ) %]
351
                                        [% IF ( attributes_loop ) %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/borrowers_stats.tt (-1 / +2 lines)
Lines 1-4 Link Here
1
[% USE Branches %]
1
[% USE Branches %]
2
[% USE Koha %]
2
[% SET footerjs = 1 %]
3
[% SET footerjs = 1 %]
3
[% INCLUDE 'doc-head-open.inc' %]
4
[% INCLUDE 'doc-head-open.inc' %]
4
<title>Koha &rsaquo; Reports [% IF ( do_it ) %]&rsaquo; Patrons statistics &rsaquo; Results[% ELSE %]&rsaquo; Patrons statistics[% END %]</title>
5
<title>Koha &rsaquo; Reports [% IF ( do_it ) %]&rsaquo; Patrons statistics &rsaquo; Results[% ELSE %]&rsaquo; Patrons statistics[% END %]</title>
Lines 202-208 Link Here
202
            [% ELSE %]
203
            [% ELSE %]
203
                <input type="hidden" name="Filter" />
204
                <input type="hidden" name="Filter" />
204
			[% END %]
205
			[% END %]
205
            [% IF ( ExtendedPatronAttributes ) %]
206
            [% IF Koha.Preference('ExtendedPatronAttributes') %]
206
                <tr>
207
                <tr>
207
                    <th colspan="4">Patron attributes</th>
208
                    <th colspan="4">Patron attributes</th>
208
                </tr>
209
                </tr>
(-)a/members/boraccount.pl (-9 lines)
Lines 29-35 use C4::Output; Link Here
29
use CGI qw ( -utf8 );
29
use CGI qw ( -utf8 );
30
use C4::Members;
30
use C4::Members;
31
use C4::Accounts;
31
use C4::Accounts;
32
use C4::Members::Attributes qw(GetBorrowerAttributes);
33
use Koha::Patrons;
32
use Koha::Patrons;
34
use Koha::Patron::Categories;
33
use Koha::Patron::Categories;
35
34
Lines 79-92 if($total <= 0){ Link Here
79
        $totalcredit = 1;
78
        $totalcredit = 1;
80
}
79
}
81
80
82
if (C4::Context->preference('ExtendedPatronAttributes')) {
83
    my $attributes = GetBorrowerAttributes($borrowernumber);
84
    $template->param(
85
        ExtendedPatronAttributes => 1,
86
        extendedattributes => $attributes
87
    );
88
}
89
90
$template->param(
81
$template->param(
91
    patron              => $patron,
82
    patron              => $patron,
92
    finesview           => 1,
83
    finesview           => 1,
(-)a/members/files.pl (-9 lines)
Lines 24-30 use CGI qw ( -utf8 ); Link Here
24
use C4::Auth;
24
use C4::Auth;
25
use C4::Output;
25
use C4::Output;
26
use C4::Members;
26
use C4::Members;
27
use C4::Members::Attributes qw(GetBorrowerAttributes);
28
use C4::Debug;
27
use C4::Debug;
29
28
30
use Koha::DateUtils;
29
use Koha::DateUtils;
Lines 107-120 else { Link Here
107
        $bf->DelFile( id => scalar $cgi->param('file_id') );
106
        $bf->DelFile( id => scalar $cgi->param('file_id') );
108
    }
107
    }
109
108
110
    if (C4::Context->preference('ExtendedPatronAttributes')) {
111
        my $attributes = GetBorrowerAttributes($borrowernumber);
112
        $template->param(
113
            ExtendedPatronAttributes => 1,
114
            extendedattributes => $attributes
115
        );
116
    }
117
118
    $template->param(
109
    $template->param(
119
        files => Koha::Patron::Files->new( borrowernumber => $borrowernumber )
110
        files => Koha::Patron::Files->new( borrowernumber => $borrowernumber )
120
          ->GetFilesInfo(),
111
          ->GetFilesInfo(),
(-)a/members/housebound.pl (-10 lines)
Lines 28-34 use Modern::Perl; Link Here
28
use CGI;
28
use CGI;
29
use C4::Auth;
29
use C4::Auth;
30
use C4::Context;
30
use C4::Context;
31
use C4::Members::Attributes qw(GetBorrowerAttributes);
32
use C4::Output;
31
use C4::Output;
33
use DateTime;
32
use DateTime;
34
use Koha::DateUtils;
33
use Koha::DateUtils;
Lines 157-171 $method = 'update_or_create' if ( !$houseboundprofile ); Link Here
157
# Ensure template has all patron details.
156
# Ensure template has all patron details.
158
$template->param( patron => $patron );
157
$template->param( patron => $patron );
159
158
160
# Load extended patron attributes if necessary (taken from members/files.pl).
161
if ( C4::Context->preference('ExtendedPatronAttributes') and $patron ) {
162
    my $attributes = GetBorrowerAttributes($patron->borrowernumber);
163
    $template->param(
164
        ExtendedPatronAttributes => 1,
165
        extendedattributes => $attributes
166
    );
167
}
168
169
$template->param(
159
$template->param(
170
    housebound_profile => $houseboundprofile,
160
    housebound_profile => $houseboundprofile,
171
    visit              => $houseboundvisit,
161
    visit              => $houseboundvisit,
(-)a/members/mancredit.pl (-10 / +1 lines)
Lines 31-37 use CGI qw ( -utf8 ); Link Here
31
use C4::Members;
31
use C4::Members;
32
use C4::Accounts;
32
use C4::Accounts;
33
use C4::Items;
33
use C4::Items;
34
use C4::Members::Attributes qw(GetBorrowerAttributes);
34
use Koha::Patrons;
35
35
36
use Koha::Items;
36
use Koha::Items;
37
use Koha::Patrons;
37
use Koha::Patrons;
Lines 100-114 if ($add){ Link Here
100
    print $input->redirect("/cgi-bin/koha/members/boraccount.pl?borrowernumber=$borrowernumber");
100
    print $input->redirect("/cgi-bin/koha/members/boraccount.pl?borrowernumber=$borrowernumber");
101
101
102
} else {
102
} else {
103
104
    if (C4::Context->preference('ExtendedPatronAttributes')) {
105
        my $attributes = GetBorrowerAttributes($borrowernumber);
106
        $template->param(
107
            ExtendedPatronAttributes => 1,
108
            extendedattributes => $attributes
109
        );
110
    }
111
112
    $template->param(
103
    $template->param(
113
        patron     => $patron,
104
        patron     => $patron,
114
        finesview  => 1,
105
        finesview  => 1,
(-)a/members/maninvoice.pl (-9 lines)
Lines 30-36 use CGI qw ( -utf8 ); Link Here
30
use C4::Members;
30
use C4::Members;
31
use C4::Accounts;
31
use C4::Accounts;
32
use C4::Items;
32
use C4::Items;
33
use C4::Members::Attributes qw(GetBorrowerAttributes);
34
use Koha::Token;
33
use Koha::Token;
35
34
36
use Koha::Items;
35
use Koha::Items;
Lines 121-134 if ($add){ Link Here
121
  }
120
  }
122
  $template->param( invoice_types_loop => \@invoice_types );
121
  $template->param( invoice_types_loop => \@invoice_types );
123
122
124
    if (C4::Context->preference('ExtendedPatronAttributes')) {
125
        my $attributes = GetBorrowerAttributes($borrowernumber);
126
        $template->param(
127
            ExtendedPatronAttributes => 1,
128
            extendedattributes => $attributes
129
        );
130
    }
131
132
    $template->param(
123
    $template->param(
133
        csrf_token => Koha::Token->new->generate_csrf({ session_id => scalar $input->cookie('CGISESSID') }),
124
        csrf_token => Koha::Token->new->generate_csrf({ session_id => scalar $input->cookie('CGISESSID') }),
134
        patron         => $patron,
125
        patron         => $patron,
(-)a/members/member-flags.pl (-9 lines)
Lines 11-17 use C4::Output; Link Here
11
use C4::Auth qw(:DEFAULT :EditPermissions);
11
use C4::Auth qw(:DEFAULT :EditPermissions);
12
use C4::Context;
12
use C4::Context;
13
use C4::Members;
13
use C4::Members;
14
use C4::Members::Attributes qw(GetBorrowerAttributes);
15
#use C4::Acquisitions;
14
#use C4::Acquisitions;
16
15
17
use Koha::Patron::Categories;
16
use Koha::Patron::Categories;
Lines 182-195 if ($input->param('newflags')) { Link Here
182
        push @loop, \%row;
181
        push @loop, \%row;
183
    }
182
    }
184
183
185
if (C4::Context->preference('ExtendedPatronAttributes')) {
186
    my $attributes = GetBorrowerAttributes($bor->{'borrowernumber'});
187
    $template->param(
188
        ExtendedPatronAttributes => 1,
189
        extendedattributes => $attributes
190
    );
191
}
192
193
$template->param(
184
$template->param(
194
    patron         => $patron,
185
    patron         => $patron,
195
    loop           => \@loop,
186
    loop           => \@loop,
(-)a/members/member-password.pl (-9 lines)
Lines 13-19 use C4::Context; Link Here
13
use C4::Members;
13
use C4::Members;
14
use C4::Circulation;
14
use C4::Circulation;
15
use CGI qw ( -utf8 );
15
use CGI qw ( -utf8 );
16
use C4::Members::Attributes qw(GetBorrowerAttributes);
17
use Koha::AuthUtils;
16
use Koha::AuthUtils;
18
use Koha::Token;
17
use Koha::Token;
19
18
Lines 98-111 if ( $newpassword and not @errors) { Link Here
98
    };
97
    };
99
}
98
}
100
99
101
if ( C4::Context->preference('ExtendedPatronAttributes') ) {
102
    my $attributes = GetBorrowerAttributes( $patron_id );
103
    $template->param(
104
        ExtendedPatronAttributes => 1,
105
        extendedattributes       => $attributes
106
    );
107
}
108
109
$template->param(
100
$template->param(
110
    patron      => $patron,
101
    patron      => $patron,
111
    destination => $destination,
102
    destination => $destination,
(-)a/members/memberentry.pl (-1 lines)
Lines 746-752 foreach (qw(dateenrolled dateexpiry dateofbirth)) { Link Here
746
}
746
}
747
747
748
if (C4::Context->preference('ExtendedPatronAttributes')) {
748
if (C4::Context->preference('ExtendedPatronAttributes')) {
749
    $template->param(ExtendedPatronAttributes => 1);
750
    patron_attributes_form($template, $borrowernumber);
749
    patron_attributes_form($template, $borrowernumber);
751
}
750
}
752
751
(-)a/members/moremember.pl (-1 lines)
Lines 267-273 if (C4::Context->preference('ExtendedPatronAttributes')) { Link Here
267
    }
267
    }
268
268
269
    $template->param(
269
    $template->param(
270
        ExtendedPatronAttributes => 1,
271
        attributes_loop => \@attributes_loop
270
        attributes_loop => \@attributes_loop
272
    );
271
    );
273
272
(-)a/members/notices.pl (-9 lines)
Lines 25-31 use C4::Output; Link Here
25
use CGI qw ( -utf8 );
25
use CGI qw ( -utf8 );
26
use C4::Members;
26
use C4::Members;
27
use C4::Letters;
27
use C4::Letters;
28
use C4::Members::Attributes qw(GetBorrowerAttributes);
29
use Koha::Patrons;
28
use Koha::Patrons;
30
use Koha::Patron::Categories;
29
use Koha::Patron::Categories;
31
30
Lines 66-79 if ( $op eq 'resend_notice' ) { Link Here
66
# Getting the messages
65
# Getting the messages
67
my $queued_messages = C4::Letters::GetQueuedMessages({borrowernumber => $borrowernumber});
66
my $queued_messages = C4::Letters::GetQueuedMessages({borrowernumber => $borrowernumber});
68
67
69
if (C4::Context->preference('ExtendedPatronAttributes')) {
70
    my $attributes = GetBorrowerAttributes($borrowernumber);
71
    $template->param(
72
        ExtendedPatronAttributes => 1,
73
        extendedattributes => $attributes
74
    );
75
}
76
77
$template->param(
68
$template->param(
78
    patron             => $patron,
69
    patron             => $patron,
79
    QUEUED_MESSAGES    => $queued_messages,
70
    QUEUED_MESSAGES    => $queued_messages,
(-)a/members/pay.pl (-19 lines)
Lines 38-44 use C4::Accounts; Link Here
38
use C4::Stats;
38
use C4::Stats;
39
use C4::Koha;
39
use C4::Koha;
40
use C4::Overdues;
40
use C4::Overdues;
41
use C4::Members::Attributes qw(GetBorrowerAttributes);
42
use Koha::Patrons;
41
use Koha::Patrons;
43
42
44
use Koha::Patron::Categories;
43
use Koha::Patron::Categories;
Lines 156-162 sub add_accounts_to_template { Link Here
156
        }
155
        }
157
        push @accounts, $account_line;
156
        push @accounts, $account_line;
158
    }
157
    }
159
    borrower_add_additional_fields($patron);
160
158
161
    $template->param(
159
    $template->param(
162
        patron   => $patron,
160
        patron   => $patron,
Lines 235-257 sub writeoff_all { Link Here
235
    return;
233
    return;
236
}
234
}
237
235
238
sub borrower_add_additional_fields {
239
    my $patron = shift;
240
241
# some borrower info is not returned in the standard call despite being assumed
242
# in a number of templates. It should not be the business of this script but in lieu of
243
# a revised api here it is ...
244
    if (C4::Context->preference('ExtendedPatronAttributes')) {
245
        my $extendedattributes = GetBorrowerAttributes($patron->borrowernumber);
246
        $template->param(
247
            extendedattributes       => $extendedattributes,
248
            ExtendedPatronAttributes => 1,
249
        );
250
    }
251
252
    return;
253
}
254
255
sub payselected {
236
sub payselected {
256
    my $parameters = shift;
237
    my $parameters = shift;
257
238
(-)a/members/paycollect.pl (-19 lines)
Lines 25-31 use C4::Context; Link Here
25
use C4::Auth;
25
use C4::Auth;
26
use C4::Output;
26
use C4::Output;
27
use C4::Members;
27
use C4::Members;
28
use C4::Members::Attributes qw(GetBorrowerAttributes);
29
use C4::Accounts;
28
use C4::Accounts;
30
use C4::Koha;
29
use C4::Koha;
31
30
Lines 180-187 if ( $total_paid and $total_paid ne '0.00' ) { Link Here
180
    $total_paid = '0.00';    #TODO not right with pay_individual
179
    $total_paid = '0.00';    #TODO not right with pay_individual
181
}
180
}
182
181
183
borrower_add_additional_fields($patron, $template);
184
185
$template->param(%$borrower);
182
$template->param(%$borrower);
186
183
187
if ( $input->param('error_over') ) {
184
if ( $input->param('error_over') ) {
Lines 193-216 $template->param( Link Here
193
    borrowernumber => $borrowernumber,    # some templates require global
190
    borrowernumber => $borrowernumber,    # some templates require global
194
    patron        => $patron,
191
    patron        => $patron,
195
    total         => $total_due,
192
    total         => $total_due,
196
    ExtendedPatronAttributes => C4::Context->preference('ExtendedPatronAttributes'),
197
193
198
    csrf_token => Koha::Token->new->generate_csrf({ session_id => scalar $input->cookie('CGISESSID') }),
194
    csrf_token => Koha::Token->new->generate_csrf({ session_id => scalar $input->cookie('CGISESSID') }),
199
);
195
);
200
196
201
output_html_with_http_headers $input, $cookie, $template->output;
197
output_html_with_http_headers $input, $cookie, $template->output;
202
203
sub borrower_add_additional_fields {
204
    my ( $patron, $template ) = @_;
205
206
# some borrower info is not returned in the standard call despite being assumed
207
# in a number of templates. It should not be the business of this script but in lieu of
208
# a revised api here it is ...
209
210
    if (C4::Context->preference('ExtendedPatronAttributes')) {
211
        my $extendedattributes = GetBorrowerAttributes($patron->borrowernumber);
212
        $template->param( extendedattributes => $extendedattributes );
213
    }
214
215
    return;
216
}
(-)a/members/purchase-suggestions.pl (-9 lines)
Lines 24-30 use C4::Auth; Link Here
24
use C4::Context;
24
use C4::Context;
25
use C4::Output;
25
use C4::Output;
26
use C4::Members;
26
use C4::Members;
27
use C4::Members::Attributes qw(GetBorrowerAttributes);
28
use C4::Suggestions;
27
use C4::Suggestions;
29
use Koha::Patrons;
28
use Koha::Patrons;
30
29
Lines 52-65 $template->param( Link Here
52
    suggestionsview  => 1,
51
    suggestionsview  => 1,
53
);
52
);
54
53
55
if (C4::Context->preference('ExtendedPatronAttributes')) {
56
    my $attributes = GetBorrowerAttributes($borrowernumber);
57
    $template->param(
58
        ExtendedPatronAttributes => 1,
59
        extendedattributes => $attributes
60
    );
61
}
62
63
my $suggestions = SearchSuggestion( { suggestedby => $borrowernumber } );
54
my $suggestions = SearchSuggestion( { suggestedby => $borrowernumber } );
64
55
65
$template->param( suggestions => $suggestions );
56
$template->param( suggestions => $suggestions );
(-)a/members/readingrec.pl (-9 lines)
Lines 29-35 use C4::Output; Link Here
29
use C4::Members;
29
use C4::Members;
30
use List::MoreUtils qw/any uniq/;
30
use List::MoreUtils qw/any uniq/;
31
use Koha::DateUtils;
31
use Koha::DateUtils;
32
use C4::Members::Attributes qw(GetBorrowerAttributes);
33
32
34
use Koha::Patrons;
33
use Koha::Patrons;
35
use Koha::Patron::Categories;
34
use Koha::Patron::Categories;
Lines 96-109 if (! $limit){ Link Here
96
	$limit = 'full';
95
	$limit = 'full';
97
}
96
}
98
97
99
if (C4::Context->preference('ExtendedPatronAttributes')) {
100
    my $attributes = GetBorrowerAttributes($patron->borrowernumber);
101
    $template->param(
102
        ExtendedPatronAttributes => 1,
103
        extendedattributes => $attributes
104
    );
105
}
106
107
$template->param(
98
$template->param(
108
    patron            => $patron,
99
    patron            => $patron,
109
    readingrecordview => 1,
100
    readingrecordview => 1,
(-)a/members/routing-lists.pl (-9 lines)
Lines 22-28 use CGI qw ( -utf8 ); Link Here
22
use C4::Output;
22
use C4::Output;
23
use C4::Auth qw/:DEFAULT/;
23
use C4::Auth qw/:DEFAULT/;
24
use C4::Members;
24
use C4::Members;
25
use C4::Members::Attributes qw(GetBorrowerAttributes);
26
use C4::Context;
25
use C4::Context;
27
use C4::Serials;
26
use C4::Serials;
28
use Koha::Patrons;
27
use Koha::Patrons;
Lines 58-69 $template->param( Link Here
58
    routinglistview   => 1,
57
    routinglistview   => 1,
59
);
58
);
60
59
61
if (C4::Context->preference('ExtendedPatronAttributes')) {
62
    my $attributes = GetBorrowerAttributes($borrowernumber);
63
    $template->param(
64
        ExtendedPatronAttributes => 1,
65
        extendedattributes => $attributes
66
    );
67
}
68
69
output_html_with_http_headers $query, $cookie, $template->output;
60
output_html_with_http_headers $query, $cookie, $template->output;
(-)a/members/statistics.pl (-9 lines)
Lines 29-35 use C4::Auth; Link Here
29
use C4::Context;
29
use C4::Context;
30
use C4::Members;
30
use C4::Members;
31
use C4::Members::Statistics;
31
use C4::Members::Statistics;
32
use C4::Members::Attributes qw(GetBorrowerAttributes);
33
use C4::Output;
32
use C4::Output;
34
use Koha::Patrons;
33
use Koha::Patrons;
35
use Koha::Patron::Categories;
34
use Koha::Patron::Categories;
Lines 77-90 my $count_total_issues = $total->{count_total_issues_today} || 0; Link Here
77
my $count_total_issues_returned = $total->{count_total_issues_returned_today} || 0;
76
my $count_total_issues_returned = $total->{count_total_issues_returned_today} || 0;
78
my $count_total_actual_state = ($count_total_precedent_state - $count_total_issues_returned + $count_total_issues);
77
my $count_total_actual_state = ($count_total_precedent_state - $count_total_issues_returned + $count_total_issues);
79
78
80
if (C4::Context->preference('ExtendedPatronAttributes')) {
81
    my $attributes = GetBorrowerAttributes($borrowernumber);
82
    $template->param(
83
        ExtendedPatronAttributes => 1,
84
        extendedattributes => $attributes
85
    );
86
}
87
88
$template->param(
79
$template->param(
89
    patron             => $patron,
80
    patron             => $patron,
90
    statisticsview     => 1,
81
    statisticsview     => 1,
(-)a/reports/borrowers_stats.pl (-1 lines)
Lines 137-143 if ($do_it) { Link Here
137
		CGIsepChoice => $CGIsepChoice,
137
		CGIsepChoice => $CGIsepChoice,
138
    );
138
    );
139
    if (C4::Context->preference('ExtendedPatronAttributes')) {
139
    if (C4::Context->preference('ExtendedPatronAttributes')) {
140
        $template->param(ExtendedPatronAttributes => 1);
141
        patron_attributes_form($template);
140
        patron_attributes_form($template);
142
    }
141
    }
143
}
142
}
(-)a/tools/viewlog.pl (-10 lines)
Lines 72-92 my ( $template, $borrowernumber, $cookie ) = get_template_and_user( Link Here
72
72
73
if ( $src eq 'circ' ) {
73
if ( $src eq 'circ' ) {
74
74
75
    # if we were called from circulation, use the circulation menu and get data to populate it -fbcit
76
    use C4::Members::Attributes qw(GetBorrowerAttributes);
77
    my $borrowernumber = $object;
75
    my $borrowernumber = $object;
78
    my $patron = Koha::Patrons->find( $borrowernumber );
76
    my $patron = Koha::Patrons->find( $borrowernumber );
79
    my $circ_info = 1;
77
    my $circ_info = 1;
80
    unless ( $patron ) {
78
    unless ( $patron ) {
81
         $circ_info = 0;
79
         $circ_info = 0;
82
    }
80
    }
83
    if ( C4::Context->preference('ExtendedPatronAttributes') ) {
84
        my $attributes = GetBorrowerAttributes( $borrowernumber );
85
        $template->param(
86
            ExtendedPatronAttributes => 1,
87
            extendedattributes       => $attributes
88
        );
89
    }
90
81
91
    $template->param(
82
    $template->param(
92
        patron      => $patron,
83
        patron      => $patron,
93
- 

Return to bug 12159