From 7e83c7ea3857a7dcca5ae610d63382c2674a1846 Mon Sep 17 00:00:00 2001 From: Marcel de Rooy Date: Wed, 3 Jul 2013 14:26:56 +0200 Subject: [PATCH] Bug 10462: Followup for showing multiple ISBNs in Z3950 response As Jonathan correctly noted, the new Z3950 response only showed one isbn although more isbn numbers could be in the record and would be imported. To resolve this display problem, I traverse them all now in the updated routine _isbn_show. There is no change in the imported records. Note that before this patch TransformMarcToKoha did put all isbn numbers in one field, separated by pipes (for display only). This behavior is restored now. The three regexes on the individual isbn numbers now seem to be overkill, but I left them there for completeness. Signed-off-by: Marcel de Rooy Tested this on a fresh French install under UNIMARC with BNF server. Tested it too for MARC21. Signed-off-by: Jonathan Druart Signed-off-by: Galen Charlton --- C4/Breeding.pm | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/C4/Breeding.pm b/C4/Breeding.pm index 7859f46fd0..b24b0c73be 100644 --- a/C4/Breeding.pm +++ b/C4/Breeding.pm @@ -424,7 +424,7 @@ sub _handle_one_result { sub _add_rowdata { my ($rowref, $marcrecord)=@_; if(C4::Context->preference("marcflavour") ne 'UNIMARC') { #MARC21, NORMARC - $rowref->{isbn} = _isbn_cleanup($marcrecord->subfield('020','a')||''); + $rowref->{isbn}= _isbn_show($marcrecord, '020'); $rowref->{title}= $marcrecord->subfield('245','a')||''; $rowref->{author}= $marcrecord->subfield('100','a')||''; $rowref->{date}= $marcrecord->subfield('260','c')||''; @@ -432,7 +432,7 @@ sub _add_rowdata { $rowref->{lccn}= $marcrecord->subfield('050','a')||''; } else { #UNIMARC - $rowref->{isbn}= _isbn_cleanup($marcrecord->subfield('010','a')||''); + $rowref->{isbn}= _isbn_show($marcrecord, '010'); $rowref->{title}= $marcrecord->subfield('200','a')||''; $rowref->{author}= $marcrecord->subfield('200','f')||''; $rowref->{date}= $marcrecord->subfield('210','d')||''; @@ -442,11 +442,16 @@ sub _add_rowdata { return $rowref; } -sub _isbn_cleanup { - my $isbn= shift; - $isbn=~ s/ |-|\.//g; - $isbn=~ s/\|/ \| /g; - $isbn=~ s/\(/ \(/g; +sub _isbn_show { + my ($record, $fieldno)= @_; #both marc21 and unimarc possible + my $isbn= ''; + foreach my $f ( $record->field($fieldno) ) { + my $a= $f->subfield('a'); + $a =~ s/ |-|\.//g; + $a =~ s/\|/ \| /g; + $a =~ s/\(/ \(/g; + $isbn= $isbn? ($isbn.' | '. $a): $a; + } return $isbn; } -- 2.39.5