Bugzilla – Attachment 159255 Details for
Bug 35115
ERM - Potential MARC data loss when importing titles from list
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 35115: (QA follow-up):
Bug-35115-QA-follow-up.patch (text/plain), 4.02 KB, created by
Victor Grousset/tuxayo
on 2023-11-26 05:19:48 UTC
(
hide
)
Description:
Bug 35115: (QA follow-up):
Filename:
MIME Type:
Creator:
Victor Grousset/tuxayo
Created:
2023-11-26 05:19:48 UTC
Size:
4.02 KB
patch
obsolete
>From 38e702d8cb791dc88cff441380cd7926ed879be6 Mon Sep 17 00:00:00 2001 >From: Pedro Amorim <pedro.amorim@ptfs-europe.com> >Date: Fri, 10 Nov 2023 15:07:35 +0000 >Subject: [PATCH] Bug 35115: (QA follow-up): > >Spelling. >Tidyness. >Removal of leftover warn > >Nick's patch fixes the issue as described, and I agree that it is the ideal solution here. >prove t/db_dependent/api/v1/erm_eholdings* passes >prove t/db_dependent/Koha/BackgroundJob/CreateEHoldingsFromBiblios.t passes > >Signed-off-by: Pedro Amorim <pedro.amorim@ptfs-europe.com> >Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net> >--- > Koha/ERM/EHoldings/Title.pm | 18 +++++++++--------- > t/db_dependent/api/v1/erm_eholdings_titles.t | 4 ++-- > 2 files changed, 11 insertions(+), 11 deletions(-) > >diff --git a/Koha/ERM/EHoldings/Title.pm b/Koha/ERM/EHoldings/Title.pm >index 4a5c4e5ca1..129924b028 100644 >--- a/Koha/ERM/EHoldings/Title.pm >+++ b/Koha/ERM/EHoldings/Title.pm >@@ -44,22 +44,23 @@ sub store { > # * Provide a mapping for each attribute of title > # * Create a txn > >- # If the 'title' is alreay linked to a biblio, then we update the title subfield only >- if ( $self->biblio_id ){ >+ # If the 'title' is already linked to a biblio, then we update the title subfield only >+ if ( $self->biblio_id ) { > my $biblio = Koha::Biblios->find( $self->biblio_id ); >- my ($title_tag, $title_subfield) = GetMarcFromKohaField( 'biblio.title' ); >- my $record = $biblio->metadata->record(); >+ my ( $title_tag, $title_subfield ) = GetMarcFromKohaField('biblio.title'); >+ my $record = $biblio->metadata->record(); > my $title_field = $record->field($title_tag); > $title_field->update( $title_subfield => $self->publication_title ); > C4::Biblio::ModBiblio( $record, $self->biblio_id, '' ); > } else { >- # If it's not linked, we create a simple biblio and save the biblio id to the 'title' >+ >+ # If it's not linked, we create a simple biblio and save the biblio id to the 'title' > my $marc_record = TransformKohaToMarc( > { > 'biblio.title' => $self->publication_title, > } > ); >- my ( $biblio_id ) = C4::Biblio::AddBiblio($marc_record, ''); >+ my ($biblio_id) = C4::Biblio::AddBiblio( $marc_record, '' ); > $self->biblio_id($biblio_id); > } > >@@ -77,7 +78,7 @@ Returns the resources linked to this title > sub resources { > my ( $self, $resources ) = @_; > >- if ( $resources ) { >+ if ($resources) { > my $schema = $self->_result->result_source->schema; > $schema->txn_do( > sub { >@@ -85,8 +86,7 @@ sub resources { > > # Cannot use the dbic RS, we need to trigger ->store overwrite > for my $resource (@$resources) { >- Koha::ERM::EHoldings::Resource->new( >- { %$resource, title_id => $self->title_id } )->store; >+ Koha::ERM::EHoldings::Resource->new( { %$resource, title_id => $self->title_id } )->store; > } > } > ); >diff --git a/t/db_dependent/api/v1/erm_eholdings_titles.t b/t/db_dependent/api/v1/erm_eholdings_titles.t >index 59a3864371..e2f12a62ad 100755 >--- a/t/db_dependent/api/v1/erm_eholdings_titles.t >+++ b/t/db_dependent/api/v1/erm_eholdings_titles.t >@@ -479,13 +479,13 @@ subtest 'update() tests' => sub { > ->status_is(200)->json_is( '/publication_title' => 'The journal of writing unit tests :' ); > > $biblio->discard_changes; >- warn $biblio->title; >+ > my $record_after = $biblio->metadata->record; > > my ( $title_tag, $title_subfield ) = GetMarcFromKohaField('biblio.title'); > is( > $record_after->subfield( $title_tag, $title_subfield ), "The journal of writing unit tests :", >- "Biblio title is correctly update by eholding title update" >+ "Biblio title is correctly updated by eholding title update" > ); > > is( $record->fields(), $record_after->fields(), "We have the same number of fields after edit" ); >-- >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 35115
:
157507
|
158085
|
158672
|
158748
|
158806
|
158807
|
159254
| 159255