[open-ils-commits] r11318 - trunk/Open-ILS/src/perlmods/OpenILS/Application
svn at svn.open-ils.org
svn at svn.open-ils.org
Mon Nov 24 10:12:47 EST 2008
Author: erickson
Date: 2008-11-24 10:12:44 -0500 (Mon, 24 Nov 2008)
New Revision: 11318
Modified:
trunk/Open-ILS/src/perlmods/OpenILS/Application/AppUtils.pm
Log:
added method to return the context org for a given transaction id
Modified: trunk/Open-ILS/src/perlmods/OpenILS/Application/AppUtils.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/Application/AppUtils.pm 2008-11-23 17:56:13 UTC (rev 11317)
+++ trunk/Open-ILS/src/perlmods/OpenILS/Application/AppUtils.pm 2008-11-24 15:12:44 UTC (rev 11318)
@@ -1569,5 +1569,27 @@
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;
More information about the open-ils-commits
mailing list