From 4c22fed245349302b669ebad93de970318136abd Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Thu, 13 Apr 2023 16:27:57 +0000 Subject: [PATCH] Bug 33231: (QA follow-up) Simplify conditional for date display This patch simply checks if we have a value for copyrighydate and displays publicationyear if not. Even if copyrightdate is requested (MARC21) but isn't populated, the publicatoinyear won't replace it because we haven't transformed that field. I think this read a bit easier, but RM can weigh in Signed-off-by: Nick Clemens --- C4/Breeding.pm | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/C4/Breeding.pm b/C4/Breeding.pm index 8c164c460f..efc9029f48 100644 --- a/C4/Breeding.pm +++ b/C4/Breeding.pm @@ -307,10 +307,9 @@ sub _handle_one_result { my $row; if( $breedingid ){ my @kohafields = ('biblio.title','biblio.author','biblioitems.isbn','biblioitems.lccn','biblioitems.editionstatement'); - my $date_label = C4::Context->preference('marcflavour') eq "MARC21" ? 'biblio.copyrightdate' : 'biblioitems.publicationyear'; - push @kohafields, $date_label; + push @kohafields, C4::Context->preference('marcflavour') eq "MARC21" ? 'biblio.copyrightdate' : 'biblioitems.publicationyear'; $row = C4::Biblio::TransformMarcToKoha({ record => $marcrecord, kohafields => \@kohafields, limit_table => 'no_items' }); - $row->{date} = $row->{ substr( $date_label, index( $date_label, '.' ) + 1 ) }; + $row->{date} = $row->{copyrightdate} // $row->{publicationyear}; $row->{biblionumber} = $bib; $row->{server} = $servhref->{servername}; $row->{breedingid} = $breedingid; -- 2.30.2