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

(-)a/koha-tmpl/opac-tmpl/bootstrap/en/includes/usermenu.inc (+8 lines)
Lines 167-172 Link Here
167
                <a href="/cgi-bin/koha/opac-alert-subscriptions.pl">Alert subscriptions ([% logged_in_user.alert_subscriptions.count | html %])</a></li>
167
                <a href="/cgi-bin/koha/opac-alert-subscriptions.pl">Alert subscriptions ([% logged_in_user.alert_subscriptions.count | html %])</a></li>
168
            [% END %]
168
            [% END %]
169
169
170
            [% IF Koha.Preference( 'OPACVirtualCard' ) %]
171
                [% IF ( virtualcardview ) %]
172
                    <li class="active">
173
                [% ELSE %]
174
                    <li>
175
                [% END %]
176
                <a href="/cgi-bin/koha/opac-virtual-card.pl">My Virtual Card</a></li>
177
            [% END %]
170
        </ul>
178
        </ul>
171
    </div>
179
    </div>
172
[% END %]
180
[% END %]
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-virtual-card.tt (+60 lines)
Line 0 Link Here
1
[% USE AdditionalContents %]
2
[% USE raw %]
3
[% USE Asset %]
4
[% USE Koha %]
5
[% SET OpacNav = AdditionalContents.get( location => "OpacNav", lang => lang, library => logged_in_user.branchcode || default_branch, blocktitle => 0 ) %]
6
[% SET OpacNavBottom = AdditionalContents.get( location => "OpacNavBottom", lang => lang, library => logged_in_user.branchcode || default_branch, blocktitle => 0 ) %]
7
[% INCLUDE 'doc-head-open.inc' %]
8
<title>My Virtual Card &rsaquo; [% IF ( LibraryNameTitle ) %][% LibraryNameTitle | html %][% ELSE %]Koha online[% END %] catalog</title>
9
[% INCLUDE 'doc-head-close.inc' %]
10
[% BLOCK cssinclude %]
11
    [% Asset.css("css/src/opac.css") | $raw %]
12
[% END %]
13
</head>
14
[% INCLUDE 'bodytag.inc' bodyid='opac-virtual-card' %]
15
[% INCLUDE 'masthead.inc' %]
16
17
<div class="main">
18
    [% WRAPPER breadcrumbs %]
19
        [% WRAPPER breadcrumb_item %]
20
            <a href="/cgi-bin/koha/opac-user.pl">[% INCLUDE 'patron-title.inc' patron = logged_in_user %]</a>
21
        [% END %]
22
        [% WRAPPER breadcrumb_item bc_active= 1 %]
23
            <span>My virtual card</span>
24
        [% END %]
25
    [% END #/ WRAPPER breadcrumbs %]
26
27
    <div class="container-fluid">
28
        <div class="row">
29
            <div class="col-lg-2">
30
                <div id="navigation">
31
                    [% INCLUDE 'navigation.inc' IsPatronPage=1 %]
32
                </div>
33
            </div>
34
            <div class="col-10 order-first order-lg-2">
35
                <div id="patron-virtual-card">
36
                    <h1>My virtual card </h1>
37
                    <div id="barcode-container">
38
                        <svg id="patron-barcode" data-barcode="[% cardnumber | html %]"></svg>
39
                    </div>
40
                    <div id="image-and-library-container">
41
                        [% IF ( display_patron_image ) %]
42
                            <div id="image-container">
43
                                <img id="patron-image" src="/cgi-bin/koha/opac-patron-image.pl" alt="" />
44
                            </div>
45
                        [% END %]
46
                        <div id="lib-container">
47
                            <p id="patron-lib"><strong>Library:</strong> [% library | html %]</p>
48
                        </div>
49
                    </div>
50
                </div> <!-- / #patron-virtual-card -->
51
            </div> <!-- / .col-10 -->
52
        </div> <!-- / .row -->
53
    </div> <!-- / .container-fluid -->
54
</div> <!-- / .main -->
55
56
[% INCLUDE 'opac-bottom.inc' %]
57
[% BLOCK jsinclude %]
58
    [% Asset.js("lib/js-barcode/js-barcode.js") | $raw %]
59
    [% Asset.js("js/barcode-generator.js") | $raw %]
60
[% END %]
(-)a/opac/opac-virtual-card.pl (-1 / +71 lines)
Line 0 Link Here
0
- 
1
#!/usr/bin/perl
2
3
# This file is part of Koha.
4
#
5
# Copyright (C) 2024 Sam Lau (ByWater Solutions)
6
#
7
# Koha is free software; you can redistribute it and/or modify it
8
# under the terms of the GNU General Public License as published by
9
# the Free Software Foundation; either version 3 of the License, or
10
# (at your option) any later version.
11
#
12
# Koha is distributed in the hope that it will be useful, but
13
# WITHOUT ANY WARRANTY; without even the implied warranty of
14
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
# GNU General Public License for more details.
16
#
17
# You should have received a copy of the GNU General Public License
18
# along with Koha; if not, see <http://www.gnu.org/licenses>.
19
20
use Modern::Perl;
21
22
#need
23
use CGI qw ( -utf8 );
24
use C4::Auth qw( get_template_and_user );
25
use C4::Output qw( output_html_with_http_headers );
26
use Koha::Libraries;
27
28
#unsure
29
use C4::Biblio;
30
use C4::External::BakerTaylor qw( image_url link_url );
31
use MARC::Record;
32
use Koha::Patrons;
33
use Koha::ItemTypes;
34
35
my $query = CGI->new;
36
37
# if OPACVirtualCard is disabled, leave immediately
38
if ( ! C4::Context->preference('OPACVirtualCard') ) {
39
    print $query->redirect("/cgi-bin/koha/errors/404.pl");
40
    exit;
41
}
42
43
my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
44
    {
45
        template_name   => "opac-virtual-card.tt",
46
        query           => $query,
47
        type            => "opac",
48
    }
49
);
50
51
my $patron = Koha::Patrons->find( $borrowernumber );
52
# Find and display patron image if allowed
53
if (C4::Context->preference('OPACpatronimages')) {
54
        $template->param( display_patron_image => 1 ) if $patron->image;
55
    }
56
57
my $branchcode = $patron->branchcode;
58
# Fetch the library object using the branchcode
59
my $library = Koha::Libraries->find($branchcode);
60
61
# Get the library name
62
my $library_name = $library ? $library->branchname : 'Unknown Library';
63
64
$template->param(
65
    virtualcardview => 1,
66
    cardnumber      => $patron->cardnumber,
67
    library         => $library_name,
68
);
69
70
71
output_html_with_http_headers $query, $cookie, $template->output, undef, { force_no_caching => 1 };

Return to bug 26777