From 3ec6f98e94fbc31d3b8176c93eb4a70e3295d071 Mon Sep 17 00:00:00 2001
From: Katrin Fischer <katrin.fischer.83@web.de>
Date: Sun, 22 Mar 2020 17:07:57 +0000
Subject: [PATCH] Bug 24476 Standardize on 'auto renew(al)' and improve db
 update

There were several versions: auto renew, auto-renew, autorenew
I've decided to use auto renew (from automatic renewal) to keep
things a bit more consistent.

The DB update was missing AFTER and IGNORE for the sys pref.
Also fixed a tiny typo (tp > to)
Also changed
---
 .../mysql/atomicupdate/bug_24476_opt_out_of_auto_renewal.perl     | 8 ++++----
 installer/data/mysql/sysprefs.sql                                 | 2 +-
 .../intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref  | 2 +-
 koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt             | 4 ++--
 4 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/installer/data/mysql/atomicupdate/bug_24476_opt_out_of_auto_renewal.perl b/installer/data/mysql/atomicupdate/bug_24476_opt_out_of_auto_renewal.perl
index c83325f067..151c9b29c3 100644
--- a/installer/data/mysql/atomicupdate/bug_24476_opt_out_of_auto_renewal.perl
+++ b/installer/data/mysql/atomicupdate/bug_24476_opt_out_of_auto_renewal.perl
@@ -1,16 +1,16 @@
 $DBversion = 'XXX';
 if( CheckVersion( $DBversion ) ) {
     unless( column_exists('borrowers','autorenew_checkouts') ){
-        $dbh->do( "ALTER TABLE borrowers ADD COLUMN autorenew_checkouts TINYINT(1) NOT NULL DEFAULT 1" );
+        $dbh->do( "ALTER TABLE borrowers ADD COLUMN autorenew_checkouts TINYINT(1) NOT NULL DEFAULT 1 AFTER anonymized" );
     }
     unless( column_exists('deletedborrowers','autorenew_checkouts') ){
-        $dbh->do( "ALTER TABLE deletedborrowers ADD COLUMN autorenew_checkouts TINYINT(1) NOT NULL DEFAULT 1" );
+        $dbh->do( "ALTER TABLE deletedborrowers ADD COLUMN autorenew_checkouts TINYINT(1) NOT NULL DEFAULT 1 AFTER anonymized" );
     }
     $dbh->do(q{
-        INSERT INTO systempreferences
+        INSERT IGNORE INTO systempreferences
         ( `variable`, `value`, `options`, `explanation`, `type` )
         VALUES
-        ('AllowPatronToControlAutorenewal','0',NULL,'If enabled, patrons will have a field in their account tp choose whether their checkouts are auto renewed or not','YesNo')
+        ('AllowPatronToControlAutorenewal','0',NULL,'If enabled, patrons will have a field in their account to choose whether their checkouts are auto renewed or not','YesNo')
     });
     SetVersion( $DBversion );
     print "Upgrade to $DBversion done (Bug 24476 - Allow patrons to opt-out of autorenewal)\n";
diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql
index 712e94d327..f88b207e6e 100644
--- a/installer/data/mysql/sysprefs.sql
+++ b/installer/data/mysql/sysprefs.sql
@@ -34,7 +34,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `
 ('AllowMultipleIssuesOnABiblio',1,'Allow/Don\'t allow patrons to check out multiple items from one biblio','','YesNo'),
 ('AllowNotForLoanOverride','0','','If ON, Koha will allow the librarian to loan a not for loan item.','YesNo'),
 ('AllowOfflineCirculation','0','','If on, enables HTML5 offline circulation functionality.','YesNo'),
-('AllowPatronToControlAutorenewal','0',NULL,'If enabled, patrons will have a field in their account tp choose whether their checkouts are auto renewed or not','YesNo'),
+('AllowPatronToControlAutorenewal','0',NULL,'If enabled, patrons will have a field in their account to choose whether their checkouts are auto renewed or not','YesNo'),
 ('AllowPatronToSetCheckoutsVisibilityForGuarantor',  '0', NULL, 'If enabled, the patron can set checkouts to be visible to his or her guarantor',  'YesNo'),
 ('AllowPatronToSetFinesVisibilityForGuarantor',  '0', NULL, 'If enabled, the patron can set fines to be visible to his or her guarantor',  'YesNo'),
 ('AllowPKIAuth','None','None|Common Name|emailAddress','Use the field from a client-side SSL certificate to look a user in the Koha database','Choice'),
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref
index 43d9c2810d..13c2e70352 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref
@@ -256,7 +256,7 @@ Patrons:
            choices:
                yes: Allow patrons
                no: Allow only staff
-         - "to allow/disallow auto-renewal for account. If allowed a patron will be able to update their own account to allow/disallow autorenewals"
+         - "to allow/disallow auto renewal for account. If allowed a patron will be able to update their own account to allow/disallow auto renewals"
 
     Privacy:
      -
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 e649229d19..f886df0c5e 100644
--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt
+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt
@@ -52,7 +52,7 @@
                     [% IF Koha.Preference('AllowPatronToControlAutorenewal') %]
                     <form id="autorenewal_option" action="/cgi-bin/koha/opac-user.pl" method="post">
                             <label for="yes-autorenew_checkouts">
-                                Allow auto-renewal:
+                                Allow auto renewal:
                             </label>
                                 [% IF ( borrower.autorenew_checkouts ) %]
                                     <label class="radio inline" for="yes-autorenew_checkouts">
@@ -76,7 +76,7 @@
                                 [% END %]
                         <input type="hidden" name="csrf_token" value="[% csrf_token | html %]" />
                         <input type="hidden" name="update_arc" value="1" />
-                        <input type="submit" value="Update autorenewal preference" />
+                        <input type="submit" value="Update auto renewal preference" />
                     </form>
                     [% END %]
                     [% IF ( patronupdate ) %]<div class="alert alert-info"><h3>Thank you!</h3><p>Your corrections have been submitted to the library, and a staff member will update your record as soon as possible.</p></div>[% END %]
-- 
2.11.0