From 4e9e1c8d349bc3f37f05079dd7adc100697b2f71 Mon Sep 17 00:00:00 2001 From: Marcel de Rooy Date: Mon, 21 Jun 2021 06:53:19 +0000 Subject: [PATCH] Bug 28491: Only whitespace changes for AddAuthority Content-Type: text/plain; charset=utf-8 Only fixes indentation at highest level in sub. Includes warnings from qa tools: forbidden pattern: trailing space char (line 600) forbidden pattern: trailing space char (line 602) forbidden pattern: trailing space char (line 608) forbidden pattern: trailing space char (line 613) Test plan: Nothing to test really. No compile warnings? Signed-off-by: Marcel de Rooy --- C4/AuthoritiesMarc.pm | 61 ++++++++++++++++++------------------------- 1 file changed, 26 insertions(+), 35 deletions(-) diff --git a/C4/AuthoritiesMarc.pm b/C4/AuthoritiesMarc.pm index 1bb808bb9c..3be96dd530 100644 --- a/C4/AuthoritiesMarc.pm +++ b/C4/AuthoritiesMarc.pm @@ -529,9 +529,9 @@ returns authid of the newly created authority sub AddAuthority { # pass the MARC::Record to this function, and it will create the records in the authority table - my ($record,$authid,$authtypecode) = @_; - my $dbh=C4::Context->dbh; - my $leader=' nz a22 o 4500';#Leader for incomplete MARC21 record + my ($record,$authid,$authtypecode) = @_; + my $dbh=C4::Context->dbh; + my $leader=' nz a22 o 4500';#Leader for incomplete MARC21 record # if authid empty => true add, find a new authid number my $format; @@ -553,7 +553,7 @@ sub AddAuthority { } SetUTF8Flag($record); - if ($format eq "MARC21") { + if ($format eq "MARC21") { my $userenv = C4::Context->userenv; my $library; my $marcorgcode = C4::Context->preference('MARCOrgCode'); @@ -583,44 +583,35 @@ sub AddAuthority { $record->insert_fields_ordered( MARC::Field->new('008',$date.$default_008) ); } - if (!$record->field('040')) { - $record->insert_fields_ordered( - MARC::Field->new('040','','', - 'a' => $marcorgcode, - 'c' => $marcorgcode, - ) - ); + if (!$record->field('040')) { + $record->insert_fields_ordered( MARC::Field->new('040','','', 'a' => $marcorgcode, 'c' => $marcorgcode )); + } } - } - if ($format eq "UNIMARCAUTH") { + if ($format eq "UNIMARCAUTH") { $record->leader(" nx j22 ") unless ($record->leader()); my $date=POSIX::strftime("%Y%m%d",localtime); my $defaultfield100 = C4::Context->preference('UNIMARCAuthorityField100'); - if (my $string=$record->subfield('100',"a")){ - $string=~s/fre50/frey50/; - $record->field('100')->update('a'=>$string); - } - elsif ($record->field('100')){ + if (my $string=$record->subfield('100',"a")){ + $string=~s/fre50/frey50/; + $record->field('100')->update('a'=>$string); + } elsif ($record->field('100')){ $record->field('100')->update('a'=>$date.$defaultfield100); - } else { - $record->append_fields( - MARC::Field->new('100',' ',' ' - ,'a'=>$date.$defaultfield100) - ); - } - } - my ($auth_type_tag, $auth_type_subfield) = get_auth_type_location($authtypecode); - if (!$authid and $format eq "MARC21") { + } else { + $record->append_fields( MARC::Field->new('100',' ',' ','a'=>$date.$defaultfield100) ); + } + } + my ($auth_type_tag, $auth_type_subfield) = get_auth_type_location($authtypecode); + if (!$authid and $format eq "MARC21") { # only need to do this fix when modifying an existing authority - C4::AuthoritiesMarc::MARC21::fix_marc21_auth_type_location($record, $auth_type_tag, $auth_type_subfield); - } - if (my $field=$record->field($auth_type_tag)){ - $field->update($auth_type_subfield=>$authtypecode); - } - else { - $record->add_fields($auth_type_tag,'','', $auth_type_subfield=>$authtypecode); - } + C4::AuthoritiesMarc::MARC21::fix_marc21_auth_type_location($record, $auth_type_tag, $auth_type_subfield); + } + if (my $field=$record->field($auth_type_tag)){ + $field->update($auth_type_subfield=>$authtypecode); + } + else { + $record->add_fields($auth_type_tag,'','', $auth_type_subfield=>$authtypecode); + } # Save record into auth_header, update 001 if (!$authid ) { -- 2.20.1