Bug 26777: Add new patron page 'My Virtual Card'
Signed-off-by: Laura Escamilla <laura.escamilla@bywatersolutions.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
This commit is contained in:
parent
3bc683f3f7
commit
3b5b84034c
3 changed files with 139 additions and 0 deletions
|
@ -167,6 +167,14 @@
|
|||
<a href="/cgi-bin/koha/opac-alert-subscriptions.pl">Alert subscriptions ([% logged_in_user.alert_subscriptions.count | html %])</a></li>
|
||||
[% END %]
|
||||
|
||||
[% IF Koha.Preference( 'OPACVirtualCard' ) %]
|
||||
[% IF ( virtualcardview ) %]
|
||||
<li class="active">
|
||||
[% ELSE %]
|
||||
<li>
|
||||
[% END %]
|
||||
<a href="/cgi-bin/koha/opac-virtual-card.pl">My Virtual Card</a></li>
|
||||
[% END %]
|
||||
</ul>
|
||||
</div>
|
||||
[% END %]
|
||||
|
|
|
@ -0,0 +1,60 @@
|
|||
[% USE AdditionalContents %]
|
||||
[% USE raw %]
|
||||
[% USE Asset %]
|
||||
[% USE Koha %]
|
||||
[% SET OpacNav = AdditionalContents.get( location => "OpacNav", lang => lang, library => logged_in_user.branchcode || default_branch, blocktitle => 0 ) %]
|
||||
[% SET OpacNavBottom = AdditionalContents.get( location => "OpacNavBottom", lang => lang, library => logged_in_user.branchcode || default_branch, blocktitle => 0 ) %]
|
||||
[% INCLUDE 'doc-head-open.inc' %]
|
||||
<title>My Virtual Card › [% IF ( LibraryNameTitle ) %][% LibraryNameTitle | html %][% ELSE %]Koha online[% END %] catalog</title>
|
||||
[% INCLUDE 'doc-head-close.inc' %]
|
||||
[% BLOCK cssinclude %]
|
||||
[% Asset.css("css/src/opac.css") | $raw %]
|
||||
[% END %]
|
||||
</head>
|
||||
[% INCLUDE 'bodytag.inc' bodyid='opac-virtual-card' %]
|
||||
[% INCLUDE 'masthead.inc' %]
|
||||
|
||||
<div class="main">
|
||||
[% WRAPPER breadcrumbs %]
|
||||
[% WRAPPER breadcrumb_item %]
|
||||
<a href="/cgi-bin/koha/opac-user.pl">[% INCLUDE 'patron-title.inc' patron = logged_in_user %]</a>
|
||||
[% END %]
|
||||
[% WRAPPER breadcrumb_item bc_active= 1 %]
|
||||
<span>My virtual card</span>
|
||||
[% END %]
|
||||
[% END #/ WRAPPER breadcrumbs %]
|
||||
|
||||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
<div class="col-lg-2">
|
||||
<div id="navigation">
|
||||
[% INCLUDE 'navigation.inc' IsPatronPage=1 %]
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-10 order-first order-lg-2">
|
||||
<div id="patron-virtual-card">
|
||||
<h1>My virtual card </h1>
|
||||
<div id="barcode-container">
|
||||
<svg id="patron-barcode" data-barcode="[% cardnumber | html %]"></svg>
|
||||
</div>
|
||||
<div id="image-and-library-container">
|
||||
[% IF ( display_patron_image ) %]
|
||||
<div id="image-container">
|
||||
<img id="patron-image" src="/cgi-bin/koha/opac-patron-image.pl" alt="" />
|
||||
</div>
|
||||
[% END %]
|
||||
<div id="lib-container">
|
||||
<p id="patron-lib"><strong>Library:</strong> [% library | html %]</p>
|
||||
</div>
|
||||
</div>
|
||||
</div> <!-- / #patron-virtual-card -->
|
||||
</div> <!-- / .col-10 -->
|
||||
</div> <!-- / .row -->
|
||||
</div> <!-- / .container-fluid -->
|
||||
</div> <!-- / .main -->
|
||||
|
||||
[% INCLUDE 'opac-bottom.inc' %]
|
||||
[% BLOCK jsinclude %]
|
||||
[% Asset.js("lib/js-barcode/js-barcode.js") | $raw %]
|
||||
[% Asset.js("js/barcode-generator.js") | $raw %]
|
||||
[% END %]
|
71
opac/opac-virtual-card.pl
Normal file
71
opac/opac-virtual-card.pl
Normal file
|
@ -0,0 +1,71 @@
|
|||
#!/usr/bin/perl
|
||||
|
||||
# This file is part of Koha.
|
||||
#
|
||||
# Copyright (C) 2024 Sam Lau (ByWater Solutions)
|
||||
#
|
||||
# Koha is free software; you can redistribute it and/or modify it
|
||||
# under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# Koha is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with Koha; if not, see <http://www.gnu.org/licenses>.
|
||||
|
||||
use Modern::Perl;
|
||||
|
||||
#need
|
||||
use CGI qw ( -utf8 );
|
||||
use C4::Auth qw( get_template_and_user );
|
||||
use C4::Output qw( output_html_with_http_headers );
|
||||
use Koha::Libraries;
|
||||
|
||||
#unsure
|
||||
use C4::Biblio;
|
||||
use C4::External::BakerTaylor qw( image_url link_url );
|
||||
use MARC::Record;
|
||||
use Koha::Patrons;
|
||||
use Koha::ItemTypes;
|
||||
|
||||
my $query = CGI->new;
|
||||
|
||||
# if OPACVirtualCard is disabled, leave immediately
|
||||
if ( ! C4::Context->preference('OPACVirtualCard') ) {
|
||||
print $query->redirect("/cgi-bin/koha/errors/404.pl");
|
||||
exit;
|
||||
}
|
||||
|
||||
my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
|
||||
{
|
||||
template_name => "opac-virtual-card.tt",
|
||||
query => $query,
|
||||
type => "opac",
|
||||
}
|
||||
);
|
||||
|
||||
my $patron = Koha::Patrons->find( $borrowernumber );
|
||||
# Find and display patron image if allowed
|
||||
if (C4::Context->preference('OPACpatronimages')) {
|
||||
$template->param( display_patron_image => 1 ) if $patron->image;
|
||||
}
|
||||
|
||||
my $branchcode = $patron->branchcode;
|
||||
# Fetch the library object using the branchcode
|
||||
my $library = Koha::Libraries->find($branchcode);
|
||||
|
||||
# Get the library name
|
||||
my $library_name = $library ? $library->branchname : 'Unknown Library';
|
||||
|
||||
$template->param(
|
||||
virtualcardview => 1,
|
||||
cardnumber => $patron->cardnumber,
|
||||
library => $library_name,
|
||||
);
|
||||
|
||||
|
||||
output_html_with_http_headers $query, $cookie, $template->output, undef, { force_no_caching => 1 };
|
Loading…
Reference in a new issue