Lines 19-57
Link Here
|
19 |
|
19 |
|
20 |
use Modern::Perl; |
20 |
use Modern::Perl; |
21 |
|
21 |
|
22 |
use CGI qw ( -utf8 ); |
22 |
use CGI qw ( -utf8 ); |
23 |
use C4::Auth qw( get_template_and_user ); |
23 |
use C4::Auth qw( get_template_and_user ); |
24 |
use C4::Output qw( output_html_with_http_headers ); |
24 |
use C4::Output qw( output_html_with_http_headers ); |
25 |
use Koha::Libraries; |
25 |
use Koha::Libraries; |
26 |
use Koha::Patrons; |
26 |
use Koha::Patrons; |
27 |
|
27 |
|
28 |
|
|
|
29 |
my $query = CGI->new; |
28 |
my $query = CGI->new; |
30 |
|
29 |
|
31 |
# if OPACVirtualCard is disabled, leave immediately |
30 |
# if OPACVirtualCard is disabled, leave immediately |
32 |
if ( ! C4::Context->preference('OPACVirtualCard') ) { |
31 |
if ( !C4::Context->preference('OPACVirtualCard') ) { |
33 |
print $query->redirect("/cgi-bin/koha/errors/404.pl"); |
32 |
print $query->redirect("/cgi-bin/koha/errors/404.pl"); |
34 |
exit; |
33 |
exit; |
35 |
} |
34 |
} |
36 |
|
35 |
|
37 |
my ( $template, $borrowernumber, $cookie ) = get_template_and_user( |
36 |
my ( $template, $borrowernumber, $cookie ) = get_template_and_user( |
38 |
{ |
37 |
{ |
39 |
template_name => "opac-virtual-card.tt", |
38 |
template_name => "opac-virtual-card.tt", |
40 |
query => $query, |
39 |
query => $query, |
41 |
type => "opac", |
40 |
type => "opac", |
42 |
} |
41 |
} |
43 |
); |
42 |
); |
44 |
|
43 |
|
45 |
my $patron = Koha::Patrons->find( $borrowernumber ); |
44 |
my $patron = Koha::Patrons->find($borrowernumber); |
|
|
45 |
|
46 |
# Find and display patron image if allowed |
46 |
# Find and display patron image if allowed |
47 |
if (C4::Context->preference('OPACpatronimages')) { |
47 |
if ( C4::Context->preference('OPACpatronimages') ) { |
48 |
$template->param( display_patron_image => 1 ) if $patron->image; |
48 |
$template->param( display_patron_image => 1 ) if $patron->image; |
49 |
} |
49 |
} |
50 |
|
50 |
|
51 |
$template->param( |
51 |
$template->param( |
52 |
virtualcardview => 1, |
52 |
virtualcardview => 1, |
53 |
patron => $patron, |
53 |
patron => $patron, |
54 |
); |
54 |
); |
55 |
|
55 |
|
56 |
|
|
|
57 |
output_html_with_http_headers $query, $cookie, $template->output, undef, { force_no_caching => 1 }; |
56 |
output_html_with_http_headers $query, $cookie, $template->output, undef, { force_no_caching => 1 }; |
58 |
- |
|
|