From 09b8ce2a5f6ef81a2bc3c347a92d01ba7bc5845d Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Thu, 29 Aug 2013 12:23:39 -0400 Subject: [PATCH] Bug 10636 - patronimage should have borrowernumber as PK, not cardnumber Test Plan: 1) Apply this patch 2) Run updatedatabase.pl 3) Enable patronimages 4) Verify patron images are still displaying correctly 5) Test deleting a patron image 6) Test adding a patron image from moremember.pl 7) Test adding a patron image from tools/picture-upload.pl Signed-off-by: Srdjan Signed-off-by: Galen Charlton --- C4/Members.pm | 26 +++++------ circ/circulation.pl | 2 +- installer/data/mysql/kohastructure.sql | 6 +-- installer/data/mysql/updatedatabase.pl | 45 +++++++++++++++++++ .../prog/en/includes/circ-menu.inc | 2 +- .../prog/en/includes/circ-menu.tt | 2 +- members/boraccount.pl | 2 +- members/deletemem.pl | 2 +- members/files.pl | 2 +- members/mancredit.pl | 2 +- members/maninvoice.pl | 2 +- members/member-flags.pl | 2 +- members/member-password.pl | 2 +- members/moremember.pl | 2 +- members/notices.pl | 2 +- members/patronimage.pl | 18 ++++---- members/pay.pl | 2 +- members/paycollect.pl | 2 +- members/printfeercpt.pl | 2 +- members/printinvoice.pl | 2 +- members/readingrec.pl | 2 +- members/routing-lists.pl | 2 +- members/statistics.pl | 2 +- opac/opac-memberentry.pl | 2 +- opac/opac-patron-image.pl | 3 +- opac/sco/sco-main.pl | 2 +- opac/sco/sco-patron-image.pl | 4 +- patroncards/create-pdf.pl | 2 +- tools/picture-upload.pl | 2 +- tools/viewlog.pl | 2 +- 30 files changed, 97 insertions(+), 53 deletions(-) diff --git a/C4/Members.pm b/C4/Members.pm index 1d966b301d..62a07dd090 100644 --- a/C4/Members.pm +++ b/C4/Members.pm @@ -1921,19 +1921,19 @@ sub GetTitles { =head2 GetPatronImage - my ($imagedata, $dberror) = GetPatronImage($cardnumber); + my ($imagedata, $dberror) = GetPatronImage($borrowernumber); -Returns the mimetype and binary image data of the image for the patron with the supplied cardnumber. +Returns the mimetype and binary image data of the image for the patron with the supplied borrowernumber. =cut sub GetPatronImage { - my ($cardnumber) = @_; - warn "Cardnumber passed to GetPatronImage is $cardnumber" if $debug; + my ($borrowernumber) = @_; + warn "Borrowernumber passed to GetPatronImage is $borrowernumber" if $debug; my $dbh = C4::Context->dbh; - my $query = 'SELECT mimetype, imagefile FROM patronimage WHERE cardnumber = ?'; + my $query = 'SELECT mimetype, imagefile FROM patronimage WHERE borrowernumber = ?'; my $sth = $dbh->prepare($query); - $sth->execute($cardnumber); + $sth->execute($borrowernumber); my $imagedata = $sth->fetchrow_hashref; warn "Database error!" if $sth->errstr; return $imagedata, $sth->errstr; @@ -1952,7 +1952,7 @@ sub PutPatronImage { my ($cardnumber, $mimetype, $imgfile) = @_; warn "Parameters passed in: Cardnumber=$cardnumber, Mimetype=$mimetype, " . ($imgfile ? "Imagefile" : "No Imagefile") if $debug; my $dbh = C4::Context->dbh; - my $query = "INSERT INTO patronimage (cardnumber, mimetype, imagefile) VALUES (?,?,?) ON DUPLICATE KEY UPDATE imagefile = ?;"; + my $query = "INSERT INTO patronimage (borrowernumber, mimetype, imagefile) VALUES ( ( SELECT borrowernumber from borrowers WHERE cardnumber = ? ),?,?) ON DUPLICATE KEY UPDATE imagefile = ?;"; my $sth = $dbh->prepare($query); $sth->execute($cardnumber,$mimetype,$imgfile,$imgfile); warn "Error returned inserting $cardnumber.$mimetype." if $sth->errstr; @@ -1961,19 +1961,19 @@ sub PutPatronImage { =head2 RmPatronImage - my ($dberror) = RmPatronImage($cardnumber); + my ($dberror) = RmPatronImage($borrowernumber); -Removes the image for the patron with the supplied cardnumber. +Removes the image for the patron with the supplied borrowernumber. =cut sub RmPatronImage { - my ($cardnumber) = @_; - warn "Cardnumber passed to GetPatronImage is $cardnumber" if $debug; + my ($borrowernumber) = @_; + warn "Borrowernumber passed to GetPatronImage is $borrowernumber" if $debug; my $dbh = C4::Context->dbh; - my $query = "DELETE FROM patronimage WHERE cardnumber = ?;"; + my $query = "DELETE FROM patronimage WHERE borrowernumber = ?;"; my $sth = $dbh->prepare($query); - $sth->execute($cardnumber); + $sth->execute($borrowernumber); my $dberror = $sth->errstr; warn "Database error!" if $sth->errstr; return $dberror; diff --git a/circ/circulation.pl b/circ/circulation.pl index efd533e57c..cd997b3eb3 100755 --- a/circ/circulation.pl +++ b/circ/circulation.pl @@ -765,7 +765,7 @@ if ($stickyduedate) { $session->param( 'stickyduedate', $duedatespec ); } -my ($picture, $dberror) = GetPatronImage($borrower->{'cardnumber'}); +my ($picture, $dberror) = GetPatronImage($borrower->{'borrowernumber'}); $template->param( picture => 1 ) if $picture; # get authorised values with type of BOR_NOTES diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql index c361885d9f..024039fbdd 100644 --- a/installer/data/mysql/kohastructure.sql +++ b/installer/data/mysql/kohastructure.sql @@ -1665,11 +1665,11 @@ CREATE TABLE `patroncards` ( DROP TABLE IF EXISTS `patronimage`; CREATE TABLE `patronimage` ( -- information related to patron images - `cardnumber` varchar(16) NOT NULL, -- the cardnumber of the patron this image is attached to (borrowers.cardnumber) + `borrowernumber` int(11) NOT NULL, -- the borrowernumber of the patron this image is attached to (borrowers.borrowernumber) `mimetype` varchar(15) NOT NULL, -- the format of the image (png, jpg, etc) `imagefile` mediumblob NOT NULL, -- the image - PRIMARY KEY (`cardnumber`), - CONSTRAINT `patronimage_fk1` FOREIGN KEY (`cardnumber`) REFERENCES `borrowers` (`cardnumber`) ON DELETE CASCADE ON UPDATE CASCADE + PRIMARY KEY (`borrowernumber`), + CONSTRAINT `patronimage_fk1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- Table structure for table `pending_offline_operations` diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index d5015ead48..7431fe59ad 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -7216,6 +7216,51 @@ if ( CheckVersion($DBversion) ) { SetVersion($DBversion); } +$DBversion = "3.13.00.XXX"; +if ( CheckVersion($DBversion) ) { + $dbh->do(qq{ + DELETE FROM patronimage WHERE NOT EXISTS (SELECT * FROM borrowers WHERE borrowers.cardnumber = patronimage.cardnumber) + }); + + $dbh->do(qq{ + ALTER TABLE patronimage ADD borrowernumber INT( 11 ) NULL FIRST + }); + + $dbh->{AutoCommit} = 0; + $dbh->{RaiseError} = 1; + + eval { + $dbh->do(qq{ + UPDATE patronimage LEFT JOIN borrowers USING ( cardnumber ) SET patronimage.borrowernumber = borrowers.borrowernumber + }); + $dbh->commit(); + }; + + if ($@) { + print "Upgrade to $DBversion done (Bug 10636 - patronimage should have borrowernumber as PK, not cardnumber) failed! Transaction aborted because $@\n"; + eval { $dbh->rollback }; + } + else { + $dbh->do(qq{ + ALTER TABLE patronimage DROP FOREIGN KEY patronimage_fk1 + }); + $dbh->do(qq{ + ALTER TABLE patronimage DROP PRIMARY KEY, ADD PRIMARY KEY( borrowernumber ) + }); + $dbh->do(qq{ + ALTER TABLE patronimage DROP cardnumber + }); + $dbh->do(qq{ + ALTER TABLE patronimage ADD FOREIGN KEY ( borrowernumber ) REFERENCES borrowers ( borrowernumber ) ON DELETE CASCADE ON UPDATE CASCADE + }); + + print "Upgrade to $DBversion done (Bug 10636 - patronimage should have borrowernumber as PK, not cardnumber)\n"; + SetVersion($DBversion); + } + + $dbh->{AutoCommit} = 1; + $dbh->{RaiseError} = 0; +} =head1 FUNCTIONS diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/circ-menu.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/circ-menu.inc index 4632467bbd..62db1c50d1 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/circ-menu.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/circ-menu.inc @@ -7,7 +7,7 @@
    [% IF ( patronimages ) %] [% IF ( picture ) %] -
  • [% firstname %] [% surname %] ([% cardnumber %])
  • +
  • [% firstname %] [% surname %] ([% cardnumber %])
  • [% ELSE %]
  • [% firstname %] [% surname %] ([% cardnumber %])
  • [% END %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/circ-menu.tt b/koha-tmpl/intranet-tmpl/prog/en/includes/circ-menu.tt index 8d52b90355..7f8cb48f50 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/circ-menu.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/circ-menu.tt @@ -9,7 +9,7 @@ in the global namespace %]
      [% IF ( patronimages ) %] [% IF borrower.has_picture %] -
    • [% borrower.firstname %] [% borrower.surname %] ([% borrower.cardnumber %])
    • +
    • [% borrower.firstname %] [% borrower.surname %] ([% borrower.cardnumber %])
    • [% ELSE %]
    • [% borrower.firstname %] [% borrower.surname %] ([% borrower.cardnumber %])
    • [% END %] diff --git a/members/boraccount.pl b/members/boraccount.pl index 48e26209f6..255b1ff056 100755 --- a/members/boraccount.pl +++ b/members/boraccount.pl @@ -92,7 +92,7 @@ foreach my $accountline ( @{$accts}) { $template->param( adultborrower => 1 ) if ( $data->{'category_type'} eq 'A' ); -my ($picture, $dberror) = GetPatronImage($data->{'cardnumber'}); +my ($picture, $dberror) = GetPatronImage($data->{'borrowernumber'}); $template->param( picture => 1 ) if $picture; if (C4::Context->preference('ExtendedPatronAttributes')) { diff --git a/members/deletemem.pl b/members/deletemem.pl index ef6ba01877..6b99cb364f 100755 --- a/members/deletemem.pl +++ b/members/deletemem.pl @@ -83,7 +83,7 @@ my $data=$sth->fetchrow_hashref; if ($countissues > 0 or $flags->{'CHARGES'} or $data->{'borrowernumber'}){ # print $input->header; - my ($picture, $dberror) = GetPatronImage($bor->{'cardnumber'}); + my ($picture, $dberror) = GetPatronImage($bor->{'borrowernumber'}); $template->param( picture => 1 ) if $picture; $template->param(borrowernumber => $member, diff --git a/members/files.pl b/members/files.pl index 77d7be5e27..dc08751228 100755 --- a/members/files.pl +++ b/members/files.pl @@ -115,7 +115,7 @@ else { ); } - my ($picture, $dberror) = GetPatronImage($data->{'cardnumber'}); + my ($picture, $dberror) = GetPatronImage($data->{'borrowernumber'}); $template->param( picture => 1 ) if $picture; $template->param( diff --git a/members/mancredit.pl b/members/mancredit.pl index b011d1a10b..a2c2258ac0 100755 --- a/members/mancredit.pl +++ b/members/mancredit.pl @@ -77,7 +77,7 @@ if ($add){ } $template->param( adultborrower => 1 ) if ( $data->{category_type} eq 'A' ); - my ($picture, $dberror) = GetPatronImage($data->{'cardnumber'}); + my ($picture, $dberror) = GetPatronImage($data->{'borrowernumber'}); $template->param( picture => 1 ) if $picture; if (C4::Context->preference('ExtendedPatronAttributes')) { diff --git a/members/maninvoice.pl b/members/maninvoice.pl index 633153530e..c4a9294aa0 100755 --- a/members/maninvoice.pl +++ b/members/maninvoice.pl @@ -105,7 +105,7 @@ if ($add){ } $template->param( adultborrower => 1 ) if ( $data->{'category_type'} eq 'A' ); - my ($picture, $dberror) = GetPatronImage($data->{'cardnumber'}); + my ($picture, $dberror) = GetPatronImage($data->{'borrowernumber'}); $template->param( picture => 1 ) if $picture; if (C4::Context->preference('ExtendedPatronAttributes')) { diff --git a/members/member-flags.pl b/members/member-flags.pl index d1c165c1c9..7b0810800e 100755 --- a/members/member-flags.pl +++ b/members/member-flags.pl @@ -160,7 +160,7 @@ if ($input->param('newflags')) { } $template->param( adultborrower => 1 ) if ( $bor->{'category_type'} eq 'A' ); - my ($picture, $dberror) = GetPatronImage($bor->{'cardnumber'}); + my ($picture, $dberror) = GetPatronImage($bor->{'borrowernumber'}); $template->param( picture => 1 ) if $picture; if (C4::Context->preference('ExtendedPatronAttributes')) { diff --git a/members/member-password.pl b/members/member-password.pl index 9495e0e8d6..ac25da5ce7 100755 --- a/members/member-password.pl +++ b/members/member-password.pl @@ -89,7 +89,7 @@ if ( $newpassword && !scalar(@errors) ) { } $template->param( adultborrower => 1 ) if ( $bor->{'category_type'} eq 'A' ); -my ($picture, $dberror) = GetPatronImage($bor->{'cardnumber'}); +my ($picture, $dberror) = GetPatronImage($bor->{'borrowernumber'}); $template->param( picture => 1 ) if $picture; if (C4::Context->preference('ExtendedPatronAttributes')) { diff --git a/members/moremember.pl b/members/moremember.pl index 7ed96d3bb7..e7542a2cf6 100755 --- a/members/moremember.pl +++ b/members/moremember.pl @@ -356,7 +356,7 @@ if($userenv->{flags} % 2 == 1){ # check to see if patron's image exists in the database # basically this gives us a template var to condition the display of # patronimage related interface on -my ($picture, $dberror) = GetPatronImage($data->{'cardnumber'}); +my ($picture, $dberror) = GetPatronImage($data->{'borrowernumber'}); $template->param( picture => 1 ) if $picture; my $branch=C4::Context->userenv->{'branch'}; diff --git a/members/notices.pl b/members/notices.pl index 16935d96fd..aca4514319 100755 --- a/members/notices.pl +++ b/members/notices.pl @@ -47,7 +47,7 @@ my ($template, $loggedinuser, $cookie) }); $template->param( $borrower ); -my ($picture, $dberror) = GetPatronImage($borrower->{'cardnumber'}); +my ($picture, $dberror) = GetPatronImage($borrower->{'borrowernumber'}); $template->param( picture => 1 ) if $picture; # Getting the messages diff --git a/members/patronimage.pl b/members/patronimage.pl index e76d117ada..4f663d64ce 100755 --- a/members/patronimage.pl +++ b/members/patronimage.pl @@ -31,7 +31,7 @@ $|=1; my $DEBUG = 0; my $data = new CGI; -my $cardnumber; +my $borrowernumber; =head1 NAME @@ -39,24 +39,24 @@ patronimage.pl - Script for retrieving and formatting Koha patron images for dis =head1 SYNOPSIS - =head1 DESCRIPTION -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. +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. =cut -if ($data->param('crdnum')) { - $cardnumber = $data->param('crdnum'); +if ($data->param('borrowernumber')) { + $borrowernumber = $data->param('borrowernumber'); } else { - $cardnumber = shift; + $borrowernumber = shift; } -warn "Cardnumber passed in: $cardnumber" if $DEBUG; +warn "Borrowernumber passed in: $borrowernumber" if $DEBUG; -my ($imagedata, $dberror) = GetPatronImage($cardnumber); +my ($imagedata, $dberror) = GetPatronImage($borrowernumber); if ($dberror) { warn "Database Error!"; @@ -70,7 +70,7 @@ if ($imagedata) { print $data->header (-type => $imagedata->{'mimetype'}, -'Cache-Control' => 'no-store', -Content_Length => length ($imagedata->{'imagefile'})), $imagedata->{'imagefile'}; exit; } else { - warn "No image exists for $cardnumber"; + warn "No image exists for $borrowernumber"; exit; } diff --git a/members/pay.pl b/members/pay.pl index 4efffc306e..8a8e9022c1 100755 --- a/members/pay.pl +++ b/members/pay.pl @@ -220,7 +220,7 @@ sub borrower_add_additional_fields { } elsif ( $b_ref->{category_type} eq 'A' ) { $b_ref->{adultborrower} = 1; } - my ( $picture, $dberror ) = GetPatronImage( $b_ref->{cardnumber} ); + my ( $picture, $dberror ) = GetPatronImage( $b_ref->{borrowernumber} ); if ($picture) { $b_ref->{has_picture} = 1; } diff --git a/members/paycollect.pl b/members/paycollect.pl index 5edb64467c..96ca0fb7b8 100755 --- a/members/paycollect.pl +++ b/members/paycollect.pl @@ -169,7 +169,7 @@ sub borrower_add_additional_fields { } elsif ( $b_ref->{category_type} eq 'A' ) { $b_ref->{adultborrower} = 1; } - my ( $picture, $dberror ) = GetPatronImage( $b_ref->{cardnumber} ); + my ( $picture, $dberror ) = GetPatronImage( $b_ref->{borrowernumber} ); if ($picture) { $b_ref->{has_picture} = 1; } diff --git a/members/printfeercpt.pl b/members/printfeercpt.pl index 59d5cb39ef..efd03c1ede 100755 --- a/members/printfeercpt.pl +++ b/members/printfeercpt.pl @@ -113,7 +113,7 @@ for (my $i=0;$i<$numaccts;$i++){ $template->param( adultborrower => 1 ) if ( $data->{'category_type'} eq 'A' ); -my ($picture, $dberror) = GetPatronImage($data->{'cardnumber'}); +my ($picture, $dberror) = GetPatronImage($data->{'borrowernumber'}); $template->param( picture => 1 ) if $picture; $template->param( diff --git a/members/printinvoice.pl b/members/printinvoice.pl index fe8e7bd038..10ae114ab5 100755 --- a/members/printinvoice.pl +++ b/members/printinvoice.pl @@ -112,7 +112,7 @@ for ( my $i = 0 ; $i < $numaccts ; $i++ ) { $template->param( adultborrower => 1 ) if ( $data->{'category_type'} eq 'A' ); -my ( $picture, $dberror ) = GetPatronImage( $data->{'cardnumber'} ); +my ( $picture, $dberror ) = GetPatronImage( $data->{'borrowernumber'} ); $template->param( picture => 1 ) if $picture; $template->param( diff --git a/members/readingrec.pl b/members/readingrec.pl index d41e3f9818..0f0c3df4ec 100755 --- a/members/readingrec.pl +++ b/members/readingrec.pl @@ -103,7 +103,7 @@ if (! $limit){ } -my ($picture, $dberror) = GetPatronImage($data->{'cardnumber'}); +my ($picture, $dberror) = GetPatronImage($data->{'borrowernumber'}); $template->param( picture => 1 ) if $picture; if (C4::Context->preference('ExtendedPatronAttributes')) { diff --git a/members/routing-lists.pl b/members/routing-lists.pl index d70c1bc996..70165f7553 100755 --- a/members/routing-lists.pl +++ b/members/routing-lists.pl @@ -128,7 +128,7 @@ $template->param( RoutingSerials => C4::Context->preference('RoutingSerials'), ); -my ($picture, $dberror) = GetPatronImage($borrower->{'cardnumber'}); +my ($picture, $dberror) = GetPatronImage($borrower->{'borrowernumber'}); $template->param( picture => 1 ) if $picture; output_html_with_http_headers $query, $cookie, $template->output; diff --git a/members/statistics.pl b/members/statistics.pl index 0667ee7dfa..0914364f31 100755 --- a/members/statistics.pl +++ b/members/statistics.pl @@ -91,7 +91,7 @@ if (C4::Context->preference('ExtendedPatronAttributes')) { ); } -my ($picture, $dberror) = GetPatronImage($borrower->{'cardnumber'}); +my ($picture, $dberror) = GetPatronImage($borrower->{'borrowernumber'}); $template->param( picture => 1 ) if $picture; $template->param( diff --git a/opac/opac-memberentry.pl b/opac/opac-memberentry.pl index 112d405fb2..9106fb4ff7 100755 --- a/opac/opac-memberentry.pl +++ b/opac/opac-memberentry.pl @@ -200,7 +200,7 @@ elsif ( $action eq 'edit' ) { #Display logged in borrower's data borrower => $borrower, ); if (C4::Context->preference('OPACpatronimages')) { - my ($image, $dberror) = GetPatronImage($borrower->{cardnumber}); + my ($image, $dberror) = GetPatronImage($borrower->{borrowernumber}); if ($image) { $template->param( display_patron_image => 1 diff --git a/opac/opac-patron-image.pl b/opac/opac-patron-image.pl index d1f4489476..eab6abc0b7 100755 --- a/opac/opac-patron-image.pl +++ b/opac/opac-patron-image.pl @@ -37,9 +37,8 @@ my %cookies = fetch CGI::Cookie; my $sessid = $cookies{'CGISESSID'}->value; my ($auth_status, $auth_sessid) = check_cookie_auth($sessid, $needed_flags); my $borrowernumber = C4::Context->userenv->{'number'}; -my $cardnumber = C4::Context->userenv->{'cardnumber'}; -my ($imagedata, $dberror) = GetPatronImage($cardnumber); +my ($imagedata, $dberror) = GetPatronImage($borrowernumber); if ($dberror) { print $query->header(status => '500 internal error'); diff --git a/opac/sco/sco-main.pl b/opac/sco/sco-main.pl index 0f16c8cea3..62884eed2e 100755 --- a/opac/sco/sco-main.pl +++ b/opac/sco/sco-main.pl @@ -248,7 +248,7 @@ if ($borrower->{cardnumber}) { ); if (C4::Context->preference('ShowPatronImageInWebBasedSelfCheck')) { - my ($image, $dberror) = GetPatronImage($borrower->{cardnumber}); + my ($image, $dberror) = GetPatronImage($borrower->{borrowernumber}); if ($image) { $template->param( display_patron_image => 1, diff --git a/opac/sco/sco-patron-image.pl b/opac/sco/sco-patron-image.pl index b2ddcf3120..de8d8d6f9a 100755 --- a/opac/sco/sco-patron-image.pl +++ b/opac/sco/sco-patron-image.pl @@ -33,9 +33,9 @@ unless (C4::Context->preference('ShowPatronImageInWebBasedSelfCheck')) { exit; } -my ($cardnumber) = C4::Service->require_params('cardnumber'); +my ($borrowernumber) = C4::Service->require_params('borrowernumber'); -my ($imagedata, $dberror) = GetPatronImage($cardnumber); +my ($imagedata, $dberror) = GetPatronImage($borrowernumber); if ($dberror) { print $query->header(status => '500 internal error'); diff --git a/patroncards/create-pdf.pl b/patroncards/create-pdf.pl index 6a1b67a573..56a32e60f7 100755 --- a/patroncards/create-pdf.pl +++ b/patroncards/create-pdf.pl @@ -145,7 +145,7 @@ foreach my $item (@{$items}) { next PROCESS_IMAGES; } elsif ($images->{$_}->{'data_source'}->[0]->{'image_source'} eq 'patronimages') { - ($image_data, $error) = GetPatronImage($card_number); + ($image_data, $error) = GetPatronImage($borrower_number); warn sprintf('No image exists for borrower number %s.', $borrower_number) if !$image_data; next PROCESS_IMAGES if !$image_data; } diff --git a/tools/picture-upload.pl b/tools/picture-upload.pl index 54b66063e5..b2aa18a89c 100755 --- a/tools/picture-upload.pl +++ b/tools/picture-upload.pl @@ -146,7 +146,7 @@ if ( ($op eq 'Upload') && $uploadfile ) { # Case is important in these ope $template->param(cardnumber => $cardnumber); $template->param(filetype => $filetype); } elsif ( $op eq 'Delete' ) { - my $dberror = RmPatronImage($cardnumber); + my $dberror = RmPatronImage($borrowernumber); $debug and warn "Patron image deleted for $cardnumber"; warn "Database returned $dberror" if $dberror; } diff --git a/tools/viewlog.pl b/tools/viewlog.pl index e48aaef4c5..67ce7dd1bb 100755 --- a/tools/viewlog.pl +++ b/tools/viewlog.pl @@ -72,7 +72,7 @@ if ($src eq 'circ') { # if we were called from circulation, use the circulatio use C4::Members; my $borrowernumber = $object; my $data = GetMember('borrowernumber'=>$borrowernumber); - my ($picture, $dberror) = GetPatronImage($data->{'cardnumber'}); + my ($picture, $dberror) = GetPatronImage($data->{'borrowernumber'}); $template->param( picture => 1 ) if $picture; $template->param( menu => 1, -- 2.39.5