some fines display. tweak eg_vhost (IfModule ...)
authorsenator <lebbeous@esilibrary.com>
Thu, 27 Jan 2011 16:45:55 +0000 (11:45 -0500)
committersenator <lebbeous@esilibrary.com>
Thu, 27 Jan 2011 16:45:55 +0000 (11:45 -0500)
Open-ILS/examples/apache/eg_vhost.conf
Open-ILS/src/perlmods/OpenILS/WWW/EGCatLoader.pm
Open-ILS/web/templates/default/opac/myopac/fines.tt2

index bdb7721..99564e8 100644 (file)
@@ -561,9 +561,11 @@ RewriteRule ^/openurl$ ${openurl:%1} [NE,PT]
 <Location /eg/opac>
     PerlSetVar OILSWebContextLoader "OpenILS::WWW::EGCatLoader"
 #    Disable caching for development..
-#    Header set Expires "Thu, 19 Nov 1981 08:52:00 GM"
-#    Header set Cache-Control "no-store, no-cache, must-revalidate, post-check=0, pre-check=0"
-#    Header set Pragma "no-cache"
+    <IfModule mod_headers.c>
+#        Header set Expires "Thu, 19 Nov 1981 08:52:00 GM"
+#        Header set Cache-Control "no-store, no-cache, must-revalidate, post-check=0, pre-check=0"
+#        Header set Pragma "no-cache"
+    </IfModule>
 </Location>
 
 # Note: the template processor will decline handling anything it does not
index 33e7675..e45341b 100644 (file)
@@ -663,7 +663,10 @@ sub load_myopac_fines {
     my $self = shift;
     my $e = $self->editor;
     my $ctx = $self->ctx;
-    $ctx->{transactions} = [];
+    $ctx->{"fines"} = {
+        "circulation" => [],
+        "grocery" => []
+    };
 
     my $limit = $self->cgi->param('limit') || 10;
     my $offset = $self->cgi->param('offset') || 0;
@@ -695,6 +698,7 @@ sub load_myopac_fines {
         }
     );
 
+    $ctx->{"responses"} = 0;
     while(my $resp = $req->recv) {
         my $mobts = $resp->content;
         my $circ = $mobts->circulation;
@@ -705,8 +709,9 @@ sub load_myopac_fines {
             $last_billing = pop(@billings);
         }
 
+        $ctx->{"responses"}++;
         push(
-            @{$ctx->{transactions}},
+            @{$ctx->{"fines"}->{$mobts->grocery ? "grocery" : "circulation"}},
             {
                 xact => $mobts,
                 last_grocery_billing => $last_billing,
index cf9d23c..49ecf30 100644 (file)
@@ -4,11 +4,16 @@
     table { border-collapse: collapse; }
     table { padding: 3px; border-bottom: 1px solid #ddd; text-align: left;}
     table tr:nth-child(odd) { background-color:#ded; }
+    h2 { margin-bottom: 0; }
 </style>
 [% END %]
 
+[% USE date %]
+[% USE money = format('$%.2f') %]
+[% PROCESS "default/opac/common.tt2" %]
 [% WRAPPER "default/opac/base.tt2" %]
 [% INCLUDE "default/opac/myopac/_links.tt2" myopac_page = "fines" %]
+<h2>Summary</h2>
 <table>
     <thead>
         <tr>
             <th>Balance Owed</th>
         </tr>
     </thead>
+    <tbody>
+        <tr>
+            <td colspan="3"><em>XXX TODO</em></td>
+        </tr>
+    </tbody>
+</table>
+
+[% IF ctx.fines.circulation.size > 0 %]
+<h2>Overdue materials</h2>
+<table>
+    <thead>
+        <tr>
+            <th>Title</th>
+            <th>Author</th>
+            <th>Checkout Date</th>
+            <th>Due Date</th>
+            <th>Date Returned</th>
+            <th>Balance Owed</th>
+        </tr>
+    </thead>
+    <tbody>
+    [% FOR f IN ctx.fines.circulation %]
+        [% attrs = {marc_xml => f.marc_xml}; %]
+        [% PROCESS get_marc_attrs args=attrs; %]
+        <tr>
+            <td>[% attrs.title %]</td>
+            <td>[% attrs.author %]</td>
+            <td>[% date.format(
+                ctx.parse_datetime(f.xact.circulation.xact_start), "%Y-%m-%d"
+            ) %]</td>
+            <td>[% date.format(
+                ctx.parse_datetime(f.xact.circulation.due_date), "%Y-%m-%d"
+            ) %]</td>
+            <td>[%
+                IF f.xact.circulation.checkin_time;
+                    date.format(
+                        ctx.parse_datetime(f.xact.circulation.checkin_time),
+                        "%Y-%m-%d"
+                    );
+                END %]</td><!-- XXX TODO display stop_fines_time if set? Display something instead of blank like "fines accruing" ? -->
+            <td>[% money(f.xact.balance_owed) %]</td>
+        </tr>
+    [% END %]
+    </tbody>
 </table>
+[% END %]
+
+[% IF ctx.fines.grocery.size > 0 %]
+<h2>Other Fees</h2>
+<table>
+    <thead>
+        <tr>
+            <th>Transaction Start Time</th>
+            <th>Last Payment Time</th>
+            <th>Initial Amount Owed</th>
+            <th>Total Amount Paid</th>
+            <th>Balance Owed</th>
+            <th>Billing Type</th>
+        </tr>
+    </thead>
+    <tbody>
+    [% FOR f IN ctx.fines.grocery %]
+        <tr>
+            <td>[%
+                date.format(
+                    ctx.parse_datetime(f.xact.xact_start), "%Y-%m-%d"
+                ) %]</td>
+            <td>[% IF f.xact.last_payment_ts;
+                    date.format(
+                        ctx.parse_datetime(f.xact.last_payment_ts), "%Y-%m-%d"
+                        );
+                    END %]</td>
+            <td>[% money(f.xact.total_owed) %]</td>
+            <td>[% money(f.xact.total_paid) %]</td>
+            <td>[% money(f.xact.balance_owed) %]</td>
+            <td>[% f.xact.last_billing_type %]</td>
+        </tr>
+    [% END %]
+    </tbody>
+</table>
+[% END %]
 
 [% END %]