|
Lines 68-74
sub get {
Link Here
|
| 68 |
); |
68 |
); |
| 69 |
} else { |
69 |
} else { |
| 70 |
my $metadata = $biblio->metadata; |
70 |
my $metadata = $biblio->metadata; |
| 71 |
my $record = $metadata->record( { embed_items => 1 } ); |
71 |
|
|
|
72 |
my $embed = $c->stash('koha.embed'); |
| 73 |
my $record = $metadata->record( { embed_items => (exists $embed->{items} ? 1 : 0) } ); |
| 74 |
|
| 72 |
my $schema = $metadata->schema // C4::Context->preference("marcflavour"); |
75 |
my $schema = $metadata->schema // C4::Context->preference("marcflavour"); |
| 73 |
|
76 |
|
| 74 |
$c->respond_to( |
77 |
$c->respond_to( |
|
Lines 781-786
sub list {
Link Here
|
| 781 |
my $biblios = $c->objects->search_rs( $rs, [ ( sub { $rs->api_query_fixer( $_[0], '', $_[1] ) } ) ] ); |
784 |
my $biblios = $c->objects->search_rs( $rs, [ ( sub { $rs->api_query_fixer( $_[0], '', $_[1] ) } ) ] ); |
| 782 |
|
785 |
|
| 783 |
return try { |
786 |
return try { |
|
|
787 |
my $embed = $c->stash('koha.embed'); |
| 788 |
my $embed_items = exists $embed->{items} ? 1 : 0; |
| 784 |
|
789 |
|
| 785 |
if ( $c->req->headers->accept =~ m/application\/json(;.*)?$/ ) { |
790 |
if ( $c->req->headers->accept =~ m/application\/json(;.*)?$/ ) { |
| 786 |
return $c->render( |
791 |
return $c->render( |
|
Lines 791-814
sub list {
Link Here
|
| 791 |
$c->res->headers->add( 'Content-Type', 'application/marcxml+xml' ); |
796 |
$c->res->headers->add( 'Content-Type', 'application/marcxml+xml' ); |
| 792 |
return $c->render( |
797 |
return $c->render( |
| 793 |
status => 200, |
798 |
status => 200, |
| 794 |
text => $biblios->print_collection('marcxml', 1) |
799 |
text => $biblios->print_collection('marcxml', $embed_items) |
| 795 |
); |
800 |
); |
| 796 |
} elsif ( $c->req->headers->accept =~ m/application\/marc-in-json(;.*)?$/ ) { |
801 |
} elsif ( $c->req->headers->accept =~ m/application\/marc-in-json(;.*)?$/ ) { |
| 797 |
$c->res->headers->add( 'Content-Type', 'application/marc-in-json' ); |
802 |
$c->res->headers->add( 'Content-Type', 'application/marc-in-json' ); |
| 798 |
return $c->render( |
803 |
return $c->render( |
| 799 |
status => 200, |
804 |
status => 200, |
| 800 |
data => $biblios->print_collection('mij', 1) |
805 |
data => $biblios->print_collection('mij', $embed_items) |
| 801 |
); |
806 |
); |
| 802 |
} elsif ( $c->req->headers->accept =~ m/application\/marc(;.*)?$/ ) { |
807 |
} elsif ( $c->req->headers->accept =~ m/application\/marc(;.*)?$/ ) { |
| 803 |
$c->res->headers->add( 'Content-Type', 'application/marc' ); |
808 |
$c->res->headers->add( 'Content-Type', 'application/marc' ); |
| 804 |
return $c->render( |
809 |
return $c->render( |
| 805 |
status => 200, |
810 |
status => 200, |
| 806 |
text => $biblios->print_collection('marc', 1) |
811 |
text => $biblios->print_collection('marc', $embed_items) |
| 807 |
); |
812 |
); |
| 808 |
} elsif ( $c->req->headers->accept =~ m/text\/plain(;.*)?$/ ) { |
813 |
} elsif ( $c->req->headers->accept =~ m/text\/plain(;.*)?$/ ) { |
| 809 |
return $c->render( |
814 |
return $c->render( |
| 810 |
status => 200, |
815 |
status => 200, |
| 811 |
text => $biblios->print_collection('txt', 1) |
816 |
text => $biblios->print_collection('txt', $embed_items) |
| 812 |
); |
817 |
); |
| 813 |
} else { |
818 |
} else { |
| 814 |
return $c->render( |
819 |
return $c->render( |