Bugzilla – Attachment 109139 Details for
Bug 25758
Items scheduled for automatic renewal do not show that they will not renew due to a hold
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 25758: Fix renewal at the OPAC
Bug-25758-Fix-renewal-at-the-OPAC.patch (text/plain), 4.39 KB, created by
Jonathan Druart
on 2020-08-26 09:15:53 UTC
(
hide
)
Description:
Bug 25758: Fix renewal at the OPAC
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2020-08-26 09:15:53 UTC
Size:
4.39 KB
patch
obsolete
>From 79da38c1206d2770a21817beeea3e054222dfc09 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Wed, 26 Aug 2020 10:49:04 +0200 >Subject: [PATCH] Bug 25758: Fix renewal at the OPAC > >--- > opac/opac-renew.pl | 9 +++++---- > opac/opac-user.pl | 30 ++++++++++++++++++------------ > 2 files changed, 23 insertions(+), 16 deletions(-) > >diff --git a/opac/opac-renew.pl b/opac/opac-renew.pl >index 2246725dff..64194e798c 100755 >--- a/opac/opac-renew.pl >+++ b/opac/opac-renew.pl >@@ -49,29 +49,30 @@ my $opacrenew = C4::Context->preference("OpacRenewalAllowed"); > > my $errorstring = q{}; > my $renewed = q{}; >+my @errors; > > my $patron = Koha::Patrons->find( $borrowernumber ); > > if ( $patron->category->effective_BlockExpiredPatronOpacActions > && $patron->is_expired ) > { >- $errorstring = 'card_expired'; >+ push @errors, 'card_expired'; > } > else { >- my @renewed; >+ my ( @renewed, @errors ); > for my $itemnumber (@items) { > my ( $status, $error ) = > CanBookBeRenewed( $borrowernumber, $itemnumber ); >- $error = $error->[0] if @$error; > if ( $status == 1 && $opacrenew == 1 ) { > AddRenewal( $borrowernumber, $itemnumber, undef, undef, undef ); > push( @renewed, $itemnumber ); > } > else { >- $errorstring .= $error . "|"; >+ push @errors, @$error; > } > } > $renewed = join( ':', @renewed ); >+ $errorstring = join "|", @errors; > } > > print $query->redirect("/cgi-bin/koha/opac-user.pl?renew_error=$errorstring&renewed=$renewed"); >diff --git a/opac/opac-user.pl b/opac/opac-user.pl >index d931ee9142..fff7fc5cc9 100755 >--- a/opac/opac-user.pl >+++ b/opac/opac-user.pl >@@ -232,18 +232,18 @@ if ( $pending_checkouts->count ) { # Useless test > > $issue->{'renewed'} = $renewed{ $issue->{'itemnumber'} }; > >+ use Data::Printer colored => 1; warn p $renewerror; > if (@$renewerror) { >- $renewerror = $renewerror->[0]; >- $issue->{'too_many'} = 1 if $renewerror eq 'too_many'; >- $issue->{'on_reserve'} = 1 if $renewerror eq 'on_reserve'; >- $issue->{'norenew_overdue'} = 1 if $renewerror eq 'overdue'; >- $issue->{'auto_renew'} = 1 if $renewerror eq 'auto_renew'; >- $issue->{'auto_too_soon'} = 1 if $renewerror eq 'auto_too_soon'; >- $issue->{'auto_too_late'} = 1 if $renewerror eq 'auto_too_late'; >- $issue->{'auto_too_much_oweing'} = 1 if $renewerror eq 'auto_too_much_oweing'; >- $issue->{'item_denied_renewal'} = 1 if $renewerror eq 'item_denied_renewal'; >- >- if ( $renewerror eq 'too_soon' ) { >+ $issue->{'too_many'} = 1 if grep { $_ eq 'too_many' } @$renewerror; >+ $issue->{'on_reserve'} = 1 if grep { $_ eq 'on_reserve' } @$renewerror; >+ $issue->{'norenew_overdue'} = 1 if grep { $_ eq 'overdue' } @$renewerror; >+ $issue->{'auto_renew'} = 1 if grep { $_ eq 'auto_renew' } @$renewerror; >+ $issue->{'auto_too_soon'} = 1 if grep { $_ eq 'auto_too_soon' } @$renewerror; >+ $issue->{'auto_too_late'} = 1 if grep { $_ eq 'auto_too_late' } @$renewerror; >+ $issue->{'auto_too_much_oweing'} = 1 if grep { $_ eq 'auto_too_much_oweing' } @$renewerror; >+ $issue->{'item_denied_renewal'} = 1 if grep { $_ eq 'item_denied_renewal' } @$renewerror; >+ >+ if ( grep { $_ eq 'too_soon' } @$renewerror ) { > $issue->{'too_soon'} = 1; > $issue->{'soonestrenewdate'} = output_pref( > C4::Circulation::GetSoonestRenewDate( >@@ -254,6 +254,8 @@ if ( $pending_checkouts->count ) { # Useless test > } > } > >+ $issue->{can_renew} = ! scalar @$renewerror; >+ > if ( $c->is_overdue ) { > push @overdues, $issue; > $overdues_count++; >@@ -301,7 +303,11 @@ if ( $pending_checkouts->count ) { # Useless test > } > } > my $overduesblockrenewing = C4::Context->preference('OverduesBlockRenewing'); >-$canrenew = 0 if ($overduesblockrenewing ne 'allow' and $overdues_count == $count); >+my $canrenew_count = grep { $_->{canrenew} } @issuedat; >+$canrenew = 0 >+ if ( $overduesblockrenewing ne 'allow' >+ && $overdues_count == $count ) >+ || $canrenew_count == 0; > > $template->param( ISSUES => \@issuedat ); > $template->param( issues_count => $count ); >-- >2.20.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 25758
:
106229
|
107409
|
107495
|
107496
|
107504
|
107879
|
107894
|
109139
|
109658
|
109668
|
109672
|
109680
|
110008
|
110009
|
110010