Lines 615-633
sub MarcRecordFromNewSuggestion {
Link Here
|
615 |
my ($suggestion) = @_; |
615 |
my ($suggestion) = @_; |
616 |
my $record = MARC::Record->new(); |
616 |
my $record = MARC::Record->new(); |
617 |
|
617 |
|
618 |
my ($title_tag, $title_subfield) = GetMarcFromKohaField('biblio.title', ''); |
618 |
if (my $isbn = $suggestion->{isbn}) { |
619 |
$record->append_fields( |
619 |
for my $field (qw(biblioitems.isbn biblioitems.issn)) { |
620 |
MARC::Field->new($title_tag, ' ', ' ', $title_subfield => $suggestion->{title}) |
620 |
my ($tag, $subfield) = GetMarcFromKohaField($field, ''); |
621 |
); |
621 |
$record->append_fields( |
622 |
|
622 |
MARC::Field->new($tag, ' ', ' ', $subfield => $isbn) |
623 |
my ($author_tag, $author_subfield) = GetMarcFromKohaField('biblio.author', ''); |
623 |
); |
624 |
if ($record->field( $author_tag )) { |
624 |
} |
625 |
$record->field( $author_tag )->add_subfields( $author_subfield => $suggestion->{author} ); |
|
|
626 |
} |
625 |
} |
627 |
else { |
626 |
else { |
|
|
627 |
my ($title_tag, $title_subfield) = GetMarcFromKohaField('biblio.title', ''); |
628 |
$record->append_fields( |
628 |
$record->append_fields( |
629 |
MARC::Field->new($author_tag, ' ', ' ', $author_subfield => $suggestion->{author}) |
629 |
MARC::Field->new($title_tag, ' ', ' ', $title_subfield => $suggestion->{title}) |
630 |
); |
630 |
); |
|
|
631 |
|
632 |
my ($author_tag, $author_subfield) = GetMarcFromKohaField('biblio.author', ''); |
633 |
if ($record->field( $author_tag )) { |
634 |
$record->field( $author_tag )->add_subfields( $author_subfield => $suggestion->{author} ); |
635 |
} |
636 |
else { |
637 |
$record->append_fields( |
638 |
MARC::Field->new($author_tag, ' ', ' ', $author_subfield => $suggestion->{author}) |
639 |
); |
640 |
} |
631 |
} |
641 |
} |
632 |
|
642 |
|
633 |
my ($it_tag, $it_subfield) = GetMarcFromKohaField('biblioitems.itemtype', ''); |
643 |
my ($it_tag, $it_subfield) = GetMarcFromKohaField('biblioitems.itemtype', ''); |