adding the branchname and the librarian name in every page :

- modified userenv to add branchname
- modifier menus.inc to have the librarian name & userenv displayed on every page. they are in a librarian_information div.
This commit is contained in:
tipaul 2006-05-09 13:28:08 +00:00
parent 06b2edfa32
commit e9a9ffb36e
3 changed files with 20 additions and 7 deletions

View File

@ -198,6 +198,7 @@ sub get_template_and_user {
}
$template->param(
LibraryName => C4::Context->preference("LibraryName"),
branchname => C4::Context->userenv->{'branchname'},
);
return ($template, $borrowernumber, $cookie);
}
@ -303,6 +304,7 @@ sub checkauth {
$hash{firstname},
$hash{surname},
$hash{branch},
$hash{branchname},
$hash{flags},
$hash{emailaddress},
);
@ -389,15 +391,15 @@ sub checkauth {
C4::Context->_unset_userenv($sessionID);
}
if ($return == 1){
my ($bornum,$firstname,$surname,$userflags,$branchcode,$emailaddress);
my $sth=$dbh->prepare("select borrowernumber,firstname,surname,flags,branchcode,emailaddress from borrowers where userid=?");
my ($bornum,$firstname,$surname,$userflags,$branchcode,$branchname,$emailaddress);
my $sth=$dbh->prepare("select borrowernumber, firstname, surname, flags, borrowers.branchcode, branches.branchname as branchname, email from borrowers left join branches on borrowers.branchcode=branches.branchcode where userid=?");
$sth->execute($userid);
($bornum,$firstname,$surname,$userflags,$branchcode,$emailaddress) = $sth->fetchrow if ($sth->rows);
($bornum,$firstname,$surname,$userflags,$branchcode,$branchname,$emailaddress) = $sth->fetchrow if ($sth->rows);
# warn "$cardnumber,$bornum,$userid,$firstname,$surname,$userflags,$branchcode,$emailaddress";
unless ($sth->rows){
my $sth=$dbh->prepare("select borrowernumber,firstname,surname,flags,branchcode,emailaddress from borrowers where cardnumber=?");
my $sth=$dbh->prepare("select borrowernumber, firstname, surname, flags, borrowers.branchcode, branches.branchname as branchname, email from borrowers left join branches on borrowers.branchcode=branches.branchcode where cardnumber=?");
$sth->execute($cardnumber);
($bornum,$firstname,$surname,$userflags,$branchcode,$emailaddress) = $sth->fetchrow if ($sth->rows);
($bornum,$firstname,$surname,$userflags,$branchcode,$branchcode,$emailaddress) = $sth->fetchrow if ($sth->rows);
# warn "$cardnumber,$bornum,$userid,$firstname,$surname,$userflags,$branchcode,$emailaddress";
unless ($sth->rows){
$sth->execute($userid);
@ -412,6 +414,7 @@ sub checkauth {
$firstname,
$surname,
$branchcode,
$branchname,
$userflags,
$emailaddress,
);

View File

@ -745,7 +745,7 @@ set_userenv is called in Auth.pm
=cut
#'
sub set_userenv{
my ($usernum, $userid, $usercnum, $userfirstname, $usersurname, $userbranch, $userflags, $emailaddress)= @_;
my ($usernum, $userid, $usercnum, $userfirstname, $usersurname, $userbranch, $branchname, $userflags, $emailaddress)= @_;
my $var=$context->{"activeuser"};
my $cell = {
"number" => $usernum,
@ -755,6 +755,7 @@ sub set_userenv{
# "surname" => $usersurname,
#possibly a law problem
"branch" => $userbranch,
"branchname" => $branchname,
"flags" => $userflags,
"emailaddress" => $emailaddress,
};
@ -825,6 +826,11 @@ Andrew Arensburger <arensb at ooblick dot com>
=cut
# $Log$
# Revision 1.36 2006/05/09 13:28:08 tipaul
# adding the branchname and the librarian name in every page :
# - modified userenv to add branchname
# - modifier menus.inc to have the librarian name & userenv displayed on every page. they are in a librarian_information div.
#
# Revision 1.35 2006/04/13 08:40:11 plg
# bug fixed: typo on Zconnauth name
#

View File

@ -15,4 +15,8 @@ function Help() {
<a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a>
<a href="/cgi-bin/koha/about.pl">About</a>
<a href="/cgi-bin/koha/help.pl" onclick="Help(); return false;">Help</a>
</p>
</p>
<div id="librarian_information">
<p><!-- TMPL_VAR name="loggedinusername" -->, from <!-- TMPL_VAR name="branchname" --></p>
</div>