From eb7fb6e1a50252a836ef87740ccc66d0e2554c4d Mon Sep 17 00:00:00 2001 From: Oli Williams Date: Wed, 21 Jan 2026 21:21:24 +0000 Subject: [PATCH] [WIP] Bug 41522: Make sysprefs clickable in warnings --- about.pl | 15 +++++++++++++++ koha-tmpl/intranet-tmpl/prog/en/modules/about.tt | 15 +++++++++------ 2 files changed, 24 insertions(+), 6 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 8af7b25..18a9379 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/about.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/about.tt @@ -545,12 +545,15 @@ [% IF (warnPrefRequireChoosingExistingAuthority) %] Warning - System preference 'RequireChoosingExistingAuthority' is disabled, but needs 'AutoCreateAuthorities' enabled. Otherwise catalogers can add headings that will not be linked to authorities. + + [% IF (UserHasSysPrefsPerm) %] + System preference ' + RequireChoosingExistingAuthority' is disabled, but needs ' + AutoCreateAuthorities' enabled. Otherwise catalogers can add headings that will not be linked to authorities. + [% ELSE %] + System preference 'RequireChoosingExistingAuthority' is disabled, but needs 'AutoCreateAuthorities' enabled. Otherwise catalogers can add headings that will not be linked to authorities. + [% END %] + [% END %] [% IF (warnPrefEasyAnalyticalRecords) %] -- 2.39.5