From 35347c6aa119df285060602691cfe62461cae7e3 Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Wed, 18 May 2022 08:30:48 +0100 Subject: [PATCH] Bug 29560: Add option to create MARC Links when bundling items This patch add a checkbox to the 'Add to bundle' modal allowing the user to optionally add MARC links between the new child record and the current biblio. For MARC21 this will result in a 773 pointing to the host from the item record and for UNIMARC a 461 field will be added. --- Koha/REST/V1/Items.pm | 5 +++++ api/v1/swagger/definitions/bundle_link.yaml | 3 +++ koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt | 6 +++++- 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/Koha/REST/V1/Items.pm b/Koha/REST/V1/Items.pm index 88a0675257..34b95a2662 100644 --- a/Koha/REST/V1/Items.pm +++ b/Koha/REST/V1/Items.pm @@ -212,8 +212,13 @@ sub add_to_bundle { ); } + my $add_link = $c->validation->param('body')->{'marc_link'} // 0; return try { my $link = $item->add_to_bundle($bundle_item); + if ($add_link) { + $bundle_item->biblio->link_marc_host( + { biblionumber => $item->biblio->biblionumber } ); + } return $c->render( status => 201, openapi => $bundle_item diff --git a/api/v1/swagger/definitions/bundle_link.yaml b/api/v1/swagger/definitions/bundle_link.yaml index 572be83d8e..d30079b93e 100644 --- a/api/v1/swagger/definitions/bundle_link.yaml +++ b/api/v1/swagger/definitions/bundle_link.yaml @@ -11,4 +11,7 @@ properties: - string - "null" description: Item barcode + marc_link: + type: boolean + description: Is there a marc link for this item additionalProperties: false diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt index 14ac3460a4..274ebaffa4 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt @@ -1248,6 +1248,10 @@ Note that permanent location is a code, and location may be an authval. Required +
  • + + +
  • @@ -1757,7 +1761,7 @@ Note that permanent location is a code, and location may be an authval. /* Send the data using post with external_id */ var posting = $.post({ url: url, - data: JSON.stringify({ external_id: $('#external_id').val()}), + data: JSON.stringify({ external_id: $('#external_id').val(), marc_link: $('#link').prop('checked') }), contentType: "application/json; charset=utf-8", dataType: "json" }); -- 2.20.1