From 8e2597db5d63e12187af9d9b1ac2592538587a08 Mon Sep 17 00:00:00 2001 From: Julian Maurice Date: Thu, 22 May 2025 09:58:55 +0000 Subject: [PATCH] Bug 39967: Reload session after modification Otherwise the existing $session still holds outdated data that is written on the next flush, which overwrites what has been set by C4::Search::History::set_to_session Test plan: 1. Enable LoadSearchHistoryToTheFirstLoggedUser and EnableOpacSearchHistory 2. Go to OPAC. If logged in, log out. 3. Go to search history and remove all searches if any. 4. Perform a search, make sure it appears in your search history 5. Log in and go to your search history. See that your unauthenticated search history has been added to your account's search history 6. Reload the page multiple times. See that the unauthenticated search history is *NOT* re-added after each page reload --- C4/Auth.pm | 1 + 1 file changed, 1 insertion(+) diff --git a/C4/Auth.pm b/C4/Auth.pm index 2fa9e2bed7..ff716e1ee2 100644 --- a/C4/Auth.pm +++ b/C4/Auth.pm @@ -436,6 +436,7 @@ sub get_template_and_user { } } C4::Search::History::set_to_session( { cgi => $in->{'query'}, search_history => [] } ); + $session = get_session($sessionID) if $session; } elsif ( $in->{type} eq 'intranet' and C4::Context->preference('EnableSearchHistory') ) { $template->param( EnableSearchHistory => 1 ); -- 2.39.5