fixed lineitem retrieval call for LIs that do not have the requested sort attr. ...
authorerickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Sun, 9 Mar 2008 01:20:46 +0000 (01:20 +0000)
committererickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Sun, 9 Mar 2008 01:20:46 +0000 (01:20 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/branches/acq-experiment@8932 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/src/perlmods/OpenILS/Application/Acq/Picklist.pm

index 84e7cc5..d0e8dae 100644 (file)
@@ -509,11 +509,17 @@ sub retrieve_pl_lineitem {
     $PL_ENTRY_JSON_QUERY->{offset} = $offset;
 
     my $entries = $e->json_query($PL_ENTRY_JSON_QUERY);
-    return [] unless $entries and @$entries;
 
     my @ids;
     push(@ids, $_->{id}) for @$entries;
+
+    # collect lineitems that don't have the requested sort attr
+    my $other_entries = $e->search_acq_lineitem(
+        {id => {'not in' => [@ids]}, picklist=>$picklist_id},{idlist=>1});
+    push(@ids, $_) for @$other_entries;
+
     return \@ids if $$options{idlist};
+    return [] unless @ids;
 
     if($$options{flesh_attrs}) {
         $entries = $e->search_acq_lineitem([