Bugzilla – Attachment 187696 Details for
Bug 40659
Allow "My virtual card" format and content to be set using a Notices & Slips template
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 40659: Add ability to customize OPACVirtualCard
Bug-40659-Add-ability-to-customize-OPACVirtualCard.patch (text/plain), 5.66 KB, created by
Lucas Gass (lukeg)
on 2025-10-09 16:12:45 UTC
(
hide
)
Description:
Bug 40659: Add ability to customize OPACVirtualCard
Filename:
MIME Type:
Creator:
Lucas Gass (lukeg)
Created:
2025-10-09 16:12:45 UTC
Size:
5.66 KB
patch
obsolete
>From a6890a14952c1455515e7ec6462be5b37e708487 Mon Sep 17 00:00:00 2001 >From: Lucas Gass <lucas@bywatersolutions.com> >Date: Thu, 9 Oct 2025 16:11:56 +0000 >Subject: [PATCH] Bug 40659: Add ability to customize OPACVirtualCard > >--- > .../bootstrap/en/modules/opac-virtual-card.tt | 38 ++++++++++--------- > opac/opac-virtual-card.pl | 32 ++++++++++++++-- > 2 files changed, 50 insertions(+), 20 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 b0a9980c3ba..7448c0a9d13 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 >@@ -33,24 +33,28 @@ > <div class="col-lg-10 order-first order-lg-2"> > <h1>Your library card </h1> > <div id="patron-virtual-card"> >- [% 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="card-details"> >- <div id="barcode-container"> >- <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> >- </div> >- <div id="cardnumber-container"> >- <p id="patron-cardnumber"><strong>Card number:</strong> [% patron.cardnumber | html %]</p> >- </div> >- <div id="dateexpiry-container"> >- <p id="patron-dateexpiry"><strong>Expiration date:</strong> [% patron.dateexpiry | $KohaDates %]</p> >- </div> >+ [% IF content.content %] >+ [% content.content | $raw %] >+ [% ELSE %] >+ [% 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="barcode-container"> >+ <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> >+ </div> >+ <div id="cardnumber-container"> >+ <p id="patron-cardnumber"><strong>Card number:</strong> [% patron.cardnumber | html %]</p> >+ </div> >+ <div id="dateexpiry-container"> >+ <p id="patron-dateexpiry"><strong>Expiration date:</strong> [% patron.dateexpiry | $KohaDates %]</p> >+ </div> >+ [% END %] > </div> > </div> > </div> >diff --git a/opac/opac-virtual-card.pl b/opac/opac-virtual-card.pl >index aa2fe57187e..c44f84910d7 100755 >--- a/opac/opac-virtual-card.pl >+++ b/opac/opac-virtual-card.pl >@@ -24,6 +24,8 @@ use C4::Auth qw( get_template_and_user ); > use C4::Output qw( output_html_with_http_headers ); > use Koha::Libraries; > use Koha::Patrons; >+use C4::Letters qw( GetPreparedLetter ); >+use C4::Scrubber; > > my $query = CGI->new; > >@@ -44,17 +46,41 @@ my ( $template, $borrowernumber, $cookie ) = get_template_and_user( > 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 $image_html = ''; >+if ( C4::Context->preference('OPACpatronimages') && $patron->image ) { >+ $template->param( display_patron_image => 1 ); >+ $image_html = >+ '<div id="image-container"><img id="patron-image" src="/cgi-bin/koha/opac-patron-image.pl" alt="" /></div>'; > } > > # Get the desired barcode format >-my $barcode_format = C4::Context->preference('OPACVirtualCardBarcode'); >+my $barcode_format = C4::Context->preference('OPACVirtualCardBarcode') || 'Code39'; >+my $barcode_html = >+ qq{<div id="barcode-container"><svg id="patron-barcode" data-barcode="${\$patron->cardnumber}" data-barcode-format="$barcode_format"></svg></div>}; >+ >+my $content = C4::Letters::GetPreparedLetter( >+ ( >+ module => 'members', >+ letter_code => 'VIRTUALCARD', >+ branchcode => $patron->branchcode, >+ tables => { >+ borrowers => $patron->borrowernumber, >+ branches => $patron->branchcode, >+ }, >+ lang => $patron->lang, >+ message_transport_type => 'email', >+ substitute => { >+ my_barcode => $barcode_html, >+ my_image => $image_html, >+ }, >+ ) >+); > > $template->param( > virtualcardview => 1, > patron => $patron, > barcode_format => $barcode_format, >+ content => $content, > ); > > output_html_with_http_headers $query, $cookie, $template->output, undef, { force_no_caching => 1 }; >-- >2.39.5
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 40659
:
187695
|
187696
|
187697
|
187706