From: Jonathan Druart Date: Mon, 8 Jan 2018 14:10:50 +0000 (-0300) Subject: Bug 19935: Replace GetPendingIssues - ILSDI X-Git-Url: http://git.rot13.org/?a=commitdiff_plain;h=0265c4ae29f860f36baccc9b09537b3cc0368274;p=koha.git 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 --- 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" ) {