@@ -, +, @@
---
C4/Circulation.pm | 2 +-
.../prog/en/modules/circ/circulation.tt | 14 ++++++++---
.../prog/en/modules/members/memberentrygen.tt | 27 ++++++++++++++++++++++
.../prog/en/modules/members/members-update.tt | 1 +
.../prog/en/modules/members/moremember-brief.tt | 1 +
.../prog/en/modules/members/moremember.tt | 6 +++++
.../bootstrap/en/modules/opac-memberentry.tt | 27 ++++++++++++++++++++++
.../opac-tmpl/bootstrap/en/modules/opac-user.tt | 6 ++---
members/memberentry.pl | 1 +
misc/cronjobs/automatic_renewals.pl | 2 +-
t/db_dependent/Circulation.t | 2 +-
11 files changed, 80 insertions(+), 9 deletions(-)
--- a/C4/Circulation.pm
+++ a/C4/Circulation.pm
@@ -2817,7 +2817,7 @@ sub CanBookBeRenewed {
# Fallback for automatic renewals:
# If norenewalbefore is undef, don't renew before due date.
- if ( $issue->auto_renew && !$auto_renew ) {
+ if ( $issue->auto_renew && !$auto_renew && $patron->autorenew_checkouts ) {
my $now = dt_from_string;
if ( $now >= dt_from_string( $issue->date_due, 'sql' ) ){
$auto_renew = 1;
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt
+++ a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt
@@ -568,15 +568,23 @@
[% IF NEEDSCONFIRMATION %]
[% IF auto_renew %]
-
+ [% IF patron.autorenewal %]
+
+ [% ELSE %]
+
+ [% END %]
[% ELSE %]
[% END %]
[% ELSE %]
- [% IF auto_renew %]
+ [% IF ( auto_renew && patron.autorenewal ) %]
- [% ELSE %]
+ [% ELSIF patron.autorenewal %]
+ [% ELSE %]
+
[% END %]
[% END %]
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt
+++ a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt
@@ -874,6 +874,33 @@ legend:hover {
[% END # /UNLESS nosort2 %]
+ [% UNLESS noautorenewal %]
+
+
+ [% IF ( autorenewal ) %]
+
+
+ [% ELSE %]
+
+
+ [% END %]
+
+ [% END %]
+
[% IF ( Koha.Preference('CheckPrevCheckout') == 'softyes' || Koha.Preference('CheckPrevCheckout') == 'softno' ) %]
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/members-update.tt
+++ a/koha-tmpl/intranet-tmpl/prog/en/modules/members/members-update.tt
@@ -52,6 +52,7 @@
[% CASE 'contacttitle' %]Contact: Title
[% CASE 'relationship' %]Contact: Relationship
[% CASE 'sex' %]Gender
+[% CASE 'autorenewal' %]Auto-renewal
[% CASE 'altcontactfirstname' %]Alternate contact: First name
[% CASE 'altcontactsurname' %]Alternate contact: Surname
[% CASE 'altcontactaddress1' %]Alternate contact: Address
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember-brief.tt
+++ a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember-brief.tt
@@ -84,6 +84,7 @@
Library: [% patron.library.branchname | html %]
[% IF ( patron.sort1 ) %]Sort field 1:[% AuthorisedValues.GetByCode('Bsort1', patron.sort1) | html %][% END %]
[% IF ( patron.sort2 ) %]Sort field 2:[% AuthorisedValues.GetByCode('Bsort2', patron.sort2) | html %][% END %]
+ [% UNLESS ( patron.autorenewal ) %]Auto renewal: Patron has opted out[% END %]
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt
+++ a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt
@@ -516,6 +516,12 @@
[% AuthorisedValues.GetByCode('Bsort2', patron.sort2) | html %]
[% END %]
+ [% UNLESS ( patron.autorenewal ) %]
+
+ Auto renewal:
+ Patron has opted out
+
+ [% END %]
Username:
[% patron.userid | html %]
--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-memberentry.tt
+++ a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-memberentry.tt
@@ -258,6 +258,33 @@
[% END %]
[% END %]
+ [% UNLESS hidden.defined('autorenewal') %]
+
+
+ [% IF ( borrower.autorenewal ) %]
+
+
+
+ [% ELSE %]
+
+
+ [% END %]
+
+ [% END %]
[% END # / defined 'branchcode' %]
--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt
+++ a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt
@@ -330,12 +330,12 @@
[% ELSIF ISSUE.auto_account_expired %]
Automatic renewal failed, your account is expired.
([% ISSUE.renewsleft | html %] of [% ISSUE.renewsallowed | html %] renewals remaining)
- [% ELSIF ( ISSUE.auto_renew || ISSUE.auto_too_soon ) %]
- Automatic renewal
- ([% ISSUE.renewsleft | html %] of [% ISSUE.renewsallowed | html %] renewals remaining)
[% ELSIF ( ISSUE.too_soon ) %]
No renewal before [% ISSUE.soonestrenewdate | html %]
([% ISSUE.renewsleft | html %] of [% ISSUE.renewsallowed | html %] renewals remaining)
+ [% ELSIF ( ISSUE.auto_renew || ISSUE.auto_too_soon ) %]
+ Automatic renewal
+ ([% ISSUE.renewsleft | html %] of [% ISSUE.renewsallowed | html %] renewals remaining)
[% ELSIF ( ISSUE.item_denied_renewal ) %]
Renewal not allowed
[% END %]
--- a/members/memberentry.pl
+++ a/members/memberentry.pl
@@ -739,6 +739,7 @@ $template->param(no_add => $no_add);
$template->param( sort1 => $data{'sort1'});
$template->param( sort2 => $data{'sort2'});
+$template->param( autorenew => $data{'autorenew'});
if ($nok) {
foreach my $error (@errors) {
--- a/misc/cronjobs/automatic_renewals.pl
+++ a/misc/cronjobs/automatic_renewals.pl
@@ -80,7 +80,7 @@ GetOptions(
pod2usage(0) if $help;
cronlogaction();
-my $auto_renews = Koha::Checkouts->search({ auto_renew => 1 });
+my $auto_renews = Koha::Checkouts->search({ auto_renew => 1, 'borrower.autorenewal' => 1 },{ join => 'borrower'});
my %report;
$verbose = 1 unless $verbose or $confirm;
--- a/t/db_dependent/Circulation.t
+++ a/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 => 77;
+ plan tests => 83;
C4::Context->set_preference('ItemsDeniedRenewal','');
# Generate test biblio
--