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 <benjamin.rokseth@deichman.no>

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
Jonathan Druart 2018-01-08 12:06:59 -03:00
parent a53471e8bb
commit 509892fd00
1 changed files with 11 additions and 10 deletions

View File

@ -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,