Lines 215-240
sub get_template_and_user {
Link Here
|
215 |
# It's possible for $user to be the borrowernumber if they don't have a |
215 |
# It's possible for $user to be the borrowernumber if they don't have a |
216 |
# userid defined (and are logging in through some other method, such |
216 |
# userid defined (and are logging in through some other method, such |
217 |
# as SSL certs against an email address) |
217 |
# as SSL certs against an email address) |
218 |
my $borrower; |
218 |
my $patron; |
219 |
$borrowernumber = getborrowernumber($user) if defined($user); |
219 |
$borrowernumber = getborrowernumber($user) if defined($user); |
220 |
if ( !defined($borrowernumber) && defined($user) ) { |
220 |
if ( !defined($borrowernumber) && defined($user) ) { |
221 |
$borrower = Koha::Patrons->find( $user ); |
221 |
$patron = Koha::Patrons->find( $user ); |
222 |
if ($borrower) { |
222 |
if ($patron) { |
223 |
$borrower = $borrower->unblessed; |
|
|
224 |
$borrowernumber = $user; |
223 |
$borrowernumber = $user; |
225 |
|
224 |
|
226 |
# A bit of a hack, but I don't know there's a nicer way |
225 |
# A bit of a hack, but I don't know there's a nicer way |
227 |
# to do it. |
226 |
# to do it. |
228 |
$user = $borrower->{firstname} . ' ' . $borrower->{surname}; |
227 |
$user = $patron->firstname . ' ' . $patron->surname; |
229 |
} |
228 |
} |
230 |
} else { |
229 |
} else { |
231 |
$borrower = Koha::Patrons->find( $borrowernumber ); |
230 |
$patron = Koha::Patrons->find( $borrowernumber ); |
232 |
$borrower->unblessed if $borrower; # FIXME Otherwise, what to do? |
231 |
# FIXME What to do if $patron does not exist? |
233 |
} |
232 |
} |
234 |
|
233 |
|
235 |
# user info |
234 |
# user info |
236 |
$template->param( loggedinusername => $user ); |
235 |
$template->param( loggedinusername => $user ); # FIXME Should be replaced with something like patron-title.inc |
237 |
$template->param( loggedinusernumber => $borrowernumber ); |
236 |
$template->param( loggedinusernumber => $borrowernumber ); # FIXME Should be replaced with logged_in_user.borrowernumber |
|
|
237 |
$template->param( logged_in_user => $patron ); |
238 |
$template->param( sessionID => $sessionID ); |
238 |
$template->param( sessionID => $sessionID ); |
239 |
|
239 |
|
240 |
if ( $in->{'type'} eq 'opac' ) { |
240 |
if ( $in->{'type'} eq 'opac' ) { |
Lines 256-262
sub get_template_and_user {
Link Here
|
256 |
); |
256 |
); |
257 |
} |
257 |
} |
258 |
|
258 |
|
259 |
$template->param( "USER_INFO" => $borrower ); |
259 |
$template->param( "USER_INFO" => $patron->unblessed ); |
260 |
|
260 |
|
261 |
my $all_perms = get_all_subpermissions(); |
261 |
my $all_perms = get_all_subpermissions(); |
262 |
|
262 |
|
263 |
- |
|
|