From 194b2dac91617ed40e25eaf942d8e5f834c22e4c Mon Sep 17 00:00:00 2001 From: Pedro Amorim 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 --- 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.30.2