From 09961dff7808d46c1f1ac5d2f90be0622da730d1 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 Signed-off-by: Tomas Cohen Arazi (cherry picked from commit f08d5b53256f5e5db309657a7c3c48b274e379e2) Signed-off-by: Matt Blenkinsop --- 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.39.5