Bug 23866: Prompt for HEA configuration
authorMartin Renvoize <martin.renvoize@ptfs-europe.com>
Tue, 22 Oct 2019 12:57:42 +0000 (13:57 +0100)
committerMartin Renvoize <martin.renvoize@ptfs-europe.com>
Thu, 31 Oct 2019 11:35:52 +0000 (11:35 +0000)
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

installer/data/mysql/atomicupdate/bug_23866.perl [new file with mode: 0644]
installer/data/mysql/sysprefs.sql
koha-tmpl/intranet-tmpl/prog/en/modules/admin/admin-home.tt
koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/admin.pref
koha-tmpl/intranet-tmpl/prog/en/modules/admin/usage_statistics.tt

diff --git a/installer/data/mysql/atomicupdate/bug_23866.perl b/installer/data/mysql/atomicupdate/bug_23866.perl
new file mode 100644 (file)
index 0000000..3c1f19c
--- /dev/null
@@ -0,0 +1,7 @@
+$DBversion = 'XXX'; # will be replaced by the RM
+if( CheckVersion( $DBversion ) ) {
+    $dbh->do( "UPDATE systempreferences SET value = '2' WHERE value = '0' AND variable = 'UsageStats'" );
+
+    SetVersion( $DBversion );
+    print "Upgrade to $DBversion done (Bug 23866 - Set HEA syspref to prompt for review)\n";
+}
index 11aa53d..3897de8 100644 (file)
@@ -642,7 +642,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `
 ('UploadPurgeTemporaryFilesDays','',NULL,'If not empty, number of days used when automatically deleting temporary uploads','integer'),
 ('uppercasesurnames','0',NULL,'If ON, surnames are converted to upper case in patron entry form','YesNo'),
 ('URLLinkText','',NULL,'Text to display as the link anchor in the OPAC','free'),
-('UsageStats', 0, NULL, 'Share anonymous usage data on the Hea Koha community website.', 'YesNo'),
+('UsageStats', 2, NULL, 'Share anonymous usage data on the Hea Koha community website.', 'YesNo'),
 ('UsageStatsCountry', '', NULL, 'The country where your library is located, to be shown on the Hea Koha community website', 'Choice'),
 ('UsageStatsID', '', NULL, 'This preference is part of Koha but it should not be deleted or updated manually.',  'Free'),
 ('UsageStatsGeolocation', '', NULL, 'Geolocation of the main library.', 'Free'),
index 5059cbf..df53b30 100644 (file)
                     </div>
                 [% END %]
             [% END %]
+            [% IF ( CAN_user_parameters_manage_usage_stats ) %]
+                [% IF ( Koha.Preference('UsageStats') == 2 ) %]
+                    <div class="dialog message">
+                        <h4>Share anonymous usage statistics with the Koha community?</h4>
+                        <p> You haven't decided if you want to activate usage statistic sharing in Koha yet. <a href=/cgi-bin/koha/admin/usage_statistics.pl>Change your HEA settings</a>.</p>
+                        <p> This feature gives the Koha developers valuable information regarding how Koha is being used and helps to drive decisions during the development cycle</p>
+                    </div>
+                [% END %]
+            [% END %]
         <h1>Koha administration</h1>
         <div class="row">
             <div class="col-md-6 sysprefs">
index 5c89070..00fba12 100644 (file)
@@ -184,10 +184,11 @@ Administration:
         -
             - "Share anonymous Koha usage data with the Koha community: "
             - pref: UsageStats
-              default: 0
+              default: 2
               choices:
                   yes: "Yes"
                   no: "No"
+                  2: "No, let me think about it"
             - ". Website where usage statistics are published: <a href=\"http://hea.koha-community.org\">Hea Koha community website</a>."
             - "<br><strong>NOTE:</strong> The other \"UsageStats\" preferences have no effect if this preference is set to \"No\"."
             - "<br><strong>NOTE:</strong> This system preference requires the <code>misc/cronjobs/share_usage_with_koha_community.pl</code> cronjob. Ask your system administrator to schedule it."
index 0f8ea78..f8d0182 100644 (file)
                         <li>
                             <label for="UsageStats">Share my Koha usage statistics: </label>
                             <select name="UsageStats" id="UsageStats">
-                            [% IF Koha.Preference('UsageStats') %]
+                            [% IF Koha.Preference('UsageStats') == 1 %]
+                                <option value="2">Undecided</option>
                                 <option value="1" selected="selected">Yes</option>
                                 <option value="0">No</option>
-                            [% ELSE %]
+                            [% ELSIF Koha.Preference('UsageStats') == 0 %]
+                                <option value="2">Undecided</option>
                                 <option value="1">Yes</option>
                                 <option value="0" selected="selected">No</option>
+                            [% ELSE %]
+                                <option value="2" selected="selected">Undecided</option>
+                                <option value="1">Yes</option>
+                                <option value="0">No</option>
                             [% END %]
                             </select>
                         </li>