Bugzilla – Attachment 172397 Details for
Bug 38093
Bundles: Add MARC link options should also add a link in 462
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 38093: Bundles: Remove the link created in 462 when removing from the bundle
Bug-38093-Bundles-Remove-the-link-created-in-462-w.patch (text/plain), 2.20 KB, created by
Baptiste Wojtkowski (bwoj)
on 2024-10-04 13:06:10 UTC
(
hide
)
Description:
Bug 38093: Bundles: Remove the link created in 462 when removing from the bundle
Filename:
MIME Type:
Creator:
Baptiste Wojtkowski (bwoj)
Created:
2024-10-04 13:06:10 UTC
Size:
2.20 KB
patch
obsolete
>From 1481f65815e2589819705ae7a5770aa85b91a08d Mon Sep 17 00:00:00 2001 >From: Baptiste Wojtkowski <bski@laposte.net> >Date: Fri, 4 Oct 2024 11:59:58 +0200 >Subject: [PATCH] Bug 38093: Bundles: Remove the link created in 462 when > removing from the bundle > >--- > Koha/Biblio.pm | 32 ++++++++++++++++++++++++++++++++ > Koha/REST/V1/Items.pm | 1 + > 2 files changed, 33 insertions(+) > >diff --git a/Koha/Biblio.pm b/Koha/Biblio.pm >index c2c011fe..6831dd7d 100644 >--- a/Koha/Biblio.pm >+++ b/Koha/Biblio.pm >@@ -2039,6 +2039,38 @@ sub link_marc_bundled_item { > return $self; > } > >+=head3 unlink_marc_bundled_item >+ >+ $biblio->unlink_marc_bundled_item({ bundled_item => $item }); >+ $biblio->unlink_marc_bundled_item({ bundled_item => $itemnumber }); >+ >+Remove the link to the child created by link_marc_bundled_item. Expects either the item object or itemnumber of the host to link to. >+ >+=cut >+ >+sub unlink_marc_bundled_item { >+ my ( $self, $params ) = @_; >+ my $bundled_item_itemnumber; >+ if ( ref( $params->{bundled_item} ) eq 'Koha::Item' ) { >+ $bundled_item_itemnumber = $params->{bundled_item}->itemnumber; >+ } else { >+ $bundled_item_itemnumber = $params->{bundled_item}; >+ } >+ >+ my $record = $self->metadata->record; >+ my $field_number = C4::Context->preference('marcflavour') eq 'MARC21' ? '774' : '462'; >+ my @fields = $record->field($field_number); >+ >+ foreach my $field (@fields) { >+ my $subfield_itemnumber = $field->subfield('9') // q{}; >+ if ( $bundled_item_itemnumber eq $subfield_itemnumber ) { >+ $record->delete_field($field); >+ } >+ } >+ >+ C4::Biblio::ModBiblio( $record, $self->biblionumber ); >+} >+ > =head3 recalls > > my $recalls = $biblio->recalls; >diff --git a/Koha/REST/V1/Items.pm b/Koha/REST/V1/Items.pm >index 96978370..8c5b501e 100644 >--- a/Koha/REST/V1/Items.pm >+++ b/Koha/REST/V1/Items.pm >@@ -413,6 +413,7 @@ sub remove_from_bundle { > > return try { > $bundle_item->biblio->unlink_marc_host({ host => $item->biblio }); >+ $item->biblio->unlink_marc_bundled_item( { bundled_item => $bundle_item } ); > $bundle_item->remove_from_bundle; > return $c->render_resource_deleted; > } catch { >-- >2.30.2
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 38093
:
172395
|
172396
| 172397