Lines 24-29
use C4::Auth qw( get_template_and_user );
Link Here
|
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 |
use C4::Letters qw( GetPreparedLetter ); |
28 |
use C4::Scrubber; |
27 |
|
29 |
|
28 |
my $query = CGI->new; |
30 |
my $query = CGI->new; |
29 |
|
31 |
|
Lines 44-60
my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
Link Here
|
44 |
my $patron = Koha::Patrons->find($borrowernumber); |
46 |
my $patron = Koha::Patrons->find($borrowernumber); |
45 |
|
47 |
|
46 |
# Find and display patron image if allowed |
48 |
# Find and display patron image if allowed |
47 |
if ( C4::Context->preference('OPACpatronimages') ) { |
49 |
my $image_html = ''; |
48 |
$template->param( display_patron_image => 1 ) if $patron->image; |
50 |
if ( C4::Context->preference('OPACpatronimages') && $patron->image ) { |
|
|
51 |
$template->param( display_patron_image => 1 ); |
52 |
$image_html = |
53 |
'<div id="image-container"><img id="patron-image" src="/cgi-bin/koha/opac-patron-image.pl" alt="" /></div>'; |
49 |
} |
54 |
} |
50 |
|
55 |
|
51 |
# Get the desired barcode format |
56 |
# Get the desired barcode format |
52 |
my $barcode_format = C4::Context->preference('OPACVirtualCardBarcode'); |
57 |
my $barcode_format = C4::Context->preference('OPACVirtualCardBarcode') || 'Code39'; |
|
|
58 |
my $barcode_html = |
59 |
qq{<div id="barcode-container"><svg id="patron-barcode" data-barcode="${\$patron->cardnumber}" data-barcode-format="$barcode_format"></svg></div>}; |
60 |
|
61 |
my $content = C4::Letters::GetPreparedLetter( |
62 |
( |
63 |
module => 'members', |
64 |
letter_code => 'VIRTUALCARD', |
65 |
branchcode => $patron->branchcode, |
66 |
tables => { |
67 |
borrowers => $patron->borrowernumber, |
68 |
branches => $patron->branchcode, |
69 |
}, |
70 |
lang => $patron->lang, |
71 |
message_transport_type => 'email', |
72 |
substitute => { |
73 |
my_barcode => $barcode_html, |
74 |
my_image => $image_html, |
75 |
}, |
76 |
) |
77 |
); |
53 |
|
78 |
|
54 |
$template->param( |
79 |
$template->param( |
55 |
virtualcardview => 1, |
80 |
virtualcardview => 1, |
56 |
patron => $patron, |
81 |
patron => $patron, |
57 |
barcode_format => $barcode_format, |
82 |
barcode_format => $barcode_format, |
|
|
83 |
content => $content, |
58 |
); |
84 |
); |
59 |
|
85 |
|
60 |
output_html_with_http_headers $query, $cookie, $template->output, undef, { force_no_caching => 1 }; |
86 |
output_html_with_http_headers $query, $cookie, $template->output, undef, { force_no_caching => 1 }; |
61 |
- |
|
|