Bugzilla – Attachment 168030 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: (Follow-up) Allow ability to select diffferent barcode types
Bug-26777-Follow-up-Allow-ability-to-select-difffe.patch (text/plain), 3.34 KB, created by
Sam Lau
on 2024-06-24 16:31:25 UTC
(
hide
)
Description:
Bug 26777: (Follow-up) Allow ability to select diffferent barcode types
Filename:
MIME Type:
Creator:
Sam Lau
Created:
2024-06-24 16:31:25 UTC
Size:
3.34 KB
patch
obsolete
>From 116a2d3210cd945f720f62046d6ecf65b547526c Mon Sep 17 00:00:00 2001 >From: Sam Lau <samalau@gmail.com> >Date: Mon, 24 Jun 2024 16:29:34 +0000 >Subject: [PATCH] Bug 26777: (Follow-up) Allow ability to select diffferent > barcode types > >--- > .../bootstrap/en/modules/opac-virtual-card.tt | 2 +- > .../bootstrap/js/barcode-generator.js | 29 ++++++++++++------- > opac/opac-virtual-card.pl | 4 +++ > 3 files changed, 24 insertions(+), 11 deletions(-) > >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 >index 85a727d947..628a772adc 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-virtual-card.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-virtual-card.tt >@@ -42,7 +42,7 @@ > </div> > [% END %] > <div id="barcode-container"> >- <svg id="patron-barcode" data-barcode="[% patron.cardnumber | html %]"></svg> >+ <svg id="patron-barcode" data-barcode="[% patron.cardnumber | html %]" data-barcode-format="[% barcode_format | html %]"></svg> > </div> > <div id="lib-container"> > <p id="patron-lib"><strong>Library:</strong> [% Branches.GetName( patron.branchcode ) | html %]</p> >diff --git a/koha-tmpl/opac-tmpl/bootstrap/js/barcode-generator.js b/koha-tmpl/opac-tmpl/bootstrap/js/barcode-generator.js >index afd32f8284..e1adb2fc9a 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/js/barcode-generator.js >+++ b/koha-tmpl/opac-tmpl/bootstrap/js/barcode-generator.js >@@ -1,11 +1,20 @@ > document.addEventListener("DOMContentLoaded", function() { >- var barcodeNumber = document.getElementById("patron-barcode").dataset.barcode; >- JsBarcode("#patron-barcode", barcodeNumber, { >- format: "CODE39", >- lineColor: "#000", >- width: 2, >- height: 100, >- displayValue: false, >- margin: 0 >- }); >-}); >\ No newline at end of file >+ const svgElement = document.getElementById('patron-barcode'); >+ var barcodeNumber = svgElement.dataset.barcode; >+ var barcodeFormat = svgElement.dataset.barcodeFormat; >+ >+ try { >+ JsBarcode("#patron-barcode", barcodeNumber, { >+ format: barcodeFormat, >+ lineColor: "#000", >+ width: 2, >+ height: 100, >+ displayValue: false, >+ margin: 0 >+ }); >+ } catch (error) { >+ // Handle the error by displaying a message on the screen >+ console.error(error); >+ document.getElementById('barcode-container').innerHTML = `<p><strong>Error: </strong>"${error}"</p>`; >+ } >+}); >diff --git a/opac/opac-virtual-card.pl b/opac/opac-virtual-card.pl >index 57bab5f493..e8767929e0 100755 >--- a/opac/opac-virtual-card.pl >+++ b/opac/opac-virtual-card.pl >@@ -48,9 +48,13 @@ if ( C4::Context->preference('OPACpatronimages') ) { > $template->param( display_patron_image => 1 ) if $patron->image; > } > >+# Get the desired barcode format >+my $barcode_format = C4::Context->preference('OPACVirtualCardBarcode'); >+ > $template->param( > virtualcardview => 1, > patron => $patron, >+ barcode_format => $barcode_format, > ); > > 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