From 804c2c1f383e149ad15fa749a79f9763f4c0326a Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Mon, 8 Jan 2018 11:10:50 -0300 Subject: [PATCH] Bug 19935: Replace GetPendingIssues - ILSDI Here we should only access to what we want in the template, but let do it as it for now. Test plan: Hit /cgi-bin/koha/ilsdi.pl?service=GetPatronInfo&patron_id=542&show_contact=0&show_loans=1 With 42 a borrowernumber with checkouts Before and after these patches the XML must be the same --- C4/ILSDI/Services.pm | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/C4/ILSDI/Services.pm b/C4/ILSDI/Services.pm index 4aa72e5801..f117076d83 100644 --- a/C4/ILSDI/Services.pm +++ b/C4/ILSDI/Services.pm @@ -445,12 +445,14 @@ sub GetPatronInfo { # Issues management if ( $cgi->param('show_loans') && $cgi->param('show_loans') eq "1" ) { - my $issues = GetPendingIssues($borrowernumber); - foreach my $issue ( @$issues ){ - $issue->{'issuedate'} = $issue->{'issuedate'}->strftime('%Y-%m-%d %H:%M'); - $issue->{'date_due'} = $issue->{'date_due'}->strftime('%Y-%m-%d %H:%M'); + my $pending_checkouts = $patron->pending_checkouts; + my @checkouts; + while ( my $c = $pending_checkouts->next ) { + # FIXME We should only retrieve what is needed in the template + my $issue = $c->unblessed_all_relateds; + push @checkouts, $issue } - $borrower->{'loans'}->{'loan'} = $issues; + $borrower->{'loans'}->{'loan'} = \@checkouts; } if ( $cgi->param('show_attributes') eq "1" ) { -- 2.11.0