use OpenILS::Utils::CStoreEditor qw/:funcs/;
use OpenILS::Utils::Fieldmapper;
use OpenILS::Application::AppUtils;
+use OpenILS::Event;
use OpenSRF::Utils::JSON;
-#use Data::Dumper;
-#$Data::Dumper::Indent = 0;
my $U = 'OpenILS::Application::AppUtils';
sub prepare_extended_user_info {
return Apache2::Const::OK;
}
+sub load_myopac_receipt_email {
+ my $self = shift;
+
+ # The following ML method doesn't actually check whether the user in
+ # question has an email address, so we do.
+ if ($self->ctx->{user}->email) {
+ $self->ctx->{email_receipt_result} = $U->simplereq(
+ "open-ils.circ", "open-ils.circ.money.payment_receipt.email",
+ $self->editor->authtoken, [$self->cgi->param("payment")]
+ );
+ } else {
+ $self->ctx->{email_receipt_result} =
+ new OpenILS::Event("PATRON_NO_EMAIL_ADDRESS");
+ }
+
+ return Apache2::Const::OK;
+}
+
sub prepare_fines {
my ($self, $limit, $offset, $id_list) = @_;
}
#myopac_payments_table th { text-align: left; }
+#myopac_payments_table tbody tr:nth-child(odd) { background-color: #ddd; }
+#myopac_payments_table form { display: inline; }
+#myopac_payments_table input[type="submit"] { padding: 1px; }
+
.payment-error {
font-weight: bold; color: red;
padding: 10px; border: 1px solid #888;
<td>[% (payment.xact_type == 'grocery') ? payment.last_billing_type : payment.title %]</td>
<td>[% money(payment.mp.amount) %]</td>
<td>
- [%# 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>
+ <form action="[% ctx.opac_root %]/myopac/receipt_print" method="POST">
+ <input type="hidden" name="payment" value="[% payment.mp.id %]" />
+ <input type="submit" value="[% l('Print') %]" />
+ </form>
+ <form action="[% ctx.opac_root %]/myopac/receipt_email" method="POST">
+ <input type="hidden" name="payment" value="[% payment.mp.id %]" />
+ <input type="submit" value="[% l('Email') %]" />
+ </form>
</td>
</tr>
[% END %]
--- /dev/null
+[% PROCESS "default/opac/parts/header.tt2";
+ PROCESS "default/opac/parts/misc_util.tt2";
+ WRAPPER "default/opac/parts/myopac/base.tt2";
+ myopac_page = "prefs" %]
+ [% IF ctx.email_receipt_result; # result should be undef on success %]
+ <div class="payment-error">
+ [% l('Error preparing receipt:') %]
+ <span title="[% ctx.email_receipt_result.textcode %]">
+ [% ctx.email_receipt_result.desc %]
+ </span>
+ </div>
+ [% ELSE %]
+ <div>[% l('Your receipt will be emailed to [_1]', ctx.user.email) %]</div>
+ [% END %]
+[% END %]
[% ELSE %]
<div class="payment-error">
[% l(
- 'Error creating receipt: [_1]',
+ 'Error preparing 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')