View | Details | Raw Unified | Return to bug 31448
Collapse All | Expand All

(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/boraccount.tt (+21 lines)
Lines 46-51 Link Here
46
        <div class="col-sm-10 col-sm-push-2">
46
        <div class="col-sm-10 col-sm-push-2">
47
            <main>
47
            <main>
48
48
49
            [% IF receipt_sent == '1' %]
50
            <div id="receipt_sent_dialog" class="dialog message">
51
              Receipt sent.
52
            </div>
53
            [% END %]
54
            [% IF receipt_sent == '-1' %]
55
            <div id="receipt_sent_dialog" class="dialog warning">
56
              Receipt not sent, failed to find template.
57
            </div>
58
            [% END %]
59
49
[% INCLUDE 'members-toolbar.inc' %]
60
[% INCLUDE 'members-toolbar.inc' %]
50
<h1>Account for [% INCLUDE 'patron-title.inc' %]</h1>
61
<h1>Account for [% INCLUDE 'patron-title.inc' %]</h1>
51
<form action="/cgi-bin/koha/members/boraccount.pl" method="get"><input type="hidden" name="borrowernumber" id="borrowernumber" value="[% patron.borrowernumber | html %]" /></form>
62
<form action="/cgi-bin/koha/members/boraccount.pl" method="get"><input type="hidden" name="borrowernumber" id="borrowernumber" value="[% patron.borrowernumber | html %]" /></form>
Lines 124-130 Link Here
124
      [% IF account.amountoutstanding <= 0 %]<td class="credit" style="text-align: right;">[% ELSE %]<td class="debit" style="text-align: right;">[% END %][% account.amountoutstanding | $Price %]</td>
135
      [% IF account.amountoutstanding <= 0 %]<td class="credit" style="text-align: right;">[% ELSE %]<td class="debit" style="text-align: right;">[% END %][% account.amountoutstanding | $Price %]</td>
125
      <td class="actions">
136
      <td class="actions">
126
        [% IF ( account.is_credit ) %]
137
        [% IF ( account.is_credit ) %]
138
          [% IF Koha.Preference('UseEmailReceipts') %]
139
          <div class="btn-group">
140
          <button class="btn btn-xs btn-default dropdown-toggle" data-toggle="dropdown"><i class="fa fa-receipt"></i> Receipt <span class="caret"></span></button>
141
          <ul class="dropdown-menu dropdown-menu-right">
142
              <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>
143
              <li><a href="boraccount.pl?action=send_receipt&amp;accountlines_id=[% account.accountlines_id | uri %]&amp;borrowernumber=[% account.borrowernumber | uri %]" class="receipt-email-action"><i class="fa fa-envelope"></i> Email</a></li>
144
          </ul>
145
          </div>
146
          [% ELSE %]
127
          <a target="_blank" href="printfeercpt.pl?action=print&amp;accountlines_id=[% account.accountlines_id | uri %]" class="btn btn-default btn-xs receipt-print-action"><i class="fa fa-print"></i> Print</a>
147
          <a target="_blank" href="printfeercpt.pl?action=print&amp;accountlines_id=[% account.accountlines_id | uri %]" class="btn btn-default btn-xs receipt-print-action"><i class="fa fa-print"></i> Print</a>
148
          [% END %]
128
        [% ELSE %]
149
        [% ELSE %]
129
          <a target="_blank" href="printinvoice.pl?action=print&amp;accountlines_id=[% account.accountlines_id | uri %]" class="btn btn-default btn-xs invoice-print-action"><i class="fa fa-print"></i> Print</a>
150
          <a target="_blank" href="printinvoice.pl?action=print&amp;accountlines_id=[% account.accountlines_id | uri %]" class="btn btn-default btn-xs invoice-print-action"><i class="fa fa-print"></i> Print</a>
130
        [% END %]
151
        [% END %]
(-)a/members/boraccount.pl (-1 / +40 lines)
Lines 30-35 use C4::Output qw( output_and_exit_if_error output_and_exit output_html_with_htt Link Here
30
use CGI qw ( -utf8 );
30
use CGI qw ( -utf8 );
31
use C4::Members;
31
use C4::Members;
32
use C4::Accounts;
32
use C4::Accounts;
33
use C4::Letters;
33
use Koha::Cash::Registers;
34
use Koha::Cash::Registers;
34
use Koha::Patrons;
35
use Koha::Patrons;
35
use Koha::Patron::Categories;
36
use Koha::Patron::Categories;
Lines 171-176 if ( $action eq 'discount' ) { Link Here
171
    );
172
    );
172
}
173
}
173
174
175
my $receipt_sent = 0;
176
if ( $action eq 'send_receipt' ) {
177
    my $credit_id = scalar $input->param('accountlines_id');
178
    my $credit    = Koha::Account::Lines->find($credit_id);
179
    my @credit_offsets =
180
      $credit->credit_offsets( { type => 'APPLY' } )->as_list;
181
    if (
182
        my $letter = C4::Letters::GetPreparedLetter(
183
            module      => 'circulation',
184
            letter_code => uc( "ACCOUNT_" . $credit->credit_type_code ),
185
            message_transport_type => 'email',
186
            lang                   => $patron->lang,
187
            tables                 => {
188
                borrowers => $patron->borrowernumber,
189
                branches  => C4::Context::mybranch,
190
            },
191
            substitute => {
192
                credit  => $credit,
193
                offsets => \@credit_offsets,
194
            },
195
        )
196
      )
197
    {
198
        my $message_id = C4::Letters::EnqueueLetter(
199
            {
200
                letter                 => $letter,
201
                borrowernumber         => $patron->borrowernumber,
202
                message_transport_type => 'email',
203
            }
204
        );
205
        C4::Letters::SendQueuedMessages( { message_id => $message_id } );
206
        $receipt_sent = 1;
207
    }
208
    else {
209
        $receipt_sent = -1;
210
    }
211
}
212
174
#get account details
213
#get account details
175
my $total = $patron->account->balance;
214
my $total = $patron->account->balance;
176
215
Lines 213-218 $template->param( Link Here
213
    payment_id          => $payment_id,
252
    payment_id          => $payment_id,
214
    change_given        => $change_given,
253
    change_given        => $change_given,
215
    renew_results       => $renew_results_display,
254
    renew_results       => $renew_results_display,
255
    receipt_sent        => $receipt_sent,
216
    csrf_token          => $csrf_token,
256
    csrf_token          => $csrf_token,
217
);
257
);
218
258
219
- 

Return to bug 31448