From 0265c4ae29f860f36baccc9b09537b3cc0368274 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 Signed-off-by: Josef Moravec Signed-off-by: Jonathan Druart --- 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 9abc87e373..158ff8e0cb 100644 --- a/C4/ILSDI/Services.pm +++ b/C4/ILSDI/Services.pm @@ -465,12 +465,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.39.5