[Koha-bugs] [Bug 1078] how about code in auth.pm to keep track of the users branch cookie?
bugzilla-daemon at daddy.katipo.co.nz
bugzilla-daemon at daddy.katipo.co.nz
Thu Feb 22 19:22:20 CET 2007
http://bugs.koha.org/cgi-bin/bugzilla/show_bug.cgi?id=1078
mhafen at i.washk12.org changed:
What |Removed |Added
----------------------------------------------------------------------------
Attachment #42|proposed patches. |proposed patches.
description| |Updated to prefer cookie,
| |otherwise doesn't work in
| |OPAC as I intended.
------- Comment #2 from mhafen at i.washk12.org 2007-02-23 07:22 -------
(From update of attachment 42)
diff -rc koha-2.2.5-orig/modules/C4/Auth.pm koha-2.2.5-patch/modules/C4/Auth.pm
*** koha-2.2.5-orig/modules/C4/Auth.pm 2006-01-13 14:24:20.000000000 -0700
--- koha-2.2.5-patch/modules/C4/Auth.pm 2006-05-23 16:19:52.000000000 -0600
***************
*** 116,132 ****
= checkauth($in->{'query'}, $in->{'authnotrequired'},
$in->{'flagsrequired'}, $in->{'type'});
my $borrowernumber;
if ($user) {
$template->param(loggedinusername => $user);
$template->param(sessionID => $sessionID);
$borrowernumber = getborrowernumber($user);
! my ($borr, $alternativeflags) = getpatroninformation(undef,
$borrowernumber);
my @bordat;
$bordat[0] = $borr;
$template->param(USER_INFO => \@bordat,
);
!
# We are going to use the $flags returned by checkauth
# to create the template's parameters that will indicate
# which menus the user can access.
--- 117,134 ----
= checkauth($in->{'query'}, $in->{'authnotrequired'},
$in->{'flagsrequired'}, $in->{'type'});
my $borrowernumber;
+ my ($branchcode, $branchname, $borr, $alternativeflags);
if ($user) {
$template->param(loggedinusername => $user);
$template->param(sessionID => $sessionID);
$borrowernumber = getborrowernumber($user);
! ($borr, $alternativeflags) = getpatroninformation(undef,
$borrowernumber);
my @bordat;
$bordat[0] = $borr;
$template->param(USER_INFO => \@bordat,
);
!
# We are going to use the $flags returned by checkauth
# to create the template's parameters that will indicate
# which menus the user can access.
***************
*** 196,204 ****
$template->param(CAN_user_tools => 1); }
}
$template->param(
! LibraryName =>
C4::Context->preference("LibraryName"),
);
return ($template, $borrowernumber, $cookie);
}
--- 198,216 ----
$template->param(CAN_user_tools => 1); }
}
+ # Set branch info to either branchcode or cookie value
+ $branchcode = $in->{'query'}->cookie('branch');
+ $branchcode = $borr->{branchcode} unless ( $branchcode );
+ $branchname = &C4::Search::getbranchname($branchcode) if
$branchcode;
$template->param(
! LibraryName =>
C4::Context->preference("LibraryName"),
! Branch => $branchcode,
! BranchName => $branchname,
);
+ if ($branchcode != $in->{'query'}->cookie('branch')) {
+ my $branchcookie = $in->{'query'}->cookie(-name =>
'branch', -value => $branchcode, -expires => '+1y');
+ $cookie = [@$cookie,$branchcookie];
+ }
return ($template, $borrowernumber, $cookie);
}
***************
*** 463,477 ****
}
my $template = gettemplate($template_name, $type,$query);
$template->param(INPUTS => \@inputs);
$template->param(loginprompt => 1) unless $info{'nopermission'};
my $self_url = $query->url(-absolute => 1);
$template->param(url => $self_url, LibraryName=> =>
C4::Context->prefer$ $template->param(\%info);
$cookie=$query->cookie(-name => 'sessionID',
-value => $sessionID,
-expires => '');
print $query->header(
-type => guesstype($template->output),
-cookie => $cookie
--- 490,508 ----
}
my $template = gettemplate($template_name, $type,$query);
+ $template->param(Branch => $query->cookie('branch'));
$template->param(INPUTS => \@inputs);
$template->param(loginprompt => 1) unless $info{'nopermission'};
my $self_url = $query->url(-absolute => 1);
$template->param(url => $self_url, LibraryName=> =>
C4::Context->prefer$ $template->param(\%info);
$cookie = [ $query->cookie(-name => 'sessionID',
-value => '',
-expires => '') ];
if ($envcookie){
$cookie = [@$cookie, $envcookie];
}
print $query->header(
-type => guesstype($template->output),
-cookie => $cookie
------- You are receiving this mail because: -------
You are the QA contact for the bug, or are watching the QA contact.
More information about the Koha-bugs
mailing list