From 60ef9502495a378924631f6f413d2116d9b32fb6 Mon Sep 17 00:00:00 2001 From: Hammat Wele Date: Fri, 13 Mar 2026 15:33:56 +0000 Subject: [PATCH] Bug 42084: Incorrect interface shown in log viewer for system preference changes The log viewer displays the OPAC interface for system preference changes. Since system preferences cannot be modified from the OPAC, the interface displayed in the logs appears to be incorrect. To reproduce: 1- Disables plack 1- sudo koha-plack --disable kohadev 2- sudo koha-plack --stop kohadev 3- sudo service apache2 restart 2- Change a system preference from the staff interface. 1- Go to Administration -> System preferences. 2- Search for a preference such as AcqCreateItem (any system preference will reproduce the issue). 3- Change the value of the preference. 4- Click Save all Acquisitions preferences (or save the preference). 3- Go to the log viewer: 1- Navigate to Tools -> Log viewer. 2- Fill the form as follows: Librarian: leave empty Modules: uncheck everything except System preferences Actions: keep All actions selected Object: leave empty Info: leave empty Interface: keep All interfaces Display from: choose yesterday Display to: leave empty 3- Click Submit. ==>The log entry shows the OPAC interface. 4- Apply the patch 5- Repeat step 1,2,3 ==>The log entry shows the Staff interface. Signed-off-by: David Nind --- svc/config/systempreferences | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/svc/config/systempreferences b/svc/config/systempreferences index ff2d45ffb2..794f796009 100755 --- a/svc/config/systempreferences +++ b/svc/config/systempreferences @@ -24,6 +24,8 @@ use C4::Context; use C4::Service; use C4::Log; use Koha::Token; +use CGI::Cookie; +use C4::Auth qw( get_session ); =head1 NAME @@ -135,6 +137,16 @@ sub set_preferences { C4::Service->return_success($response); } +my %cookies = CGI::Cookie->fetch; + +if ( exists $cookies{'CGISESSID'} ) { + my $sessionID = $cookies{'CGISESSID'}->value; + if ($sessionID) { + my $session = get_session($sessionID); + C4::Context->interface( $session->param('interface') ) if ($session); + } +} + C4::Service->dispatch( [ 'POST /([A-Za-z0-9_-]+)', ['value'], \&set_preference ], [ 'POST /', [], \&set_preferences ], -- 2.39.5