added some retrieval methods for plain transits as well as transits by org
authorerickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Fri, 1 Sep 2006 04:41:27 +0000 (04:41 +0000)
committererickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Fri, 1 Sep 2006 04:41:27 +0000 (04:41 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@5822 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/src/perlmods/OpenILS/Application/Circ/Transit.pm

index e7b3079..1cc3631 100644 (file)
@@ -294,6 +294,58 @@ sub fetch_transit_by_copy {
 }
 
 
+
+__PACKAGE__->register_method(
+       method => 'transits_by_lib',
+       api_name => 'open-ils.circ.transit.retrieve_by_lib',
+);
+
+
+sub transits_by_lib {
+       my( $self, $conn, $auth, $orgid ) = @_;
+       my $e = new_editor(authtoken=>$auth);
+       return $e->event unless $e->checkauth;
+       return $e->event unless $e->allowed('VIEW_CIRCULATIONS'); # eh.. basically the same permission
+
+       my $tos = $e->search_action_transit_copy(
+               {
+                       dest => $orgid,
+                       dest_recv_time => undef,
+               },
+               { idlist => 1 }
+       );
+
+       my $froms = $e->search_action_transit_copy(
+               {
+                       source => $orgid,
+                       dest_recv_time => undef,
+               },
+               { idlist => 1 }
+       );
+
+       return { from => $froms, to => $tos };
+}
+
+
+
+__PACKAGE__->register_method(
+       method => 'fetch_transit',
+       api_name => 'open-ils.circ.transit.retrieve',
+);
+sub fetch_transit {
+       my( $self, $conn, $auth, $transid ) = @_;
+       my $e = new_editor(authtoken=>$auth);
+       return $e->event unless $e->checkauth;
+       return $e->event unless $e->allowed('VIEW_CIRCULATIONS'); # eh.. basically the same permission
+
+       my $ht = $e->retrieve_action_hold_transit_copy($transid);
+       return $ht if $ht;
+
+       my $t = $e->retrieve_action_transit_copy($transid)
+               or return $e->event;
+       return $t;
+}
+