From: erickson Date: Tue, 15 Aug 2006 19:02:52 +0000 (+0000) Subject: fleshing workstation on payment objects and returning specific objects X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=824aed28e8a4652167b9257122beaa75b1649bc6;p=evergreen%2Fpines.git fleshing workstation on payment objects and returning specific objects git-svn-id: svn://svn.open-ils.org/ILS/trunk@5522 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- diff --git a/Open-ILS/src/perlmods/OpenILS/Application/Circ/Money.pm b/Open-ILS/src/perlmods/OpenILS/Application/Circ/Money.pm index 4e3d760e60..395d8099bd 100644 --- a/Open-ILS/src/perlmods/OpenILS/Application/Circ/Money.pm +++ b/Open-ILS/src/perlmods/OpenILS/Application/Circ/Money.pm @@ -26,7 +26,8 @@ use OpenILS::Perm; use Data::Dumper; use OpenILS::Event; use OpenSRF::Utils::Logger qw/:logger/; -use OpenILS::Utils::Editor qw/:funcs/; +#use OpenILS::Utils::Editor qw/:funcs/; +use OpenILS::Utils::CStoreEditor qw/:funcs/; __PACKAGE__->register_method( method => "make_payments", @@ -208,7 +209,7 @@ sub _update_patron_credit { __PACKAGE__->register_method( method => "retrieve_payments", - api_name => "open-ils.circ.money.payment.retrieve.all", + api_name => "open-ils.circ.money.payment.retrieve.all_", notes => "Returns a list of payments attached to a given transaction" ); @@ -222,12 +223,43 @@ sub retrieve_payments { # XXX the logic here is wrong.. we need to check the owner of the transaction # to make sure the requestor has access + # XXX grab the view, for each object in the view, grab the real object + return $apputils->simplereq( 'open-ils.cstore', 'open-ils.cstore.direct.money.payment.search.atomic', { xact => $transid } ); } +__PACKAGE__->register_method( + method => "retrieve_payments2", + api_name => "open-ils.circ.money.payment.retrieve.all", + notes => "Returns a list of payments attached to a given transaction" + ); + +sub retrieve_payments2 { + my( $self, $client, $login, $transid ) = @_; + + my $e = new_editor(authtoken=>$login); + return $e->event unless $e->checkauth; + return $e->event unless $e->allowed('VIEW_TRANSACTION'); + + my @payments; + my $pmnts = $e->search_money_payment({ xact => $transid }); + for( @$pmnts ) { + my $type = $_->payment_type; + my $meth = "retrieve_money_$type"; + my $p = $e->$meth($_->id) or return $e->event; + try { + $p->cash_drawer($e->retrieve_actor_workstation($p->cash_drawer)); + } catch Error with {}; + push( @payments, $p ); + } + + return \@payments; +} + + __PACKAGE__->register_method( method => "create_grocery_bill", @@ -346,7 +378,8 @@ __PACKAGE__->register_method( sub void_bill { my( $s, $c, $authtoken, $billid ) = @_; - my $e = OpenILS::Utils::Editor->new( authtoken => $authtoken ); + #my $e = OpenILS::Utils::Editor->new( authtoken => $authtoken ); + my $e = new_editor( authtoken => $authtoken ); return $e->event unless $e->checkauth; return $e->event unless $e->allowed('VOID_BILLING');