Bugzilla – Attachment 192281 Details for
Bug 41522
Make system preferences clickable for warnings in About Koha > System information
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 41522: Make sysprefs clickable in warnings
Bug-41522-Make-sysprefs-clickable-in-warnings.patch (text/plain), 28.45 KB, created by
Oli Williams
on 2026-01-31 05:15:06 UTC
(
hide
)
Description:
Bug 41522: Make sysprefs clickable in warnings
Filename:
MIME Type:
Creator:
Oli Williams
Created:
2026-01-31 05:15:06 UTC
Size:
28.45 KB
patch
obsolete
>From 7d4d28c5f9ecb29a00e3a196f7ebcba180629a21 Mon Sep 17 00:00:00 2001 >From: Oli Williams <imhungryoliver@gmail.com> >Date: Wed, 28 Jan 2026 11:57:31 +1300 >Subject: [PATCH] Bug 41522: Make sysprefs clickable in warnings > >This patch makes the system preferences warnings/errors in system information clickable, linking to the system preferences page. > >Links are only shown to users with permissions to manage system preferences. > >Test plan: >1. Log in as a user with the superlibrarian or manage_sysprefs permission >2. Go to More -> About Koha -> System information >3. Verify warnings containing system preferences names are clickable and lead to the correct preference (to check all messages, you must manually trigger the warnings via incorrect settings or direct database modification) >4. Log in as a user without the superlibrarian and manage_sysprefs permission >5. Verify preference names are not links > >Bug 41522: Remove debug output from clickable sysprefs warning >--- > about.pl | 15 + > .../intranet-tmpl/prog/en/modules/about.tt | 276 ++++++++++++++++-- > 2 files changed, 261 insertions(+), 30 deletions(-) > >diff --git a/about.pl b/about.pl >index 86080fa..9bc828c 100755 >--- a/about.pl >+++ b/about.pl >@@ -397,6 +397,7 @@ if ( $tab eq 'sysinfo' ) { > my $userid = C4::Context->preference('AutoSelfCheckID'); > my $all_permissions = C4::Auth::get_user_subpermissions($userid); > my ( $has_self_checkout_perm, $has_other_permissions ); >+ > while ( my ( $module, $permissions ) = each %$all_permissions ) { > if ( $module eq 'self_check' ) { > while ( my ( $permission, $flag ) = each %$permissions ) { >@@ -416,6 +417,20 @@ if ( $tab eq 'sysinfo' ) { > ); > } > >+ my $patron = Koha::Patrons->find( { borrowernumber => $loggedinuser } ); >+ >+ my ($has_sysprefs_perm); >+ >+ if ( C4::Auth::haspermission( $patron->userid, { superlibrarian => '1' } ) ) { >+ $has_sysprefs_perm = 1; >+ } elsif ( C4::Auth::haspermission( $patron->userid, { parameters => 'manage_sysprefs' } ) ) { >+ $has_sysprefs_perm = 1; >+ } >+ >+ $template->param( >+ UserHasSysPrefsPerm => $has_sysprefs_perm, >+ ); >+ > if ( C4::Context->preference('PatronSelfRegistration') ) { > $template->param( warnPrefPatronSelfRegistrationDefaultCategory => 1 ) > unless Koha::Patron::Categories->find( C4::Context->preference('PatronSelfRegistrationDefaultCategory') ); >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/about.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/about.tt >index 326eae4..e209e67 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/about.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/about.tt >@@ -545,59 +545,164 @@ > [% IF (warnPrefRequireChoosingExistingAuthority) %] > <tr> > <th scope="row"><strong>Warning</strong> </th> >- <td>System preference 'RequireChoosingExistingAuthority' is disabled, but needs 'AutoCreateAuthorities' enabled. Otherwise catalogers can add headings that will not be linked to authorities.</td> >+ <td> >+ System preference >+ [% IF (UserHasSysPrefsPerm) %] >+ '<a href="admin/preferences.pl?op=search&searchfield=RequireChoosingExistingAuthority&ok=Search">RequireChoosingExistingAuthority</a>' >+ [% ELSE %] >+ 'RequireChoosingExistingAuthority' >+ [% END %] >+ is disabled, but needs >+ [% IF (UserHasSysPrefsPerm) %] >+ <a href="admin/preferences.pl?op=search&searchfield=AutoCreateAuthorities&ok=Search">AutoCreateAuthorities</a> >+ [% ELSE %] >+ AutoCreateAuthorities >+ [% END %] >+ enabled. Otherwise catalogers can add headings that will not be linked to authorities. >+ </td> > </tr> > [% END %] > [% IF (warnPrefEasyAnalyticalRecords) %] > <tr> > <th scope="row"><strong>Warning</strong> </th> >- <td >- >System preference 'EasyAnalyticalRecords' set, but UseControlNumber preference is set to 'Use'. Set it to 'Don't use' or else the 'Show analytics' links in the staff interface and the OPAC will be >- broken.</td >- > >+ <td> >+ System preference >+ [% IF (UserHasSysPrefsPerm) %] >+ '<a href="admin/preferences.pl?op=search&searchfield=EasyAnalyticalRecords&ok=Search">EasyAnalyticalRecords</a>' >+ [% ELSE %] >+ 'EasyAnalyticalRecords' >+ [% END %] >+ set, but >+ [% IF (UserHasSysPrefsPerm) %] >+ <a href="admin/preferences.pl?op=search&searchfield=UseControlNumber&ok=Search">UseControlNumber</a> >+ [% ELSE %] >+ UseControlNumber >+ [% END %] >+ preference is set to 'Use'. Set it to 'Don't use' or else the 'Show analytics' links in the staff interface and the OPAC will be broken. >+ </td> > </tr> > [% END %] > [% IF warnPrefAnonymousPatronOPACPrivacy %] > <tr> > <th scope="row"><strong class="error">Error</strong> </th> >- <td>System preference 'OPACPrivacy' set, but AnonymousPatron preference is set to '0'. Set it to a valid borrower number or checkins for these patrons will fail.</td> >+ <td> >+ System preference >+ [% IF (UserHasSysPrefsPerm) %] >+ '<a href="admin/preferences.pl?op=search&searchfield=OPACPrivacy&ok=Search">OPACPrivacy</a>' >+ [% ELSE %] >+ 'OPACPrivacy' >+ [% END %] >+ set, but >+ [% IF (UserHasSysPrefsPerm) %] >+ <a href="admin/preferences.pl?op=search&searchfield=AnonymousPatron&ok=Search">AnonymousPatron</a> >+ [% ELSE %] >+ AnonymousPatron >+ [% END %] >+ preference is set to '0'. Set it to a valid borrower number or checkins for these patrons will fail. >+ </td> > </tr> > [% END %] > [% IF warnPrefAnonymousPatronAnonSuggestions %] > <tr> > <th scope="row"><strong>Warning</strong> </th> >- <td>System preference 'AnonSuggestions' set, but AnonymousPatron preference is set to '0'. Set it to a valid borrower number if you want that this feature works correctly.</td> >+ <td> >+ System preference >+ [% IF (UserHasSysPrefsPerm) %] >+ '<a href="admin/preferences.pl?op=search&searchfield=AnonSuggestions&ok=Search">AnonSuggestions</a>' >+ [% ELSE %] >+ 'AnonSuggestions' >+ [% END %] >+ set, but >+ [% IF (UserHasSysPrefsPerm) %] >+ <a href="admin/preferences.pl?op=search&searchfield=AnonymousPatron&ok=Search">AnonymousPatron</a> >+ [% ELSE %] >+ AnonymousPatron >+ [% END %] >+ preference is set to '0'. Set it to a valid borrower number if you want that this feature works correctly. >+ </td> > </tr> > [% END %] > [% IF warnPrefAnonymousPatronOPACPrivacy_PatronDoesNotExist %] > <tr> > <th scope="row"><strong class="error">Error</strong> </th> >- <td>Some patrons have requested privacy after their items are checked in, but the AnonymousPatron preference is not set correctly. Set it to a valid borrower number or checkins for these patrons will fail.</td> >+ <td> >+ Some patrons have requested privacy after their items are checked in, but the >+ [% IF (UserHasSysPrefsPerm) %] >+ <a href="admin/preferences.pl?op=search&searchfield=AnonymousPatron&ok=Search">AnonymousPatron</a> >+ [% ELSE %] >+ AnonymousPatron >+ [% END %] >+ preference is not set correctly. Set it to a valid borrower number or checkins for these patrons will fail. >+ </td> > </tr> > [% END %] > [% IF warnPrefAnonymousPatronAnonSuggestions_PatronDoesNotExist %] > <tr> > <th scope="row"><strong>Warning</strong> </th> >- <td>System preference 'AnonSuggestions' set, but AnonymousPatron preference is not set correctly. Set it to a valid borrower number if you want that this feature works correctly.</td> >+ <td> >+ System preference >+ [% IF (UserHasSysPrefsPerm) %] >+ '<a href="admin/preferences.pl?op=search&searchfield=AnonSuggestions&ok=Search">AnonSuggestions</a>' >+ [% ELSE %] >+ 'AnonSuggestions' >+ [% END %] >+ set, but >+ [% IF (UserHasSysPrefsPerm) %] >+ <a href="admin/preferences.pl?op=search&searchfield=AnonymousPatron&ok=Search">AnonymousPatron</a> >+ [% ELSE %] >+ AnonymousPatron >+ [% END %] >+ preference is not set correctly. Set it to a valid borrower number if you want that this feature works correctly.</td >+ > > </tr> > [% END %] > [% IF warnPrefKohaAdminEmailAddress %] > <tr> > <th scope="row"><strong>Warning</strong> </th> >- <td>System preference 'KohaAdminEmailAddress' does not contain a valid email address. Emails will not be sent.</td> >+ <td> >+ System preference >+ [% IF (UserHasSysPrefsPerm) %] >+ '<a href="admin/preferences.pl?op=search&searchfield=KohaAdminEmailAddress&ok=Search">KohaAdminEmailAddress</a>' >+ [% ELSE %] >+ 'KohaAdminEmailAddress' >+ [% END %] >+ does not contain a valid email address. Emails will not be sent. >+ </td> > </tr> > [% END %] > [% IF warnPrefOpacHiddenItems %] > <tr> > <th scope="row"><strong>Warning</strong> </th> >- <td>System preference 'OpacHiddenItems' generates a warning and will produce unexpected behaviors: [% warnPrefOpacHiddenItems | html %]</td> >+ <td> >+ System preference >+ [% IF (UserHasSysPrefsPerm) %] >+ '<a href="admin/preferences.pl?op=search&searchfield=OpacHiddenItems&ok=Search">OpacHiddenItems</a>' >+ [% ELSE %] >+ 'OpacHiddenItems' >+ [% END %] >+ generates a warning and will produce unexpected behaviors: [% warnPrefOpacHiddenItems | html %] >+ </td> > </tr> > [% END %] > [% IF warnPrefPatronSelfRegistrationDefaultCategory %] >- <tr >- ><th scope="row"><strong>Warning</strong> </th >- ><td>System preference 'PatronSelfRegistration' is set, but 'PatronSelfRegistrationDefaultCategory' does not contain a valid patron category code. Patron self-registration is disabled.</td></tr >- > >+ <tr> >+ <th scope="row"><strong>Warning</strong> </th> >+ <td> >+ System preference >+ [% IF (UserHasSysPrefsPerm) %] >+ '<a href="admin/preferences.pl?op=search&searchfield=PatronSelfRegistration&ok=Search">PatronSelfRegistration</a>' >+ [% ELSE %] >+ 'PatronSelfRegistration' >+ [% END %] >+ is set, but >+ [% IF (UserHasSysPrefsPerm) %] >+ '<a href="admin/preferences.pl?op=search&searchfield=PatronSelfRegistrationDefaultCategory&ok=Search">PatronSelfRegistrationDefaultCategory</a>' >+ [% ELSE %] >+ 'PatronSelfRegistrationDefaultCategory' >+ [% END %] >+ does not contain a valid patron category code. Patron self-registration is disabled. >+ </td> >+ </tr> > [% END %] > [% IF warnXSLT %] > [% FOR p IN warnXSLT %] >@@ -611,7 +716,15 @@ > [% FOR p IN invalid_yesno %] > <tr> > <th scope="row"><strong>Warning</strong> </th> >- <td>System preference '[% p.variable | html %]' must be '0' or '1', but is [% IF p.value.defined %]'[% p.value | html %]'[% ELSE %]NULL[% END %].</td> >+ <td> >+ System preference >+ [% IF (UserHasSysPrefsPerm) %] >+ '<a href="admin/preferences.pl?tab=&op=search&searchfield=[% p.variable | uri %]">[% p.variable | html %]</a>' >+ [% ELSE %] >+ '[% p.variable | html %]' >+ [% END %] >+ must be '0' or '1', but is [% IF p.value.defined %]'[% p.value | html %]'[% ELSE %]NULL[% END %]. >+ </td> > </tr> > [% END %] > [% END %] >@@ -624,7 +737,15 @@ > [% IF warnStatisticsFieldsError %] > <tr> > <th scope="row"><strong>Warning</strong> </th> >- <td>System preference 'StatisticsFields' contains field names not belonging to the items database table: [% warnStatisticsFieldsError | html %] </td> >+ <td> >+ System preference >+ [% IF (UserHasSysPrefsPerm) %] >+ '<a href="admin/preferences.pl?op=search&searchfield=StatisticsFields&ok=Search">StatisticsFields</a>' >+ [% ELSE %] >+ 'StatisticsFields' >+ [% END %] >+ contains field names not belonging to the items database table: [% warnStatisticsFieldsError | html %] >+ </td> > </tr> > [% END %] > [% IF AutoSelfCheckPatronDoesNotHaveSelfCheckPerm %] >@@ -654,51 +775,130 @@ > [% IF warnPassChangeNoticeMissing %] > <tr> > <th scope="row"><strong>Warning</strong> </th> >- <td >- >System preference 'NotifyPasswordChange' is enabled, but the PASSWORD_CHANGE notice template is missing. Patrons will not be notified about password changes. Please create the PASSWORD_CHANGE notice template >- in <a href="/cgi-bin/koha/tools/letter.pl">Tools > Notices and slips</a>.</td >- > >+ <td> >+ System preference >+ [% IF (UserHasSysPrefsPerm) %] >+ '<a href="admin/preferences.pl?op=search&searchfield=NotifyPasswordChange&ok=Search">NotifyPasswordChange</a>' >+ [% ELSE %] >+ 'NotifyPasswordChange' >+ [% END %] >+ is enabled, but the PASSWORD_CHANGE notice template is missing. Patrons will not be notified about password changes. Please create the PASSWORD_CHANGE notice template in >+ <a href="/cgi-bin/koha/tools/letter.pl">Tools > Notices and slips</a>. >+ </td> > </tr> > [% END %] > [% IF warnILLConfiguration %] > [% IF no_ill_backends %] > <tr> > <th scope="row"><strong>Warning</strong> </th> >- <td> The ILL module is enabled, but there are no backends available. </td> >+ <td> >+ The >+ [% IF (UserHasSysPrefsPerm) %] >+ <a href="admin/preferences.pl?op=search&searchfield=ILLModule&ok=Search">ILL module</a> >+ [% ELSE %] >+ ILL module >+ [% END %] >+ is enabled, but there are no backends available. >+ </td> > </tr> > [% END %] > [% IF ill_partner_code_not_defined %] > <tr> > <th scope="row"><strong>Warning</strong> </th> >- <td> The ILL module is enabled, but ILLPartnerCode system preference is empty. Falling back to the hardcoded 'IL'. </td> >+ <td> >+ The >+ [% IF (UserHasSysPrefsPerm) %] >+ <a href="admin/preferences.pl?op=search&searchfield=ILLModule&ok=Search">ILL module</a> >+ [% ELSE %] >+ ILL module >+ [% END %] >+ is enabled, but >+ [% IF (UserHasSysPrefsPerm) %] >+ <a href="admin/preferences.pl?op=search&searchfield=ILLPartnerCode&ok=Search">ILLPartnerCode</a> >+ [% ELSE %] >+ ILLPartnerCode >+ [% END %] >+ system preference is empty. Falling back to the hardcoded 'IL'. >+ </td> > </tr> > [% END %] > [% IF ill_partner_code_no_patrons %] > <tr> > <th scope="row"><strong>Warning</strong> </th> >- <td> The ILL module is enabled and ILLPartnerCode system preference configured, but there are no patrons in [% ill_partner_code_no_patrons | html %] category. </td> >+ <td> >+ The >+ [% IF (UserHasSysPrefsPerm) %] >+ <a href="admin/preferences.pl?op=search&searchfield=ILLModule&ok=Search">ILL module</a> >+ [% ELSE %] >+ ILL module >+ [% END %] >+ is enabled and >+ [% IF (UserHasSysPrefsPerm) %] >+ <a href="admin/preferences.pl?op=search&searchfield=ILLPartnerCode&ok=Search">ILLPartnerCode</a> >+ [% ELSE %] >+ ILLPartnerCode >+ [% END %] >+ system preference configured, but there are no patrons in [% ill_partner_code_no_patrons | html %] category. >+ </td> > </tr> > [% END %] > [% IF ill_branch_not_defined %] > <tr> > <th scope="row"><strong>Warning</strong> </th> >- <td> The ILL module is enabled, but no 'branch' block is defined in koha-conf.xml. You must define this block before use. </td> >+ <td> >+ The >+ [% IF (UserHasSysPrefsPerm) %] >+ <a href="admin/preferences.pl?op=search&searchfield=ILLModule&ok=Search">ILL module</a> >+ [% ELSE %] >+ ILL module >+ [% END %] >+ is enabled, but no 'branch' block is defined in koha-conf.xml. You must define this block before use. >+ </td> > </tr> > [% END %] > [% IF ill_partner_code_doesnt_exist %] > <tr> > <th scope="row"><strong>Warning</strong> </th> >- <td> The ILL module is enabled, but the configured ILLPartnerCode ([% ill_partner_code_doesnt_exist | html %]) is not defined on the system. </td> >+ <td> >+ The >+ [% IF (UserHasSysPrefsPerm) %] >+ <a href="admin/preferences.pl?op=search&searchfield=ILLModule&ok=Search">ILL module</a> >+ [% ELSE %] >+ ILL module >+ [% END %] >+ is enabled, but the configured >+ [% IF (UserHasSysPrefsPerm) %] >+ <a href="admin/preferences.pl?op=search&searchfield=ILLPartnerCode&ok=Search">ILLPartnerCode</a> >+ [% ELSE %] >+ ILLPartnerCode >+ [% END %] >+ ([% ill_partner_code_doesnt_exist | html %]) is not defined on the system. >+ </td> > </tr> > [% END %] > [% IF ill_deprecated_backend_freeform_is_installed %] > <tr> > <th scope="row"><strong>Warning</strong> </th> > <td> >- <p>The ILL module is enabled, but the deprecated 'FreeForm' backend is installed.</p> >+ <p >+ >The >+ [% IF (UserHasSysPrefsPerm) %] >+ <a href="admin/preferences.pl?op=search&searchfield=ILLModule&ok=Search">ILL module</a> >+ [% ELSE %] >+ ILL module >+ [% END %] >+ is enabled, but the deprecated 'FreeForm' backend is installed.</p >+ > > <p>'FreeForm' has since become part of core Koha as 'Standard'.</p> > <p>All 'FreeForm' ILL content should've been migrated to 'Standard' upon upgrading Koha to 24.11.</p> >- <p>To avoid confusion or redundancy, please uninstall the 'FreeForm' backend before using the ILL module.</p> >+ <p >+ >To avoid confusion or redundancy, please uninstall the 'FreeForm' backend before using the >+ [% IF (UserHasSysPrefsPerm) %] >+ <a href="admin/preferences.pl?op=search&searchfield=ILLModule&ok=Search">ILL module</a>. >+ [% ELSE %] >+ ILL module. >+ [% END %] >+ </p> > </td> > </tr> > [% END %] >@@ -713,7 +913,15 @@ > [% IF oauth2_missing_deps %] > <tr> > <th scope="row"><strong>Warning</strong> </th> >- <td> System preference 'RESTOAuth2ClientCredentials' is set, but the required Net::OAuth2::AuthorizationServer dependency is missing. The feature is disabled. </td> >+ <td> >+ System preference >+ [% IF (UserHasSysPrefsPerm) %] >+ '<a href="admin/preferences.pl?op=search&searchfield=RESTOAuth2ClientCredentials&ok=Search">RESTOAuth2ClientCredentials</a>' >+ [% ELSE %] >+ 'RESTOAuth2ClientCredentials' >+ [% END %] >+ is set, but the required Net::OAuth2::AuthorizationServer dependency is missing. The feature is disabled. >+ </td> > </tr> > [% END %] > [% IF bad_yaml_prefs %] >@@ -725,7 +933,15 @@ > [% IF config_bcrypt_settings_no_set %] > <tr> > <th scope="row"><strong>Warning</strong> </th> >- <td> System preference 'Pseudonymization' is set, but there is not 'bcrypt_settings' entry defined in the $KOHA_CONF file. </td> >+ <td> >+ System preference >+ [% IF (UserHasSysPrefsPerm) %] >+ '<a href="admin/preferences.pl?op=search&searchfield=Pseudonymization&ok=Search">Pseudonymization</a>' >+ [% ELSE %] >+ 'Pseudonymization' >+ [% END %] >+ is set, but there is not 'bcrypt_settings' entry defined in the $KOHA_CONF file. >+ </td> > </tr> > [% END %] > [% IF warnHiddenBiblionumbers.size %] >-- >2.39.5
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 41522
:
191735
|
191776
|
191838
|
191894
|
192115
|
192280
|
192281
|
192682