[Koha-bugs] [Bug 20947] New: Navigating to moremember.pl for a patron who has fines on deleted items causes software error.

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Thu Jun 14 20:35:06 CEST 2018


https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20947

            Bug ID: 20947
           Summary: Navigating to  moremember.pl  for a patron who has
                    fines on deleted items causes software error.
 Change sponsored?: ---
           Product: Koha
           Version: 17.11
          Hardware: All
                OS: All
            Status: NEW
          Severity: critical
          Priority: P5 - low
         Component: Patrons
          Assignee: koha-bugs at lists.koha-community.org
          Reporter: barton at bywatersolutions.com
        QA Contact: testopia at bugs.koha-community.org
                CC: gmcharlt at gmail.com, kyle.m.hall at gmail.com

Note this ONLY happens in 17.11 -- earlier versions of Koha don't have this
code, and GetMemberAccountRecords does not exist in 18.05+ (per bug 12001)...
however it is a major problem in 17.11.

--

Steps to re-create:

1) Find a borrower with fines, preferably on an item that has already been
checked in.
2) Delete the item
3) Navigate to moremember.pl for that borrower. This will trigger a software
error with

Can't call method "biblio" on an undefined value at
/usr/share/koha/lib/C4/Members.pm line 767.

in the plack-error.log

Here's the code:

 750 sub GetMemberAccountRecords {
 751     my ($borrowernumber) = @_;
 752     my $dbh = C4::Context->dbh;
 753     my @acctlines;
 754     my $numlines = 0;
 755     my $strsth      = qq(
 756                         SELECT *
 757                         FROM accountlines
 758                         WHERE borrowernumber=?);
 759     $strsth.=" ORDER BY accountlines_id desc";
 760     my $sth= $dbh->prepare( $strsth );
 761     $sth->execute( $borrowernumber );
 762 
 763     my $total = 0;
 764     while ( my $data = $sth->fetchrow_hashref ) {
 765         if ( $data->{itemnumber} ) {
 766             my $item = Koha::Items->find( $data->{itemnumber} );
 767             my $biblio = $item->biblio;

The problem is that $data->{itemnumber}, (the itemnumber read from
accountlines) may point to an active item or a deleted item. If the item was
deleted, $item, as populated in

   my $item = Koha::Items->find( $data->{itemnumber} );

will be undef, and 

   my $biblio = $item->biblio;

Will throw the error message.

-- 
You are receiving this mail because:
You are watching all bug changes.
You are the assignee for the bug.


More information about the Koha-bugs mailing list