Bugzilla – Attachment 98706 Details for
Bug 19014
Patrons should not get an 'on_reserve' notification if the due date is far into the future
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 19014: on_reserve blocks auto_renew
Bug-19014-onreserve-blocks-autorenew.patch (text/plain), 3.09 KB, created by
Nick Clemens (kidclamp)
on 2020-02-11 13:18:55 UTC
(
hide
)
Description:
Bug 19014: on_reserve blocks auto_renew
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2020-02-11 13:18:55 UTC
Size:
3.09 KB
patch
obsolete
>From 8141f5b60d3a9a48b04e03d80f6d6b84bf605df8 Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Tue, 11 Feb 2020 13:18:10 +0000 >Subject: [PATCH] Bug 19014: on_reserve blocks auto_renew > >--- > C4/Circulation.pm | 14 +++++++++----- > t/db_dependent/Circulation.t | 7 ++++++- > 2 files changed, 15 insertions(+), 6 deletions(-) > >diff --git a/C4/Circulation.pm b/C4/Circulation.pm >index bda8815e30..379f1f46b5 100644 >--- a/C4/Circulation.pm >+++ b/C4/Circulation.pm >@@ -2693,6 +2693,7 @@ sub CanBookBeRenewed { > > my $dbh = C4::Context->dbh; > my $renews = 1; >+ my $auto_renew = 0; > > my $item = Koha::Items->find($itemnumber) or return ( 0, 'no_item' ); > my $issue = $item->checkout or return ( 0, 'no_checkout' ); >@@ -2794,17 +2795,19 @@ sub CanBookBeRenewed { > return ( 0, "too_soon" ); > } > elsif ( $issue->auto_renew ) { >- return ( 0, "auto_renew" ); >+ $auto_renew = 1; > } > } > > # Fallback for automatic renewals: > # If norenewalbefore is undef, don't renew before due date. >- if ( $issue->auto_renew ) { >+ if ( $issue->auto_renew && !$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" ); >+ if ( $now >= dt_from_string( $issue->date_due, 'sql' ) ){ >+ $auto_renew = 1; >+ } else { >+ return ( 0, "auto_too_soon" ); >+ } > } > } > >@@ -2874,6 +2877,7 @@ sub CanBookBeRenewed { > } > } > return ( 0, "on_reserve" ) if $resfound; # '' when no hold was found >+ return ( 0, "auto_renew" ) if $auto_renew && !$override_limit; # 0 if auto-renewal should not succeed > > return ( 1, undef ); > } >diff --git a/t/db_dependent/Circulation.t b/t/db_dependent/Circulation.t >index f4069f4eea..4ba4e4b419 100755 >--- a/t/db_dependent/Circulation.t >+++ b/t/db_dependent/Circulation.t >@@ -274,7 +274,7 @@ Koha::CirculationRules->set_rules( > > my ( $reused_itemnumber_1, $reused_itemnumber_2 ); > subtest "CanBookBeRenewed tests" => sub { >- plan tests => 75; >+ plan tests => 77; > > C4::Context->set_preference('ItemsDeniedRenewal',''); > # Generate test biblio >@@ -622,6 +622,11 @@ subtest "CanBookBeRenewed tests" => sub { > ( $renewokay, $error ) = CanBookBeRenewed( $renewing_borrowernumber, $item_4->itemnumber, 1 ); > is( $renewokay, 0, 'Still should not be able to renew' ); > is( $error, 'on_reserve', 'returned code is on_reserve, auto_too_soon limit is overridden' ); >+ $dbh->do('UPDATE circulation_rules SET rule_value = 0 where rule_name = "norenewalbefore"'); >+ ( $renewokay, $error ) = CanBookBeRenewed( $renewing_borrowernumber, $item_4->itemnumber, 1 ); >+ is( $renewokay, 0, 'Still should not be able to renew' ); >+ is( $error, 'on_reserve', 'returned code is on_reserve, auto_renew only happens if not on reserve' ); >+ ModReserveCancelAll($item_4->itemnumber, $reserving_borrowernumber); > > > >-- >2.11.0
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 19014
:
65590
|
86960
|
90509
|
95348
|
95851
|
95852
|
96688
|
96689
|
97374
|
97395
|
97396
|
97397
|
98704
|
98705
|
98706
|
98717
|
98718
|
98719
|
98720
|
100180