Bugzilla – Attachment 111293 Details for
Bug 24083
Koha should support "seen" vs "unseen" renewals
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 24083: (follow-up) Fix bad rebase
Bug-24083-follow-up-Fix-bad-rebase.patch (text/plain), 6.22 KB, created by
Andrew Isherwood
on 2020-10-06 11:26:00 UTC
(
hide
)
Description:
Bug 24083: (follow-up) Fix bad rebase
Filename:
MIME Type:
Creator:
Andrew Isherwood
Created:
2020-10-06 11:26:00 UTC
Size:
6.22 KB
patch
obsolete
>From 9c82b5a6fd73878a71dad883927ef3aded6b9053 Mon Sep 17 00:00:00 2001 >From: Andrew Isherwood <andrew.isherwood@ptfs-europe.com> >Date: Tue, 6 Oct 2020 12:18:44 +0100 >Subject: [PATCH] Bug 24083: (follow-up) Fix bad rebase > >There was a real mess in C4/Circulation.pm due to a bad rebase back in >February. Frankly it's a wonder anything worked at all. This commit >fixes that problem and reinstates the correct patch for >C4/Circulation.pm >--- > C4/Circulation.pm | 117 ++-------------------------------------------- > 1 file changed, 5 insertions(+), 112 deletions(-) > >diff --git a/C4/Circulation.pm b/C4/Circulation.pm >index de4ece9aea..8e7358c4bf 100644 >--- a/C4/Circulation.pm >+++ b/C4/Circulation.pm >@@ -2679,6 +2679,11 @@ sub CanBookBeRenewed { > 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? >@@ -2850,118 +2855,6 @@ sub CanBookBeRenewed { > > return ( 0, "auto_renew" ) if $auto_renew eq "ok" && !$override_limit; # 0 if auto-renewal should not succeed > >- return ( 1, undef ) if $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', >- 'no_auto_renewal_after', >- 'no_auto_renewal_after_hard_limit', >- 'lengthunit', >- 'norenewalbefore', >- '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'); >- } >- >- if ( $issue->auto_renew ) { >- >- if ( $patron->category->effective_BlockExpiredPatronOpacActions and $patron->is_expired ) { >- return ( 0, 'auto_account_expired' ); >- } >- >- if ( defined $issuing_rule->{no_auto_renewal_after} >- and $issuing_rule->{no_auto_renewal_after} ne "" ) { >- # Get issue_date and add no_auto_renewal_after >- # If this is greater than today, it's too late for renewal. >- my $maximum_renewal_date = dt_from_string($issue->issuedate, 'sql'); >- $maximum_renewal_date->add( >- $issuing_rule->{lengthunit} => $issuing_rule->{no_auto_renewal_after} >- ); >- my $now = dt_from_string; >- if ( $now >= $maximum_renewal_date ) { >- return ( 0, "auto_too_late" ); >- } >- } >- if ( defined $issuing_rule->{no_auto_renewal_after_hard_limit} >- and $issuing_rule->{no_auto_renewal_after_hard_limit} ne "" ) { >- # If no_auto_renewal_after_hard_limit is >= today, it's also too late for renewal >- if ( dt_from_string >= dt_from_string( $issuing_rule->{no_auto_renewal_after_hard_limit} ) ) { >- return ( 0, "auto_too_late" ); >- } >- } >- >- if ( C4::Context->preference('OPACFineNoRenewalsBlockAutoRenew') ) { >- my $fine_no_renewals = C4::Context->preference("OPACFineNoRenewals"); >- my $amountoutstanding = >- C4::Context->preference("OPACFineNoRenewalsIncludeCredit") >- ? $patron->account->balance >- : $patron->account->outstanding_debits->total_outstanding; >- if ( $amountoutstanding and $amountoutstanding > $fine_no_renewals ) { >- return ( 0, "auto_too_much_oweing" ); >- } >- } >- } >- >- if ( defined $issuing_rule->{norenewalbefore} >- and $issuing_rule->{norenewalbefore} ne "" ) >- { >- >- # Calculate soonest renewal by subtracting 'No renewal before' from due date >- my $soonestrenewal = dt_from_string( $issue->date_due, 'sql' )->subtract( >- $issuing_rule->{lengthunit} => $issuing_rule->{norenewalbefore} ); >- >- # Depending on syspref reset the exact time, only check the date >- if ( C4::Context->preference('NoRenewalBeforePrecision') eq 'date' >- and $issuing_rule->{lengthunit} eq 'days' ) >- { >- $soonestrenewal->truncate( to => 'day' ); >- } >- >- if ( $soonestrenewal > dt_from_string() ) >- { >- return ( 0, "auto_too_soon" ) if $issue->auto_renew; >- return ( 0, "too_soon" ); >- } >- elsif ( $issue->auto_renew ) { >- return ( 0, "auto_renew" ); >- } >- } >- >- # Fallback for automatic renewals: >- # If norenewalbefore is undef, don't renew before due date. >- if ( $issue->auto_renew ) { >- my $now = dt_from_string; >- return ( 0, "auto_renew" ) >- if $now >= dt_from_string( $issue->date_due, 'sql' ); >- return ( 0, "auto_too_soon" ); >- } >- > 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 24083
:
95861
|
95862
|
95863
|
95864
|
95865
|
95866
|
95867
|
95868
|
98749
|
98750
|
98751
|
98752
|
98765
|
98766
|
98767
|
98768
|
100244
|
100245
|
100246
|
100247
|
100380
|
100381
|
100382
|
100383
|
100392
|
110607
|
110608
|
110609
|
110610
|
110611
|
111147
|
111148
|
111149
|
111150
|
111151
|
111152
|
111283
|
111284
|
111285
|
111286
|
111287
|
111288
|
111289
|
111290
|
111291
|
111292
|
111293
|
111849
|
111850
|
111851
|
111852
|
111853
|
111854
|
111855
|
111856
|
111857
|
111858
|
111859
|
111860
|
112230
|
112231
|
112232
|
112233
|
112234
|
112235
|
112236
|
112237
|
112238
|
112239
|
112240
|
112241
|
112242
|
112243
|
112410
|
112411
|
112412
|
112413
|
112414
|
112415
|
112416
|
112417
|
112418
|
112419
|
112420
|
112421
|
112422
|
112423
|
113073
|
113074
|
113075
|
113076
|
113077
|
113078
|
113079
|
113080
|
113314
|
113315
|
113484
|
113485
|
113486
|
113487
|
113488
|
113489
|
113490
|
113491
|
113492
|
113493
|
113494
|
113546
|
113556
|
113557
|
113814