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