From 2522363ac7663e1ab07e16b7405861b2ee6fb294 Mon Sep 17 00:00:00 2001 From: erickson Date: Mon, 13 Feb 2006 21:38:33 +0000 Subject: [PATCH] tweaked some utility methods git-svn-id: svn://svn.open-ils.org/ILS/trunk@3047 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- .../perlmods/OpenILS/Application/AppUtils.pm | 10 +++++++++- .../perlmods/OpenILS/Application/Circ/Money.pm | 18 ++++++++++-------- 2 files changed, 19 insertions(+), 9 deletions(-) diff --git a/Open-ILS/src/perlmods/OpenILS/Application/AppUtils.pm b/Open-ILS/src/perlmods/OpenILS/Application/AppUtils.pm index 512f803cd8..e61a132608 100644 --- a/Open-ILS/src/perlmods/OpenILS/Application/AppUtils.pm +++ b/Open-ILS/src/perlmods/OpenILS/Application/AppUtils.pm @@ -861,7 +861,15 @@ sub update_copy { return undef; } - +sub fetch_billable_xact { + my( $self, $id ) = @_; + my($xact, $evt); + $logger->debug("Fetching billable transaction %id"); + $xact = $self->storagereq( + 'open-ils.storage.direct.money.billable_transaction.retrieve', $id ); + $evt = OpenILS::Event->new('TRANSACTION_NOT_FOUND') unless $xact; + return ($xact, $evt); +} diff --git a/Open-ILS/src/perlmods/OpenILS/Application/Circ/Money.pm b/Open-ILS/src/perlmods/OpenILS/Application/Circ/Money.pm index 1deaec2177..74c64af130 100644 --- a/Open-ILS/src/perlmods/OpenILS/Application/Circ/Money.pm +++ b/Open-ILS/src/perlmods/OpenILS/Application/Circ/Money.pm @@ -19,6 +19,7 @@ use base qw/OpenSRF::Application/; use strict; use warnings; use OpenILS::Application::AppUtils; my $apputils = "OpenILS::Application::AppUtils"; +my $U = "OpenILS::Application::AppUtils"; use OpenSRF::EX qw(:try); use OpenILS::Perm; @@ -222,19 +223,20 @@ __PACKAGE__->register_method( sub billing_items { my( $self, $client, $login, $transid ) = @_; - my( $staff, $evt ) = $apputils->checksesperm($login, 'VIEW_TRANSACTION'); + my( $trans, $evt ) = $U->fetch_billable_xact($transid); return $evt if $evt; -# we need to grab the transaction by id and check the billing location -# to determin the permissibility XXX - -# $evt = $apputils->check_perms($staff->id, -# $transaction->billing_location, 'VIEW_TRANSACTION' ); -# return $evt if $evt; + my $staff; + ($staff, $evt ) = $apputils->checkses($login); + return $evt if $evt; + if($staff->id ne $trans->usr) { + $evt = $U->check_perms($staff->id, $staff->home_ou, 'VIEW_TRANSACTION'); + return $evt if $evt; + } + return $apputils->simplereq( 'open-ils.storage', 'open-ils.storage.direct.money.billing.search.xact.atomic', $transid ) - } -- 2.43.2