From d03c8443a4c5a4549a3ee37df201f031b40b2f41 Mon Sep 17 00:00:00 2001 From: Chris Cormack Date: Sun, 17 Feb 2013 22:44:01 +1300 Subject: [PATCH] Bug 9587 Follow up to fix the problem Katrin identified Signed-off-by: Bernardo Gonzalez Kriegel Comment: Solve that problem, but now koha-qa complains about tabs in C4/Context.pm. Signed-off-by: Katrin Fischer Tests done: 1) System preference 'Persona' added correctly. 2) Persona off, normal login still possible 3) Persona on, Persona login works 4) Persona logout works 5) normal login still possible 6) normal logout still possible Persona is off by default and uses the primary email address from the patron account. Signed-off-by: Jared Camins-Esakov --- C4/Auth.pm | 12 ++++++++---- C4/Context.pm | 8 +++++--- koha-tmpl/opac-tmpl/prog/en/includes/opac-bottom.inc | 2 +- 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/C4/Auth.pm b/C4/Auth.pm index 6141fc2712..efe1200acd 100644 --- a/C4/Auth.pm +++ b/C4/Auth.pm @@ -324,6 +324,7 @@ sub get_template_and_user { LoginFirstname => (C4::Context->userenv?C4::Context->userenv->{"firstname"}:"Bel"), LoginSurname => C4::Context->userenv?C4::Context->userenv->{"surname"}:"Inconnu", emailaddress => C4::Context->userenv?C4::Context->userenv->{"emailaddress"}:undef, + loggedinpersona => C4::Context->userenv?C4::Context->userenv->{"persona"}:undef, TagsEnabled => C4::Context->preference("TagsEnabled"), hide_marc => C4::Context->preference("hide_marc"), item_level_itypes => C4::Context->preference('item-level_itypes'), @@ -336,7 +337,6 @@ sub get_template_and_user { marcflavour => C4::Context->preference("marcflavour"), persona => C4::Context->preference("persona"), ); - if ( $in->{'type'} eq "intranet" ) { $template->param( AmazonCoverImages => C4::Context->preference("AmazonCoverImages"), @@ -661,7 +661,8 @@ sub checkauth { $session->param('cardnumber'), $session->param('firstname'), $session->param('surname'), $session->param('branch'), $session->param('branchname'), $session->param('flags'), - $session->param('emailaddress'), $session->param('branchprinter') + $session->param('emailaddress'), $session->param('branchprinter'), + $session->param('persona') ); C4::Context::set_shelves_userenv('bar',$session->param('barshelves')); C4::Context::set_shelves_userenv('pub',$session->param('pubshelves')); @@ -780,7 +781,6 @@ sub checkauth { } $return = $value ? 1 : 0; $userid = $value; - } elsif ( @@ -926,12 +926,16 @@ sub checkauth { $session->param('ip',$session->remote_addr()); $session->param('lasttime',time()); } + if ($persona){ + $session->param('persona',1); + } C4::Context::set_userenv( $session->param('number'), $session->param('id'), $session->param('cardnumber'), $session->param('firstname'), $session->param('surname'), $session->param('branch'), $session->param('branchname'), $session->param('flags'), - $session->param('emailaddress'), $session->param('branchprinter') + $session->param('emailaddress'), $session->param('branchprinter'), + $session->param('persona') ); } diff --git a/C4/Context.pm b/C4/Context.pm index 4e6c5fb2c0..84516092d3 100644 --- a/C4/Context.pm +++ b/C4/Context.pm @@ -1057,7 +1057,8 @@ sub userenv { =head2 set_userenv C4::Context->set_userenv($usernum, $userid, $usercnum, $userfirstname, - $usersurname, $userbranch, $userflags, $emailaddress); + $usersurname, $userbranch, $userflags, $emailaddress, $branchprinter, + $persona); Establish a hash of user environment variables. @@ -1067,7 +1068,7 @@ set_userenv is called in Auth.pm #' sub set_userenv { - my ($usernum, $userid, $usercnum, $userfirstname, $usersurname, $userbranch, $branchname, $userflags, $emailaddress, $branchprinter)= @_; + my ($usernum, $userid, $usercnum, $userfirstname, $usersurname, $userbranch, $branchname, $userflags, $emailaddress, $branchprinter, $persona)= @_; my $var=$context->{"activeuser"} || ''; my $cell = { "number" => $usernum, @@ -1080,7 +1081,8 @@ sub set_userenv { "branchname" => $branchname, "flags" => $userflags, "emailaddress" => $emailaddress, - "branchprinter" => $branchprinter + "branchprinter" => $branchprinter, + "persona" => $persona, }; $context->{userenv}->{$var} = $cell; return $cell; diff --git a/koha-tmpl/opac-tmpl/prog/en/includes/opac-bottom.inc b/koha-tmpl/opac-tmpl/prog/en/includes/opac-bottom.inc index 25d74e2028..b875028e9b 100644 --- a/koha-tmpl/opac-tmpl/prog/en/includes/opac-bottom.inc +++ b/koha-tmpl/opac-tmpl/prog/en/includes/opac-bottom.inc @@ -65,7 +65,7 @@