From: erickson Date: Mon, 24 Nov 2008 15:12:44 +0000 (+0000) Subject: added method to return the context org for a given transaction id X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=47186ff5b038a1c9e5c9c62c2e5fbfbce1f135a2;p=Evergreen.git added method to return the context org for a given transaction id git-svn-id: svn://svn.open-ils.org/ILS/trunk@11318 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- diff --git a/Open-ILS/src/perlmods/OpenILS/Application/AppUtils.pm b/Open-ILS/src/perlmods/OpenILS/Application/AppUtils.pm index d3e4f3c491..a8b9fa73e7 100644 --- a/Open-ILS/src/perlmods/OpenILS/Application/AppUtils.pm +++ b/Open-ILS/src/perlmods/OpenILS/Application/AppUtils.pm @@ -1569,5 +1569,27 @@ sub get_copy_price { return 0; } +# given a transaction ID, this returns the context org_unit for the transaction +sub xact_org { + my($self, $xact_id, $e) = @_; + $e ||= new_editor(); + + my $loc = $e->json_query({ + "select" => {circ => ["circ_lib"]}, + from => "circ", + "where" => {id => $xact_id}, + }); + + return $loc->[0]->{circ_lib} if @$loc; + + $loc = $e->json_query({ + "select" => {mg => ["billing_location"]}, + from => "mg", + "where" => {id => $xact_id}, + }); + + return $loc->[0]->{billing_location}; +} + 1;