Bugzilla – Attachment 191497 Details for
Bug 41618
Add item data in marc returned by the api
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 41618: Add x-koha-embed 'items' flag to preserve default behavior
Bug-41618-Add-x-koha-embed-items-flag-to-preserve-.patch (text/plain), 3.94 KB, created by
Shi Yao Wang
on 2026-01-15 14:35:21 UTC
(
hide
)
Description:
Bug 41618: Add x-koha-embed 'items' flag to preserve default behavior
Filename:
MIME Type:
Creator:
Shi Yao Wang
Created:
2026-01-15 14:35:21 UTC
Size:
3.94 KB
patch
obsolete
>From 717d00c5cbf3103cfdace3e78df2191fd3ca6b70 Mon Sep 17 00:00:00 2001 >From: Shi Yao Wang <shi-yao.wang@inlibro.com> >Date: Thu, 15 Jan 2026 09:32:34 -0500 >Subject: [PATCH] Bug 41618: Add x-koha-embed 'items' flag to preserve default > behavior > >--- > Koha/REST/V1/Biblios.pm | 15 ++++++++++----- > api/v1/swagger/paths/biblios.yaml | 20 ++++++++++++++++++++ > 2 files changed, 30 insertions(+), 5 deletions(-) > >diff --git a/Koha/REST/V1/Biblios.pm b/Koha/REST/V1/Biblios.pm >index 629f3a25be4..e40b861c745 100644 >--- a/Koha/REST/V1/Biblios.pm >+++ b/Koha/REST/V1/Biblios.pm >@@ -68,7 +68,10 @@ sub get { > ); > } else { > my $metadata = $biblio->metadata; >- my $record = $metadata->record( { embed_items => 1 } ); >+ >+ my $embed = $c->stash('koha.embed'); >+ my $record = $metadata->record( { embed_items => (exists $embed->{items} ? 1 : 0) } ); >+ > my $schema = $metadata->schema // C4::Context->preference("marcflavour"); > > $c->respond_to( >@@ -781,6 +784,8 @@ sub list { > my $biblios = $c->objects->search_rs( $rs, [ ( sub { $rs->api_query_fixer( $_[0], '', $_[1] ) } ) ] ); > > return try { >+ my $embed = $c->stash('koha.embed'); >+ my $embed_items = exists $embed->{items} ? 1 : 0; > > if ( $c->req->headers->accept =~ m/application\/json(;.*)?$/ ) { > return $c->render( >@@ -791,24 +796,24 @@ sub list { > $c->res->headers->add( 'Content-Type', 'application/marcxml+xml' ); > return $c->render( > status => 200, >- text => $biblios->print_collection('marcxml', 1) >+ text => $biblios->print_collection('marcxml', $embed_items) > ); > } elsif ( $c->req->headers->accept =~ m/application\/marc-in-json(;.*)?$/ ) { > $c->res->headers->add( 'Content-Type', 'application/marc-in-json' ); > return $c->render( > status => 200, >- data => $biblios->print_collection('mij', 1) >+ data => $biblios->print_collection('mij', $embed_items) > ); > } elsif ( $c->req->headers->accept =~ m/application\/marc(;.*)?$/ ) { > $c->res->headers->add( 'Content-Type', 'application/marc' ); > return $c->render( > status => 200, >- text => $biblios->print_collection('marc', 1) >+ text => $biblios->print_collection('marc', $embed_items) > ); > } elsif ( $c->req->headers->accept =~ m/text\/plain(;.*)?$/ ) { > return $c->render( > status => 200, >- text => $biblios->print_collection('txt', 1) >+ text => $biblios->print_collection('txt', $embed_items) > ); > } else { > return $c->render( >diff --git a/api/v1/swagger/paths/biblios.yaml b/api/v1/swagger/paths/biblios.yaml >index 18120c5dd98..4e5663f304e 100644 >--- a/api/v1/swagger/paths/biblios.yaml >+++ b/api/v1/swagger/paths/biblios.yaml >@@ -78,6 +78,16 @@ > - $ref: "../swagger.yaml#/parameters/q_param" > - $ref: "../swagger.yaml#/parameters/q_body" > - $ref: "../swagger.yaml#/parameters/request_id_header" >+ - name: x-koha-embed >+ in: header >+ required: false >+ description: Embed list sent as a request header >+ type: array >+ items: >+ type: string >+ enum: >+ - items >+ collectionFormat: csv > produces: > - application/json > - application/marcxml+xml >@@ -136,6 +146,16 @@ > summary: Get biblio > parameters: > - $ref: "../swagger.yaml#/parameters/biblio_id_pp" >+ - name: x-koha-embed >+ in: header >+ required: false >+ description: Embed list sent as a request header >+ type: array >+ items: >+ type: string >+ enum: >+ - items >+ collectionFormat: csv > produces: > - application/json > - application/marcxml+xml >-- >2.43.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 41618
:
191440
|
191496
| 191497