From 3860f2321e72d93242426da9d5b0226b10ce2f79 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 Signed-off-by: Benjamin Rokseth --- 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 7e021a5..fbc5044 100644 --- a/C4/ILSDI/Services.pm +++ b/C4/ILSDI/Services.pm @@ -462,12 +462,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.1.4