Merge branch 'template-toolkit-opac' of git+ssh://yeti.esilibrary.com/home/evergreen...
authorMike Rylander <mrylander@gmail.com>
Tue, 17 May 2011 18:11:05 +0000 (14:11 -0400)
committerMike Rylander <mrylander@gmail.com>
Tue, 17 May 2011 18:11:05 +0000 (14:11 -0400)
Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm
Open-ILS/web/css/skin/default/opac/style.css
Open-ILS/web/templates/default/opac/myopac/circ_history.tt2
Open-ILS/web/templates/default/opac/myopac/hold_history.tt2
Open-ILS/web/templates/default/opac/myopac/main.tt2
Open-ILS/web/templates/default/opac/myopac/main_payment_form.tt2
Open-ILS/web/templates/default/opac/myopac/main_payments.tt2
Open-ILS/web/templates/default/opac/myopac/receipt_email.tt2 [new file with mode: 0644]
Open-ILS/web/templates/default/opac/myopac/receipt_print.tt2
Open-ILS/web/templates/default/opac/parts/myopac/main_base.tt2
Open-ILS/web/templates/default/opac/parts/myopac/main_refund_policy.tt2 [moved from Open-ILS/web/templates/default/opac/myopac/main_refund_policy.tt2 with 100% similarity]

index bb49e11..0e96bb2 100644 (file)
@@ -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) = @_;
 
index ac67524..caba3e0 100644 (file)
@@ -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;
index 8848693..a095558 100644 (file)
@@ -1,5 +1,5 @@
 [%  PROCESS "default/opac/parts/header.tt2";
-    PROCESS "default/opac/parts/marc_misc.tt2";
+    PROCESS "default/opac/parts/misc_util.tt2";
     WRAPPER "default/opac/parts/myopac/base.tt2";
     myopac_page = "circs"
     limit = ctx.circ_history_limit;
index 048dbb2..43f3256 100644 (file)
@@ -1,5 +1,5 @@
 [%  PROCESS "default/opac/parts/header.tt2";
-    PROCESS "default/opac/parts/marc_misc.tt2";
+    PROCESS "default/opac/parts/misc_util.tt2";
     WRAPPER "default/opac/parts/myopac/base.tt2";
     myopac_page = "holds"  
     limit = ctx.hold_history_limit;
index 1a4b1b4..71382e7 100644 (file)
         </table>
     </div>
     [% END %]
+    [% UNLESS ctx.fines.grocery.size OR ctx.fines.circulation.size %]
+    <div>[% l('You have no current fines.') %]</div>
+    [% ELSE %]
     <div class="text-right pad-top-ten">
         <input type="image"
             alt="[% l('Pay selected fines') %]"
             onmouseout="this.src='[% ctx.media_prefix %]/images/pay-fines-btn.png';"
             src="[% ctx.media_prefix %]/images/pay-fines-btn.png" />
     </div>
+    [% END %]
 </form>
 [% END %]
index 8a57d64..c10d5a2 100644 (file)
                             onclick="history.go(-1);" />
                     </td>
                 </tr>
-                [% INCLUDE "default/opac/myopac/main_refund_policy.tt2" %]
+                [% INCLUDE "default/opac/parts/myopac/main_refund_policy.tt2" %]
             </tbody>
         </table>
     </form>
index 2c4daa4..83e25f3 100644 (file)
                 <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 %]
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 (file)
index 0000000..371f7df
--- /dev/null
@@ -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 %]
+    <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 %]
index 4867561..0ee7b12 100644 (file)
@@ -11,7 +11,7 @@
         [% 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')
index a79141e..18f39f4 100644 (file)
@@ -10,7 +10,9 @@
     </div>
 
     <!-- fines summary along the right of the page -->
-    [% IF myopac_main_page == "payment_form" %]
+    [% IF myopac_main_page == "payment_form" OR (
+        !ctx.fines.circulation.size AND !ctx.fines.grocery.size
+    ) %]
     <div id="myopac_sum_fines_placehold"></div>
     [% ELSE %]
     <div id="myopac_sum_fines">