From 6347ad75c8f48f450ce82042f664bbb2d2bcd03c Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Fri, 4 Sep 2020 13:18:53 +0000 Subject: [PATCH] Bug 26388: Do not show 'Renew all' or 'Renew selected' if no renewable items Additionally, only include renewable items in 'Renew all' To test: 1 - Check out some items to a patron, ideally: Some not renewable because set for auto renewal Some not renewable because of holds Some renewable 2 - Confirm 'Renew selected' and 'Renew all' show on the opac 3 - Click 'Renew all' 4 - You get errors about the non-renewable items? 5 - Check in all renewable items 6 - Confirm you still see renew buttons 7 - Apply patch 8 - Refresh and you shoudl not see renew buttons 9 - Check out a renewable item 10 - Click 'Renew all' 11 - Renewable item is renewed with no error 12 - Try again with 'Renew selected' 13 - Confirm it works as expected Signed-off-by: Andrew Fuerste-Henry Signed-off-by: Owen Leonard Signed-off-by: Martin Renvoize Signed-off-by: Jonathan Druart (cherry picked from commit 763cc4eb2e53f7a44a138d6162bfa4470a484bac) Signed-off-by: Lucas Gass --- koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt | 4 +++- opac/opac-user.pl | 4 +++- 2 files changed, 6 insertions(+), 2 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 5e72d21891..1691f9dbfa 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt @@ -414,7 +414,9 @@ [% FOREACH ISSUE IN ISSUES %] - + [% IF ISSUE.status %] + + [% END %] [% END %] diff --git a/opac/opac-user.pl b/opac/opac-user.pl index 18c983fa35..a380d88f01 100755 --- a/opac/opac-user.pl +++ b/opac/opac-user.pl @@ -190,6 +190,7 @@ my @overdues; my @issuedat; my $itemtypes = { map { $_->{itemtype} => $_ } @{ Koha::ItemTypes->search_with_localization->unblessed } }; my $pending_checkouts = $patron->pending_checkouts->search({}, { order_by => [ { -desc => 'date_due' }, { -asc => 'issue_id' } ] }); +my $are_renewable_items = 0; if ( $pending_checkouts->count ) { # Useless test while ( my $c = $pending_checkouts->next ) { my $issue = $c->unblessed_all_relateds; @@ -226,6 +227,7 @@ if ( $pending_checkouts->count ) { # Useless test ( $issue->{'renewalfee'}, $issue->{'renewalitemtype'} ) = GetIssuingCharges( $issue->{'itemnumber'}, $borrowernumber ); $issue->{itemtype_object} = Koha::ItemTypes->find( Koha::Items->find( $issue->{itemnumber} )->effective_itemtype ); if($status && C4::Context->preference("OpacRenewalAllowed")){ + $are_renewable_items = 1; $issue->{'status'} = $status; } @@ -299,7 +301,7 @@ if ( $pending_checkouts->count ) { # Useless test } } my $overduesblockrenewing = C4::Context->preference('OverduesBlockRenewing'); -$canrenew = 0 if ($overduesblockrenewing ne 'allow' and $overdues_count == $count); +$canrenew = 0 if ($overduesblockrenewing ne 'allow' and $overdues_count == $count) || !$are_renewable_items; $template->param( ISSUES => \@issuedat ); $template->param( issues_count => $count ); -- 2.39.5