Bug 27943: (QA follow-up) Perltidy
I have some trouble to get the tidyness test on AuthoritiesMarc.pm passing. There are several outstanding patches touching this file, so I didn't dare to perltidy the whole file just yet. Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
parent
b724bb579c
commit
a04f9447f7
2 changed files with 108 additions and 110 deletions
|
@ -991,8 +991,8 @@ sub BuildSummary {
|
|||
use C4::Heading::MARC21;
|
||||
my $handler = C4::Heading::MARC21->new();
|
||||
my $subfields_to_report;
|
||||
my $subfields_to_subdivision="";
|
||||
my $delimiter = C4::Context->preference('AuthoritySeparator');
|
||||
my $subfields_to_subdivision = "";
|
||||
my $delimiter = C4::Context->preference('AuthoritySeparator');
|
||||
|
||||
foreach my $field ($record->field('1..')) {
|
||||
my $tag = $field->tag();
|
||||
|
@ -1071,71 +1071,69 @@ sub BuildSummary {
|
|||
push @notes, { note => $field->as_string(), field => $field->tag() };
|
||||
}
|
||||
|
||||
foreach my $field ($record->field('7..'))
|
||||
{
|
||||
my $tag = $field->tag();
|
||||
foreach my $field ( $record->field('7..') ) {
|
||||
my $tag = $field->tag();
|
||||
|
||||
if ($tag eq '700') {
|
||||
$subfields_to_report = 'abcdefghjklmnopqrst';
|
||||
$subfields_to_subdivision='vxyz';
|
||||
} elsif ($tag eq '710') {
|
||||
$subfields_to_report = 'abcdefghklmnoprst';
|
||||
$subfields_to_subdivision='vxyz';
|
||||
} elsif ($tag eq '711') {
|
||||
$subfields_to_report = 'acdefghklnpqst';
|
||||
$subfields_to_subdivision='vxyz';
|
||||
} elsif ($tag eq '730') {
|
||||
$subfields_to_report = 'adfghklmnoprst';
|
||||
$subfields_to_subdivision='vxyz';
|
||||
} elsif ($tag eq '748') {
|
||||
$subfields_to_report = 'ab';
|
||||
$subfields_to_subdivision='vxyz';
|
||||
} elsif ($tag eq '750') {
|
||||
$subfields_to_report = 'ab';
|
||||
$subfields_to_subdivision='vxyz';
|
||||
} elsif ($tag eq '751') {
|
||||
$subfields_to_report = 'a';
|
||||
$subfields_to_subdivision='vxyz';
|
||||
} elsif ($tag eq '755') {
|
||||
$subfields_to_report = 'abvxyz';
|
||||
$subfields_to_subdivision='vxyz';
|
||||
} elsif ($tag eq '780') {
|
||||
$subfields_to_report = 'vxyz';
|
||||
$delimiter=" ";
|
||||
} elsif ($tag eq '781') {
|
||||
$subfields_to_report = 'vxyz';
|
||||
$delimiter=" ";
|
||||
} elsif ($tag eq '782') {
|
||||
$subfields_to_report = 'vxyz';
|
||||
$delimiter=" ";
|
||||
} elsif ($tag eq '785') {
|
||||
$subfields_to_report = 'vxyz';
|
||||
$delimiter=" ";
|
||||
}
|
||||
|
||||
my $heading = $field->as_string($subfields_to_report);
|
||||
|
||||
my $subheading = $field->as_string($subfields_to_subdivision,$delimiter);
|
||||
if(length $subheading > 0 )
|
||||
{
|
||||
$heading.=$delimiter.$subheading;
|
||||
}
|
||||
|
||||
if ($subfields_to_report) {
|
||||
push @equalterm, {
|
||||
heading => $heading,
|
||||
hemain => ( $field->subfield( substr($subfields_to_report, 0, 1) ) // undef ),
|
||||
field => $tag,
|
||||
};
|
||||
} else {
|
||||
push @equalterm, {
|
||||
heading => $field->as_string(),
|
||||
hemain => ( $field->subfield( 'a' ) // undef ),
|
||||
field => $tag,
|
||||
};
|
||||
}
|
||||
if ( $tag eq '700' ) {
|
||||
$subfields_to_report = 'abcdefghjklmnopqrst';
|
||||
$subfields_to_subdivision = 'vxyz';
|
||||
} elsif ( $tag eq '710' ) {
|
||||
$subfields_to_report = 'abcdefghklmnoprst';
|
||||
$subfields_to_subdivision = 'vxyz';
|
||||
} elsif ( $tag eq '711' ) {
|
||||
$subfields_to_report = 'acdefghklnpqst';
|
||||
$subfields_to_subdivision = 'vxyz';
|
||||
} elsif ( $tag eq '730' ) {
|
||||
$subfields_to_report = 'adfghklmnoprst';
|
||||
$subfields_to_subdivision = 'vxyz';
|
||||
} elsif ( $tag eq '748' ) {
|
||||
$subfields_to_report = 'ab';
|
||||
$subfields_to_subdivision = 'vxyz';
|
||||
} elsif ( $tag eq '750' ) {
|
||||
$subfields_to_report = 'ab';
|
||||
$subfields_to_subdivision = 'vxyz';
|
||||
} elsif ( $tag eq '751' ) {
|
||||
$subfields_to_report = 'a';
|
||||
$subfields_to_subdivision = 'vxyz';
|
||||
} elsif ( $tag eq '755' ) {
|
||||
$subfields_to_report = 'abvxyz';
|
||||
$subfields_to_subdivision = 'vxyz';
|
||||
} elsif ( $tag eq '780' ) {
|
||||
$subfields_to_report = 'vxyz';
|
||||
$delimiter = " ";
|
||||
} elsif ( $tag eq '781' ) {
|
||||
$subfields_to_report = 'vxyz';
|
||||
$delimiter = " ";
|
||||
} elsif ( $tag eq '782' ) {
|
||||
$subfields_to_report = 'vxyz';
|
||||
$delimiter = " ";
|
||||
} elsif ( $tag eq '785' ) {
|
||||
$subfields_to_report = 'vxyz';
|
||||
$delimiter = " ";
|
||||
}
|
||||
|
||||
my $heading = $field->as_string($subfields_to_report);
|
||||
|
||||
my $subheading = $field->as_string( $subfields_to_subdivision, $delimiter );
|
||||
if ( length $subheading > 0 ) {
|
||||
$heading .= $delimiter . $subheading;
|
||||
}
|
||||
|
||||
if ($subfields_to_report) {
|
||||
push @equalterm, {
|
||||
heading => $heading,
|
||||
hemain => ( $field->subfield( substr( $subfields_to_report, 0, 1 ) ) // undef ),
|
||||
field => $tag,
|
||||
};
|
||||
} else {
|
||||
push @equalterm, {
|
||||
heading => $field->as_string(),
|
||||
hemain => ( $field->subfield('a') // undef ),
|
||||
field => $tag,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
foreach my $field ($record->field('880')) {
|
||||
my $linkage = $field->subfield('6');
|
||||
my $category = substr $linkage, 0, 1;
|
||||
|
@ -1156,14 +1154,14 @@ sub BuildSummary {
|
|||
push @otherscript, { term => $field->as_string($subfields_to_report), category => $category, type => $type, direction => $direction, linkage => $linkage };
|
||||
}
|
||||
}
|
||||
$summary{mainentry} = $authorized[0]->{heading};
|
||||
$summary{mainentry} = $authorized[0]->{heading};
|
||||
$summary{mainmainentry} = $authorized[0]->{hemain};
|
||||
$summary{authorized} = \@authorized;
|
||||
$summary{notes} = \@notes;
|
||||
$summary{seefrom} = \@seefrom;
|
||||
$summary{seealso} = \@seealso;
|
||||
$summary{otherscript} = \@otherscript;
|
||||
$summary{equalterm} = \@equalterm;
|
||||
$summary{authorized} = \@authorized;
|
||||
$summary{notes} = \@notes;
|
||||
$summary{seefrom} = \@seefrom;
|
||||
$summary{seealso} = \@seealso;
|
||||
$summary{otherscript} = \@otherscript;
|
||||
$summary{equalterm} = \@equalterm;
|
||||
return \%summary;
|
||||
}
|
||||
|
||||
|
|
|
@ -130,32 +130,33 @@ $dbh->do(q{
|
|||
t::lib::Mocks::mock_preference('marcflavour', 'MARC21');
|
||||
my $expected_marc21_summary = {
|
||||
'authorized' => [
|
||||
{
|
||||
'field' => '151',
|
||||
'heading' => 'New York (State)',
|
||||
'hemain' => 'New York (State)'
|
||||
}
|
||||
],
|
||||
'authtypecode' => 'GEOGR_NAME',
|
||||
'mainentry' => 'New York (State)',
|
||||
{
|
||||
'field' => '151',
|
||||
'heading' => 'New York (State)',
|
||||
'hemain' => 'New York (State)'
|
||||
}
|
||||
],
|
||||
'authtypecode' => 'GEOGR_NAME',
|
||||
'mainentry' => 'New York (State)',
|
||||
'mainmainentry' => 'New York (State)',
|
||||
'notes' => [],
|
||||
'otherscript' => [],
|
||||
'seealso' => [
|
||||
{
|
||||
'authid' => '1',
|
||||
'field' => '551',
|
||||
'heading' => 'United States',
|
||||
'hemain' => 'United States',
|
||||
'search' => 'United States',
|
||||
'type' => 'broader'
|
||||
}
|
||||
],
|
||||
'seefrom' => [],
|
||||
'label' => 'Geographic Name',
|
||||
'type' => 'Geographic Name',
|
||||
'notes' => [],
|
||||
'otherscript' => [],
|
||||
'seealso' => [
|
||||
{
|
||||
'authid' => '1',
|
||||
'field' => '551',
|
||||
'heading' => 'United States',
|
||||
'hemain' => 'United States',
|
||||
'search' => 'United States',
|
||||
'type' => 'broader'
|
||||
}
|
||||
],
|
||||
'seefrom' => [],
|
||||
'label' => 'Geographic Name',
|
||||
'type' => 'Geographic Name',
|
||||
'equalterm' => []
|
||||
};
|
||||
|
||||
is_deeply(
|
||||
BuildSummary(C4::AuthoritiesMarc::GetAuthority(2), 2, 'GEOGR_NAME'),
|
||||
$expected_marc21_summary,
|
||||
|
@ -183,23 +184,22 @@ $unimarc_name_auth->add_fields(
|
|||
);
|
||||
my $expected_unimarc_name_summary = {
|
||||
'authorized' => [
|
||||
{
|
||||
'field' => '200',
|
||||
'heading' => 'Fossey Brigitte',
|
||||
'hemain' => 'Fossey'
|
||||
}
|
||||
],
|
||||
'authtypecode' => 'NP',
|
||||
'mainentry' => 'Fossey Brigitte',
|
||||
{
|
||||
'field' => '200',
|
||||
'heading' => 'Fossey Brigitte',
|
||||
'hemain' => 'Fossey'
|
||||
}
|
||||
],
|
||||
'authtypecode' => 'NP',
|
||||
'mainentry' => 'Fossey Brigitte',
|
||||
'mainmainentry' => 'Fossey',
|
||||
'notes' => [],
|
||||
'otherscript' => [],
|
||||
'seealso' => [],
|
||||
'seefrom' => [],
|
||||
'summary' => 'Fossey, Brigitte',
|
||||
'type' => 'Auteur',
|
||||
'equalterm' => []
|
||||
|
||||
'notes' => [],
|
||||
'otherscript' => [],
|
||||
'seealso' => [],
|
||||
'seefrom' => [],
|
||||
'summary' => 'Fossey, Brigitte',
|
||||
'type' => 'Auteur',
|
||||
'equalterm' => []
|
||||
};
|
||||
|
||||
is_deeply(
|
||||
|
|
Loading…
Reference in a new issue