Bugzilla – Attachment 147427 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), 5.38 KB, created by
Martin Renvoize (ashimema)
on 2023-02-27 10:09:31 UTC
(
hide
)
Description:
Bug 31448: Replace 'Print' with 'Receipt' dropdown
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2023-02-27 10:09:31 UTC
Size:
5.38 KB
patch
obsolete
>From e7b8e672a183debe31be6012231ca550c1bbbcae 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 | 21 ++++++++++ > members/boraccount.pl | 40 +++++++++++++++++++ > 2 files changed, 61 insertions(+) > >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 310e4795d6..b5b5f30485 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/boraccount.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/boraccount.tt >@@ -46,6 +46,17 @@ > <div class="col-sm-10 col-sm-push-2"> > <main> > >+ [% IF receipt_sent == '1' %] >+ <div id="receipt_sent_dialog" class="dialog message"> >+ Receipt sent. >+ </div> >+ [% END %] >+ [% IF receipt_sent == '-1' %] >+ <div id="receipt_sent_dialog" class="dialog warning"> >+ Receipt not sent, failed to find template. >+ </div> >+ [% END %] >+ > [% INCLUDE 'members-toolbar.inc' %] > <h1>Account for [% INCLUDE 'patron-title.inc' %]</h1> > <form action="/cgi-bin/koha/members/boraccount.pl" method="get"><input type="hidden" name="borrowernumber" id="borrowernumber" value="[% patron.borrowernumber | html %]" /></form> >@@ -122,7 +133,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?accountlines_id=[% account.accountlines_id | uri %]" class="receipt-print-action"><i class="fa fa-print"></i> Print</a></li> >+ <li><a href="boraccount.pl?action=send_receipt&accountlines_id=[% account.accountlines_id | uri %]&borrowernumber=[% account.borrowernumber | 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/boraccount.pl b/members/boraccount.pl >index 83fa43bf65..2d625a459c 100755 >--- a/members/boraccount.pl >+++ b/members/boraccount.pl >@@ -30,6 +30,7 @@ use C4::Output qw( output_and_exit_if_error output_and_exit output_html_with_htt > use CGI qw ( -utf8 ); > use C4::Members; > use C4::Accounts; >+use C4::Letters; > use Koha::Cash::Registers; > use Koha::Patrons; > use Koha::Patron::Categories; >@@ -171,6 +172,44 @@ if ( $action eq 'discount' ) { > ); > } > >+my $receipt_sent = 0; >+if ( $action eq 'send_receipt' ) { >+ my $credit_id = scalar $input->param('accountlines_id'); >+ my $credit = Koha::Account::Lines->find($credit_id); >+ my @credit_offsets = >+ $credit->credit_offsets( { type => 'APPLY' } )->as_list; >+ if ( >+ my $letter = C4::Letters::GetPreparedLetter( >+ module => 'circulation', >+ letter_code => uc( "ACCOUNT_" . $credit->credit_type_code ), >+ message_transport_type => 'email', >+ lang => $patron->lang, >+ tables => { >+ borrowers => $patron->borrowernumber, >+ branches => C4::Context::mybranch, >+ }, >+ substitute => { >+ credit => $credit, >+ offsets => \@credit_offsets, >+ }, >+ ) >+ ) >+ { >+ my $message_id = C4::Letters::EnqueueLetter( >+ { >+ letter => $letter, >+ borrowernumber => $patron->borrowernumber, >+ message_transport_type => 'email', >+ } >+ ); >+ C4::Letters::SendQueuedMessages( { message_id => $message_id } ); >+ $receipt_sent = 1; >+ } >+ else { >+ $receipt_sent = -1; >+ } >+} >+ > #get account details > my $total = $patron->account->balance; > >@@ -213,6 +252,7 @@ $template->param( > payment_id => $payment_id, > change_given => $change_given, > renew_results => $renew_results_display, >+ receipt_sent => $receipt_sent, > csrf_token => $csrf_token, > ); > >-- >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 31448
:
139702
|
147427
|
147488
|
149393