Bugzilla – Attachment 156832 Details for
Bug 25393
Create separate 'no automatic renewal before' rule
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 25393: Distinguish between auto or normal renewals in GetSoonestRenewDate
Bug-25393-Distinguish-between-auto-or-normal-renew.patch (text/plain), 3.27 KB, created by
Nick Clemens (kidclamp)
on 2023-10-11 14:56:24 UTC
(
hide
)
Description:
Bug 25393: Distinguish between auto or normal renewals in GetSoonestRenewDate
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2023-10-11 14:56:24 UTC
Size:
3.27 KB
patch
obsolete
>From 693f01579dc0a22509596616f2ae45a4379e1482 Mon Sep 17 00:00:00 2001 >From: Pedro Amorim <pedro.amorim@ptfs-europe.com> >Date: Fri, 11 Aug 2023 13:37:08 +0000 >Subject: [PATCH] Bug 25393: Distinguish between auto or normal renewals in > GetSoonestRenewDate > >Signed-off-by: Andrew Fuerste-Henry <andrewfh@dubcolib.org> >Signed-off-by: Nick Clemens <nick@bywatersolutions.com> >--- > C4/Circulation.pm | 20 ++++++++++++-------- > 1 file changed, 12 insertions(+), 8 deletions(-) > >diff --git a/C4/Circulation.pm b/C4/Circulation.pm >index 3b20e8ab93..b2bbabbc05 100644 >--- a/C4/Circulation.pm >+++ b/C4/Circulation.pm >@@ -3433,6 +3433,8 @@ C<$patron> is the patron who currently has the item on loan. > > C<$issue> is the the item issue. > >+C<$is_auto> is this soonest renew date for an auto renewal? >+ > C<$GetSoonestRenewDate> returns the DateTime of the soonest possible > renew date, based on the value "No renewal before" of the applicable > issuing rule. Returns the current date if the item can already be >@@ -3442,13 +3444,15 @@ cannot be found. > =cut > > sub GetSoonestRenewDate { >- my ( $patron, $issue ) = @_; >+ my ( $patron, $issue, $is_auto ) = @_; > return unless $issue; > return unless $patron; > > my $item = $issue->item; > return unless $item; > >+ my $circ_rule = $is_auto ? 'noautorenewalbefore' : 'norenewalbefore'; >+ > my $dbh = C4::Context->dbh; > > my $branchcode = _GetCircControlBranch( $item, $patron ); >@@ -3457,7 +3461,7 @@ sub GetSoonestRenewDate { > itemtype => $item->effective_itemtype, > branchcode => $branchcode, > rules => [ >- 'norenewalbefore', >+ $circ_rule, > 'lengthunit', > ] > } >@@ -3465,12 +3469,12 @@ sub GetSoonestRenewDate { > > my $now = dt_from_string; > >- if ( defined $issuing_rule->{norenewalbefore} >- and $issuing_rule->{norenewalbefore} ne "" ) >+ if ( defined $issuing_rule->{$circ_rule} >+ and $issuing_rule->{$circ_rule} ne "" ) > { > my $soonestrenewal = > dt_from_string( $issue->date_due )->subtract( >- $issuing_rule->{lengthunit} => $issuing_rule->{norenewalbefore} ); >+ $issuing_rule->{lengthunit} => $issuing_rule->{$circ_rule} ); > > if ( C4::Context->preference('NoRenewalBeforePrecision') eq 'date' > and $issuing_rule->{lengthunit} eq 'days' ) >@@ -3478,8 +3482,8 @@ sub GetSoonestRenewDate { > $soonestrenewal->truncate( to => 'day' ); > } > return $soonestrenewal; >- } elsif ( $issue->auto_renew && $patron->autorenew_checkouts ) { >- # Checkouts with auto-renewing fall back to due date >+ } elsif ( $is_auto && $issue->auto_renew && $patron->autorenew_checkouts ) { >+ # Checkouts with auto-renewing fall back to due date if noautorenewalbefore is undef > my $soonestrenewal = dt_from_string( $issue->date_due ); > if ( C4::Context->preference('NoRenewalBeforePrecision') eq 'date' > and $issuing_rule->{lengthunit} eq 'days' ) >@@ -4572,7 +4576,7 @@ sub _CanBookBeAutoRenewed { > } > } > >- my $soonest = GetSoonestRenewDate($patron, $issue); >+ my $soonest = GetSoonestRenewDate( $patron, $issue, 1 ); > if ( $soonest > dt_from_string() ) > { > return ( "auto_too_soon", $soonest ); >-- >2.30.2
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 25393
:
154533
|
154534
|
154535
|
154536
|
154537
|
154538
|
154539
|
154540
|
154541
|
154661
|
154662
|
154663
|
154664
|
154665
|
154666
|
154667
|
154668
|
154669
|
155307
|
155308
|
155309
|
155310
|
155311
|
155312
|
155313
|
155314
|
155315
|
156829
|
156830
|
156831
| 156832 |
156833
|
156834
|
156835
|
156836
|
156837
|
156838
|
156839
|
156840