]> git.evergreen-ils.org Git - Evergreen.git/blob - Open-ILS/src/perlmods/OpenILS/Application/Search/Biblio.pm
cleaning up code from cat days.
[Evergreen.git] / Open-ILS / src / perlmods / OpenILS / Application / Search / Biblio.pm
1 package OpenILS::Application::Search::Biblio;
2 use base qw/OpenSRF::Application/;
3 use strict; use warnings;
4
5 use JSON;
6 use OpenILS::Utils::Fieldmapper;
7 use OpenILS::Utils::ModsParser;
8 use OpenSRF::Utils::SettingsClient;
9
10 use OpenILS::Application::AppUtils;
11
12 use JSON;
13
14 use Time::HiRes qw(time);
15 use OpenSRF::EX qw(:try);
16 use Digest::MD5 qw(md5_hex);
17
18 use XML::LibXML;
19 use XML::LibXSLT;
20
21 my $apputils = "OpenILS::Application::AppUtils";
22
23 # Houses biblio search utilites 
24
25 __PACKAGE__->register_method(
26         method  => "biblio_search_marc",
27         api_name        => "open-ils.search.biblio.marc",
28         argc            => 1, 
29         note            => "Searches biblio information by marc tag",
30 );
31
32 sub biblio_search_marc {
33
34         my( $self, $client, $search_hash, $string ) = @_;
35
36         warn "Building biblio marc session\n";
37         my $session = OpenSRF::AppSession->create("open-ils.storage");
38
39         use Data::Dumper;
40         warn "Sending biblio marc request. String $string\nSearch hash: " . Dumper($search_hash);
41         my $request = $session->request( 
42                         "open-ils.storage.direct.metabib.full_rec.search_fts.index_vector.atomic", 
43                         restrict => $search_hash, 
44                         term            => $string );
45         my $data = $request->gather(1);
46
47         warn Dumper $data;
48
49         $session->finish();
50         $session->disconnect();
51
52         return $data;
53
54 }
55
56
57
58 # ---------------------------------------------------------------------------
59 # takes a list of record id's and turns the docs into friendly 
60 # mods structures. Creates one MODS structure for each doc id.
61 # ---------------------------------------------------------------------------
62 sub _records_to_mods {
63         my @ids = @_;
64         
65         my @results;
66         my @marcxml_objs;
67
68         my $session = OpenSRF::AppSession->create("open-ils.storage");
69         my $request = $session->request(
70                         "open-ils.storage.direct.biblio.record_entry.batch.retrieve",  @ids );
71
72         my $last_content = undef;
73
74         while( my $response = $request->recv() ) {
75
76                 if( $last_content ) {
77                         my $u = OpenILS::Utils::ModsParser->new();
78                         $u->start_mods_batch( $last_content->marc );
79                         my $mods = $u->finish_mods_batch();
80                         $mods->doc_id($last_content->id());
81                         warn "Turning doc " . $mods->doc_id() . " into MODS\n";
82                         $last_content = undef;
83                         push @results, $mods;
84                 }
85
86                 next unless $response;
87
88                 if($response->isa("OpenSRF::EX")) {
89                         throw $response ($response->stringify);
90                 }
91
92                 $last_content = $response->content;
93
94         }
95
96         if( $last_content ) {
97                 my $u = OpenILS::Utils::ModsParser->new();
98                 $u->start_mods_batch( $last_content->marc );
99                 my $mods = $u->finish_mods_batch();
100                 $mods->doc_id($last_content->id());
101                 push @results, $mods;
102         }
103
104         $request->finish();
105         $session->finish();
106         $session->disconnect();
107
108         return \@results;
109
110 }
111
112 __PACKAGE__->register_method(
113         method  => "record_id_to_mods",
114         api_name        => "open-ils.search.biblio.record.mods.retrieve",
115         argc            => 1, 
116         note            => "Provide ID, we provide the mods"
117 );
118
119 # converts a record into a mods object with copy counts attached
120 sub record_id_to_mods {
121
122         my( $self, $client, $org_id, $id ) = @_;
123
124         my $mods_list = _records_to_mods( $id );
125         my $mods_obj = $mods_list->[0];
126         my $cmethod = $self->method_lookup(
127                         "open-ils.search.biblio.record.copy_count");
128         my ($count) = $cmethod->run($org_id, $id);
129         $mods_obj->copy_count($count);
130
131         return $mods_obj;
132 }
133
134
135 __PACKAGE__->register_method(
136         method  => "record_id_to_mods_slim",
137         api_name        => "open-ils.search.biblio.record.mods_slim.retrieve",
138         argc            => 1, 
139         note            => "Provide ID, we provide the mods"
140 );
141
142 # converts a record into a mods object with NO copy counts attached
143 sub record_id_to_mods_slim {
144
145         my( $self, $client, $id ) = @_;
146         warn "Retrieving MODS object for record $id\n";
147         return undef unless(defined $id);
148
149         my $mods_list = _records_to_mods( $id );
150         my $mods_obj = $mods_list->[0];
151         return $mods_obj;
152 }
153
154
155 # Returns the number of copies attached to a record based on org location
156 __PACKAGE__->register_method(
157         method  => "record_id_to_copy_count",
158         api_name        => "open-ils.search.biblio.record.copy_count",
159 );
160
161 __PACKAGE__->register_method(
162         method  => "record_id_to_copy_count",
163         api_name        => "open-ils.search.biblio.metarecord.copy_count",
164 );
165 sub record_id_to_copy_count {
166         my( $self, $client, $org_id, $record_id ) = @_;
167
168         my $method = "open-ils.storage.biblio.record_entry.copy_count.atomic";
169         my $key = "record";
170         if($self->api_name =~ /metarecord/) {
171                 $method = "open-ils.storage.metabib.metarecord.copy_count.atomic";
172                 $key = "metarecord";
173         }
174
175         my $session = OpenSRF::AppSession->create("open-ils.storage");
176         warn "copy_count retrieve $record_id\n";
177         return undef unless(defined $record_id);
178
179         my $request = $session->request(
180                 $method, org_unit => $org_id => $key => $record_id );
181
182
183         my $count = $request->gather(1);
184         $session->disconnect();
185         return [ sort { $a->{depth} <=> $b->{depth} } @$count ];
186
187 }
188
189
190 # used for cat search classes
191 my $cat_search_hash =  {
192
193         author => [ 
194                 { tag => "100", subfield => "a"} ,
195                 { tag => "700", subfield => "a"}, 
196         ],
197
198         title => [ 
199                 { tag => "245", subfield => "a"},
200                 { tag => "242", subfield => "a"}, 
201                 { tag => "240", subfield => "a"},
202                 { tag => "210", subfield => "a"},
203         ],
204
205         subject => [ 
206                 { tag => "650", subfield => "_" }, 
207         ],
208
209         tcn     => [
210                 { tag => "035", subfield => "_" },
211         ],
212
213         isbn    => [
214                 { tag => "020", subfield => "a" },
215         ],
216
217 };
218
219
220 __PACKAGE__->register_method(
221         method  => "biblio_search_tcn",
222         api_name        => "open-ils.search.biblio.tcn",
223         argc            => 3, 
224         note            => "Retrieve a record by TCN",
225 );
226
227 sub biblio_search_tcn {
228
229         my( $self, $client, $tcn ) = @_;
230
231         $tcn =~ s/.*?(\w+)\s*$/$1/o;
232         warn "Searching TCN $tcn\n";
233
234         my $session = OpenSRF::AppSession->create( "open-ils.storage" );
235         my $request = $session->request( 
236                         "open-ils.storage.direct.biblio.record_entry.search.tcn_value", $tcn );
237         my $response = $request->recv();
238
239
240         unless ($response) { return []; }
241
242         if(UNIVERSAL::isa($response,"OpenSRF::EX")) {
243                 warn "Received exception for tcn search\n";
244                 throw $response ($response->stringify);
245         }
246
247         my $record_entry = $response->content;
248         my @ids;
249         for my $record (@$record_entry) {
250                 push @ids, $record->id;
251         }
252
253         warn "received ID's for tcn search @ids\n";
254
255         my $size = @ids;
256         return { count => $size, ids => \@ids };
257
258 }
259
260
261 # --------------------------------------------------------------------------------
262 # ISBN
263
264 __PACKAGE__->register_method(
265         method  => "biblio_search_isbn",
266         api_name        => "open-ils.search.biblio.isbn",
267 );
268
269 sub biblio_search_isbn { 
270         my( $self, $client, $isbn ) = @_;
271         throw OpenSRF::EX::InvalidArg 
272
273                 ("biblio_search_isbn needs an ISBN to search")
274                         unless defined $isbn;
275
276         warn "biblio search for ISBN $isbn\n";
277         my $method = $self->method_lookup("open-ils.search.biblio.marc");
278         my ($records) = $method->run( $cat_search_hash->{isbn}, $isbn );
279
280 =head
281         for my $i (@$records) { 
282                 if(defined($i)) { 
283                         push @ids, $i->[0]; 
284                 }
285         }
286 =cut
287
288         my $size = @$records;
289         return { count => $size, ids => $records };
290 }
291
292
293
294 # --------------------------------------------------------------------------------
295
296 __PACKAGE__->register_method(
297         method  => "biblio_barcode_to_copy",
298         api_name        => "open-ils.search.asset.copy.find_by_barcode",
299 );
300
301 # turns a barcode into a copy object
302 sub biblio_barcode_to_copy { 
303         my( $self, $client, $barcode ) = @_;
304
305         throw OpenSRF::EX::InvalidArg 
306                 ("search.biblio.barcode needs a barcode to search")
307                         unless defined $barcode;
308
309         warn "copy search for barcode $barcode\n";
310         my $record = OpenILS::Application::AppUtils->simple_scalar_request(
311                         "open-ils.storage", 
312                         "open-ils.storage.direct.asset.copy.search.barcode",
313                         $barcode );
314
315         return undef unless($record);
316         return $record->[0];
317
318 }
319
320 __PACKAGE__->register_method(
321         method  => "biblio_barcode_to_title",
322         api_name        => "open-ils.search.biblio.find_by_barcode",
323 );
324
325 sub biblio_barcode_to_title {
326         my( $self, $client, $barcode ) = @_;
327
328         if(!$barcode) {
329                 throw OpenSRF::EX::ERROR 
330                         ("Not enough args to find_by_barcode");
331         }
332
333         my $title = $apputils->simple_scalar_request(
334                 "open-ils.storage",
335                 "open-ils.storage.biblio.record_entry.retrieve_by_barcode",
336                 $barcode );
337
338         return { ids => $title->id, count => 1 };
339
340 =head
341         my $u = OpenILS::Utils::ModsParser->new();
342         $u->start_mods_batch( $title->marc );
343         my $mods = $u->finish_mods_batch();
344         $mods->doc_id($title->id());
345         return $mods;
346 =cut
347         
348 }
349
350
351 __PACKAGE__->register_method(
352         method  => "biblio_copy_to_mods",
353         api_name        => "open-ils.search.biblio.copy.mods.retrieve",
354 );
355
356 # takes a copy object and returns it fleshed mods object
357 sub biblio_copy_to_mods {
358         my( $self, $client, $copy ) = @_;
359
360         throw OpenSRF::EX::InvalidArgs 
361                 ("copy.mods.retrieve needs a copy") unless( $copy );
362
363         new Fieldmapper::asset::copy($copy);
364
365         my $volume = OpenILS::Application::AppUtils->simple_scalar_request(
366                 "open-ils.storage",
367                 "open-ils.storage.direct.asset.call_number.retrieve",
368                 $copy->call_number() );
369
370         my $mods = _records_to_mods($volume->record());
371         $mods = shift @$mods;
372         $volume->copies([$copy]);
373         push @{$mods->call_numbers()}, $volume;
374
375         return $mods;
376 }
377
378
379 sub barcode_to_mods {
380
381 }
382
383
384 # --------------------------------------------------------------------------------
385
386 __PACKAGE__->register_method(
387         method  => "cat_biblio_search_class",
388         api_name        => "open-ils.search.cat.biblio.class",
389         argc            => 3, 
390         note            => "Searches biblio information by search class",
391 );
392
393 sub cat_biblio_search_class {
394
395         my( $self, $client, $org_id, $class, $sort, $string ) = @_;
396
397         throw OpenSRF::EX::InvalidArg 
398                 ("Not enough args to open-ils.search.cat.biblio.class")
399                         unless( defined($org_id) and $class and $sort and $string );
400
401
402         my $search_hash;
403
404         my $method = $self->method_lookup("open-ils.search.biblio.marc");
405         if(!$method) {
406                 throw OpenSRF::EX::PANIC 
407                         ("Can't lookup method 'open-ils.search.biblio.marc'");
408         }
409
410         my ($records) = $method->run( $cat_search_hash->{$class}, $string );
411
412         my @ids;
413         for my $i (@$records) { push @ids, $i->[0]; }
414
415         my $mods_list = _records_to_mods( @ids );
416         return undef unless (ref($mods_list) eq "ARRAY");
417
418         # ---------------------------------------------------------------
419         # append copy count information to the mods objects
420         my $session = OpenSRF::AppSession->create("open-ils.storage");
421
422         my $request = $session->request(
423                 "open-ils.storage.direct.biblio.record_copy_count.batch",  $org_id, @ids );
424
425         for my $id (@ids) {
426
427                 warn "receiving copy counts for doc $id\n";
428
429                 my $response = $request->recv();
430                 next unless $response;
431
432                 if( $response and UNIVERSAL::isa($response, "Error")) {
433                         throw $response ($response->stringify);
434                 }
435
436                 my $count = $response->content;
437                 my $mods_obj = undef;
438                 for my $m (@$mods_list) {
439                         $mods_obj = $m if ($m->doc_id() == $id)
440                 }
441                 if($mods_obj) {
442                         $mods_obj->copy_count($count);
443                 }
444
445                 $client->respond( $mods_obj );
446
447         }       
448         $request->finish();
449
450         $session->finish();
451         $session->disconnect();
452         $session->kill_me();
453         # ---------------------------------------------------------------
454
455         return undef;
456 }
457
458
459
460 __PACKAGE__->register_method(
461         method  => "cat_biblio_search_class_id",
462         api_name        => "open-ils.search.cat.biblio.class.id",
463         argc            => 3, 
464         note            => "Searches biblio information by search class and returns the IDs",
465 );
466
467 sub cat_biblio_search_class_id {
468
469         my( $self, $client, $org_id, $class, $string, $limit, $offset ) = @_;
470
471         $offset ||= 0;
472         $limit  ||= 100;
473         $limit -= 1;
474
475
476         $string = OpenILS::Application::Search->filter_search($string);
477         if(!$string) { return undef; }
478
479         warn "Searching cat.biblio.class.id string: $string offset: $offset limit: $limit\n";
480
481         throw OpenSRF::EX::InvalidArg 
482                 ("Not enough args to open-ils.search.cat.biblio.class")
483                         unless( defined($org_id) and $class and $string );
484
485
486         my $search_hash;
487
488         my $cache_key = md5_hex( $org_id . $class . $string );
489         my $id_array = OpenILS::Application::SearchCache->get_cache($cache_key);
490
491         if(ref($id_array)) {
492                 warn "Returning class search from cache\n";
493                 my $size = @$id_array;
494                 my @ids = @$id_array[ $offset..($offset+$limit) ];
495                 return { count => $size, ids => \@ids };
496         }
497
498         my $method = $self->method_lookup("open-ils.search.biblio.marc");
499         if(!$method) {
500                 throw OpenSRF::EX::PANIC 
501                         ("Can't lookup method 'open-ils.search.biblio.marc'");
502         }
503
504         my ($records) = $method->run( $cat_search_hash->{$class}, $string );
505
506         my @cache_ids;
507
508         for my $i (@$records) { 
509                 if(defined($i->[0])) {
510                         push @cache_ids, $i->[0]; 
511                 }
512         }
513
514         my @ids = @cache_ids[ $offset..($offset+$limit) ];
515         my $size = @$records;
516
517         OpenILS::Application::SearchCache->put_cache( 
518                         $cache_key, \@cache_ids, $size );
519
520         return { count =>$size, ids => \@ids };
521
522 }
523
524
525 __PACKAGE__->register_method(
526         method  => "biblio_search_class",
527         api_name        => "open-ils.search.biblio.class",
528         argc            => 3, 
529         note            => "Searches biblio information by search class and returns the IDs",
530 );
531
532 sub biblio_search_class {
533
534         my( $self, $client, $class, $string, 
535                         $org_id, $org_type, $limit, $offset ) = @_;
536
537         warn "org: $org_id : depth: $org_type : limit: $limit :  offset: $offset\n";
538
539         $offset         ||= 0;
540         $limit          = 100 unless defined($limit and $limit > 0 );
541         $org_id         = "1" unless defined($org_id); # xxx
542         $org_type       = 0     unless defined($org_type);
543
544         warn "Searching biblio.class.id\n" . 
545                 "string: $string "              . 
546                 "\noffset: $offset\n"   .
547                 "limit: $limit\n"                       .
548                 "org_id: $org_id\n"             .
549                 "depth: $org_type\n" ;
550
551         $string = OpenILS::Application::Search->filter_search($string);
552         if(!$string) { return undef; }
553
554         if( !defined($org_id) or !$class or !$string ) {
555                 warn "not enbough args to metarecord search\n";
556                 throw OpenSRF::EX::InvalidArg 
557                         ("Not enough args to open-ils.search.cat.biblio.class")
558         }
559
560         $class =~ s/\s+//g;
561
562         if( ($class ne "title") and ($class ne "author") and 
563                 ($class ne "subject") and ($class ne "keyword") ) {
564                 warn "Invalid search class: $class\n";
565                 throw OpenSRF::EX::InvalidArg ("Not a valid search class: $class")
566         }
567
568         # grab the mr id's from storage
569
570         my $method = "open-ils.storage.metabib.$class.search_fts.metarecord_count";
571         warn "Performing count method $method\n";
572         my $session = OpenSRF::AppSession->create('open-ils.storage');
573
574         my $request = $session->request( $method, 
575                         term => $string, 
576                         org_unit => $org_id, 
577                         depth =>$org_type );
578
579         my $response = $request->recv();
580
581         if(UNIVERSAL::isa($response, "OpenSRF::EX")) {
582                 throw $response ($response->stringify);
583         }
584
585         my $count = $response->content;
586         warn "Received count $count\n";
587         # XXX check count size and respond accordingly
588
589         $request->finish();
590         $request = $session->request(   
591                 #"open-ils.storage.cachable.metabib.$class.search_fts.metarecord.atomic",
592                 "open-ils.storage.cachable.metabib.$class.search_fts.metarecord.atomic",
593                 term            => $string, 
594                 org_unit => $org_id, 
595                 depth           => $org_type, 
596                 limit           => $limit,
597                 offset  => $offset,
598                 );
599
600         $response = $request->recv();
601
602         if(UNIVERSAL::isa($response, "OpenSRF::EX")) {
603                 warn "Recieved Exception from storage: " . $response->stringify . "\n";
604                 $response->{'msg'} = $response->stringify();
605                 throw $response ($response->stringify);
606         }
607
608
609         my $records = $response->content;
610
611         my @all_ids;
612
613         # if we just get one, it won't be wrapped in an array
614         if(!ref($records->[0])) {
615                 $records = [$records];
616         }
617
618         for my $i (@$records) { 
619                 if(defined($i)) {
620                         push @all_ids, $i; 
621                 }
622         }
623
624         #my @ids = @all_ids[ $offset..($offset+$limit) ];
625         my @ids = @all_ids;
626         @ids = grep { defined($_->[0]) } @ids;
627
628         $request->finish();
629         $session->finish();
630         $session->disconnect();
631
632         return { count =>$count, ids => \@ids };
633
634 }
635
636
637
638
639 __PACKAGE__->register_method(
640         method  => "biblio_mrid_to_modsbatch",
641         api_name        => "open-ils.search.biblio.metarecord.mods_slim.retrieve",
642 );
643
644 sub biblio_mrid_to_modsbatch {
645         my( $self, $client, $mrid ) = @_;
646
647         throw OpenSRF::EX::InvalidArg 
648                 ("search.biblio.metarecord_to_mods requires mr id")
649                         unless defined( $mrid );
650
651
652         my $metarecord = OpenILS::Application::AppUtils->simple_scalar_request( "open-ils.storage", 
653                         "open-ils.storage.direct.metabib.metarecord.retrieve", $mrid );
654
655         if(!$metarecord) {
656                 throw OpenSRF::EX::ERROR ("No metarecord exists with the given id: $mrid");
657         }
658
659         my $master_id = $metarecord->master_record();
660
661
662         # check for existing mods
663         if($metarecord->mods()){
664                 warn "We already have mods for " . $metarecord->id . "\n";
665                 my $perl = JSON->JSON2perl($metarecord->mods());
666                 return Fieldmapper::metabib::virtual_record->new($perl);
667         }
668
669
670
671         warn "Creating mods batch for metarecord $mrid\n";
672         my $id_hash = biblio_mrid_to_record_ids( undef, undef,  $mrid );
673         my @ids = @{$id_hash->{ids}};
674
675         if(@ids < 1) { return undef; }
676
677         warn "Master ID is $master_id\n";
678         # grab the master record to start the mods batch 
679
680         my $record = OpenILS::Application::AppUtils->simple_scalar_request( "open-ils.storage", 
681                         "open-ils.storage.direct.biblio.record_entry.retrieve", $master_id );
682
683         if(!$record) {
684                 throw OpenSRF::EX::ERROR 
685                         ("No record returned with id $master_id");
686         }
687
688         my $u = OpenILS::Utils::ModsParser->new();
689         use Data::Dumper;
690         $u->start_mods_batch( $record->marc );
691         my $main_doc_id = $record->id();
692
693         @ids = grep { $_ ne $master_id } @ids;
694
695         # now we have to collect all of the marc objects and push them into a mods batch
696         my $session = OpenSRF::AppSession->create("open-ils.storage");
697         my $request = $session->request(
698                 "open-ils.storage.direct.biblio.record_entry.batch.retrieve",  @ids );
699
700         while( my $response = $request->recv() ) {
701
702                 next unless $response;
703                 if(UNIVERSAL::isa( $response,"OpenSRF::EX")) {
704                         throw $response ($response->stringify);
705                 }
706
707                 my $content = $response->content;
708
709                 if( $content ) {
710                         $u->push_mods_batch( $content->marc );
711                 }
712         }
713
714         my $mods = $u->finish_mods_batch();
715         $mods->doc_id($mrid);
716         $request->finish();
717
718         $client->respond_complete($mods);
719
720         my $mods_string = JSON->perl2JSON($mods->decast);
721
722         $metarecord->mods($mods_string);
723
724         my $req = $session->request( 
725                         "open-ils.storage.direct.metabib.metarecord.update", 
726                         $metarecord );
727
728
729         $req->gather(1);
730
731         $session->finish();
732         $session->disconnect();
733
734         return undef;
735
736 }
737
738
739
740 # converts a mr id into a list of record ids
741
742 __PACKAGE__->register_method(
743         method  => "biblio_mrid_to_record_ids",
744         api_name        => "open-ils.search.biblio.metarecord_to_records",
745 );
746
747 sub biblio_mrid_to_record_ids {
748         my( $self, $client, $mrid ) = @_;
749
750         throw OpenSRF::EX::InvalidArg 
751                 ("search.biblio.metarecord_to_record_ids requires mr id")
752                         unless defined( $mrid );
753
754         warn "Searching for record for MR $mrid\n";
755
756         my $mrmaps = OpenILS::Application::AppUtils->simple_scalar_request( "open-ils.storage", 
757                         "open-ils.storage.direct.metabib.metarecord_source_map.search.metarecord", $mrid );
758
759         my @ids;
760         for my $map (@$mrmaps) { push @ids, $map->source(); }
761
762         warn "Recovered id's [@ids] for mr $mrid\n";
763
764         my $size = @ids;
765
766         return { count => $size, ids => \@ids };
767
768 }
769
770
771
772 __PACKAGE__->register_method(
773         method  => "biblio_record_to_marc_html",
774         api_name        => "open-ils.search.biblio.record.html" );
775
776 my $parser              = XML::LibXML->new();
777 my $xslt                        = XML::LibXSLT->new();
778 my $marc_sheet;
779
780 my $settings_client = OpenSRF::Utils::SettingsClient->new();
781 sub biblio_record_to_marc_html {
782         my( $self, $client, $recordid ) = @_;
783
784         if( !$marc_sheet ) {
785                 my $dir = $settings_client->config_value( "dirs", "xsl" );
786                 my $xsl = $settings_client->config_value(
787                         "apps", "open-ils.search", "app_settings", "marc_html_xsl" );
788
789                 $xsl = $parser->parse_file("$dir/$xsl");
790                 $marc_sheet = $xslt->parse_stylesheet( $xsl );
791         }
792
793
794         my $record = $apputils->simple_scalar_request(
795                 "open-ils.storage", 
796                 "open-ils.storage.direct.biblio.record_entry.retrieve",
797                 $recordid );
798
799         my $xmldoc = $parser->parse_string($record->marc);
800         my $html = $marc_sheet->transform($xmldoc);
801         $html = $html->toString();
802         return $html;
803
804 }
805
806
807
808 __PACKAGE__->register_method(
809         method  => "retrieve_all_copy_locations",
810         api_name        => "open-ils.search.config.copy_location.retrieve.all" );
811
812 my $shelving_locations;
813 sub retrieve_all_copy_locations {
814         my( $self, $client ) = @_;
815         if(!$shelving_locations) {
816                 $shelving_locations = $apputils->simple_scalar_request(
817                         "open-ils.storage", 
818                         "open-ils.storage.direct.asset.copy_location.retrieve.all.atomic");
819         }
820         return $shelving_locations;
821 }
822
823
824
825
826 1;