From: erickson Date: Fri, 1 Sep 2006 04:41:27 +0000 (+0000) Subject: added some retrieval methods for plain transits as well as transits by org X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=d0009dd707a5453f51f8292abf44b19da16be254;p=Evergreen.git added some retrieval methods for plain transits as well as transits by org git-svn-id: svn://svn.open-ils.org/ILS/trunk@5822 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- diff --git a/Open-ILS/src/perlmods/OpenILS/Application/Circ/Transit.pm b/Open-ILS/src/perlmods/OpenILS/Application/Circ/Transit.pm index e7b307999e..1cc3631e5e 100644 --- a/Open-ILS/src/perlmods/OpenILS/Application/Circ/Transit.pm +++ b/Open-ILS/src/perlmods/OpenILS/Application/Circ/Transit.pm @@ -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; +} +