Skip to content

Commit

Permalink
Bug 35405: Remove noise from MARC::Record in SearchAuthorities
Browse files Browse the repository at this point in the history
We are calling ->field with an undef parameter.
MARC::Record does not like that and says:
  Use of uninitialized value $tag in hash element at /usr/share/perl5/MARC/Record.pm line 202.
For now, a fix at our side.

Test plan:
Run SearchAuthorities without passing an authtypecode.
Without this patch, it results in a warning per hit.
With this patch, the noise should be gone.

Signed-off-by: Marcel de Rooy <[email protected]>
Signed-off-by: David Nind <[email protected]>
Signed-off-by: Tomas Cohen Arazi <[email protected]>
Signed-off-by: Katrin Fischer <[email protected]>
  • Loading branch information
mderooy authored and kfischer committed Dec 18, 2023
1 parent f3bb885 commit ac02c1d
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions C4/AuthoritiesMarc.pm
Original file line number Diff line number Diff line change
Expand Up @@ -297,12 +297,13 @@ sub SearchAuthorities {
my %newline;
$newline{authid} = $authid;
if ( !$skipmetadata ) {
my $auth_tag_to_report;
$auth_tag_to_report = Koha::Authority::Types->find($authtypecode)->auth_tag_to_report
if $authtypecode;
my $reported_tag;
my $mainentry = $authrecord->field($auth_tag_to_report);
my ( $auth_tag_to_report, $reported_tag, $mainentry );
if ( $authtypecode ) {
$auth_tag_to_report = Koha::Authority::Types->find($authtypecode)->auth_tag_to_report;
$mainentry = $authrecord->field($auth_tag_to_report) if $auth_tag_to_report;
}
if ($mainentry) {
$reported_tag = q{};
foreach ( $mainentry->subfields() ) {
$reported_tag .= '$' . $_->[0] . $_->[1];
}
Expand Down

0 comments on commit ac02c1d

Please sign in to comment.