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

(-)a/Koha/Patron.pm (+17 lines)
Lines 30-35 use Koha::Database; Link Here
30
use Koha::DateUtils;
30
use Koha::DateUtils;
31
use Koha::Holds;
31
use Koha::Holds;
32
use Koha::Old::Checkouts;
32
use Koha::Old::Checkouts;
33
use Koha::Patron::Attributes;
33
use Koha::Patron::Categories;
34
use Koha::Patron::Categories;
34
use Koha::Patron::HouseboundProfile;
35
use Koha::Patron::HouseboundProfile;
35
use Koha::Patron::HouseboundRole;
36
use Koha::Patron::HouseboundRole;
Lines 831-836 sub is_child { Link Here
831
    return $self->category->category_type eq 'C' ? 1 : 0;
832
    return $self->category->category_type eq 'C' ? 1 : 0;
832
}
833
}
833
834
835
=head3 attributes
836
837
my $attributes = $patron->attributes
838
839
Return object of Koha::Patron::Attributes type with all attributes set for this patron
840
841
=cut
842
843
sub attributes {
844
    my ( $self ) = @_;
845
    return Koha::Patron::Attributes->search({
846
        borrowernumber => $self->borrowernumber,
847
        branchcode     => $self->branchcode,
848
    });
849
}
850
834
=head3 type
851
=head3 type
835
852
836
=cut
853
=cut
(-)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 42-48 use C4::Reserves; Link Here
42
use Koha::Holds;
42
use Koha::Holds;
43
use C4::Context;
43
use C4::Context;
44
use CGI::Session;
44
use CGI::Session;
45
use C4::Members::Attributes qw(GetBorrowerAttributes);
46
use Koha::AuthorisedValues;
45
use Koha::AuthorisedValues;
47
use Koha::CsvProfiles;
46
use Koha::CsvProfiles;
48
use Koha::Patrons;
47
use Koha::Patrons;
Lines 579-591 if ( Koha::BiblioFrameworks->find('FA') ) { Link Here
579
    $fast_cataloging = 1 
578
    $fast_cataloging = 1 
580
}
579
}
581
580
582
if (C4::Context->preference('ExtendedPatronAttributes')) {
583
    my $attributes = GetBorrowerAttributes($borrowernumber);
584
    $template->param(
585
        ExtendedPatronAttributes => 1,
586
        extendedattributes => $attributes
587
    );
588
}
589
my $view = $batch
581
my $view = $batch
590
    ?'batch_checkout_view'
582
    ?'batch_checkout_view'
591
    : 'circview';
583
    : 'circview';
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/circ-menu.inc (-5 / +5 lines)
Lines 56-68 Link Here
56
        <li> <span class="empty">No email stored.</span></li>
56
        <li> <span class="empty">No email stored.</span></li>
57
    [% END %]
57
    [% END %]
58
58
59
    [% IF ( ExtendedPatronAttributes ) %][% FOREACH extendedattribute IN extendedattributes %]
59
    [% IF Koha.Preference('ExtendedPatronAttributes') %]
60
        [% IF ( extendedattribute.display_checkout ) %]
60
        [% FOREACH extendedattribute IN patron.attributes %]
61
            [% IF ( extendedattribute.value ) %]
61
            [% IF ( extendedattribute.display_checkout ) %]
62
                <li class="patronattribute"><span class="patronattributelabel">[% extendedattribute.description %]</span> : [% IF ( extendedattribute.value_description ) %][% extendedattribute.value_description %][% ELSE %][% extendedattribute.value %][% END %]</li>
62
                <li class="patronattribute"><span class="patronattributelabel">[% extendedattribute.type_description %]</span> : [% IF ( extendedattribute.value_description ) %][% extendedattribute.value_description %][% ELSE %][% extendedattribute.attribute %][% END %]</li>
63
            [% END %]
63
            [% END %]
64
        [% END %]
64
        [% END %]
65
    [% END %][% END %]
65
    [% END %]
66
    <li class="patroncategory">Category: [% patron.category.description %] ([% patron.categorycode %])</li>
66
    <li class="patroncategory">Category: [% patron.category.description %] ([% patron.categorycode %])</li>
67
    <li class="patronlibrary">Home library: [% Branches.GetName( patron.branchcode ) %]</li>
67
    <li class="patronlibrary">Home library: [% Branches.GetName( patron.branchcode ) %]</li>
68
</ul></div>
68
</ul></div>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt (-1 / +1 lines)
Lines 1017-1023 Link Here
1017
    </ol>
