Bugzilla – Attachment 170669 Details for
Bug 26777
Give the user the option to display their patron card barcode from the OPAC
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 26777: Add new patron page 'My Virtual Card'
Bug-26777-Add-new-patron-page-My-Virtual-Card.patch (text/plain), 6.74 KB, created by
Sam Lau
on 2024-08-23 19:14:34 UTC
(
hide
)
Description:
Bug 26777: Add new patron page 'My Virtual Card'
Filename:
MIME Type:
Creator:
Sam Lau
Created:
2024-08-23 19:14:34 UTC
Size:
6.74 KB
patch
obsolete
>From 9e73dd704a0d478b0363de31b4be435be911d662 Mon Sep 17 00:00:00 2001 >From: Sam Lau <samalau@gmail.com> >Date: Tue, 18 Jun 2024 22:47:47 +0000 >Subject: [PATCH] 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> >--- > .../bootstrap/en/includes/usermenu.inc | 8 +++ > .../bootstrap/en/modules/opac-virtual-card.tt | 60 ++++++++++++++++ > opac/opac-virtual-card.pl | 71 +++++++++++++++++++ > 3 files changed, 139 insertions(+) > create mode 100644 koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-virtual-card.tt > create mode 100644 opac/opac-virtual-card.pl > >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/usermenu.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/usermenu.inc >index 87268831fc..e6290a26c4 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/usermenu.inc >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/usermenu.inc >@@ -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 %] >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-virtual-card.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-virtual-card.tt >new file mode 100644 >index 0000000000..b21dcf98b2 >--- /dev/null >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-virtual-card.tt >@@ -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 %] >diff --git a/opac/opac-virtual-card.pl b/opac/opac-virtual-card.pl >new file mode 100644 >index 0000000000..26cd722d85 >--- /dev/null >+++ b/opac/opac-virtual-card.pl >@@ -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 }; >-- >2.39.2
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 26777
:
167969
|
167970
|
167971
|
167972
|
167976
|
167977
|
168029
|
168030
|
168165
|
168166
|
168167
|
168168
|
168169
|
168170
|
168171
|
168172
|
168289
|
168290
|
168291
|
168292
|
168293
|
168294
|
168295
|
168296
|
169742
|
169743
|
169744
|
169745
|
169746
|
169747
|
169748
|
169749
|
170667
|
170668
| 170669 |
170670
|
170671
|
170672
|
170673
|
170674