use POSIX qw(ceil floor strftime);
use URI::Escape;
-use Storable qw(thaw freeze);
+use JSON qw/decode_json encode_json/;
use Business::ISBN;
my $DisplayMultiPlaceHold = C4::Context->preference("DisplayMultiPlaceHold");
my $branches = GetBranches(); # used later in *getRecords, probably should be internalized by those functions after caching in C4::Branch is established
$template->param(
- searchdomainloop => GetBranchCategories(undef,'searchdomain'),
+ searchdomainloop => GetBranchCategories('searchdomain'),
);
# load the language limits (for search)
my $searchcookie = $cgi->cookie('KohaOpacRecentSearches');
if ($searchcookie){
$searchcookie = uri_unescape($searchcookie);
- if (thaw($searchcookie)) {
- @recentSearches = @{thaw($searchcookie)};
+ if (decode_json($searchcookie)) {
+ @recentSearches = @{decode_json($searchcookie)};
}
}
# To a cookie (the user is not logged in)
if (!$offset) {
push @recentSearches, {
- "query_desc" => $query_desc_history || "unknown",
- "query_cgi" => $query_cgi_history || "unknown",
+ "query_desc" => Encode::decode_utf8($query_desc_history) || "unknown",
+ "query_cgi" => Encode::decode_utf8($query_cgi_history) || "unknown",
"time" => time(),
"total" => $total
};
# Pushing the cookie back
$newsearchcookie = $cgi->cookie(
-name => 'KohaOpacRecentSearches',
- # We uri_escape the whole freezed structure so we're sure we won't have any encoding problems
- -value =>freeze(\@recentSearches),
+ # We uri_escape the whole serialized structure so we're sure we won't have any encoding problems
+ -value => uri_escape( encode_json(\@recentSearches) ),
-expires => ''
);
$cookie = [$cookie, $newsearchcookie];