From 6b02b7404dbaf4a9c266cdc6a23ddba829ffdf81 Mon Sep 17 00:00:00 2001 From: Marcel de Rooy Date: Fri, 14 Oct 2016 10:01:12 +0200 Subject: [PATCH] Bug 16245: [QA Follow-up] Replace typeofrecord2 by biblevel MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Position 7 of the leader is better referred to as biblevel. (Pos 6 is record type.) At the same time replacing some regex's by simple eq's. Signed-off-by: Marcel de Rooy It seems that bib level in the UNIMARC leader only allows a subset of the possible combinations for MARC21. This does not have bad side-effects however in the new code that tests bib level to determine the type tag. Signed-off-by: Kyle M Hall (cherry picked from commit 556a4870d6beced7df52dbbc2ad472769e79e148) Signed-off-by: Frédéric Demians --- C4/Ris.pm | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/C4/Ris.pm b/C4/Ris.pm index 4b2a1a1155..5bf8ecc98d 100644 --- a/C4/Ris.pm +++ b/C4/Ris.pm @@ -385,10 +385,11 @@ sub print_typetag { ## The type of a MARC record is found at position 06 of the leader my $typeofrecord = defined($leader) && length $leader >=6 ? substr($leader, 6, 1): undef; - my $typeofrecord2 = defined($leader) && length $leader >=6 ? - substr($leader, 7, 1): undef; + ## Pos 07 == Bibliographic level + my $biblevel = defined($leader) && length $leader >=7 ? + substr($leader, 7, 1): ''; - ## ToDo: for books, field 008 positions 24-27 might have a few more + ## TODO: for books, field 008 positions 24-27 might have a few more ## hints my %typehash; @@ -405,15 +406,15 @@ sub print_typetag { print "TY - GEN\r\n"; ## most reasonable default warn ("no type found - assume GEN") if $marcprint; } elsif ( $typeofrecord =~ "a" ) { - if ( $typeofrecord2 =~ "a" ) { + if ( $biblevel eq 'a' ) { print "TY - GEN\r\n"; ## monographic component part - } elsif ( $typeofrecord2 =~ "b" || $typeofrecord2 =~ "s" ) { + } elsif ( $biblevel eq 'b' || $biblevel eq 's' ) { print "TY - SER\r\n"; ## serial or serial component part - } elsif ( $typeofrecord2 =~ "m" ) { + } elsif ( $biblevel eq 'm' ) { print "TY - $typehash{$typeofrecord}\r\n"; ## book - } elsif ( $typeofrecord2 =~ "c" || $typeofrecord2 =~ "d" ) { + } elsif ( $biblevel eq 'c' || $biblevel eq 'd' ) { print "TY - GEN\r\n"; ## collections, part of collections or made-up collections - } elsif ( $typeofrecord2 =~ "i" ) { + } elsif ( $biblevel eq 'i' ) { print "TY - DATA\r\n"; ## updating loose-leafe as Dataset } } else { -- 2.39.5