From 509892fd00cf6b7a5d65e2aef9d615bf35806cbe Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Mon, 8 Jan 2018 12:06:59 -0300 Subject: [PATCH] Bug 19935: Replace GetPendingIssues - sco-main Same as previously, we do not need all the prefetched values here, just a few. Test plan: Use the self checkout module to check some items out Signed-off-by: Benjamin Rokseth Signed-off-by: Josef Moravec Signed-off-by: Jonathan Druart --- opac/sco/sco-main.pl | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/opac/sco/sco-main.pl b/opac/sco/sco-main.pl index 8829b4dd22..9fcf7293b5 100755 --- a/opac/sco/sco-main.pl +++ b/opac/sco/sco-main.pl @@ -248,24 +248,25 @@ if ($borrower) { # warn "issuer's branchcode: " . $issuer->{branchcode}; # warn "user's branchcode: " . $borrower->{branchcode}; my $borrowername = sprintf "%s %s", ($borrower->{firstname} || ''), ($borrower->{surname} || ''); - my @issues; - my ($issueslist) = GetPendingIssues( $borrower->{'borrowernumber'} ); - foreach my $it (@$issueslist) { + my $pending_checkouts = $patron->pending_checkouts; + my @checkouts; + while ( my $c = $pending_checkouts->next ) { + my $checkout = $c->unblessed_all_relateds; my ($can_be_renewed, $renew_error) = CanBookBeRenewed( $borrower->{borrowernumber}, - $it->{itemnumber}, + $checkout->{itemnumber}, ); - $it->{can_be_renewed} = $can_be_renewed; - $it->{renew_error} = $renew_error; - $it->{date_due} = $it->{date_due_sql}; - push @issues, $it; + $checkout->{can_be_renewed} = $can_be_renewed; # In the future this will be $checkout->can_be_renewed + $checkout->{renew_error} = $renew_error; + $checkout->{overdue} = $c->is_overdue; + push @checkouts, $checkout; } $template->param( validuser => 1, borrowername => $borrowername, - issues_count => scalar(@issues), - ISSUES => \@issues, + issues_count => scalar(@checkouts), + ISSUES => \@checkouts, patronid => $patronid, patronlogin => $patronlogin, patronpw => $patronpw, -- 2.39.5