Bugzilla – Attachment 128586 Details for
Bug 26440
Not renewable Supersedes On Hold
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 26440: Prioritize 'on hold' over Not renewable' in Renew column
Bug-26440-Prioritize-on-hold-over-Not-renewable-in.patch (text/plain), 6.10 KB, created by
Didier Gautheron
on 2021-12-16 07:08:55 UTC
(
hide
)
Description:
Bug 26440: Prioritize 'on hold' over Not renewable' in Renew column
Filename:
MIME Type:
Creator:
Didier Gautheron
Created:
2021-12-16 07:08:55 UTC
Size:
6.10 KB
patch
obsolete
>From d47847bfbf2029a91b451f0806d59bf314de5042 Mon Sep 17 00:00:00 2001 >From: Fridolin Somers <fridolin.somers@biblibre.com> >Date: Wed, 2 Jun 2021 12:39:23 +0200 >Subject: [PATCH] Bug 26440: Prioritize 'on hold' over Not renewable' in Renew > column > >--- > C4/Circulation.pm | 105 ++++++++++++++++++++++------------------------ > 1 file changed, 51 insertions(+), 54 deletions(-) > >diff --git a/C4/Circulation.pm b/C4/Circulation.pm >index c2edf81f94..786c9ae1db 100644 >--- a/C4/Circulation.pm >+++ b/C4/Circulation.pm >@@ -2753,53 +2753,6 @@ sub CanBookBeRenewed { > > my $patron = $issue->patron or return; > >- # override_limit will override anything else except on_reserve >- unless ( $override_limit ){ >- my $branchcode = _GetCircControlBranch( $item->unblessed, $patron->unblessed ); >- my $issuing_rule = Koha::CirculationRules->get_effective_rules( >- { >- categorycode => $patron->categorycode, >- itemtype => $item->effective_itemtype, >- branchcode => $branchcode, >- rules => [ >- 'renewalsallowed', >- 'lengthunit', >- 'unseen_renewals_allowed' >- ] >- } >- ); >- >- return ( 0, "too_many" ) >- if not $issuing_rule->{renewalsallowed} or $issuing_rule->{renewalsallowed} <= $issue->renewals; >- >- return ( 0, "too_unseen" ) >- if C4::Context->preference('UnseenRenewals') && >- $issuing_rule->{unseen_renewals_allowed} && >- $issuing_rule->{unseen_renewals_allowed} <= $issue->unseen_renewals; >- >- my $overduesblockrenewing = C4::Context->preference('OverduesBlockRenewing'); >- my $restrictionblockrenewing = C4::Context->preference('RestrictionBlockRenewing'); >- $patron = Koha::Patrons->find($borrowernumber); # FIXME Is this really useful? >- my $restricted = $patron->is_debarred; >- my $hasoverdues = $patron->has_overdues; >- >- if ( $restricted and $restrictionblockrenewing ) { >- return ( 0, 'restriction'); >- } elsif ( ($hasoverdues and $overduesblockrenewing eq 'block') || ($issue->is_overdue and $overduesblockrenewing eq 'blockitem') ) { >- return ( 0, 'overdue'); >- } >- >- $auto_renew = _CanBookBeAutoRenewed({ >- patron => $patron, >- item => $item, >- branchcode => $branchcode, >- issue => $issue >- }); >- return ( 0, $auto_renew ) if $auto_renew =~ 'auto_account_expired'; >- return ( 0, $auto_renew ) if $auto_renew =~ 'auto_too_late'; >- return ( 0, $auto_renew ) if $auto_renew =~ 'auto_too_much_oweing'; >- } >- > my ( $resfound, $resrec, $possible_reserves ) = C4::Reserves::CheckReserves($itemnumber); > > # If next hold is non priority, then check if any hold with priority (non_priority = 0) exists for the same biblionumber. >@@ -2858,15 +2811,59 @@ sub CanBookBeRenewed { > } > } > } >- if( $cron ) { #The cron wants to return 'too_soon' over 'on_reserve' >- return ( 0, $auto_renew ) if $auto_renew =~ 'too_soon';#$auto_renew ne "no" && $auto_renew ne "ok"; >- return ( 0, "on_reserve" ) if $resfound; # '' when no hold was found >- } else { # For other purposes we want 'on_reserve' before 'too_soon' >- return ( 0, "on_reserve" ) if $resfound; # '' when no hold was found >- return ( 0, $auto_renew ) if $auto_renew =~ 'too_soon';#$auto_renew ne "no" && $auto_renew ne "ok"; >+ #The cron wants to return 'too_soon' over 'on_reserve' >+ return ( 0, "on_reserve" ) if $resfound && !$cron; >+ >+ # override_limit will override anything else except on_reserve >+ unless ( $override_limit ){ >+ my $branchcode = _GetCircControlBranch( $item->unblessed, $patron->unblessed ); >+ my $issuing_rule = Koha::CirculationRules->get_effective_rules( >+ { >+ categorycode => $patron->categorycode, >+ itemtype => $item->effective_itemtype, >+ branchcode => $branchcode, >+ rules => [ >+ 'renewalsallowed', >+ 'lengthunit', >+ 'unseen_renewals_allowed' >+ ] >+ } >+ ); >+ >+ return ( 0, "too_many" ) >+ if not $issuing_rule->{renewalsallowed} or $issuing_rule->{renewalsallowed} <= $issue->renewals; >+ >+ return ( 0, "too_unseen" ) >+ if C4::Context->preference('UnseenRenewals') && >+ $issuing_rule->{unseen_renewals_allowed} && >+ $issuing_rule->{unseen_renewals_allowed} <= $issue->unseen_renewals; >+ >+ my $overduesblockrenewing = C4::Context->preference('OverduesBlockRenewing'); >+ my $restrictionblockrenewing = C4::Context->preference('RestrictionBlockRenewing'); >+ $patron = Koha::Patrons->find($borrowernumber); # FIXME Is this really useful? >+ my $restricted = $patron->is_debarred; >+ my $hasoverdues = $patron->has_overdues; >+ >+ if ( $restricted and $restrictionblockrenewing ) { >+ return ( 0, 'restriction'); >+ } elsif ( ($hasoverdues and $overduesblockrenewing eq 'block') || ($issue->is_overdue and $overduesblockrenewing eq 'blockitem') ) { >+ return ( 0, 'overdue'); >+ } >+ >+ $auto_renew = _CanBookBeAutoRenewed({ >+ patron => $patron, >+ item => $item, >+ branchcode => $branchcode, >+ issue => $issue >+ }); >+ return ( 0, $auto_renew ) if $auto_renew =~ 'auto_account_expired'; >+ return ( 0, $auto_renew ) if $auto_renew =~ 'auto_too_late'; >+ return ( 0, $auto_renew ) if $auto_renew =~ 'auto_too_much_oweing'; > } > >- return ( 0, "auto_renew" ) if $auto_renew eq "ok" && !$override_limit; # 0 if auto-renewal should not succeed >+ return ( 0, $auto_renew ) if $auto_renew =~ 'too_soon';#$auto_renew ne "no" && $auto_renew ne "ok"; >+ return ( 0, "on_reserve" ) if $resfound; # '' when no hold was found >+ return ( 0, "auto_renew" ) if $auto_renew eq "ok"; # 0 if auto-renewal should not succeed > > return ( 1, undef ); > } >-- >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 26440
: 128586