From ff15d86fa627c4315cddae28af7c910e5345a384 Mon Sep 17 00:00:00 2001 From: miker Date: Tue, 14 Feb 2006 04:45:58 +0000 Subject: [PATCH] commenting oISBN git-svn-id: svn://svn.open-ils.org/ILS/trunk@3066 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- .../src/perlmods/OpenILS/Application/SuperCat.pm | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/Open-ILS/src/perlmods/OpenILS/Application/SuperCat.pm b/Open-ILS/src/perlmods/OpenILS/Application/SuperCat.pm index 0f835624df..cec1d1205b 100644 --- a/Open-ILS/src/perlmods/OpenILS/Application/SuperCat.pm +++ b/Open-ILS/src/perlmods/OpenILS/Application/SuperCat.pm @@ -295,35 +295,47 @@ sub oISBN { my $client = shift; my $isbn = shift; + throw OpenSRF::EX::InvalidArg ('I need an ISBN please') + unless (length($isbn) >= 10); + + # Create a storage session, since we'll be making muliple requests. $_storage->connect; + # Find the record that has that ISBN. my $bibrec = $_storage->request( 'open-ils.storage.direct.metabib.full_rec.search_where.atomic', { tag => '020', subfield => 'a', value => { like => $isbn.'%'} } )->gather(1); + # Go away if we don't have one. return {} unless (@$bibrec); + # Find the metarecord for that bib record. my $mr = $_storage->request( 'open-ils.storage.direct.metabib.metarecord_source_map.search.source.atomic', $bibrec->[0]->record )->gather(1); + # Find the other records for that metarecord. my $records = $_storage->request( 'open-ils.storage.direct.metabib.metarecord_source_map.search.metarecord.atomic', $mr->[0]->metarecord )->gather(1); + # Just to be safe. There's currently no unique constraint on sources... my %unique_recs = map { ($_->source, 1) } @$records; my @rec_list = sort keys %unique_recs; + # And now fetch the ISBNs for thos records. my $recs = $_storage->request( 'open-ils.storage.direct.metabib.full_rec.search_where.atomic', { tag => '020', subfield => 'a', record => \@rec_list } )->gather(1); + # We're done with the storage server session. $_storage->disconnect; + # Return the oISBN data structure. This will be XMLized at a higher layer. return { metarecord => $mr->[0]->metarecord, record_list => { map { ($_->record, $_->value) } @$recs } }; } @@ -338,8 +350,8 @@ Returns the ISBN list for the metarecord of the requested isbn DESC params => [ - { name => 'recordId', - desc => 'An OpenILS biblio::record_entry id', + { name => 'isbn', + desc => 'An ISBN. Duh.', type => 'string' }, ], 'return' => -- 2.43.2