Bugzilla – Attachment 39800 Details for
Bug 14101
auto renewal is tied to 'no renewal before'
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 14101: Automatic renewals exactly on due date
Bug-14101-Automatic-renewals-exactly-on-due-date.patch (text/plain), 3.62 KB, created by
Holger Meißner
on 2015-06-03 11:14:27 UTC
(
hide
)
Description:
Bug 14101: Automatic renewals exactly on due date
Filename:
MIME Type:
Creator:
Holger Meißner
Created:
2015-06-03 11:14:27 UTC
Size:
3.62 KB
patch
obsolete
>From b0479fbd27b9e840156d81af3218aecd34655cd5 Mon Sep 17 00:00:00 2001 >From: =?UTF-8?q?Holger=20Mei=C3=9Fner?= <h.meissner.82@web.de> >Date: Tue, 2 Jun 2015 15:39:21 +0200 >Subject: [PATCH] Bug 14101: Automatic renewals exactly on due date >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit > >If no value for 'no renewal before' is specified, automatic renewal now >falls back on the due date. Also 'no renewal before' can now be zero, so >both automatic and manual renewals can be delayed until due date. > >Test plan: > >1) Create some circulation rules with different settings for 'No renewal > before' and 'Automatic renewal'. Both daily and hourly loans should > work. > >2) Run misc/cronjobs/automatic_renewals.pl and try to renew manually > before and after a renewal should be possible. > >3) Confirm that: > * Both automatic and manual renewal with 'No renewal before' set > to 0 do not happen before the due date (exact DateTime). > * Manual renewal with 'No renewal before' set to undef (enter empty > string) is unrestricted. > * Automatic renewal with 'No renewal before' set to undef does not > happen before the due date. > >Sponsored-by: Hochschule für Gesundheit (hsg), Germany >--- > C4/Circulation.pm | 18 +++++++++++++++--- > admin/smart-rules.pl | 2 +- > 2 files changed, 16 insertions(+), 4 deletions(-) > >diff --git a/C4/Circulation.pm b/C4/Circulation.pm >index f991680..397f76d 100644 >--- a/C4/Circulation.pm >+++ b/C4/Circulation.pm >@@ -2737,7 +2737,7 @@ sub CanBookBeRenewed { > return ( 0, "too_many" ) > if $issuingrule->{renewalsallowed} <= $itemissue->{renewals}; > >- if ( $issuingrule->{norenewalbefore} ) { >+ if ( defined $issuingrule->{norenewalbefore} ) { > > # Get current time and add norenewalbefore. > # If this is smaller than date_due, it's too soon for renewal. >@@ -2750,9 +2750,21 @@ sub CanBookBeRenewed { > return ( 0, "auto_too_soon" ) if $itemissue->{auto_renew}; > return ( 0, "too_soon" ); > } >+ else { >+ return ( 0, "auto_renew" ) if $itemissue->{auto_renew}; >+ return ( 1, undef ); >+ } >+ } >+ >+ # Fallback for automatic renewals: >+ # If norenewalbefore is undef, don't renew before due date. >+ elsif ( $itemissue->{auto_renew} ) { >+ return ( 0, "auto_renew" ) >+ if DateTime->now( time_zone => C4::Context->tz() ) >= >+ $itemissue->{date_due}; >+ return ( 0, "auto_too_soon" ); > } > >- return ( 0, "auto_renew" ) if $itemissue->{auto_renew}; > return ( 1, undef ); > } > >@@ -2966,7 +2978,7 @@ sub GetSoonestRenewDate { > > my $now = DateTime->now( time_zone => C4::Context->tz() ); > >- if ( $issuingrule->{norenewalbefore} ) { >+ if ( defined $issuingrule->{norenewalbefore} ) { > my $soonestrenewal = > $itemissue->{date_due}->subtract( > $issuingrule->{lengthunit} => $issuingrule->{norenewalbefore} ); >diff --git a/admin/smart-rules.pl b/admin/smart-rules.pl >index 9ef6ef6..5a33616 100755 >--- a/admin/smart-rules.pl >+++ b/admin/smart-rules.pl >@@ -114,7 +114,7 @@ elsif ($op eq 'add') { > my $renewalsallowed = $input->param('renewalsallowed'); > my $renewalperiod = $input->param('renewalperiod'); > my $norenewalbefore = $input->param('norenewalbefore'); >- $norenewalbefore = undef if $norenewalbefore eq '0' or $norenewalbefore =~ /^\s*$/; >+ $norenewalbefore = undef if $norenewalbefore =~ /^\s*$/; > my $auto_renew = $input->param('auto_renew') eq 'yes' ? 1 : 0; > my $reservesallowed = $input->param('reservesallowed'); > my $onshelfholds = $input->param('onshelfholds') || 0; >-- >1.7.10.4
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 14101
:
39800
|
39802
|
39829
|
42773
|
43808
|
43809
|
44948
|
44949
|
44990
|
44991