If get_session() is called in the same scope and before get_template_and_user() then the changes to the session in C4::Auth, including the session timestamp, will be overwritten when the earlier call leaves scope and is flushed.
This is to replace my 'cache the session' patch as a fix for the problem of checkout stations having their session prematurely timed out. --- circ/circulation.pl | 26 ++++++++++++++------------ 1 files changed, 14 insertions(+), 12 deletions(-) diff --git a/circ/circulation.pl b/circ/circulation.pl index 4b67920..93b7230 100755 --- a/circ/circulation.pl +++ b/circ/circulation.pl @@ -49,6 +49,16 @@ use Date::Calc qw( # my $query = new CGI; +my ( $template, $loggedinuser, $cookie ) = get_template_and_user ( + { + template_name => 'circ/circulation.tmpl', + query => $query, + type => "intranet", + authnotrequired => 0, + flagsrequired => { circulate => 'circulate_remaining_permissions' }, + } +); + my $sessionID = $query->cookie("CGISESSID") ; my $session = get_session($sessionID); @@ -68,24 +78,16 @@ if ($printer){ $session->param('branchprinter', $printer); } -if (!C4::Context->userenv && !$branch){ - if ($session->param('branch') eq 'NO_LIBRARY_SET'){ +if (!$branch){ + my $issue_branch = ( C4::Context->userenv ) ? + C4::Context->userenv->{branch} : $session->param('branch'); + if ($issue_branch eq 'NO_LIBRARY_SET'){ # no branch set we can't issue print $query->redirect("/cgi-bin/koha/circ/selectbranchprinter.pl"); exit; } } -my ( $template, $loggedinuser, $cookie ) = get_template_and_user ( - { - template_name => 'circ/circulation.tmpl', - query => $query, - type => "intranet", - authnotrequired => 0, - flagsrequired => { circulate => 'circulate_remaining_permissions' }, - } -); - my $branches = GetBranches(); my @failedrenews = $query->param('failedrenew'); # expected to be itemnumbers -- 1.7.0.4 _______________________________________________ Koha-patches mailing list Koha-patches@lists.koha.org http://lists.koha.org/mailman/listinfo/koha-patches