From: erickson Date: Thu, 10 Dec 2009 16:02:38 +0000 (+0000) Subject: fleshing some additional transaction data in user payment receive method. added... X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=f087d1201247d9db4b67d3e3c72cf5ebdca7992e;p=evergreen%2Fbjwebb.git fleshing some additional transaction data in user payment receive method. added optional 'where' filter to transaction history method, for date filtering git-svn-id: svn://svn.open-ils.org/ILS/trunk@15132 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- diff --git a/Open-ILS/src/perlmods/OpenILS/Application/Actor.pm b/Open-ILS/src/perlmods/OpenILS/Application/Actor.pm index 39b4e7eaa..d1059c7cb 100644 --- a/Open-ILS/src/perlmods/OpenILS/Application/Actor.pm +++ b/Open-ILS/src/perlmods/OpenILS/Application/Actor.pm @@ -2143,7 +2143,8 @@ __PACKAGE__->register_method( 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 @@ sub user_transaction_history { my $mbts = $e->search_money_billable_transaction_summary( [ - { usr => $userid, @xact_finish }, + { usr => $userid, @xact_finish, %$filter }, { order_by => { mbt => 'xact_start DESC' } } ] ); @@ -3641,7 +3642,34 @@ sub user_payments { } 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; }