sub get_template_and_user {
my $in = shift;
- warn "GET Template";
my $template =
gettemplate( $in->{'template_name'}, $in->{'type'}, $in->{'query'} );
my ( $user, $cookie, $sessionID, $flags ) = checkauth(
}
if ( $in->{'type'} eq "intranet" ) {
$template->param(
- intranetcolorstylesheet => C4::Context->preference("intranetcolorstylesheet"),
+ intranetcolorstylesheet =>
+ C4::Context->preference("intranetcolorstylesheet"),
intranetstylesheet => C4::Context->preference("intranetstylesheet"),
IntranetNav => C4::Context->preference("IntranetNav"),
intranetuserjs => C4::Context->preference("intranetuserjs"),
# state variables
my $loggedin = 0;
my %info;
- my ( $userid, $cookie, $sessionID, $flags );
+ my ( $userid, $cookie, $sessionID, $flags, $envcookie );
my $logout = $query->param('logout.x');
if ( $userid = $ENV{'REMOTE_USER'} ) {
# new op dev :
# launch a sequence to check if we have a ip for the branch, if we have one we replace the branchcode of the userenv by the branch bound in the ip.
my $ip = $ENV{'REMOTE_ADDR'};
- # if they specify at login, use that
- if ($query->param('branch')) {
- $branchcode = $query->param('branch');
- $branchname = GetBranchName($branchcode);
- }
my $branches = GetBranches();
my @branchesloop;
foreach my $br ( keys %$branches ) {
+
# now we work with the treatment of ip
my $domain = $branches->{$br}->{'branchip'};
if ( $domain && $ip =~ /^$domain/ ) {
$session->param('ip',$session->remote_addr());
$session->param('lasttime',time());
}
- if ($session){
- 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')
- );
- }
}
-
else {
if ($userid) {
$info{'invalid_username_or_password'} = 1;
my $value = $query->param($name);
push @inputs, { name => $name, value => $value };
}
- # get the branchloop, which we need for authetication
- use C4::Branch;
- my $branches = GetBranches();
- my @branch_loop;
- for my $branch_hash (keys %$branches) {
- push @branch_loop, {branchcode => "$branch_hash", branchname => $branches->{$branch_hash}->{'branchname'}, };
- }
my $template = gettemplate( $template_name, $type, $query );
- $template->param(branchloop => \@branch_loop,);
$template->param(
INPUTS => \@inputs,
suggestion => C4::Context->preference("suggestion"),