return $self->load_myopac_payments if $path =~ m|opac/myopac/main_payments|;
return $self->load_myopac_pay if $path =~ m|opac/myopac/main_pay|;
return $self->load_myopac_main if $path =~ m|opac/myopac/main|;
+ return $self->load_myopac_receipt_email if $path =~ m|opac/myopac/receipt_email|;
+ return $self->load_myopac_receipt_print if $path =~ m|opac/myopac/receipt_print|;
return $self->load_myopac_update_email if $path =~ m|opac/myopac/update_email|;
return $self->load_myopac_update_password if $path =~ m|opac/myopac/update_password|;
return $self->load_myopac_update_username if $path =~ m|opac/myopac/update_username|;
return Apache2::Const::OK;
}
+sub load_myopac_receipt_print {
+ my $self = shift;
+
+ $self->ctx->{printable_receipt} = $U->simplereq(
+ "open-ils.circ", "open-ils.circ.money.payment_receipt.print",
+ $self->editor->authtoken, [$self->cgi->param("payment")]
+ );
+
+ return Apache2::Const::OK;
+}
+
sub prepare_fines {
my ($self, $limit, $offset, $id_list) = @_;
</p>
[% ELSE %]
<p><big>[% l('Your payment has been approved.') %]</big></p>
- [% IF ctx.printable_receipt.template_output %]
- <p>[ <a href="javascript:void(0);"
+ [% IF ctx.printable_receipt.template_output;
+ print_args = [];
+ FOR p IN ctx.payment_response.payments;
+ print_args.push('payment=' _ p);
+ END %]
+ <p>[ <a href="[% ctx.opac_root %]/myopac/receipt_print?[% print_args.join('&') %]"
+ target="_egrecpt"
onclick="try { print_node('printable-receipt'); } catch (e) { window.print(); } return false;">[% l('Print receipt') %]</a> ]</p>
<tt id="printable-receipt">
[% ctx.printable_receipt.template_output.data %]
<div class="payment-error">
[% l(
'Error creating receipt: [_1]',
+ (ctx.printable_receipt.textcode ? ctx.printable_receipt.textcode _ ' / ' _ ctx.printable_receipt.desc : 0) ||
ctx.printable_receipt.error_output.data ||
l('No receipt data returned from server')
) %]
<td>[% (payment.xact_type == 'grocery') ? payment.last_billing_type : payment.title %]</td>
<td>[% money(payment.mp.amount) %]</td>
<td>
- [%# post to print/email form... %]
- <a href=''>[% l('Print') %]</a> / <a href=''>[% l('Email') %]</a>
+ [%# post to print/email form... XXX wait, why post? -senator %]
+ <a href="[% ctx.opac_root %]/myopac/receipt_print?payment=[% payment.mp.id %]" target="_egrcpt">[% l('Print') %]</a>
+ /
+ <a href=''>[% l('Email') %]</a>
</td>
</tr>
[% END %]
--- /dev/null
+[%# sic! no wrapper %]
+<html>
+ <head>
+ <title>[% l('Receipt') %]</title>
+ </head>
+ <body onload="if (document.getElementById('printable-receipt')) window.print();">
+ [% IF ctx.printable_receipt.template_output %]
+ <tt id="printable-receipt">
+ [% ctx.printable_receipt.template_output.data %]
+ </tt>
+ [% ELSE %]
+ <div class="payment-error">
+ [% l(
+ 'Error creating receipt: [_1]',
+ (ctx.printable_receipt.textcode ? ctx.printable_receipt.textcode _ ' / ' _ ctx.printable_receipt.desc : 0) ||
+ ctx.printable_receipt.error_output.data ||
+ l('No receipt data returned from server')
+ ) %]
+ </div>
+ [% END %]
+ </body>
+</html>