[open-ils-commits] r15132 - trunk/Open-ILS/src/perlmods/OpenILS/Application (erickson)

svn at svn.open-ils.org svn at svn.open-ils.org
Thu Dec 10 11:02:41 EST 2009


Author: erickson
Date: 2009-12-10 11:02:38 -0500 (Thu, 10 Dec 2009)
New Revision: 15132

Modified:
   trunk/Open-ILS/src/perlmods/OpenILS/Application/Actor.pm
Log:
fleshing some additional transaction data in user payment receive method.  added optional 'where' filter to transaction history method, for date filtering

Modified: trunk/Open-ILS/src/perlmods/OpenILS/Application/Actor.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/Application/Actor.pm	2009-12-09 22:44:01 UTC (rev 15131)
+++ trunk/Open-ILS/src/perlmods/OpenILS/Application/Actor.pm	2009-12-10 16:02:38 UTC (rev 15132)
@@ -2143,7 +2143,8 @@
 
 
 sub user_transaction_history {
-	my( $self, $conn, $auth, $userid, $type ) = @_;
+	my( $self, $conn, $auth, $userid, $type, $filter ) = @_;
+    $filter ||= {};
 
 	# run inside of a transaction to prevent replication delays
 	my $e = new_editor(authtoken=>$auth);
@@ -2159,7 +2160,7 @@
 
     my $mbts = $e->search_money_billable_transaction_summary(
         [ 
-            { usr => $userid, @xact_finish },
+            { usr => $userid, @xact_finish, %$filter },
             { order_by => { mbt => 'xact_start DESC' } }
         ]
     );
@@ -3641,8 +3642,35 @@
     }
 
     my $payment_ids = $e->json_query($query);
-    $conn->respond($e->retrieve_money_payment($_->{id})) for @$payment_ids;
+    for my $pid (@$payment_ids) {
+        my $pay = $e->retrieve_money_payment([
+            $pid->{id},
+            {   flesh => 6,
+                flesh_fields => {
+                    mp => ['xact'],
+                    mbt => ['summary', 'circulation', 'grocery'],
+                    circ => ['target_copy'],
+                    acp => ['call_number'],
+                    acn => ['record']
+                }
+            }
+        ]);
 
+        my $resp = {
+            mp => $pay,
+            xact_type => $pay->xact->summary->xact_type,
+            last_billing_type => $pay->xact->summary->last_billing_type,
+        };
+
+        if($pay->xact->summary->xact_type eq 'circulation') {
+            $resp->{barcode} = $pay->xact->circulation->target_copy->barcode;
+            $resp->{title} = $U->record_to_mvr($pay->xact->circulation->target_copy->call_number->record)->title;
+        }
+
+        $pay->xact($pay->xact->id); # de-flesh
+        $conn->respond($resp);
+    }
+
     return undef;
 }
 



More information about the open-ils-commits mailing list