From 2db06f951075556ae3938e0bb388cea30ccedc8d Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Fri, 18 Sep 2026 09:20:16 +0200 Subject: [PATCH] Bug 43561: Redirect to local use sysprefs instead of 'not found' If a user search for a local use syspref, the name will appear in the autocomplete but when choosen "not found" will be return. This patch suggests to redirect to the "local use" syspref view if we found a local use syspref that match the search term. Test plan: - in admin, type "OPACdid" into the system preference search - see "OPACdidyoumean" is offered as a search term - click OPACdidyoumean => Without this patch you get an error that no such syspref exists => With this patch you are redirected to the local use syspref view Signed-off-by: Laura_Escamilla Signed-off-by: John Vinke Signed-off-by: Pedro Amorim --- admin/preferences.pl | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/admin/preferences.pl b/admin/preferences.pl index b60b5b7e50..a428d4e873 100755 --- a/admin/preferences.pl +++ b/admin/preferences.pl @@ -29,6 +29,7 @@ use C4::Output qw( output_html_with_http_headers output_and_exit_if_error ) use C4::Templates; use Koha::Acquisition::Currencies; use Koha::AuthorisedValues; +use Koha::Config::SysPrefs; use Koha::Database::Columns; use Koha::ILL::Request::Config; use IO::File; @@ -467,6 +468,12 @@ if ( $op eq 'search' ) { $tab = ''; # No need to load a particular tab, as we found results $template->param( search_jumped => 1 ) if ( $TABS[0]->{'search_jumped'} ); } else { + my $local_use = Koha::Config::SysPrefs->search( { variable => { like => "%$searchfield%" } } )->count; + if ($local_use) { + print $input->redirect("/cgi-bin/koha/admin/systempreferences.pl"); + exit; + } + $template->param( search_not_found => 1, );