Bugzilla – Attachment 111595 Details for
Bug 24381
ACCOUNT_CREDIT and ACCOUNT_DEBIT slip not printing information about paid fines/fees
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 24381: Convert printfeercpt to use GetPreparedLetter
Bug-24381-Convert-printfeercpt-to-use-GetPreparedL.patch (text/plain), 6.33 KB, created by
Martin Renvoize (ashimema)
on 2020-10-14 11:05:05 UTC
(
hide
)
Description:
Bug 24381: Convert printfeercpt to use GetPreparedLetter
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2020-10-14 11:05:05 UTC
Size:
6.33 KB
patch
obsolete
>From 284969e522df66d0876cfac38b361c6bb924788b Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Wed, 14 Oct 2020 11:58:26 +0100 >Subject: [PATCH] Bug 24381: Convert printfeercpt to use GetPreparedLetter > >This patch updates C4::Letters to allow use of existing koha template >includes from notices, then updates the printfeercpt slip print option >to use GetPreparedLetter rather than calling getletter directly. > >As part of this work, we also add credits and debits handling to the >_parseletter_sth and _get_tt_params routines in C4::Letters to allow for >recognisable variable names in the notice template. >--- > C4/Letters.pm | 25 +++++++++++++++++++ > .../prog/en/modules/members/printfeercpt.tt | 21 +++++++++++----- > members/printfeercpt.pl | 21 ++++++++++------ > 3 files changed, 54 insertions(+), 13 deletions(-) > >diff --git a/C4/Letters.pm b/C4/Letters.pm >index 2bae52d346..b4303f4e39 100644 >--- a/C4/Letters.pm >+++ b/C4/Letters.pm >@@ -31,6 +31,7 @@ use Try::Tiny; > use C4::Members; > use C4::Log; > use C4::SMS; >+use C4::Templates; > use C4::Debug; > use Koha::DateUtils; > use Koha::SMS::Providers; >@@ -751,8 +752,11 @@ sub _parseletter_sth { > # broke things for the rest of us. prepare_cached is a better > # way to cache statement handles anyway. > my $query = >+ ($table eq 'accountlines' ) ? "SELECT * FROM $table WHERE accountlines_id = ?" : > ($table eq 'biblio' ) ? "SELECT * FROM $table WHERE biblionumber = ?" : > ($table eq 'biblioitems' ) ? "SELECT * FROM $table WHERE biblionumber = ?" : >+ ($table eq 'credits' ) ? "SELECT * FROM accountlines WHERE accountlines_id = ?" : >+ ($table eq 'debits' ) ? "SELECT * FROM accountlines WHERE accountlines_id = ?" : > ($table eq 'items' ) ? "SELECT * FROM $table WHERE itemnumber = ?" : > ($table eq 'issues' ) ? "SELECT * FROM $table WHERE itemnumber = ?" : > ($table eq 'old_issues' ) ? "SELECT * FROM $table WHERE itemnumber = ? ORDER BY timestamp DESC LIMIT 1" : >@@ -1487,6 +1491,14 @@ sub _process_tt { > my $loops = $params->{loops}; > my $substitute = $params->{substitute} || {}; > >+ my $htdocs = C4::Context->config('intrahtdocs'); >+ my ($theme, $lang, $activethemes)= C4::Templates::themelanguage( $htdocs, 'about.tt', 'intranet'); >+ my @includes; >+ foreach (@$activethemes) { >+ push @includes, "$htdocs/$_/$lang/includes"; >+ push @includes, "$htdocs/$_/en/includes" unless $lang eq 'en'; >+ } >+ > my $use_template_cache = C4::Context->config('template_cache_dir') && defined $ENV{GATEWAY_INTERFACE}; > my $template = Template->new( > { >@@ -1495,6 +1507,7 @@ sub _process_tt { > PLUGIN_BASE => 'Koha::Template::Plugin', > COMPILE_EXT => $use_template_cache ? '.ttc' : '', > COMPILE_DIR => $use_template_cache ? C4::Context->config('template_cache_dir') : '', >+ INCLUDE_PATH => \@includes, > FILTERS => {}, > ENCODING => 'UTF-8', > } >@@ -1548,6 +1561,18 @@ sub _get_tt_params { > plural => 'branches', > pk => 'branchcode', > }, >+ credits => { >+ module => 'Koha::Account::Lines', >+ singular => 'credit', >+ plural => 'credits', >+ pk => 'accountlines_id', >+ }, >+ debits => { >+ module => 'Koha::Account::Lines', >+ singular => 'debit', >+ plural => 'debits', >+ pk => 'accountlines_id', >+ }, > items => { > module => 'Koha::Items', > singular => 'item', >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/printfeercpt.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/printfeercpt.tt >index c1de78be6b..6227f8f7b6 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/printfeercpt.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/printfeercpt.tt >@@ -1,16 +1,15 @@ > [% USE raw %] > [% USE Asset %] > [% USE Koha %] >-[% USE KohaDates %] >-[% USE Branches %] >-[% USE Price %] > [% SET footerjs = 1 %] > >-[% PROCESS 'accounts.inc' %] >- > [% INCLUDE 'doc-head-open.inc' %] > <title>Print receipt for [% patron.cardnumber | html %]</title> > [% INCLUDE 'doc-head-close.inc' %] >+ >+<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> >+<link rel="shortcut icon" href="[% IF ( IntranetFavicon ) %][% IntranetFavicon | url %][% ELSE %][% interface | html %]/[% theme | html %]/img/favicon.ico[% END %]" type="image/x-icon" /> >+ > [% Asset.css("css/printreceiptinvoice.css") | $raw %] > [% INCLUDE 'blocking_errors.inc' %] > </head> >@@ -18,7 +17,17 @@ > <body id="pat_printfeercpt" class="pat"> > > <div id="receipt"> >- [% letter.content | $raw | evaltt %] >+ [% IF slip %] >+ [% IF plain %] >+ <pre> >+ [% slip | html %] >+ </pre> >+ [% ELSE %] >+ [% slip | $raw %] >+ [% END %] >+ [% ELSE %] >+ No print template found >+ [% END %] > </div> > > [% MACRO jsinclude BLOCK %] >diff --git a/members/printfeercpt.pl b/members/printfeercpt.pl >index 0dd60f3de2..b414532282 100755 >--- a/members/printfeercpt.pl >+++ b/members/printfeercpt.pl >@@ -55,15 +55,22 @@ output_and_exit_if_error( > } > ); > >-my $letter = C4::Letters::getletter( 'circulation', 'ACCOUNT_CREDIT', >- C4::Context::mybranch, 'print', $patron->lang ); >+my $letter = C4::Letters::GetPreparedLetter( >+ module => 'circulation', >+ letter_code => 'ACCOUNT_CREDIT', >+ branchcode => C4::Context::mybranch, >+ message_transport_type => 'print', >+ lang => $patron->lang, >+ tables => { 'credits' => $credit_id }, >+ substitute => { >+ tendered => scalar $input->param('tendered'), >+ change => scalar $input->param('change') >+ } >+); > > $template->param( >- letter => $letter, >- credit => $credit, >- >- tendered => scalar $input->param('tendered'), >- change => scalar $input->param('change') >+ slip => $letter->{content}, >+ plain => !$letter->{is_html} > ); > > output_html_with_http_headers $input, $cookie, $template->output; >-- >2.20.1
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 24381
:
106946
|
106947
|
106950
|
106951
|
106952
|
106953
|
106956
|
106957
|
106958
|
106959
|
106960
|
106974
|
106975
|
106976
|
106977
|
110210
|
110211
|
110212
|
110213
|
110461
|
110462
|
110463
|
110464
|
111530
|
111531
|
111532
|
111533
|
111534
|
111590
|
111591
|
111592
|
111593
|
111594
|
111595
|
116394
|
140868
|
140869
|
140870
|
140871
|
140872
|
140873
|
141619
|
141620
|
141621
|
141622
|
141623
|
142386
|
142387
|
142388
|
142389
|
142390