Bugzilla – Attachment 139702 Details for
Bug 31448
Add option to re-send email receipt when UseEmailReceipts is enabled
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 31448: Replace 'Print' with 'Receipt' dropdown
Bug-31448-Replace-Print-with-Receipt-dropdown.patch (text/plain), 6.98 KB, created by
Martin Renvoize (ashimema)
on 2022-08-24 07:30:49 UTC
(
hide
)
Description:
Bug 31448: Replace 'Print' with 'Receipt' dropdown
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2022-08-24 07:30:49 UTC
Size:
6.98 KB
patch
obsolete
>From fa1cc46e772580a455b6533934b6923bcc76a0c4 Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Wed, 24 Aug 2022 08:28:12 +0100 >Subject: [PATCH] Bug 31448: Replace 'Print' with 'Receipt' dropdown > >This patch replaces the 'Print' button with a 'Receipt' menu dropdown >exposing 'Print' and 'Email' options when `UseEmailReceipts` is enabled > >Test plan >1. Enable `UseEmailReceipts` >2. Navigate to a patron with paid charges >3. Note the new dropdown 'Receipt' menu >4. Confirm 'Print' works as expected >5. Confirm 'Email' works as expected >--- > .../prog/en/modules/members/boraccount.tt | 10 ++ > members/printfeercpt.pl | 106 ++++++++++++------ > 2 files changed, 79 insertions(+), 37 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/boraccount.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/boraccount.tt >index 5223997277..5ebc349819 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/boraccount.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/boraccount.tt >@@ -106,7 +106,17 @@ > [% IF account.amountoutstanding <= 0 %]<td class="credit" style="text-align: right;">[% ELSE %]<td class="debit" style="text-align: right;">[% END %][% account.amountoutstanding | $Price %]</td> > <td class="actions"> > [% IF ( account.is_credit ) %] >+ [% IF Koha.Preference('UseEmailReceipts') %] >+ <div class="btn-group"> >+ <button class="btn btn-xs btn-default dropdown-toggle" data-toggle="dropdown"><i class="fa fa-receipt"></i> Receipt <span class="caret"></span></button> >+ <ul class="dropdown-menu dropdown-menu-right"> >+ <li><a target="_blank" href="printfeercpt.pl?action=print&accountlines_id=[% account.accountlines_id | uri %]" class="receipt-print-action"><i class="fa fa-print"></i> Print</a></li> >+ <li><a target="_blank" href="printfeercpt.pl?action=email&accountlines_id=[% account.accountlines_id | uri %]" class="receipt-email-action"><i class="fa fa-envelope"></i> Email</a></li> >+ </ul> >+ </div> >+ [% ELSE %] > <a target="_blank" href="printfeercpt.pl?action=print&accountlines_id=[% account.accountlines_id | uri %]" class="btn btn-default btn-xs receipt-print-action"><i class="fa fa-print"></i> Print</a> >+ [% END %] > [% ELSE %] > <a target="_blank" href="printinvoice.pl?action=print&accountlines_id=[% account.accountlines_id | uri %]" class="btn btn-default btn-xs invoice-print-action"><i class="fa fa-print"></i> Print</a> > [% END %] >diff --git a/members/printfeercpt.pl b/members/printfeercpt.pl >index 6c695e469a..0cc2bc25bc 100755 >--- a/members/printfeercpt.pl >+++ b/members/printfeercpt.pl >@@ -21,7 +21,8 @@ > use Modern::Perl; > > use C4::Auth qw( get_template_and_user ); >-use C4::Output qw( output_and_exit_if_error output_and_exit output_html_with_http_headers ); >+use C4::Output >+ qw( output_and_exit_if_error output_and_exit output_html_with_http_headers ); > use CGI qw ( -utf8 ); > use C4::Letters; > use Koha::Account::Lines; >@@ -40,6 +41,7 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user( > } > ); > >+my $action = $input->param('action'); > my $credit_id = $input->param('accountlines_id'); > my $credit = Koha::Account::Lines->find($credit_id); > my $patron = $credit->patron; >@@ -55,42 +57,72 @@ output_and_exit_if_error( > } > ); > >-my $letter = C4::Letters::GetPreparedLetter( >- module => 'circulation', >- letter_code => 'CREDIT_' . $credit->credit_type_code, >- branchcode => C4::Context::mybranch, >- message_transport_type => 'print', >- lang => $patron->lang, >- tables => { >- credits => $credit_id, >- borrowers => $patron->borrowernumber >- }, >- substitute => { >- tendered => scalar $input->param('tendered'), >- change => scalar $input->param('change') >- } >-); >+if ( $action eq 'print' ) { >+ my $letter = C4::Letters::GetPreparedLetter( >+ module => 'circulation', >+ letter_code => 'CREDIT_' . $credit->credit_type_code, >+ branchcode => C4::Context::mybranch, >+ message_transport_type => 'print', >+ lang => $patron->lang, >+ tables => { >+ credits => $credit_id, >+ borrowers => $patron->borrowernumber >+ }, >+ substitute => { >+ tendered => scalar $input->param('tendered'), >+ change => scalar $input->param('change') >+ } >+ ); > >-$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, >- borrowers => $patron->borrowernumber >- }, >- substitute => { >- tendered => scalar $input->param('tendered'), >- change => scalar $input->param('change') >- } >-); >+ $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, >+ borrowers => $patron->borrowernumber >+ }, >+ substitute => { >+ tendered => scalar $input->param('tendered'), >+ change => scalar $input->param('change') >+ } >+ ); > >-$template->param( >- slip => $letter->{content}, >- plain => !$letter->{is_html}, >- patron => $patron, >-); >+ $template->param( >+ slip => $letter->{content}, >+ plain => !$letter->{is_html}, >+ patron => $patron, >+ ); >+ >+ output_html_with_http_headers $input, $cookie, $template->output; >+} >+elsif ( $action eq 'email' ) { >+ if ( >+ my $letter = C4::Letters::GetPreparedLetter( >+ module => 'circulation', >+ letter_code => uc("ACCOUNT_$type"), >+ message_transport_type => 'email', >+ lang => $patron->lang, >+ tables => { >+ borrowers => $patron->borrowernumber, >+ branches => $library_id, >+ }, >+ substitute => { >+ credit => $payment, >+ offsets => \@account_offsets, >+ }, >+ ) >+ ) >+ { >+ C4::Letters::EnqueueLetter( >+ { >+ letter => $letter, >+ borrowernumber => $patron->borrowernumber, >+ message_transport_type => 'email', >+ } >+ ) or warn "can't enqueue letter $letter"; >+ } > >-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 31448
:
139702
|
147427
|
147488
|
149393