From 24b5afb6d6ea415ba9c8ce7fa80f322e84d65cab Mon Sep 17 00:00:00 2001 From: Pedro Amorim Date: Wed, 16 Oct 2024 10:45:51 +0000 Subject: [PATCH] Bug 35570: (QA follow-up): Update UNIMARC author to 200$f Reworked the logic here a bit to ensure the following scenario for UNIMARC: If both title and author exist, the result is: 200$aTitle$fAuthor In the previous logic, it would become: 200$aTitle 200$fAuthor I'm assuming the desired result is the former and not the latter. Test following the same test plan, but try having only author, or only title, and verify that the resulted MARC data is as expected. Signed-off-by: Katrin Fischer --- Koha/ILL/Backend/Standard.pm | 31 +++++++++++-------------------- 1 file changed, 11 insertions(+), 20 deletions(-) diff --git a/Koha/ILL/Backend/Standard.pm b/Koha/ILL/Backend/Standard.pm index f64908adff..98e9cf463a 100644 --- a/Koha/ILL/Backend/Standard.pm +++ b/Koha/ILL/Backend/Standard.pm @@ -1176,26 +1176,17 @@ sub _standard_request2biblio { ($record) = MarcToUTF8Record( $record, $marcflavour ); } - if ($isbn) { - my $marc_isbn = - $marcflavour eq 'MARC21' - ? MARC::Field->new( '020', '', '', a => $isbn ) - : MARC::Field->new( '010', '', '', a => $isbn ); - $record->append_fields($marc_isbn); - } - if ($author) { - my $marc_author = - $marcflavour eq 'MARC21' - ? MARC::Field->new( '100', '1', '', a => $author ) - : MARC::Field->new( '700', '1', '', a => $author ); - $record->append_fields($marc_author); - } - if ($title) { - my $marc_title = - $marcflavour eq 'MARC21' - ? MARC::Field->new( '245', '0', '0', a => $title ) - : MARC::Field->new( '200', '0', '0', a => $title ); - $record->append_fields($marc_title); + my $marc_isbn; + my $marc_author; + my $marc_title; + + if( $marcflavour eq 'MARC21' ) { + $record->append_fields(MARC::Field->new( '020', '', '', a => $isbn )) if $isbn; + $record->append_fields(MARC::Field->new( '100', '1', '', a => $author )) if $author; + $record->append_fields(MARC::Field->new( '245', '0', '0', a => $title )) if $title; + }elsif( $marcflavour eq 'UNIMARC' ) { + $record->append_fields(MARC::Field->new( '010', '', '', a => $isbn )) if $isbn; + $record->append_fields(MARC::Field->new( '200', '', '', $title ? ( 'a' => $title ) : undef, $author ? ( 'f' => $author ) : undef)) if $author || $title; } # Suppress the record