Dedup recs from open-ils.search.biblio.isbn_list. Consistent whitespace with the...
authorphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Tue, 26 Jan 2010 16:35:37 +0000 (16:35 +0000)
committerphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Tue, 26 Jan 2010 16:35:37 +0000 (16:35 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@15387 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/src/perlmods/OpenILS/Application/Search/Biblio.pm

index 3c59a4e..0ef938b 100644 (file)
@@ -1538,11 +1538,17 @@ __PACKAGE__->register_method(
 sub biblio_search_isbn_batch { 
        my( $self, $client, $isbn_list ) = @_;
        $logger->debug("Searching ISBNs @$isbn_list");
-       my $e = new_editor();
-    my @recs = ();
-       @recs = ( @recs, @{ $U->storagereq(
-               'open-ils.storage.id_list.biblio.record_entry.search.isbn.atomic', $_ )
-    } ) for @$isbn_list;
+       my @recs = (); my %rec_set = ();
+       foreach my $isbn ( @$isbn_list ) {
+               foreach my $rec ( @{ $U->storagereq(
+                       'open-ils.storage.id_list.biblio.record_entry.search.isbn.atomic', $isbn )
+               } ) {
+                       if (! $rec_set{ $rec }) {
+                               $rec_set{ $rec } = 1;
+                               push @recs, $rec;
+                       }
+               }
+       }
        return { ids => \@recs, count => scalar(@recs) };
 }