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

(-)a/C4/Members.pm (-13 / +13 lines)
Lines 1944-1962 sub GetTitles { Link Here
1944
1944
1945
=head2 GetPatronImage
1945
=head2 GetPatronImage
1946
1946
1947
    my ($imagedata, $dberror) = GetPatronImage($cardnumber);
1947
    my ($imagedata, $dberror) = GetPatronImage($borrowernumber);
1948
1948
1949
Returns the mimetype and binary image data of the image for the patron with the supplied cardnumber.
1949
Returns the mimetype and binary image data of the image for the patron with the supplied borrowernumber.
1950
1950
1951
=cut
1951
=cut
1952
1952
1953
sub GetPatronImage {
1953
sub GetPatronImage {
1954
    my ($cardnumber) = @_;
1954
    my ($borrowernumber) = @_;
1955
    warn "Cardnumber passed to GetPatronImage is $cardnumber" if $debug;
1955
    warn "Borrowernumber passed to GetPatronImage is $borrowernumber" if $debug;
1956
    my $dbh = C4::Context->dbh;
1956
    my $dbh = C4::Context->dbh;
1957
    my $query = 'SELECT mimetype, imagefile FROM patronimage WHERE cardnumber = ?';
1957
    my $query = 'SELECT mimetype, imagefile FROM patronimage WHERE borrowernumber = ?';
1958
    my $sth = $dbh->prepare($query);
1958
    my $sth = $dbh->prepare($query);
1959
    $sth->execute($cardnumber);
1959
    $sth->execute($borrowernumber);
1960
    my $imagedata = $sth->fetchrow_hashref;
1960
    my $imagedata = $sth->fetchrow_hashref;
1961
    warn "Database error!" if $sth->errstr;
1961
    warn "Database error!" if $sth->errstr;
1962
    return $imagedata, $sth->errstr;
1962
    return $imagedata, $sth->errstr;
Lines 1975-1981 sub PutPatronImage { Link Here
1975
    my ($cardnumber, $mimetype, $imgfile) = @_;
1975
    my ($cardnumber, $mimetype, $imgfile) = @_;
1976
    warn "Parameters passed in: Cardnumber=$cardnumber, Mimetype=$mimetype, " . ($imgfile ? "Imagefile" : "No Imagefile") if $debug;
1976
    warn "Parameters passed in: Cardnumber=$cardnumber, Mimetype=$mimetype, " . ($imgfile ? "Imagefile" : "No Imagefile") if $debug;
1977
    my $dbh = C4::Context->dbh;
1977
    my $dbh = C4::Context->dbh;
1978
    my $query = "INSERT INTO patronimage (cardnumber, mimetype, imagefile) VALUES (?,?,?) ON DUPLICATE KEY UPDATE imagefile = ?;";
1978
    my $query = "INSERT INTO patronimage (borrowernumber, mimetype, imagefile) VALUES ( ( SELECT borrowernumber from borrowers WHERE cardnumber = ? ),?,?) ON DUPLICATE KEY UPDATE imagefile = ?;";
1979
    my $sth = $dbh->prepare($query);
1979
    my $sth = $dbh->prepare($query);
1980
    $sth->execute($cardnumber,$mimetype,$imgfile,$imgfile);
1980
    $sth->execute($cardnumber,$mimetype,$imgfile,$imgfile);
1981
    warn "Error returned inserting $cardnumber.$mimetype." if $sth->errstr;
1981
    warn "Error returned inserting $cardnumber.$mimetype." if $sth->errstr;
Lines 1984-2002 sub PutPatronImage { Link Here
1984
1984
1985
=head2 RmPatronImage
1985
=head2 RmPatronImage
1986
1986
1987
    my ($dberror) = RmPatronImage($cardnumber);
1987
    my ($dberror) = RmPatronImage($borrowernumber);
1988
1988
1989
Removes the image for the patron with the supplied cardnumber.
1989
Removes the image for the patron with the supplied borrowernumber.
1990
1990
1991
=cut
1991
=cut
1992
1992
1993
sub RmPatronImage {
1993
sub RmPatronImage {
1994
    my ($cardnumber) = @_;
1994
    my ($borrowernumber) = @_;
1995
    warn "Cardnumber passed to GetPatronImage is $cardnumber" if $debug;
1995
    warn "Borrowernumber passed to GetPatronImage is $borrowernumber" if $debug;
1996
    my $dbh = C4::Context->dbh;
1996
    my $dbh = C4::Context->dbh;
1997
    my $query = "DELETE FROM patronimage WHERE cardnumber = ?;";
1997
    my $query = "DELETE FROM patronimage WHERE borrowernumber = ?;";
1998
    my $sth = $dbh->prepare($query);
1998
    my $sth = $dbh->prepare($query);
1999
    $sth->execute($cardnumber);
1999
    $sth->execute($borrowernumber);
2000
    my $dberror = $sth->errstr;
2000
    my $dberror = $sth->errstr;
2001
    warn "Database error!" if $sth->errstr;
2001
    warn "Database error!" if $sth->errstr;
2002
    return $dberror;
2002
    return $dberror;
(-)a/circ/circulation.pl (-1 / +1 lines)
Lines 765-771 if ($stickyduedate) { Link Here
765
    $session->param( 'stickyduedate', $duedatespec );
765
    $session->param( 'stickyduedate', $duedatespec );
766
}
766
}
767
767
768
my ($picture, $dberror) = GetPatronImage($borrower->{'cardnumber'});
768
my ($picture, $dberror) = GetPatronImage($borrower->{'borrowernumber'});
769
$template->param( picture => 1 ) if $picture;
769
$template->param( picture => 1 ) if $picture;
770
770
771
# get authorised values with type of BOR_NOTES
771
# get authorised values with type of BOR_NOTES
(-)a/installer/data/mysql/updatedatabase.pl (+35 lines)
Lines 7067-7072 if ( CheckVersion($DBversion) ) { Link Here
7067
    SetVersion($DBversion);
7067
    SetVersion($DBversion);
7068
}
7068
}
7069
7069
7070
$DBversion = "3.13.00.XXX";
7071
if ( CheckVersion($DBversion) ) {
7072
    $dbh->{AutoCommit} = 0;
7073
    $dbh->{RaiseError} = 1;
7074
7075
    eval {
7076
        $dbh->do(qq{
7077
            ALTER TABLE patronimage ADD borrowernumber INT( 11 ) NULL FIRST,
7078
            ADD UNIQUE ( borrowernumber )
7079
        });
7080
        $dbh->do(qq{
7081
            UPDATE patronimage LEFT JOIN borrowers USING ( cardnumber ) SET patronimage.borrowernumber = borrowers.borrowernumber
7082
        });
7083
        $dbh->do(qq{
7084
            ALTER TABLE patronimage DROP FOREIGN KEY patronimage_fk1
7085
        });
7086
        $dbh->do(qq{
7087
            ALTER TABLE patronimage DROP PRIMARY KEY, ADD PRIMARY KEY( borrowernumber )
7088
        });
7089
        $dbh->do(qq{
7090
            ALTER TABLE patronimage DROP cardnumber 
7091
        });
7092
        $dbh->commit();
7093
    };
7094
7095
    if ($@) {
7096
        print "Upgrade to $DBversion done (Bug 10636 - patronimage should have borrowernumber as PK, not cardnumber) failed! Transaction aborted because $@\n";
7097
        eval { $dbh->rollback };
7098
    }
7099
    else {
7100
        print "Upgrade to $DBversion done (Bug 10636 - patronimage should have borrowernumber as PK, not cardnumber)\n";
7101
        SetVersion($DBversion);
7102
    }
7103
}
7104
7070
=head1 FUNCTIONS
7105
=head1 FUNCTIONS
7071
7106
7072
=head2 TableExists($table)
7107
=head2 TableExists($table)
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/circ-menu.inc (-1 / +1 lines)
Lines 7-13 Link Here
7
<ul class="patronbriefinfo">
7
<ul class="patronbriefinfo">
8
[% IF ( patronimages ) %]
8
[% IF ( patronimages ) %]
9
[% IF ( picture ) %]
9
[% IF ( picture ) %]
10
<li><img src="/cgi-bin/koha/members/patronimage.pl?crdnum=[% cardnumber | uri %]" id="patronimage" alt="[% firstname %] [% surname %] ([% cardnumber %])" border="0" style="max-width : 140px; margin: .3em 0 .3em .3em; padding: .2em; border: 1px solid #CCCCCC; width:auto !important; width:130px;" /></li>
10
<li><img src="/cgi-bin/koha/members/patronimage.pl?borrowernumber=[% borrowernumber | uri %]" id="patronimage" alt="[% firstname %] [% surname %] ([% cardnumber %])" border="0" style="max-width : 140px; margin: .3em 0 .3em .3em; padding: .2em; border: 1px solid #CCCCCC; width:auto !important; width:130px;" /></li>
11
[% ELSE %]
11
[% ELSE %]
12
<li id="patronbasics"><img src="[% interface %]/[% theme %]/img/patron-blank.png" alt="[% firstname %] [% surname %] ([% cardnumber %])" border="0" style="margin: .3em 0 .3em .3em; padding: .2em; border: 1px solid #CCCCCC;" /></li>
12
<li id="patronbasics"><img src="[% interface %]/[% theme %]/img/patron-blank.png" alt="[% firstname %] [% surname %] ([% cardnumber %])" border="0" style="margin: .3em 0 .3em .3em; padding: .2em; border: 1px solid #CCCCCC;" /></li>
13
[% END %]
13
[% END %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/circ-menu.tt (-1 / +1 lines)
Lines 9-15 in the global namespace %] Link Here
9
<ul class="patronbriefinfo">
9
<ul class="patronbriefinfo">
10
[% IF ( patronimages ) %]
10
[% IF ( patronimages ) %]
11
[% IF borrower.has_picture %]
11
[% IF borrower.has_picture %]
12
<li><img src="/cgi-bin/koha/members/patronimage.pl?crdnum=[% borrower.cardnumber %]" id="patronimage" alt="[% borrower.firstname %] [% borrower.surname %] ([% borrower.cardnumber %])" border="0" style="max-width : 140px; margin: .3em 0 .3em .3em; padding: .2em; border: 1px solid #CCCCCC; width:auto !important; width:130px;" /></li>
12
<li><img src="/cgi-bin/koha/members/patronimage.pl?borrowernumber=[% borrower.borrowernumber %]" id="patronimage" alt="[% borrower.firstname %] [% borrower.surname %] ([% borrower.cardnumber %])" border="0" style="max-width : 140px; margin: .3em 0 .3em .3em; padding: .2em; border: 1px solid #CCCCCC; width:auto !important; width:130px;" /></li>
13
[% ELSE %]
13
[% ELSE %]
14
<li id="patronbasics"><img src="[% interface %]/[% theme %]/img/patron-blank.png" alt="[% borrower.firstname %] [% borrower.surname %] ([% borrower.cardnumber %])" border="0" style="margin: .3em 0 .3em .3em; padding: .2em; border: 1px solid #CCCCCC;" /></li>
14
<li id="patronbasics"><img src="[% interface %]/[% theme %]/img/patron-blank.png" alt="[% borrower.firstname %] [% borrower.surname %] ([% borrower.cardnumber %])" border="0" style="margin: .3em 0 .3em .3em; padding: .2em; border: 1px solid #CCCCCC;" /></li>
15
[% END %]
15
[% END %]
(-)a/members/boraccount.pl (-1 / +1 lines)
Lines 92-98 foreach my $accountline ( @{$accts}) { Link Here
92
92
93
$template->param( adultborrower => 1 ) if ( $data->{'category_type'} eq 'A' );
93
$template->param( adultborrower => 1 ) if ( $data->{'category_type'} eq 'A' );
94
94
95
my ($picture, $dberror) = GetPatronImage($data->{'cardnumber'});
95
my ($picture, $dberror) = GetPatronImage($data->{'borrowernumber'});
96
$template->param( picture => 1 ) if $picture;
96
$template->param( picture => 1 ) if $picture;
97
97
98
if (C4::Context->preference('ExtendedPatronAttributes')) {
98
if (C4::Context->preference('ExtendedPatronAttributes')) {
(-)a/members/deletemem.pl (-1 / +1 lines)
Lines 83-89 my $data=$sth->fetchrow_hashref; Link Here
83
if ($countissues > 0 or $flags->{'CHARGES'}  or $data->{'borrowernumber'}){
83
if ($countissues > 0 or $flags->{'CHARGES'}  or $data->{'borrowernumber'}){
84
    #   print $input->header;
84
    #   print $input->header;
85
85
86
    my ($picture, $dberror) = GetPatronImage($bor->{'cardnumber'});
86
    my ($picture, $dberror) = GetPatronImage($bor->{'borrowernumber'});
87
    $template->param( picture => 1 ) if $picture;
87
    $template->param( picture => 1 ) if $picture;
88
88
89
    $template->param(borrowernumber => $member,
89
    $template->param(borrowernumber => $member,
(-)a/members/files.pl (-1 / +1 lines)
Lines 115-121 else { Link Here
115
        );
115
        );
116
    }
116
    }
117
117
118
    my ($picture, $dberror) = GetPatronImage($data->{'cardnumber'});
118
    my ($picture, $dberror) = GetPatronImage($data->{'borrowernumber'});
119
    $template->param( picture => 1 ) if $picture;
119
    $template->param( picture => 1 ) if $picture;
120
120
121
    $template->param(
121
    $template->param(
(-)a/members/mancredit.pl (-1 / +1 lines)
Lines 77-83 if ($add){ Link Here
77
    }
77
    }
78
78
79
    $template->param( adultborrower => 1 ) if ( $data->{category_type} eq 'A' );
79
    $template->param( adultborrower => 1 ) if ( $data->{category_type} eq 'A' );
80
    my ($picture, $dberror) = GetPatronImage($data->{'cardnumber'});
80
    my ($picture, $dberror) = GetPatronImage($data->{'borrowernumber'});
81
    $template->param( picture => 1 ) if $picture;
81
    $template->param( picture => 1 ) if $picture;
82
82
83
if (C4::Context->preference('ExtendedPatronAttributes')) {
83
if (C4::Context->preference('ExtendedPatronAttributes')) {
(-)a/members/maninvoice.pl (-1 / +1 lines)
Lines 105-111 if ($add){ Link Here
105
    }
105
    }
106
106
107
    $template->param( adultborrower => 1 ) if ( $data->{'category_type'} eq 'A' );
107
    $template->param( adultborrower => 1 ) if ( $data->{'category_type'} eq 'A' );
108
    my ($picture, $dberror) = GetPatronImage($data->{'cardnumber'});
108
    my ($picture, $dberror) = GetPatronImage($data->{'borrowernumber'});
109
    $template->param( picture => 1 ) if $picture;
109
    $template->param( picture => 1 ) if $picture;
110
110
111
if (C4::Context->preference('ExtendedPatronAttributes')) {
111
if (C4::Context->preference('ExtendedPatronAttributes')) {
(-)a/members/member-flags.pl (-1 / +1 lines)
Lines 160-166 if ($input->param('newflags')) { Link Here
160
    }
160
    }
161
	
161
	
162
$template->param( adultborrower => 1 ) if ( $bor->{'category_type'} eq 'A' );
162
$template->param( adultborrower => 1 ) if ( $bor->{'category_type'} eq 'A' );
163
    my ($picture, $dberror) = GetPatronImage($bor->{'cardnumber'});
163
    my ($picture, $dberror) = GetPatronImage($bor->{'borrowernumber'});
164
    $template->param( picture => 1 ) if $picture;
164
    $template->param( picture => 1 ) if $picture;
165
165
166
if (C4::Context->preference('ExtendedPatronAttributes')) {
166
if (C4::Context->preference('ExtendedPatronAttributes')) {
(-)a/members/member-password.pl (-1 / +1 lines)
Lines 88-94 if ( $newpassword && !scalar(@errors) ) { Link Here
88
    }
88
    }
89
	
89
	
90
$template->param( adultborrower => 1 ) if ( $bor->{'category_type'} eq 'A' );
90
$template->param( adultborrower => 1 ) if ( $bor->{'category_type'} eq 'A' );
91
my ($picture, $dberror) = GetPatronImage($bor->{'cardnumber'});
91
my ($picture, $dberror) = GetPatronImage($bor->{'borrowernumber'});
92
$template->param( picture => 1 ) if $picture;
92
$template->param( picture => 1 ) if $picture;
93
93
94
if (C4::Context->preference('ExtendedPatronAttributes')) {
94
if (C4::Context->preference('ExtendedPatronAttributes')) {
(-)a/members/moremember.pl (-1 / +1 lines)
Lines 356-362 if($userenv->{flags} % 2 == 1){ Link Here
356
# check to see if patron's image exists in the database
356
# check to see if patron's image exists in the database
357
# basically this gives us a template var to condition the display of
357
# basically this gives us a template var to condition the display of
358
# patronimage related interface on
358
# patronimage related interface on
359
my ($picture, $dberror) = GetPatronImage($data->{'cardnumber'});
359
my ($picture, $dberror) = GetPatronImage($data->{'borrowernumber'});
360
$template->param( picture => 1 ) if $picture;
360
$template->param( picture => 1 ) if $picture;
361
361
362
my $branch=C4::Context->userenv->{'branch'};
362
my $branch=C4::Context->userenv->{'branch'};
(-)a/members/notices.pl (-1 / +1 lines)
Lines 47-53 my ($template, $loggedinuser, $cookie) Link Here
47
				});
47
				});
48
48
49
$template->param( $borrower );
49
$template->param( $borrower );
50
my ($picture, $dberror) = GetPatronImage($borrower->{'cardnumber'});
50
my ($picture, $dberror) = GetPatronImage($borrower->{'borrowernumber'});
51
$template->param( picture => 1 ) if $picture;
51
$template->param( picture => 1 ) if $picture;
52
52
53
# Getting the messages
53
# Getting the messages
(-)a/members/patronimage.pl (-9 / +9 lines)
Lines 31-37 $|=1; Link Here
31
31
32
my $DEBUG = 0;
32
my $DEBUG = 0;
33
my $data = new CGI;
33
my $data = new CGI;
34
my $cardnumber;
34
my $borrowernumber;
35
35
36
=head1 NAME
36
=head1 NAME
37
37
Lines 39-62 patronimage.pl - Script for retrieving and formatting Koha patron images for dis Link Here
39
39
40
=head1 SYNOPSIS
40
=head1 SYNOPSIS
41
41
42
<img src="patronimage.pl?crdnum= />
42
<img src="patronimage.pl?borrowernumber= />
43
43
44
=head1 DESCRIPTION
44
=head1 DESCRIPTION
45
45
46
This script, when called from within HTML and passed a valid patron cardnumber, will retrieve the image data associated with that cardnumber if one exists, format it in proper HTML format and pass it back to be displayed.
46
This script, when called from within HTML and passed a valid patron borrowernumber, will retrieve the image data associated with that borrowernumber if one exists, format it in proper HTML format and pass it back to be displayed.
47
47
48
=cut
48
=cut
49
49
50
if ($data->param('crdnum')) {
50
if ($data->param('borrowernumber')) {
51
    $cardnumber = $data->param('crdnum');
51
    $borrowernumber = $data->param('borrowernumber');
52
} else {
52
} else {
53
    $cardnumber = shift;
53
    $borrowernumber = shift;
54
}
54
}
55
55
56
56
57
warn "Cardnumber passed in: $cardnumber" if $DEBUG;
57
warn "Borrowernumber passed in: $borrowernumber" if $DEBUG;
58
58
59
my ($imagedata, $dberror) = GetPatronImage($cardnumber);
59
my ($imagedata, $dberror) = GetPatronImage($borrowernumber);
60
60
61
if ($dberror) {
61
if ($dberror) {
62
    warn "Database Error!";
62
    warn "Database Error!";
Lines 70-76 if ($imagedata) { Link Here
70
    print $data->header (-type => $imagedata->{'mimetype'}, -'Cache-Control' => 'no-store', -Content_Length => length ($imagedata->{'imagefile'})), $imagedata->{'imagefile'};
70
    print $data->header (-type => $imagedata->{'mimetype'}, -'Cache-Control' => 'no-store', -Content_Length => length ($imagedata->{'imagefile'})), $imagedata->{'imagefile'};
71
    exit;
71
    exit;
72
} else {
72
} else {
73
    warn "No image exists for $cardnumber";
73
    warn "No image exists for $borrowernumber";
74
    exit;
74
    exit;
75
}
75
}
76
76
(-)a/members/pay.pl (-1 / +1 lines)
Lines 220-226 sub borrower_add_additional_fields { Link Here
220
    } elsif ( $b_ref->{category_type} eq 'A' ) {
220
    } elsif ( $b_ref->{category_type} eq 'A' ) {
221
        $b_ref->{adultborrower} = 1;
221
        $b_ref->{adultborrower} = 1;
222
    }
222
    }
223
    my ( $picture, $dberror ) = GetPatronImage( $b_ref->{cardnumber} );
223
    my ( $picture, $dberror ) = GetPatronImage( $b_ref->{borrowernumber} );
224
    if ($picture) {
224
    if ($picture) {
225
        $b_ref->{has_picture} = 1;
225
        $b_ref->{has_picture} = 1;
226
    }
226
    }
(-)a/members/paycollect.pl (-1 / +1 lines)
Lines 169-175 sub borrower_add_additional_fields { Link Here
169
    } elsif ( $b_ref->{category_type} eq 'A' ) {
169
    } elsif ( $b_ref->{category_type} eq 'A' ) {
170
        $b_ref->{adultborrower} = 1;
170
        $b_ref->{adultborrower} = 1;
171
    }
171
    }
172
    my ( $picture, $dberror ) = GetPatronImage( $b_ref->{cardnumber} );
172
    my ( $picture, $dberror ) = GetPatronImage( $b_ref->{borrowernumber} );
173
    if ($picture) {
173
    if ($picture) {
174
        $b_ref->{has_picture} = 1;
174
        $b_ref->{has_picture} = 1;
175
    }
175
    }
(-)a/members/printfeercpt.pl (-1 / +1 lines)
Lines 113-119 for (my $i=0;$i<$numaccts;$i++){ Link Here
113
113
114
$template->param( adultborrower => 1 ) if ( $data->{'category_type'} eq 'A' );
114
$template->param( adultborrower => 1 ) if ( $data->{'category_type'} eq 'A' );
115
115
116
my ($picture, $dberror) = GetPatronImage($data->{'cardnumber'});
116
my ($picture, $dberror) = GetPatronImage($data->{'borrowernumber'});
117
$template->param( picture => 1 ) if $picture;
117
$template->param( picture => 1 ) if $picture;
118
118
119
$template->param(
119
$template->param(
(-)a/members/printinvoice.pl (-1 / +1 lines)
Lines 113-119 for (my $i=0;$i<$numaccts;$i++){ Link Here
113
113
114
$template->param( adultborrower => 1 ) if ( $data->{'category_type'} eq 'A' );
114
$template->param( adultborrower => 1 ) if ( $data->{'category_type'} eq 'A' );
115
115
116
my ($picture, $dberror) = GetPatronImage($data->{'cardnumber'});
116
my ($picture, $dberror) = GetPatronImage($data->{'borrowernumber'});
117
$template->param( picture => 1 ) if $picture;
117
$template->param( picture => 1 ) if $picture;
118
118
119
$template->param(
119
$template->param(
(-)a/members/readingrec.pl (-1 / +1 lines)
Lines 103-109 if (! $limit){ Link Here
103
}
103
}
104
104
105
105
106
my ($picture, $dberror) = GetPatronImage($data->{'cardnumber'});
106
my ($picture, $dberror) = GetPatronImage($data->{'borrowernumber'});
107
$template->param( picture => 1 ) if $picture;
107
$template->param( picture => 1 ) if $picture;
108
108
109
if (C4::Context->preference('ExtendedPatronAttributes')) {
109
if (C4::Context->preference('ExtendedPatronAttributes')) {
(-)a/members/routing-lists.pl (-1 / +1 lines)
Lines 128-134 $template->param( Link Here
128
    RoutingSerials => C4::Context->preference('RoutingSerials'),
128
    RoutingSerials => C4::Context->preference('RoutingSerials'),
129
);
129
);
130
130
131
my ($picture, $dberror) = GetPatronImage($borrower->{'cardnumber'});
131
my ($picture, $dberror) = GetPatronImage($borrower->{'borrowernumber'});
132
$template->param( picture => 1 ) if $picture;
132
$template->param( picture => 1 ) if $picture;
133
133
134
output_html_with_http_headers $query, $cookie, $template->output;
134
output_html_with_http_headers $query, $cookie, $template->output;
(-)a/members/statistics.pl (-1 / +1 lines)
Lines 91-97 if (C4::Context->preference('ExtendedPatronAttributes')) { Link Here
91
    );
91
    );
92
}
92
}
93
93
94
my ($picture, $dberror) = GetPatronImage($borrower->{'cardnumber'});
94
my ($picture, $dberror) = GetPatronImage($borrower->{'borrowernumber'});
95
$template->param( picture => 1 ) if $picture;
95
$template->param( picture => 1 ) if $picture;
96
96
97
$template->param(
97
$template->param(
(-)a/opac/opac-memberentry.pl (-1 / +1 lines)
Lines 200-206 elsif ( $action eq 'edit' ) { #Display logged in borrower's data Link Here
200
        borrower => $borrower, );
200
        borrower => $borrower, );
201
201
202
    if (C4::Context->preference('OPACpatronimages')) {
202
    if (C4::Context->preference('OPACpatronimages')) {
203
        my ($image, $dberror) = GetPatronImage($borrower->{cardnumber});
203
        my ($image, $dberror) = GetPatronImage($borrower->{borrowernumber});
204
        if ($image) {
204
        if ($image) {
205
            $template->param(
205
            $template->param(
206
                display_patron_image => 1
206
                display_patron_image => 1
(-)a/opac/opac-patron-image.pl (-2 / +1 lines)
Lines 37-45 my %cookies = fetch CGI::Cookie; Link Here
37
my $sessid = $cookies{'CGISESSID'}->value;
37
my $sessid = $cookies{'CGISESSID'}->value;
38
my ($auth_status, $auth_sessid) = check_cookie_auth($sessid, $needed_flags);
38
my ($auth_status, $auth_sessid) = check_cookie_auth($sessid, $needed_flags);
39
my $borrowernumber = C4::Context->userenv->{'number'};
39
my $borrowernumber = C4::Context->userenv->{'number'};
40
my $cardnumber = C4::Context->userenv->{'cardnumber'};
41
40
42
my ($imagedata, $dberror) = GetPatronImage($cardnumber);
41
my ($imagedata, $dberror) = GetPatronImage($borrowernumber);
43
42
44
if ($dberror) {
43
if ($dberror) {
45
    print $query->header(status => '500 internal error');
44
    print $query->header(status => '500 internal error');
(-)a/opac/sco/sco-main.pl (-1 / +1 lines)
Lines 248-254 if ($borrower->{cardnumber}) { Link Here
248
248
249
    );
249
    );
250
    if (C4::Context->preference('ShowPatronImageInWebBasedSelfCheck')) {
250
    if (C4::Context->preference('ShowPatronImageInWebBasedSelfCheck')) {
251
        my ($image, $dberror) = GetPatronImage($borrower->{cardnumber});
251
        my ($image, $dberror) = GetPatronImage($borrower->{borrowernumber});
252
        if ($image) {
252
        if ($image) {
253
            $template->param(
253
            $template->param(
254
                display_patron_image => 1,
254
                display_patron_image => 1,
(-)a/opac/sco/sco-patron-image.pl (-2 / +2 lines)
Lines 33-41 unless (C4::Context->preference('ShowPatronImageInWebBasedSelfCheck')) { Link Here
33
    exit;
33
    exit;
34
}
34
}
35
35
36
my ($cardnumber) = C4::Service->require_params('cardnumber');
36
my ($borrowernumber) = C4::Service->require_params('borrowernumber');
37
37
38
my ($imagedata, $dberror) = GetPatronImage($cardnumber);
38
my ($imagedata, $dberror) = GetPatronImage($borrowernumber);
39
39
40
if ($dberror) {
40
if ($dberror) {
41
    print $query->header(status => '500 internal error');
41
    print $query->header(status => '500 internal error');
(-)a/patroncards/create-pdf.pl (-1 / +1 lines)
Lines 145-151 foreach my $item (@{$items}) { Link Here
145
                    next PROCESS_IMAGES;
145
                    next PROCESS_IMAGES;
146
                }
146
                }
147
                elsif ($images->{$_}->{'data_source'}->[0]->{'image_source'} eq 'patronimages') {
147
                elsif ($images->{$_}->{'data_source'}->[0]->{'image_source'} eq 'patronimages') {
148
                    ($image_data, $error) = GetPatronImage($card_number);
148
                    ($image_data, $error) = GetPatronImage($borrower_number);
149
                    warn sprintf('No image exists for borrower number %s.', $borrower_number) if !$image_data;
149
                    warn sprintf('No image exists for borrower number %s.', $borrower_number) if !$image_data;
150
                    next PROCESS_IMAGES if !$image_data;
150
                    next PROCESS_IMAGES if !$image_data;
151
                }
151
                }
(-)a/tools/picture-upload.pl (-1 / +1 lines)
Lines 146-152 if ( ($op eq 'Upload') && $uploadfile ) { # Case is important in these ope Link Here
146
    $template->param(cardnumber => $cardnumber);
146
    $template->param(cardnumber => $cardnumber);
147
    $template->param(filetype => $filetype);
147
    $template->param(filetype => $filetype);
148
} elsif ( $op eq 'Delete' ) {
148
} elsif ( $op eq 'Delete' ) {
149
    my $dberror = RmPatronImage($cardnumber);
149
    my $dberror = RmPatronImage($borrowernumber);
150
	$debug and warn "Patron image deleted for $cardnumber";
150
	$debug and warn "Patron image deleted for $cardnumber";
151
    warn "Database returned $dberror" if $dberror;
151
    warn "Database returned $dberror" if $dberror;
152
}
152
}
(-)a/tools/viewlog.pl (-2 / +1 lines)
Lines 72-78 if ($src eq 'circ') { # if we were called from circulation, use the circulatio Link Here
72
    use C4::Members;
72
    use C4::Members;
73
    my $borrowernumber = $object;
73
    my $borrowernumber = $object;
74
    my $data = GetMember('borrowernumber'=>$borrowernumber);
74
    my $data = GetMember('borrowernumber'=>$borrowernumber);
75
    my ($picture, $dberror) = GetPatronImage($data->{'cardnumber'});
75
    my ($picture, $dberror) = GetPatronImage($data->{'borrowernumber'});
76
    $template->param( picture => 1 ) if $picture;
76
    $template->param( picture => 1 ) if $picture;
77
    
77
    
78
    $template->param(   menu            => 1,
78
    $template->param(   menu            => 1,
79
- 

Return to bug 10636