From 0ea810b031ac341abef6e15474a9e660cf977764 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Mon, 8 Jan 2018 11:59:29 -0300 Subject: [PATCH] Bug 19935: Replace GetPendingIssues - opac-user.pl At first glance we just need the biblio title and the subtitle (in addition of the fines info), we should not need the prefetch. Test plan: Loggin at the OPAC, on the summary page you should see your checkouts and overdues with the correct values Signed-off-by: Benjamin Rokseth Signed-off-by: Josef Moravec --- koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt | 6 +++--- opac/opac-user.pl | 9 +++++---- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt index fed6f23..9eabf10 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt @@ -246,14 +246,14 @@ Using this account is not recommended because some parts of Koha will not functi Date due: - [% ISSUE.date_due_sql | $KohaDates as_due_date => 1 %] + [% ISSUE.date_due | $KohaDates as_due_date => 1 %] [% ELSE %] Date due: - [% ISSUE.date_due_sql | $KohaDates as_due_date => 1 %] + [% ISSUE.date_due | $KohaDates as_due_date => 1 %] [% END %] @@ -540,7 +540,7 @@ Using this account is not recommended because some parts of Koha will not functi Date due: - [% OVERDUE.date_due_sql | $KohaDates as_due_date => 1 %] + [% OVERDUE.date_due | $KohaDates as_due_date => 1 %] [% IF ( OpacRenewalAllowed ) %] diff --git a/opac/opac-user.pl b/opac/opac-user.pl index bdd002d..880ade8 100755 --- a/opac/opac-user.pl +++ b/opac/opac-user.pl @@ -184,9 +184,10 @@ my $overdues_count = 0; my @overdues; my @issuedat; my $itemtypes = { map { $_->{itemtype} => $_ } @{ Koha::ItemTypes->search_with_localization->unblessed } }; -my $issues = GetPendingIssues($borrowernumber); -if ($issues){ - foreach my $issue ( sort { $b->{date_due}->datetime() cmp $a->{date_due}->datetime() } @{$issues} ) { +my $pending_checkouts = $patron->pending_checkouts({}, { order_by => [ { -desc => 'date_due' }, { -asc => 'issue_id' } ] }); +if ( $pending_checkouts->count ) { # Useless test + while ( my $c = $pending_checkouts->next ) { + my $issue = $c->unblessed_all_relateds; # check for reserves my $restype = GetReserveStatus( $issue->{'itemnumber'} ); if ( $restype ) { @@ -251,7 +252,7 @@ if ($issues){ } } - if ( $issue->{'overdue'} ) { + if ( $c->is_overdue ) { push @overdues, $issue; $overdues_count++; $issue->{'overdue'} = 1; -- 2.1.4