Bug 24682: Make UsageStatsGeolocation readonly (and redirect to the config page)
authorJonathan Druart <jonathan.druart@bugs.koha-community.org>
Fri, 21 Feb 2020 09:31:54 +0000 (10:31 +0100)
committerMartin Renvoize <martin.renvoize@ptfs-europe.com>
Mon, 24 Feb 2020 13:17:15 +0000 (13:17 +0000)
To prevent invalid values in this pref (and so on the server), we should
make this input readonly on the syspref page.
The sysprefs related to Hea should be edited from the dedicated page, so
also adding a note about that.

Test plan:
Search syspref with "UsageStats"
Notice the note about the admin page
Notice the UsageStatsGeolocation input is now readonly (and resized, to
display the whole value when filled)

Signed-off-by: Maryse Simard <maryse.simard@inlibro.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences.tt
koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/admin.pref

index ae22e00..4c3f867 100644 (file)
                     [% IF ( CHUNK.type_text ) %]
                     [% CHUNK.contents | $raw %]
                     [% ELSIF ( CHUNK.type_input ) %]
-                    <input type="[%IF CHUNK.input_type %][% CHUNK.input_type | html %][% ELSE %]text[% END %]" name="pref_[% CHUNK.name | html %]" id="pref_[% CHUNK.name | html %]" class="preference preference-[% CHUNK.class or "short" | html %]" value="[% CHUNK.value | html %]" autocomplete="off" /> [% IF ( CHUNK.dateinput ) %]<span class="hint">[% INCLUDE 'date-format.inc' %]</span>[% END %]
+                        [% IF CHUNK.name == 'UsageStatsGeolocation' %]
+                            <input type="[%IF CHUNK.input_type %][% CHUNK.input_type | html %][% ELSE %]text[% END %]" name="pref_[% CHUNK.name | html %]" id="pref_[% CHUNK.name | html %]" class="preference preference-[% CHUNK.class or "short" | html %]" value="[% CHUNK.value | html %]" autocomplete="off" readonly="readonly" size="40" style="width: auto;"/> [% IF ( CHUNK.dateinput ) %]<span class="hint">[% INCLUDE 'date-format.inc' %]</span>[% END %]
+                        [% ELSE %]
+                            <input type="[%IF CHUNK.input_type %][% CHUNK.input_type | html %][% ELSE %]text[% END %]" name="pref_[% CHUNK.name | html %]" id="pref_[% CHUNK.name | html %]" class="preference preference-[% CHUNK.class or "short" | html %]" value="[% CHUNK.value | html %]" autocomplete="off" /> [% IF ( CHUNK.dateinput ) %]<span class="hint">[% INCLUDE 'date-format.inc' %]</span>[% END %]
+                        [% END %]
                     [% ELSIF ( CHUNK.type_select ) %]
                     <select name="pref_[% CHUNK.name | html %]" id="pref_[% CHUNK.name | html %]" class="preference preference-[% CHUNK.class or "choice" | html %]">
                         [% FOREACH CHOICE IN CHUNK.CHOICES.sort('value') %]
index 00fba12..3764386 100644 (file)
@@ -192,6 +192,7 @@ Administration:
             - ". 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."
+            - "<br><strong>NOTE:</strong> You should use the <a href=\"/cgi-bin/koha/admin/usage_statistics.pl\">dedicated admin configuration page</a> to edit the preference related to Hea."
         -
             - "Use the following library name to be shown on the Hea Community website: "
             - pref: UsageStatsLibraryName
@@ -432,6 +433,7 @@ Administration:
             - "Geolocation of the main library: "
             - pref: UsageStatsGeolocation
             - "<br><strong>NOTE:</strong> This value has no effect if the UsageStats system preference is set to \"Don't share\"."
+            - "<br><strong>NOTE:</strong> You must use the <a href=\"/cgi-bin/koha/admin/usage_statistics.pl\">dedicated admin configuration page</a> to edit this preference."
     Search Engine:
         -
             - "Use following search engine: "