Lines 25-30
use C4::Biblio;
Link Here
|
25 |
use C4::Koha; |
25 |
use C4::Koha; |
26 |
use C4::Charset; |
26 |
use C4::Charset; |
27 |
use MARC::File::USMARC; |
27 |
use MARC::File::USMARC; |
|
|
28 |
use MARC::Field; |
28 |
use C4::ImportBatch; |
29 |
use C4::ImportBatch; |
29 |
use C4::AuthoritiesMarc; #GuessAuthTypeCode, FindDuplicateAuthority |
30 |
use C4::AuthoritiesMarc; #GuessAuthTypeCode, FindDuplicateAuthority |
30 |
use C4::Languages; |
31 |
use C4::Languages; |
Lines 374-388
sub _add_rowdata {
Link Here
|
374 |
author => 'biblio.author', |
375 |
author => 'biblio.author', |
375 |
isbn =>'biblioitems.isbn', |
376 |
isbn =>'biblioitems.isbn', |
376 |
lccn =>'biblioitems.lccn', #LC control number (not call number) |
377 |
lccn =>'biblioitems.lccn', #LC control number (not call number) |
377 |
edition =>'biblioitems.editionstatement', |
378 |
edition =>'biblioitems.editionstatement' |
378 |
date => 'biblio.copyrightdate', #MARC21 |
|
|
379 |
date2 => 'biblioitems.publicationyear', #UNIMARC |
380 |
); |
379 |
); |
|
|
380 |
$fetch{date} = C4::Context->preference('marcflavour') eq "MARC21" ? 'biblio.copyrightdate' : 'biblioitems.publicationyear'; |
381 |
|
381 |
foreach my $k (keys %fetch) { |
382 |
foreach my $k (keys %fetch) { |
382 |
$row->{$k} = C4::Biblio::TransformMarcToKohaOneField( $fetch{$k}, $record ); |
383 |
$row->{$k} = C4::Biblio::TransformMarcToKohaOneField( $fetch{$k}, $record ); |
383 |
} |
384 |
} |
384 |
$row->{date}//= $row->{date2}; |
385 |
$row->{date}//= $row->{date2}; |
385 |
$row->{isbn}=_isbn_replace($row->{isbn}); |
386 |
$row->{isbn}=_isbn_replace($row->{isbn}); |
|
|
387 |
|
388 |
$row = _add_custom_field_rowdata($row, $record); |
389 |
|
390 |
return $row; |
391 |
} |
392 |
|
393 |
sub _add_custom_field_rowdata |
394 |
{ |
395 |
my ( $row, $record ) = @_; |
396 |
my $pref_newtags = C4::Context->preference('AdditionalFieldsInZ3950ResultSearch'); |
397 |
|
398 |
$pref_newtags =~ s/^\s+|\s+$//g; |
399 |
$pref_newtags =~ s/\h+/ /g; |
400 |
|
401 |
my @addnumberfields; |
402 |
|
403 |
foreach my $field (split /\,/, $pref_newtags) { |
404 |
$field =~ s/^\s+|\s+$//g ; # trim whitespace |
405 |
my ($tag, $subtags) = split(/\$/, $field); |
406 |
|
407 |
if ( $record->field($tag) ) { |
408 |
my @content = (); |
409 |
|
410 |
for my $marcfield ($record->field($tag)) { |
411 |
if ( $subtags ) { |
412 |
my $str = ''; |
413 |
for my $code (split //, $subtags) { |
414 |
if ( $marcfield->subfield($code) ) { |
415 |
$str .= $marcfield->subfield($code) . ' '; |
416 |
} |
417 |
} |
418 |
if ( not $str eq '') { |
419 |
push @content, $str; |
420 |
} |
421 |
} elsif ( $tag <= 10 ) { |
422 |
push @content, $marcfield->data(); |
423 |
} else { |
424 |
push @content, $marcfield->as_string(); |
425 |
} |
426 |
} |
427 |
|
428 |
if ( @content ) { |
429 |
$row->{$field} = \@content; |
430 |
push( @addnumberfields, $field ); |
431 |
} |
432 |
} |
433 |
} |
434 |
|
435 |
$row->{'addnumberfields'} = \@addnumberfields; |
436 |
|
386 |
return $row; |
437 |
return $row; |
387 |
} |
438 |
} |
388 |
|
439 |
|