From a85400e02328fb761215323884649f57a2bf2033 Mon Sep 17 00:00:00 2001 From: Emmi Takkinen Date: Tue, 8 Jul 2025 14:16:09 +0300 Subject: [PATCH] Bug 39625: Set interface correctly in check_cookie_auth When one renews or returns an item from patrons "Checkouts" table, this actions interface is recorded to statistics table as opac. We use method check_cookie_auth in scv endpoints and this method doesn't set interface value correctly. This patch fixes this by fetching interface value from session params. To test: 1. Search for a patron with renewable checkouts. 2. Renew one of patron's items by checkin it in Renew column and selecting then Renew selected items. 3. Check the statistics table which interface is recorded with following query: SELECT * FROM statistics WHERE borrowernumber=xxx AND type='renew' ORDER BY 1 DESC; => Notice that interface has value "opac" not "intranet". 4. Apply this patch. 5. Repeat steps 2. and 3. => Confirm that intreface value is now "intranet". Test returning an item the same way. Sponsored-by: Koha-Suomi Oy --- C4/Auth.pm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/C4/Auth.pm b/C4/Auth.pm index 2fa9e2bed7..eddb1d31b4 100644 --- a/C4/Auth.pm +++ b/C4/Auth.pm @@ -1926,6 +1926,8 @@ sub check_cookie_auth { my $lasttime = $session->param('lasttime'); my $timeout = _timeout_syspref(); + C4::Context->interface( $session->param('interface') ); + if ( !$lasttime || ( $lasttime < time() - $timeout ) ) { # time out @@ -1957,7 +1959,7 @@ sub check_cookie_auth { return ( "password_expired", undef ) if $patron->password_expired; my $flags = defined($flagsrequired) ? haspermission( $userid, $flagsrequired ) : 1; if ($flags) { - if ( !C4::Context->interface ) { + if ( !C4::Context->interface || C4::Context->interface ne $session->param('interface') ) { # No need to override the interface, most often set by get_template_and_user C4::Context->interface( $session->param('interface') ); -- 2.34.1