Bugzilla – Attachment 101422 Details for
Bug 24476
Allow patrons to opt-out of auto-renewal
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 24476: Allow patrons to opt out of auto-renewal
Bug-24476-Allow-patrons-to-opt-out-of-auto-renewal.patch (text/plain), 17.22 KB, created by
Nick Clemens (kidclamp)
on 2020-03-23 11:58:02 UTC
(
hide
)
Description:
Bug 24476: Allow patrons to opt out of auto-renewal
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2020-03-23 11:58:02 UTC
Size:
17.22 KB
patch
obsolete
>From 6f699efa29b1c147f05961cb6effd868e51e410a Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Thu, 23 Jan 2020 02:38:50 +0000 >Subject: [PATCH] Bug 24476: Allow patrons to opt out of auto-renewal > >To test: >1 - Verify on staff side that patron can be edited to opt in our out of auto renewal >2 - Check out some items to a patron opted in to auto renewal >3 - Ensure the items are checked out and set to autorenew >4 - Login on the opac at the patron >5 - Verify items cannot be renewed as scheduled for auto-renewal >6 - On staff side, opt patron out of auto renewal >7 - Verify on opac items are no longer marked for auto renewal >8 - Run the auto renewal cron job, items are not renewed >9 - Set 'no renewal before' to a setting that would prevent renewal >10 - Verify that opting patron in or out of auto renewal changes only the reason items cannot be renewed >11 - Set 'no renewal before' to a setting that would allow for renewal >12 - Verify that opting patron in/out changes their ability to renew >13 - Verify that when opted out cron does not renew >14 - Verify that when opted in the item is auto renewed >15 - Reset the due date, opt out, verify manual renewal succeeds > >Signed-off-by: Andrew <andrew@bywatersolutions.com> > >Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com> >--- > 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(-) > >diff --git a/C4/Circulation.pm b/C4/Circulation.pm >index a529b2ebbe..3bc9841065 100644 >--- a/C4/Circulation.pm >+++ b/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; >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt >index 3d13536df8..feb3c3a5e6 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt >@@ -568,15 +568,23 @@ > <div id="set-automatic-renewal" class="circ-setting"> > [% IF NEEDSCONFIRMATION %] > [% IF auto_renew %] >- <input type="checkbox" name="auto_renew" id="auto_renew" value="auto_renew" disabled="disabled" checked="checked" /> >+ [% IF patron.autorenewal %] >+ <input type="checkbox" name="auto_renew" id="auto_renew" value="auto_renew" disabled="disabled" >+ title="Patron has opted out of auto-renewal"/> >+ [% ELSE %] >+ <input type="checkbox" name="auto_renew" id="auto_renew" value="auto_renew" disabled="disabled" checked="checked" /> >+ [% END %] > [% ELSE %] > <input type="checkbox" name="auto_renew" id="auto_renew" value="auto_renew" disabled="disabled" /> > [% END %] > [% ELSE %] >- [% IF auto_renew %] >+ [% IF ( auto_renew && patron.autorenewal ) %] > <input type="checkbox" name="auto_renew" id="auto_renew" value="auto_renew" class="circ_setting" checked="checked" /> >- [% ELSE %] >+ [% ELSIF patron.autorenewal %] > <input type="checkbox" name="auto_renew" id="auto_renew" value="auto_renew" class="circ_setting" /> >+ [% ELSE %] >+ <input type="checkbox" name="auto_renew" id="auto_renew" value="auto_renew" disabled="disabled" >+ title="Patron has opted out of auto-renewal"/> > [% END %] > [% END %] > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt >index 2b6a379d71..20ddc76026 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt >@@ -874,6 +874,33 @@ legend:hover { > </li> > [% END # /UNLESS nosort2 %] > >+ [% UNLESS noautorenewal %] >+ <li class="radio"> >+ <label for="yes-autorenewal"> >+ Allow auto-renewal of items: >+ </label> >+ [% IF ( autorenewal ) %] >+ <label for="yes-autorenewal"> >+ Yes >+ <input type="radio" id="yes-autorenewal" name="autorenewal" value="1" checked="checked" /> >+ </label> >+ <label for="no-autorenewal"> >+ No >+ <input type="radio" id="no-autorenewal" name="autorenewal" value="0" /> >+ </label> >+ [% ELSE %] >+ <label for="yes-autorenewal"> >+ Yes >+ <input type="radio" id="yes-autorenewal" name="autorenewal" value="1" /> >+ </label> >+ <label for="no-autorenewal"> >+ No >+ <input type="radio" id="no-autorenewal" name="autorenewal" value="0" checked="checked" /> >+ </label> >+ [% END %] >+ </li> >+ [% END %] >+ > [% IF ( Koha.Preference('CheckPrevCheckout') == 'softyes' || Koha.Preference('CheckPrevCheckout') == 'softno' ) %] > <li> > <label for="checkprevcheckout">Check for previous checkouts: </label> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/members-update.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/members-update.tt >index 77b368740d..c16e432530 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/members-update.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/members-update.tt >@@ -52,6 +52,7 @@ > [% CASE 'contacttitle' %]<span>Contact: Title</span> > [% CASE 'relationship' %]<span>Contact: Relationship</span> > [% CASE 'sex' %]<span>Gender</span> >+[% CASE 'autorenewal' %]<span>Auto-renewal</span> > [% CASE 'altcontactfirstname' %]<span>Alternate contact: First name</span> > [% CASE 'altcontactsurname' %]<span>Alternate contact: Surname</span> > [% CASE 'altcontactaddress1' %]<span>Alternate contact: Address</span> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember-brief.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember-brief.tt >index 1c3b2c3b1b..ecac3b7f28 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember-brief.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember-brief.tt >@@ -84,6 +84,7 @@ > <li><span class="label">Library: </span>[% patron.library.branchname | html %]</li> > [% IF ( patron.sort1 ) %]<li><span class="label">Sort field 1:</span>[% AuthorisedValues.GetByCode('Bsort1', patron.sort1) | html %]</li>[% END %] > [% IF ( patron.sort2 ) %]<li><span class="label">Sort field 2:</span>[% AuthorisedValues.GetByCode('Bsort2', patron.sort2) | html %]</li>[% END %] >+ [% UNLESS ( patron.autorenewal ) %]<li>Auto renewal: Patron has opted out</li>[% END %] > </ol> > </div> > </div> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt >index ab3e89abf7..fbbc2b2be1 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt >@@ -520,6 +520,12 @@ > [% AuthorisedValues.GetByCode('Bsort2', patron.sort2) | html %] > </li> > [% END %] >+ [% UNLESS ( patron.autorenewal ) %] >+ <li id="patron-autorenewal"> >+ <span class="label">Auto renewal:</span> >+ Patron has opted out >+ </li> >+ [% END %] > <li id="patron-username"> > <span class="label">Username: </span> > [% patron.userid | html %] >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-memberentry.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-memberentry.tt >index 8761cc88ae..a2bcde4516 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-memberentry.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-memberentry.tt >@@ -258,6 +258,33 @@ > [% END %] > </li> > [% END %] >+ [% UNLESS hidden.defined('autorenewal') %] >+ <li class="lradio"> >+ <label for="yes-autorenewal"> >+ Allow auto-renewal: >+ </label> >+ [% IF ( borrower.autorenewal ) %] >+ <label class="radio inline" for="yes-autorenewal"> >+ Yes >+ <input type="radio" id="yes-autorenewal" name="borrower_autorenewal" value="1" checked="checked" /> >+ </label> >+ >+ <label class="radio inline" for="no-autorenewal"> >+ No >+ <input type="radio" id="no-autorenewal" name="borrower_autorenewal" value="0" /> >+ </label> >+ [% ELSE %] >+ <label class="radio inline" for="yes-autorenewal"> >+ Yes >+ <input type="radio" id="yes-autorenewal" name="borrower_autorenewal" value="1" /> >+ </label> >+ <label class="radio inline" for="no-autorenewal"> >+ No >+ <input type="radio" id="no-autorenewal" name="borrower_autorenewal" value="0" checked="checked" /> >+ </label> >+ [% END %] >+ </li> >+ [% END %] > </ol> > </fieldset> > [% END # / defined 'branchcode' %] >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt >index 369dbd7dd0..47f10db028 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt >+++ b/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. > <span class="renewals">([% ISSUE.renewsleft | html %] of [% ISSUE.renewsallowed | html %] renewals remaining)</span> >- [% ELSIF ( ISSUE.auto_renew || ISSUE.auto_too_soon ) %] >- Automatic renewal >- <span class="renewals">([% ISSUE.renewsleft | html %] of [% ISSUE.renewsallowed | html %] renewals remaining)</span> > [% ELSIF ( ISSUE.too_soon ) %] > No renewal before [% ISSUE.soonestrenewdate | html %] > <span class="renewals">([% ISSUE.renewsleft | html %] of [% ISSUE.renewsallowed | html %] renewals remaining)</span> >+ [% ELSIF ( ISSUE.auto_renew || ISSUE.auto_too_soon ) %] >+ Automatic renewal >+ <span class="renewals">([% ISSUE.renewsleft | html %] of [% ISSUE.renewsallowed | html %] renewals remaining)</span> > [% ELSIF ( ISSUE.item_denied_renewal ) %] > Renewal not allowed > [% END %] >diff --git a/members/memberentry.pl b/members/memberentry.pl >index ed482b9b81..d16dd8ccfe 100755 >--- a/members/memberentry.pl >+++ b/members/memberentry.pl >@@ -738,6 +738,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) { >diff --git a/misc/cronjobs/automatic_renewals.pl b/misc/cronjobs/automatic_renewals.pl >index d7bc5a140b..a3bded3aea 100755 >--- a/misc/cronjobs/automatic_renewals.pl >+++ b/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; >diff --git a/t/db_dependent/Circulation.t b/t/db_dependent/Circulation.t >index f0d46df0ed..72dd1d2948 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 => 77; >+ plan tests => 83; > > C4::Context->set_preference('ItemsDeniedRenewal',''); > # Generate test biblio >-- >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 24476
:
97766
|
97767
|
97768
|
97769
|
97770
|
97831
|
97832
|
97833
|
97834
|
97835
|
97836
|
97923
|
97924
|
97925
|
97926
|
97927
|
97928
|
97997
|
97998
|
97999
|
98000
|
98001
|
98002
|
99793
|
99794
|
99795
|
99796
|
99797
|
99798
|
99799
|
99800
|
100022
|
100023
|
100024
|
100025
|
100026
|
100027
|
100028
|
100029
|
101385
|
101419
|
101420
|
101421
|
101422
|
101423
|
101424
|
101425
|
101426
|
101427
|
101511
|
101512
|
101513
|
101514
|
101515
|
101516
|
101517
|
101518
|
101519
|
101520
|
101521
|
101542