Bugzilla – Attachment 80251 Details for
Bug 21486
SIP does not return checked out (charged) items on patron_information request
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 21486: Re-added get_pending_issues function to C4/SIP/ILS/Patron.pm
Bug-21486-Re-added-getpendingissues-function-to-C4.patch (text/plain), 5.72 KB, created by
Alex Buckley
on 2018-10-09 00:59:19 UTC
(
hide
)
Description:
Bug 21486: Re-added get_pending_issues function to C4/SIP/ILS/Patron.pm
Filename:
MIME Type:
Creator:
Alex Buckley
Created:
2018-10-09 00:59:19 UTC
Size:
5.72 KB
patch
obsolete
>From 7204ef626453b2bdc220bb6dc93fe88db9a4cca7 Mon Sep 17 00:00:00 2001 >From: Alex Buckley <alexbuckley@catalyst.net.nz> >Date: Mon, 8 Oct 2018 16:26:10 +0000 >Subject: [PATCH] Bug 21486: Re-added get_pending_issues function to > C4/SIP/ILS/Patron.pm > >This allows the list of a borrower's checked out items to be returned by >SIP. > >Test plan: >1. Make sure SIP is working with the commands: >sudo koha-enable-sip <instancename> >sudo koha-start-sip <instancename> > >2. Check SIP is working with the command: >telnet localhost 6001 > >3. Choose a patron with items checked out to them and set their username >and password in the SIPconfig.xml file > >4. From inside the Koha-shell from the Koha home directory run the command: >misc/sip_cli_emulator.pl -a localhost -p 6001 -su <sip_user_username> -sp <sip_user_password> -l <sip_user_librarybranch> >--patron <sip_user_cardnumber> -s " Y " -m patron_information > >This command is PATRON_INFORMATION, it should return information about >the patron. > >The Y in the 3rd position of the quotes means return the list of the >borrowers charged items (items issued to the borrower). > >5. Notice the "AU" field is empty: > >e.g. READ: 64 00120181008 >161428000100000001000000000002AOCPL|AA8765432|AEMika >SMith|BLY|CC5|AU|PCB|PIY|AFGreetings from Koha. | > >i.e. There should be a barcode after the AU field as the borrower has a >item issued to them > >6. Apply patch > >7. Restart memcached and plack with the commands: >sudo service memcached restart >sudo koha-plack --restart <instancename> > >8. Stop SIP: >sudo koha-stop-sip <instancename> > >9. Then enable and start SIP again: >sudo koha-enable-sip <instancename> >sudo koha-start-sip <instancename> > >10. Repeat step 4 and notice the AU field does have a item barcode >value: > >e.g. READ: 64 00120181008 >161859000100000001000000000002AOCPL|AA8765432|AEMika >SMith|BLY|CC5|AUTEST7474747474|PCB|PIY|AFGreetings from Koha. | > >In this case the item barcode value for the AU field is: TEST7474747474 > >Sponsored-By: Brimbank Library, Australia >--- > C4/SIP/ILS/Patron.pm | 75 +++++++++++++++++++++++++++++++++++++++++++++++++++- > 1 file changed, 74 insertions(+), 1 deletion(-) > >diff --git a/C4/SIP/ILS/Patron.pm b/C4/SIP/ILS/Patron.pm >index 359b712..f905e1f 100644 >--- a/C4/SIP/ILS/Patron.pm >+++ b/C4/SIP/ILS/Patron.pm >@@ -130,7 +130,7 @@ sub new { > > # FIXME: populate fine_items recall_items > $ilspatron{unavail_holds} = _get_outstanding_holds($kp->{borrowernumber}); >- $ilspatron{items} = $patron->pending_checkouts->unblessed; >+ $ilspatron{items} = _get_pending_issues($kp->{borrowernumber}); > $self = \%ilspatron; > $debug and warn Dumper($self); > syslog("LOG_DEBUG", "new ILS::Patron(%s): found patron '%s'", $patron_id,$self->{id}); >@@ -501,6 +501,79 @@ sub _get_outstanding_holds { > return \@holds; > } > >+sub _get_pending_issues { >+ my @borrowernumbers = @_; >+ unless (@borrowernumbers ) { # return a ref_to_array >+ return \@borrowernumbers; # to not cause surprise to caller >+ } >+ # Borrowers part of the query >+ my $bquery = ''; >+ for (my $i = 0; $i < @borrowernumbers; $i++) { >+ $bquery .= ' issues.borrowernumber = ?'; >+ if ($i < $#borrowernumbers ) { >+ $bquery .= ' OR'; >+ } >+ } >+ >+ # must avoid biblioitems.* to prevent large marc and marcxml fields from killing performance >+ # FIXME: namespace collision: each table has "timestamp" fields. Which one is "timestamp" ? >+ # FIXME: circ/ciculation.pl tries to sort by timestamp! >+ # FIXME: namespace collision: other collisions possible. >+ # FIXME: most of this data isn't really being used by callers. >+ my $query = >+ "SELECT issues.*, >+ items.*, >+ biblio.*, >+ biblioitems.volume, >+ biblioitems.number, >+ biblioitems.itemtype, >+ biblioitems.isbn, >+ biblioitems.issn, >+ biblioitems.publicationyear, >+ biblioitems.publishercode, >+ biblioitems.volumedate, >+ biblioitems.volumedesc, >+ biblioitems.lccn, >+ biblioitems.url, >+ borrowers.firstname, >+ borrowers.surname, >+ borrowers.cardnumber, >+ issues.timestamp AS timestamp, >+ issues.renewals AS renewals, >+ issues.borrowernumber AS borrowernumber, >+ items.renewals AS totalrenewals >+ FROM issues >+ LEFT JOIN items ON items.itemnumber = issues.itemnumber >+ LEFT JOIN biblio ON items.biblionumber = biblio.biblionumber >+ LEFT JOIN biblioitems ON items.biblioitemnumber = biblioitems.biblioitemnumber >+ LEFT JOIN borrowers ON issues.borrowernumber = borrowers.borrowernumber >+ WHERE >+ $bquery >+ ORDER BY issues.issuedate" >+ ; >+ >+ my $sth = C4::Context->dbh->prepare($query); >+ $sth->execute(@borrowernumbers); >+ my $data = $sth->fetchall_arrayref({}); >+ my $today = dt_from_string; >+ foreach (@{$data}) { >+ if ($_->{issuedate}) { >+ $_->{issuedate} = dt_from_string($_->{issuedate}, 'sql'); >+ } >+ $_->{date_due_sql} = $_->{date_due}; >+ # FIXME no need to have this value >+ $_->{date_due} or next; >+ $_->{date_due_sql} = $_->{date_due}; >+ # FIXME no need to have this value >+ $_->{date_due} = dt_from_string($_->{date_due}, 'sql'); >+ if ( DateTime->compare($_->{date_due}, $today) == -1 ) { >+ $_->{overdue} = 1; >+ } >+ } >+ return $data; >+} >+ >+ > =head2 build_patron_attributes_string > > This method builds the part of the sip message for extended patron >-- >2.1.4
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 21486
:
80251
|
80522
|
80655
|
80729
|
80730
|
80976
|
81001
|
81002
|
81050
|
81051