From e22e11aeb8e9e3afe8a6bda72d68544c4475997a Mon Sep 17 00:00:00 2001 From: senator Date: Tue, 17 May 2011 11:31:08 -0400 Subject: [PATCH] Emailing receipts working, some tweaks to payment history page --- .../lib/OpenILS/WWW/EGCatLoader/Account.pm | 21 ++++++++++++++++++- Open-ILS/web/css/skin/default/opac/style.css | 4 +++ .../default/opac/myopac/main_payments.tt2 | 12 +++++++--- .../default/opac/myopac/receipt_email.tt2 | 15 ++++++++++++++ .../default/opac/myopac/receipt_print.tt2 | 2 +- 5 files changed, 47 insertions(+), 7 deletions(-) create mode 100644 Open-ILS/web/templates/default/opac/myopac/receipt_email.tt2 diff --git a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm index bb49e11..0e96bb2 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm @@ -5,9 +5,8 @@ use OpenSRF::Utils::Logger qw/$logger/; 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 { @@ -651,6 +650,24 @@ sub load_myopac_receipt_print { 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) = @_; diff --git a/Open-ILS/web/css/skin/default/opac/style.css b/Open-ILS/web/css/skin/default/opac/style.css index ac67524..caba3e0 100644 --- a/Open-ILS/web/css/skin/default/opac/style.css +++ b/Open-ILS/web/css/skin/default/opac/style.css @@ -877,6 +877,10 @@ div.select-wrapper:hover { } #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; diff --git a/Open-ILS/web/templates/default/opac/myopac/main_payments.tt2 b/Open-ILS/web/templates/default/opac/myopac/main_payments.tt2 index 2c4daa4..83e25f3 100644 --- a/Open-ILS/web/templates/default/opac/myopac/main_payments.tt2 +++ b/Open-ILS/web/templates/default/opac/myopac/main_payments.tt2 @@ -34,10 +34,14 @@ [% (payment.xact_type == 'grocery') ? payment.last_billing_type : payment.title %] [% money(payment.mp.amount) %] - [%# post to print/email form... XXX wait, why post? -senator %] - [% l('Print') %] - / - [% l('Email') %] +
+ + +
+
+ + +
[% END %] diff --git a/Open-ILS/web/templates/default/opac/myopac/receipt_email.tt2 b/Open-ILS/web/templates/default/opac/myopac/receipt_email.tt2 new file mode 100644 index 0000000..371f7df --- /dev/null +++ b/Open-ILS/web/templates/default/opac/myopac/receipt_email.tt2 @@ -0,0 +1,15 @@ +[% 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 %] +
+ [% l('Error preparing receipt:') %] + + [% ctx.email_receipt_result.desc %] + +
+ [% ELSE %] +
[% l('Your receipt will be emailed to [_1]', ctx.user.email) %]
+ [% END %] +[% END %] diff --git a/Open-ILS/web/templates/default/opac/myopac/receipt_print.tt2 b/Open-ILS/web/templates/default/opac/myopac/receipt_print.tt2 index 4867561..0ee7b12 100644 --- a/Open-ILS/web/templates/default/opac/myopac/receipt_print.tt2 +++ b/Open-ILS/web/templates/default/opac/myopac/receipt_print.tt2 @@ -11,7 +11,7 @@ [% ELSE %]
[% 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') -- 1.7.2.5