From 533632e484606ba3825b498b5b9195ea5fc2a91e 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 --- C4/Breeding.pm | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/C4/Breeding.pm b/C4/Breeding.pm index 7859f46..b24b0c7 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; } -- 1.7.10.4