1017
    </ol>
1018
  </fieldset>
1018
  </fieldset>
1019
[% END # hide fieldset %]
1019
[% END # hide fieldset %]
1020
[% IF ( ExtendedPatronAttributes ) %][% UNLESS ( no_patron_attribute_types ) %]
1020
[% IF Koha.Preference('ExtendedPatronAttributes') %][% UNLESS ( no_patron_attribute_types ) %]
1021
  <fieldset class="rows" id="memberentry_patron_attributes">
1021
  <fieldset class="rows" id="memberentry_patron_attributes">
1022
    <legend id="patron_attributes_lgd">Additional attributes and identifiers</legend>
1022
    <legend id="patron_attributes_lgd">Additional attributes and identifiers</legend>
1023
    <input type="hidden" name="setting_extended_patron_attributes" value="1" />
1023
    <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 244-250 Link Here
244
<div class="action"><a href="memberentry.pl?op=modify&amp;borrowernumber=[% patron.borrowernumber %]&amp;step=4">Edit</a></div>
244
<div class="action"><a href="memberentry.pl?op=modify&amp;borrowernumber=[% patron.borrowernumber %]&amp;step=4">Edit</a></div>
245
[% END %]
245
[% END %]
246
246
247
[% IF ( ExtendedPatronAttributes ) %]
247
[% IF Koha.Preference('ExtendedPatronAttributes') %]
248
[% UNLESS ( no_patron_attribute_types ) %]
248
[% UNLESS ( no_patron_attribute_types ) %]
249
<div id="patron-extended-attributes" style="padding-top: 1em;">
249
<div id="patron-extended-attributes" style="padding-top: 1em;">
250
<h3>Additional attributes and identifiers</h3>
250
<h3>Additional attributes and identifiers</h3>
(-)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 203-209 Link Here
203
            [% ELSE %]
204
            [% ELSE %]
204
                <input type="hidden" name="Filter" />
205
                <input type="hidden" name="Filter" />
205
			[% END %]
206
			[% END %]
206
            [% IF ( ExtendedPatronAttributes ) %]
207
            [% IF Koha.Preference('ExtendedPatronAttributes') %]
207
                <tr>
208
                <tr>
208
                    <th colspan="4">Patron attributes</th>
209
                    <th colspan="4">Patron attributes</th>
209
                </tr>
210
                </tr>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/import_borrowers.tt (-1 / +1 lines)
Lines 258-264 Link Here
258
            </ul>
258
            </ul>
259
        </li>
259
        </li>
260
260
261
        [% IF ( ExtendedPatronAttributes ) %]
261
        [% IF Koha.Preference('ExtendedPatronAttributes') %]
262
            <li>
262
            <li>
263
                If loading patron attributes, the 'patron_attributes' field should contain a comma-separated list of attribute types and values. The attribute type code and a colon should precede each value. For example: <b>INSTID:12345,LANG:fr</b> or <b>STARTDATE:January 1 2010,TRACK:Day</b>. If an input record has more than one attribute, the fields should either be entered as an unquoted string (previous examples), or with each field wrapped in separate double quotes and delimited by a comma: <b>&quot;STARTDATE:January 1, 2010&quot;,&quot;TRACK:Day&quot;</b>.  The second syntax would be required if the data might have a comma in it, like a date string.
263
                If loading patron attributes, the 'patron_attributes' field should contain a comma-separated list of attribute types and values. The attribute type code and a colon should precede each value. For example: <b>INSTID:12345,LANG:fr</b> or <b>STARTDATE:January 1 2010,TRACK:Day</b>. If an input record has more than one attribute, the fields should either be entered as an unquoted string (previous examples), or with each field wrapped in separate double quotes and delimited by a comma: <b>&quot;STARTDATE:January 1, 2010&quot;,&quot;TRACK:Day&quot;</b>.  The second syntax would be required if the data might have a comma in it, like a date string.
264
            </li>
264
            </li>
(-)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 111-124 while ( my $line = $accts->next ) { Link Here
111
    push @accountlines, $accountline;
110
    push @accountlines, $accountline;
112
}
111
}
113
112
114
if (C4::Context->preference('ExtendedPatronAttributes')) {
115
    my $attributes = GetBorrowerAttributes($borrowernumber);
116
    $template->param(
117
        ExtendedPatronAttributes => 1,
118
        extendedattributes => $attributes
119
    );
120
}
121
122
$template->param(
113
$template->param(
123
    patron              => $patron,
114
    patron              => $patron,
124
    finesview           => 1,
115
    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 106-119 else { Link Here
106
        $bf->DelFile( id => scalar $cgi->param('file_id') );
105
        $bf->DelFile( id => scalar $cgi->param('file_id') );
107
    }
106
    }
108
107
109
    if (C4::Context->preference('ExtendedPatronAttributes')) {
110
        my $attributes = GetBorrowerAttributes($borrowernumber);
111
        $template->param(
112
            ExtendedPatronAttributes => 1,
113
            extendedattributes => $attributes
114
        );
115
    }
116
117
    $template->param(
108
    $template->param(
118
        files => Koha::Patron::Files->new( borrowernumber => $borrowernumber )
109
        files => Koha::Patron::Files->new( borrowernumber => $borrowernumber )
119
          ->GetFilesInfo(),
110
          ->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 (-9 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);
35
use Koha::Patrons;
34
use Koha::Patrons;
36
35
37
use Koha::Patron::Categories;
36
use Koha::Patron::Categories;
Lines 85-98 if ($add){ Link Here
85
        $template->param( 'catcode' => $patron_categories->next->categorycode )  if $patron_categories->count == 1;
84
        $template->param( 'catcode' => $patron_categories->next->categorycode )  if $patron_categories->count == 1;
86
    }
85
    }
87
86
88
    if (C4::Context->preference('ExtendedPatronAttributes')) {
89
        my $attributes = GetBorrowerAttributes($borrowernumber);
90
        $template->param(
91
            ExtendedPatronAttributes => 1,
92
            extendedattributes => $attributes
93
        );
94
    }
95
96
    $template->param( patron => $patron );
87
    $template->param( patron => $patron );
97
88
98
    $template->param(
89
    $template->param(
(-)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
33
35
use Koha::Patrons;
34
use Koha::Patrons;
36
35
Lines 113-126 if ($add){ Link Here
113
        $template->param( 'catcode' => $patron_categories->next->categorycode )  if $patron_categories->count == 1;
112
        $template->param( 'catcode' => $patron_categories->next->categorycode )  if $patron_categories->count == 1;
114
    }
113
    }
115
114
116
    if (C4::Context->preference('ExtendedPatronAttributes')) {
117
        my $attributes = GetBorrowerAttributes($borrowernumber);
118
        $template->param(
119
            ExtendedPatronAttributes => 1,
120
            extendedattributes => $attributes
121
        );
122
    }
123
124
    $template->param(
115
    $template->param(
125
        patron         => $patron,
116
        patron         => $patron,
126
        finesview      => 1,
117
        finesview      => 1,
(-)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 187-200 if ($input->param('newflags')) { Link Here
187
        $template->param( 'catcode' => $patron_categories->next->categorycode )  if $patron_categories->count == 1;
186
        $template->param( 'catcode' => $patron_categories->next->categorycode )  if $patron_categories->count == 1;
188
    }
187
    }
189
188
190
if (C4::Context->preference('ExtendedPatronAttributes')) {
191
    my $attributes = GetBorrowerAttributes($bor->{'borrowernumber'});
192
    $template->param(
193
        ExtendedPatronAttributes => 1,
194
        extendedattributes => $attributes
195
    );
196
}
197
198
$template->param(
189
$template->param(
199
    patron         => $patron,
190
    patron         => $patron,
200
    loop           => \@loop,
191
    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 101-114 if ( $patron->is_child ) { Link Here
101
    $template->param( 'catcode' => $patron_categories->next->categorycode )  if $patron_categories->count == 1;
100
    $template->param( 'catcode' => $patron_categories->next->categorycode )  if $patron_categories->count == 1;
102
}
101
}
103
102
104
if ( C4::Context->preference('ExtendedPatronAttributes') ) {
105
    my $attributes = GetBorrowerAttributes( $bor->{'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
    destination                => $destination,
105
    destination                => $destination,
(-)a/members/memberentry.pl (-1 lines)
Lines 728-734 foreach (qw(dateenrolled dateexpiry dateofbirth)) { Link Here
728
}
728
}
729
729
730
if (C4::Context->preference('ExtendedPatronAttributes')) {
730
if (C4::Context->preference('ExtendedPatronAttributes')) {
731
    $template->param(ExtendedPatronAttributes => 1);
732
    patron_attributes_form($template, $borrowernumber);
731
    patron_attributes_form($template, $borrowernumber);
733
}
732
}
734
733
(-)a/members/moremember.pl (-1 lines)
Lines 296-302 if (C4::Context->preference('ExtendedPatronAttributes')) { Link Here
296
    }
296
    }
297
297
298
    $template->param(
298
    $template->param(
299
        ExtendedPatronAttributes => 1,
300
        attributes_loop => \@attributes_loop
299
        attributes_loop => \@attributes_loop
301
    );
300
    );
302
301
(-)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
29
31
my $input=new CGI;
30
my $input=new CGI;
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 (-24 / +5 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 138-144 sub add_accounts_to_template { Link Here
138
        }
137
        }
139
        push @accounts, $account_line;
138
        push @accounts, $account_line;
140
    }
139
    }
141
    borrower_add_additional_fields($patron->unblessed);
140
    if ( $patron->is_child ) {
141
        my $patron_categories = Koha::Patron::Categories->search_limited({ category_type => 'A' }, {order_by => ['categorycode']} );
142
        $template->param( 'CATCODE_MULTI' => 1) if $patron_categories->count > 1;
143
        $template->param( 'catcode' => $patron_categories->next->categorycode )  if $patron_categories->count == 1;
144
    }
142
145
143
    $template->param(
146
    $template->param(
144
        patron   => $patron,
147
        patron   => $patron,
Lines 215-242 sub writeoff_all { Link Here
215
    return;
218
    return;
216
}
219
}
217
220
218
sub borrower_add_additional_fields {
219
    my $b_ref = shift;
220
221
# some borrower info is not returned in the standard call despite being assumed
222
# in a number of templates. It should not be the business of this script but in lieu of
223
# a revised api here it is ...
224
    if ( $b_ref->{category_type} eq 'C' ) {
225
        my $patron_categories = Koha::Patron::Categories->search_limited({ category_type => 'A' }, {order_by => ['categorycode']});
226
        $template->param( 'CATCODE_MULTI' => 1) if $patron_categories->count > 1;
227
        $template->param( 'catcode' => $patron_categories->next->categorycode )  if $patron_categories->count == 1;
228
    }
229
230
    if (C4::Context->preference('ExtendedPatronAttributes')) {
231
        $b_ref->{extendedattributes} = GetBorrowerAttributes($borrowernumber);
232
        $template->param(
233
            ExtendedPatronAttributes => 1,
234
        );
235
    }
236
237
    return;
238
}
239
240
sub payselected {
221
sub payselected {
241
    my @params = @_;
222
    my @params = @_;
242
    my $amt    = 0;
223
    my $amt    = 0;
(-)a/members/paycollect.pl (-21 / +5 lines)
Lines 24-30 use C4::Auth; Link Here
24
use C4::Output;
24
use C4::Output;
25
use CGI qw ( -utf8 );
25
use CGI qw ( -utf8 );
26
use C4::Members;
26
use C4::Members;
27
use C4::Members::Attributes qw(GetBorrowerAttributes);
28
use C4::Accounts;
27
use C4::Accounts;
29
use C4::Koha;
28
use C4::Koha;
30
use Koha::Patrons;
29
use Koha::Patrons;
Lines 170-176 if ( $total_paid and $total_paid ne '0.00' ) { Link Here
170
    $total_paid = '0.00';    #TODO not right with pay_individual
169
    $total_paid = '0.00';    #TODO not right with pay_individual
171
}
170
}
172
171
173
borrower_add_additional_fields($borrower, $template);
172
if ( $patron->is_child ) {
173
    my $patron_categories = Koha::Patron::Categories->search_limited({ category_type => 'A' }, {order_by => ['categorycode']}    );
174
    $template->param( 'CATCODE_MULTI' => 1) if $patron_categories->count > 1;
175
    $template->param( 'catcode' => $patron_categories->next->categorycode )  if $patron_categories->count == 1;
176
}
174
177
175
$template->param(%$borrower);
178
$template->param(%$borrower);
176
179
Lines 178-205 $template->param( Link Here
178
    borrowernumber => $borrowernumber,    # some templates require global
181
    borrowernumber => $borrowernumber,    # some templates require global
179
    patron        => $patron,
182
    patron        => $patron,
180
    total         => $total_due,
183
    total         => $total_due,
181
    ExtendedPatronAttributes => C4::Context->preference('ExtendedPatronAttributes'),
182
184
183
    csrf_token => Koha::Token->new->generate_csrf({ session_id => scalar $input->cookie('CGISESSID') }),
185
    csrf_token => Koha::Token->new->generate_csrf({ session_id => scalar $input->cookie('CGISESSID') }),
184
);
186
);
185
187
186
output_html_with_http_headers $input, $cookie, $template->output;
188
output_html_with_http_headers $input, $cookie, $template->output;
187
189
188
sub borrower_add_additional_fields {
189
    my ( $b_ref, $template ) = @_;
190
191
# some borrower info is not returned in the standard call despite being assumed
192
# in a number of templates. It should not be the business of this script but in lieu of
193
# a revised api here it is ...
194
    if ( $b_ref->{category_type} eq 'C' ) {
195
        my $patron_categories = Koha::Patron::Categories->search_limited({ category_type => 'A' }, {order_by => ['categorycode']});
196
        $template->param( 'CATCODE_MULTI' => 1) if $patron_categories->count > 1;
197
        $template->param( 'catcode' => $patron_categories->next->categorycode )  if $patron_categories->count == 1;
198
    }
199
200
    if (C4::Context->preference('ExtendedPatronAttributes')) {
201
        $b_ref->{extendedattributes} = GetBorrowerAttributes($b_ref->{borrowernumber});
202
    }
203
204
    return;
205
}
(-)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 102-115 if (! $limit){ Link Here
102
	$limit = 'full';
101
	$limit = 'full';
103
}
102
}
104
103
105
if (C4::Context->preference('ExtendedPatronAttributes')) {
106
    my $attributes = GetBorrowerAttributes($patron->borrowernumber);
107
    $template->param(
108
        ExtendedPatronAttributes => 1,
109
        extendedattributes => $attributes
110
    );
111
}
112
113
$template->param(
104
$template->param(
114
    patron            => $patron,
105
    patron            => $patron,
115
    readingrecordview => 1,
106
    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 76-87 $template->param( Link Here
76
    branch            => $branch, # FIXME This is confusing
75
    branch            => $branch, # FIXME This is confusing
77
);
76
);
78
77
79
if (C4::Context->preference('ExtendedPatronAttributes')) {
80
    my $attributes = GetBorrowerAttributes($borrowernumber);
81
    $template->param(
82
        ExtendedPatronAttributes => 1,
83
        extendedattributes => $attributes
84
    );
85
}
86
87
output_html_with_http_headers $query, $cookie, $template->output;
78
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
34
Lines 76-89 my $count_total_issues = $total->{count_total_issues_today} || 0; Link Here
76
my $count_total_issues_returned = $total->{count_total_issues_returned_today} || 0;
75
my $count_total_issues_returned = $total->{count_total_issues_returned_today} || 0;
77
my $count_total_actual_state = ($count_total_precedent_state - $count_total_issues_returned + $count_total_issues);
76
my $count_total_actual_state = ($count_total_precedent_state - $count_total_issues_returned + $count_total_issues);
78
77
79
if (C4::Context->preference('ExtendedPatronAttributes')) {
80
    my $attributes = GetBorrowerAttributes($borrowernumber);
81
    $template->param(
82
        ExtendedPatronAttributes => 1,
83
        extendedattributes => $attributes
84
    );
85
}
86
87
$template->param(
78
$template->param(
88
    patron             => $patron,
79
    patron             => $patron,
89
    statisticsview     => 1,
80
    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 69-89 my ( $template, $borrowernumber, $cookie ) = get_template_and_user( Link Here
69
69
70
if ( $src eq 'circ' ) {
70
if ( $src eq 'circ' ) {
71
71
72
    # if we were called from circulation, use the circulation menu and get data to populate it -fbcit
73
    use C4::Members::Attributes qw(GetBorrowerAttributes);
74
    my $borrowernumber = $object;
72
    my $borrowernumber = $object;
75
    my $patron = Koha::Patrons->find( $borrowernumber );
73
    my $patron = Koha::Patrons->find( $borrowernumber );
76
    unless ( $patron ) {
74
    unless ( $patron ) {
77
        print $input->redirect("/cgi-bin/koha/circ/circulation.pl?borrowernumber=$borrowernumber");
75
        print $input->redirect("/cgi-bin/koha/circ/circulation.pl?borrowernumber=$borrowernumber");
78
        exit;
76
        exit;
79
    }
77
    }
80
    if ( C4::Context->preference('ExtendedPatronAttributes') ) {
81
        my $attributes = GetBorrowerAttributes( $borrowernumber );
82
        $template->param(
83
            ExtendedPatronAttributes => 1,
84
            extendedattributes       => $attributes
85
        );
86
    }
87
78
88
    $template->param(
79
    $template->param(
89
        patron      => $patron,
80
        patron      => $patron,
90
- 

Return to bug 12159