[Koha-bugs] [Bug 23403] SIP2 lends to wrong patron if cardnumber is missing

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Wed Jul 31 15:21:46 CEST 2019


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

--- Comment #1 from Magnus Enger <magnus at libriotech.no> ---
C4::SIP::ILS::Patron::new() looks for a patron based on either cardnumber or
userid, around line 41: 

     my $patron = Koha::Patrons->find( { cardnumber => $patron_id } )
       || Koha::Patrons->find( { userid => $patron_id } );

but then we set the id of the patron to the value of the barcode field, around
line 77: 

    id   => $kp->{cardnumber},    # to SIP, the id is the BARCODE, not userid

If there is no barcode, the id will be empty. Then in
C4::SIP::ILS::Transaction::Checkout::do_checkout() we use the id to find the
patron, around line 53:

    my $patron_barcode = $self->{patron}->id;
    ...
    my $patron = Koha::Patrons->find( { cardnumber => $patron_barcode } );

And I guess ->find( { cardnumber => '' } ) returns the first patron that has an
empty cardnumber.

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


More information about the Koha-bugs mailing list