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

(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/pos/pay.tt (-4 / +37 lines)
Lines 51-57 Link Here
51
51
52
        [% IF payment_id && !Koha.Preference('FinePaymentAutoPopup') %]
52
        [% IF payment_id && !Koha.Preference('FinePaymentAutoPopup') %]
53
        <div class="dialog alert audio-alert-action">
53
        <div class="dialog alert audio-alert-action">
54
            Payment received: <a target="_blank" href="/cgi-bin/koha/pos/printreceipt.pl?action=print&accountlines_id=[% payment_id | uri %]&collected=[% collected | uri %]&change=[% change | uri %]" class="btn btn-default btn-xs"><i class="fa fa-print"></i> Print receipt</a>
54
            Payment received: <a target="_blank" href="/cgi-bin/koha/pos/printreceipt.pl?action=print&accountlines_id=[% payment_id | uri %]&collected=[% collected | uri %]&change=[% change | uri %]" class="btn btn-default btn-xs"><i class="fa fa-print"></i> Print receipt</a> <a type="button" data-toggle="modal" data-target="#emailReceiptModal" class="btn btn-default btn-xs"><i class="fa fa-envelope"></i> Email receipt</a>
55
        </div>
55
        </div>
56
        [% END %]
56
        [% END %]
57
57
Lines 168-174 Link Here
168
    </div>
168
    </div>
169
</div> <!-- /.row -->
169
</div> <!-- /.row -->
170
170
171
<!-- Modal -->
171
<!-- Email receipt modal -->
172
<div class="modal" id="emailReceiptModal" tabindex="-1" role="dialog" aria-labelledby="emailReceiptLabel">
173
    <form id="email_form" action="/cgi-bin/koha/pos/pay.pl" method="get" enctype="multipart/form-data" class="validated">
174
        <input type="hidden" name="payment_id" id="payment_id" value="[% payment_id | uri %]">
175
        <input type="hidden" name="collected" id="collected" value="[% collected | uri %]">
176
        <input type="hidden" name="change" id="change" value="[% change | uri %]">"
177
        <div class="modal-dialog" role="document">
178
            <div class="modal-content">
179
                <div class="modal-header">
180
                    <button type="button" class="closebtn" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
181
                    <h4 class="modal-title" id="emailReceiptLabel">Email receipt</h4>
182
                </div>
183
                <div class="modal-body">
184
                    <fieldset class="rows">
185
                        <ol>
186
                            <li>
187
                                <label class="required" for="toaddr">Email address: </label>
188
                                <input type="email" id="toaddr" name="toaddr" required="required">
189
                                <span class="required">Required</span>
190
                            </li>
191
                        </ol>
192
                    </fieldset> <!-- /.rows -->
193
                </div> <!-- /.modal-body -->
194
                <div class="modal-footer">
195
                    <input type="hidden" name="action" value="send">
196
                    <button type="submit" class="btn btn-default">Confirm</button>
197
                    <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
198
                </div> <!-- /.modal-footer -->
199
            </div> <!-- /.modal-content -->
200
        </div> <!-- /.modal-dialog -->
201
    </form> <!-- /#email_form -->
202
</div> <!-- /#emailReceiptModal
203
204
<!-- Change modal -->
172
<div id="confirm_change_form" class="modal" tabindex="-1" role="dialog" aria-hidden="true">
205
<div id="confirm_change_form" class="modal" tabindex="-1" role="dialog" aria-hidden="true">
173
    <div class="modal-dialog">
206
    <div class="modal-dialog">
174
        <div class="modal-content">
207
        <div class="modal-content">
Lines 189-196 Link Here
189
</div>
222
</div>
190
223
191
[% IF payment_id && Koha.Preference('FinePaymentAutoPopup') %]
224
[% IF payment_id && Koha.Preference('FinePaymentAutoPopup') %]
192
<!-- Automatic Print Receipt -->
225
    <!-- Automatic Print Receipt -->
193
      <a id="printReceipt" style="display: none" href="#"></a>
226
    <a id="printReceipt" style="display: none" href="#"></a>
194
[% END %]
227
[% END %]
195
228
196
[% MACRO jsinclude BLOCK %]
229
[% MACRO jsinclude BLOCK %]
(-)a/pos/pay.pl (-8 / +51 lines)
Lines 23-30 use CGI; Link Here
23
use JSON qw( from_json );
23
use JSON qw( from_json );
24
24
25
use C4::Auth qw( get_session get_template_and_user );
25
use C4::Auth qw( get_session get_template_and_user );
26
use C4::Output qw( output_html_with_http_headers );
27
use C4::Context;
26
use C4::Context;
27
use C4::Letters qw( GetPreparedLetter EnqueueLetter SendQueuedMessages );
28
use C4::Output  qw( output_html_with_http_headers );
28
29
29
use Koha::Account::DebitTypes;
30
use Koha::Account::DebitTypes;
30
use Koha::AuthorisedValues;
31
use Koha::AuthorisedValues;
Lines 39-54 my $session = get_session($sessionID); Link Here
39
40
40
my ( $template, $loggedinuser, $cookie, $user_flags ) = get_template_and_user(
41
my ( $template, $loggedinuser, $cookie, $user_flags ) = get_template_and_user(
41
    {
42
    {
42
        template_name   => 'pos/pay.tt',
43
        template_name => 'pos/pay.tt',
43
        query           => $input,
44
        query         => $input,
44
        type            => 'intranet',
45
        type          => 'intranet',
45
        flagsrequired   => { cash_management => 'takepayment' },
46
        flagsrequired => { cash_management => 'takepayment' },
46
    }
47
    }
47
);
48
);
48
my $logged_in_user = Koha::Patrons->find($loggedinuser) or die "Not logged in";
49
my $logged_in_user = Koha::Patrons->find($loggedinuser) or die "Not logged in";
49
50
50
my $library_id         = C4::Context->userenv->{'branch'};
51
my $library_id = C4::Context->userenv->{'branch'};
51
my $registerid         = $input->param('registerid');
52
my $registerid = $input->param('registerid');
53
my $action     = $input->param('action') || '';
52
54
53
my $invoice_types =
55
my $invoice_types =
54
  Koha::Account::DebitTypes->search_with_library_limits(
56
  Koha::Account::DebitTypes->search_with_library_limits(
Lines 82-87 if ( $total_paid and $total_paid ne '0.00' ) { Link Here
82
    );
84
    );
83
}
85
}
84
86
87
if ( $action eq 'send' ) {
88
    my $payment_id = $input->param('payment_id');
89
    my $change     = $input->param('change');
90
    my $collected  = $input->param('collected');
91
    my $toaddr     = $input->param('toaddr');
92
93
    # Create our letter from the template
94
    my $letter = GetPreparedLetter(
95
        module                 => 'pos',
96
        letter_code            => 'RECEIPT',
97
        branchcode             => C4::Context->userenv->{'branch'},
98
        message_transport_type => 'email',
99
        tables                 => {
100
            credits => $payment_id,
101
        },
102
        substitute => {
103
            collected => $collected,
104
            change    => $change
105
        }
106
    );
107
108
    # Add letter to the queue
109
    my $message_id = EnqueueLetter(
110
        {
111
            letter                 => $letter,
112
            message_transport_type => 'email',
113
            from_address => C4::Context->preference('KohaAdminEmailAddress'),
114
            to_address   => $toaddr,
115
        }
116
    );
117
118
    # Send immediately
119
    SendQueuedMessages( { message_id => $message_id } );
120
121
    # Set variables for template to allow printing still
122
    $template->param(
123
        payment_id => $payment_id,
124
        collected  => $collected,
125
        change     => $change
126
    );
127
}
128
85
output_html_with_http_headers( $input, $cookie, $template->output );
129
output_html_with_http_headers( $input, $cookie, $template->output );
86
130
87
1;
131
1;
88
- 

Return to bug 30619