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 <david@davidnind.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 78d4c42a61)
Signed-off-by: Baptiste Wojtkowski <baptiste.wojtkowski@biblibre.com>
This commit is contained in:
Hammat Wele 2026-03-13 15:33:56 +00:00 committed by Baptiste Wojtkowski
parent 952163d02f
commit 7640c28b5f
No known key found for this signature in database
GPG Key ID: 47A8A13E10BC0D40
1 changed files with 12 additions and 0 deletions

View File

@ -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 ],