Bugzilla – Attachment 115071 Details for
Bug 27014
SIP2 cannot find patrons at checkin
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 27014: Enable C4::SIP::ILS::Patron::new to accept a hash
Bug-27014-Enable-C4SIPILSPatronnew-to-accept-a-has.patch (text/plain), 2.79 KB, created by
Martin Renvoize (ashimema)
on 2021-01-12 11:05:15 UTC
(
hide
)
Description:
Bug 27014: Enable C4::SIP::ILS::Patron::new to accept a hash
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2021-01-12 11:05:15 UTC
Size:
2.79 KB
patch
obsolete
>From 4e2facd41967019fa2b9b0e8e10c07f7a6ed1936 Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatersolutions.com> >Date: Fri, 13 Nov 2020 08:24:43 -0500 >Subject: [PATCH] Bug 27014: Enable C4::SIP::ILS::Patron::new to accept a hash > >Caused by bug 23403 - when performing a checkin we lookup the SIP patron >using the borrowernumber, however, SIP only knows how to find a patron >via cardnumber or userid > >The change on 23403 was to avoid using an 'id' that didn't always exist >(as some users don't have a userid or cardnumber > >When checking in, however, we are not passed a user cardnumber or >borrowernumber, so we don't have those on hand to get the patron. > >Test Plan: >1) Check in an item via SIP, note patron is not found >2) Apply this patch >3) Restart all the things! >4) Check in an item via SIP, patron should be found! > >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > C4/SIP/ILS.pm | 2 +- > C4/SIP/ILS/Patron.pm | 17 +++++++++++++++-- > 2 files changed, 16 insertions(+), 3 deletions(-) > >diff --git a/C4/SIP/ILS.pm b/C4/SIP/ILS.pm >index d2a253873b..ddf4fed4db 100644 >--- a/C4/SIP/ILS.pm >+++ b/C4/SIP/ILS.pm >@@ -243,7 +243,7 @@ sub checkin { > siplog("LOG_DEBUG", "C4::SIP::ILS::Checkin - item not checked out"); > } > } elsif ( $circ->ok ) { >- $circ->patron( $patron = C4::SIP::ILS::Patron->new( $item->{borrowernumber} ) ); >+ $circ->patron( $patron = C4::SIP::ILS::Patron->new( { borrowernumber => $item->{borrowernumber} } ) ); > delete $item->{borrowernumber}; > delete $item->{due_date}; > $patron->{items} = [ grep { $_ ne $item_id } @{ $patron->{items} } ]; >diff --git a/C4/SIP/ILS/Patron.pm b/C4/SIP/ILS/Patron.pm >index 9820013ee7..237f854487 100644 >--- a/C4/SIP/ILS/Patron.pm >+++ b/C4/SIP/ILS/Patron.pm >@@ -38,8 +38,21 @@ sub new { > my ($class, $patron_id) = @_; > my $type = ref($class) || $class; > my $self; >- my $patron = Koha::Patrons->find( { cardnumber => $patron_id } ) >- || Koha::Patrons->find( { userid => $patron_id } ); >+ >+ my $patron; >+ if ( ref $patron_id eq "HASH" ) { >+ if ( $patron_id->{borrowernumber} ) { >+ $patron = Koha::Patrons->find( $patron_id->{borrowernumber} ); >+ } elsif ( $patron_id->{cardnumber} ) { >+ $patron = Koha::Patrons->find( { cardnumber => $patron_id->{cardnumber} } ); >+ } elsif ( $patron_id->{userid} ) { >+ $patron = Koha::Patrons->find( { userid => $patron_id->{userid} } ); >+ } >+ } else { >+ $patron = Koha::Patrons->find( { cardnumber => $patron_id } ) >+ || Koha::Patrons->find( { userid => $patron_id } ); >+ } >+ > $debug and warn "new Patron: " . Dumper($patron->unblessed) if $patron; > unless ($patron) { > siplog("LOG_DEBUG", "new ILS::Patron(%s): no such patron", $patron_id); >-- >2.20.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 27014
:
113602
| 115071 |
115072