From b3af8f93637a7d54dac3426f54057f8034b24eee Mon Sep 17 00:00:00 2001 From: Marcel de Rooy Date: Thu, 5 Jul 2018 12:10:26 +0200 Subject: [PATCH] Bug 21036: Remove odd number of elements warnings from AuthoritiesMarc.pm Like this one (16.11 line number): Odd number of elements in anonymous hash at C4/AuthoritiesMarc.pm line 1070. We need to add a scalar to some MARC::Field::subfield calls. In list context an empty list returned affects the hash built around it. Test plan: Could reproduce this warning easily from OPAC authority search. opac-authorities-home.pl calling BuildSummary. Signed-off-by: Bouzid Fergani Signed-off-by: Martin Renvoize Signed-off-by: Nick Clemens (cherry picked from commit 88b37330abaee6372ec999c1a81fd216d66a1379) Signed-off-by: Martin Renvoize --- C4/AuthoritiesMarc.pm | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/C4/AuthoritiesMarc.pm b/C4/AuthoritiesMarc.pm index 10c67fc9ff..0d90b37d67 100644 --- a/C4/AuthoritiesMarc.pm +++ b/C4/AuthoritiesMarc.pm @@ -994,14 +994,14 @@ sub BuildSummary { if ($type eq 'subfi') { push @seefrom, { heading => $field->as_string($marc21subfields), - hemain => $field->subfield( substr($marc21subfields, 0, 1) ), + hemain => scalar $field->subfield( substr($marc21subfields, 0, 1) ), type => ($field->subfield('i') || ''), field => $field->tag(), }; } else { push @seefrom, { heading => $field->as_string($marc21subfields), - hemain => $field->subfield( substr($marc21subfields, 0, 1) ), + hemain => scalar $field->subfield( substr($marc21subfields, 0, 1) ), type => $type, field => $field->tag(), }; @@ -1017,8 +1017,8 @@ sub BuildSummary { if ($type eq 'subfi') { push @seealso, { heading => $field->as_string($marc21subfields), - hemain => $field->subfield( substr($marc21subfields, 0, 1) ), - type => $field->subfield('i'), + hemain => scalar $field->subfield( substr($marc21subfields, 0, 1) ), + type => scalar $field->subfield('i'), field => $field->tag(), search => $field->as_string($marc21subfields) || '', authid => $field->subfield('9') || '' @@ -1026,7 +1026,7 @@ sub BuildSummary { } else { push @seealso, { heading => $field->as_string($marc21subfields), - hemain => $field->subfield( substr($marc21subfields, 0, 1) ), + hemain => scalar $field->subfield( substr($marc21subfields, 0, 1) ), type => $type, field => $field->tag(), search => $field->as_string($marc21subfields) || '', -- 2.39.5