View | Details | Raw Unified | Return to bug 40659
Collapse All | Expand All

(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-virtual-card.tt (-17 / +21 lines)
Lines 33-56 Link Here
33
            <div class="col-lg-10 order-first order-lg-2">
33
            <div class="col-lg-10 order-first order-lg-2">
34
                <h1>Your library card </h1>
34
                <h1>Your library card </h1>
35
                <div id="patron-virtual-card">
35
                <div id="patron-virtual-card">
36
                    [% IF ( display_patron_image ) %]
37
                        <div id="image-container">
38
                            <img id="patron-image" src="/cgi-bin/koha/opac-patron-image.pl" alt="" />
39
                        </div>
40
                    [% END %]
41
                    <div id="card-details">
36
                    <div id="card-details">
42
                        <div id="barcode-container">
37
                        [% IF content.content %]
43
                            <svg id="patron-barcode" data-barcode="[% patron.cardnumber | html %]" data-barcode-format="[% barcode_format | html %]"></svg>
38
                            [% content.content | $raw %]
44
                        </div>
39
                        [% ELSE %]
45
                        <div id="lib-container">
40
                            [% IF ( display_patron_image ) %]
46
                            <p id="patron-lib"><strong>Library:</strong> [% Branches.GetName( patron.branchcode ) | html %]</p>
41
                                <div id="image-container">
47
                        </div>
42
                                    <img id="patron-image" src="/cgi-bin/koha/opac-patron-image.pl" alt="" />
48
                        <div id="cardnumber-container">
43
                                </div>
49
                            <p id="patron-cardnumber"><strong>Card number:</strong> [% patron.cardnumber | html %]</p>
44
                            [% END %]
50
                        </div>
45
                            <div id="barcode-container">
51
                        <div id="dateexpiry-container">
46
                                <svg id="patron-barcode" data-barcode="[% patron.cardnumber | html %]" data-barcode-format="[% barcode_format | html %]"></svg>
52
                            <p id="patron-dateexpiry"><strong>Expiration date:</strong> [% patron.dateexpiry | $KohaDates %]</p>
47
                            </div>
53
                        </div>
48
                            <div id="lib-container">
49
                                <p id="patron-lib"><strong>Library:</strong> [% Branches.GetName( patron.branchcode ) | html %]</p>
50
                            </div>
51
                            <div id="cardnumber-container">
52
                                <p id="patron-cardnumber"><strong>Card number:</strong> [% patron.cardnumber | html %]</p>
53
                            </div>
54
                            <div id="dateexpiry-container">
55
                                <p id="patron-dateexpiry"><strong>Expiration date:</strong> [% patron.dateexpiry | $KohaDates %]</p>
56
                            </div>
57
                        [% END %]
54
                    </div>
58
                    </div>
55
                </div>
59
                </div>
56
            </div>
60
            </div>
(-)a/opac/opac-virtual-card.pl (-4 / +29 lines)
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
- 

Return to bug 40659