From 2296326da57b6fbee048dce4433e2bacf28b303d Mon Sep 17 00:00:00 2001 From: sboyette Date: Tue, 2 Feb 2010 15:08:04 +0000 Subject: [PATCH] retrieve_purchase_order now handles multiple PO requests git-svn-id: svn://svn.open-ils.org/ILS/trunk@15430 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- .../perlmods/OpenILS/Application/Acq/Financials.pm | 40 ++++++++++++++-------- 1 file changed, 25 insertions(+), 15 deletions(-) diff --git a/Open-ILS/src/perlmods/OpenILS/Application/Acq/Financials.pm b/Open-ILS/src/perlmods/OpenILS/Application/Acq/Financials.pm index c6a454c97b..b5bb788060 100644 --- a/Open-ILS/src/perlmods/OpenILS/Application/Acq/Financials.pm +++ b/Open-ILS/src/perlmods/OpenILS/Application/Acq/Financials.pm @@ -898,31 +898,41 @@ sub search_purchase_order { __PACKAGE__->register_method( - method => 'retrieve_purchase_order', - api_name => 'open-ils.acq.purchase_order.retrieve', - signature => { - desc => 'Retrieves a purchase order', - params => [ - {desc => 'Authentication token', type => 'string'}, - {desc => 'purchase_order to retrieve', type => 'number'}, - {desc => q/Options hash. flesh_lineitems, to get the lineitems and lineitem_attrs; + method => 'retrieve_purchase_order', + api_name => 'open-ils.acq.purchase_order.retrieve', + stream => 1, + signature => { + desc => 'Retrieves a purchase order', + params => [ + {desc => 'Authentication token', type => 'string'}, + {desc => 'purchase_order to retrieve', type => 'number'}, + {desc => q/Options hash. flesh_lineitems, to get the lineitems and lineitem_attrs; clear_marc, to clear the MARC data from the lineitem (for reduced bandwidth) li_limit : number of lineitems to return if fleshing line items; li_offset : lineitem offset if fleshing line items li_order_by : lineitem sort definition if fleshing line items - /, - type => 'hash'} - ], - return => {desc => 'The purchase order, Event on failure'} - } + /, + type => 'hash'} + ], + return => {desc => 'The purchase order, Event on failure'} + } ); sub retrieve_purchase_order { my($self, $conn, $auth, $po_id, $options) = @_; my $e = new_editor(authtoken=>$auth); return $e->event unless $e->checkauth; - return $e->event if po_perm_failure($e, $po_id); - return retrieve_purchase_order_impl($e, $po_id, $options); + + $po_id = [ $po_id ] unless ref $po_id; + for ( @{$po_id} ) { + my $rv; + if ( po_perm_failure($e, $_) ) + { $rv = $e->event } + else + { $rv = retrieve_purchase_order_impl($e, $_, $options) } + + $conn->respond($rv); + } } -- 2.11.0