Lines 1660-1675
sub _add_auth_fields {
Link Here
|
1660 |
sub _add_biblio_fields { |
1660 |
sub _add_biblio_fields { |
1661 |
my ($import_record_id, $marc_record) = @_; |
1661 |
my ($import_record_id, $marc_record) = @_; |
1662 |
|
1662 |
|
1663 |
my $controlnumber; |
1663 |
my ($title, $author, $isbn, $issn, $controlnumber, $lccn, $pubdate) = _parse_biblio_fields($marc_record); |
1664 |
if ($marc_record->field('001')) { |
|
|
1665 |
$controlnumber = $marc_record->field('001')->data(); |
1666 |
} |
1667 |
my ($title, $author, $isbn, $issn) = _parse_biblio_fields($marc_record); |
1668 |
my $dbh = C4::Context->dbh; |
1664 |
my $dbh = C4::Context->dbh; |
1669 |
# FIXME no originalsource |
1665 |
# FIXME no originalsource |
1670 |
$isbn = C4::Koha::GetNormalizedISBN($isbn); |
1666 |
$isbn = C4::Koha::GetNormalizedISBN($isbn); |
1671 |
my $sth = $dbh->prepare("INSERT INTO import_biblios (import_record_id, title, author, isbn, issn, control_number) VALUES (?, ?, ?, ?, ?, ?)"); |
1667 |
$lccn =~ s/^\s+|\s+$//g; |
1672 |
$sth->execute($import_record_id, $title, $author, $isbn, $issn, $controlnumber); |
1668 |
my $sth = $dbh->prepare("INSERT INTO import_biblios (import_record_id, title, author, isbn, issn, control_number, lccn, pubdate) VALUES (?, ?, ?, ?, ?, ?, ?, ?)"); |
|
|
1669 |
$sth->execute($import_record_id, $title, $author, $isbn, $issn, $controlnumber, $lccn, $pubdate); |
1673 |
$sth->finish(); |
1670 |
$sth->finish(); |
1674 |
|
1671 |
|
1675 |
} |
1672 |
} |
Lines 1677-1690
sub _add_biblio_fields {
Link Here
|
1677 |
sub _update_biblio_fields { |
1674 |
sub _update_biblio_fields { |
1678 |
my ($import_record_id, $marc_record) = @_; |
1675 |
my ($import_record_id, $marc_record) = @_; |
1679 |
|
1676 |
|
1680 |
my ($title, $author, $isbn, $issn) = _parse_biblio_fields($marc_record); |
1677 |
my ($title, $author, $isbn, $issn, $controlnumber, $lccn, $pubdate) = _parse_biblio_fields($marc_record); |
1681 |
my $dbh = C4::Context->dbh; |
1678 |
my $dbh = C4::Context->dbh; |
1682 |
# FIXME no originalsource |
1679 |
# FIXME no originalsource |
1683 |
# FIXME 2 - should regularize normalization of ISBN wherever it is done |
1680 |
# FIXME 2 - should regularize normalization of ISBN wherever it is done |
1684 |
$isbn = C4::Koha::GetNormalizedISBN($isbn); |
1681 |
$isbn = C4::Koha::GetNormalizedISBN($isbn); |
1685 |
my $sth = $dbh->prepare("UPDATE import_biblios SET title = ?, author = ?, isbn = ?, issn = ? |
1682 |
my $sth = $dbh->prepare("UPDATE import_biblios SET title = ?, author = ?, isbn = ?, issn = ?, control_number = ?, lccn = ?, pubdate = ? |
1686 |
WHERE import_record_id = ?"); |
1683 |
WHERE import_record_id = ?"); |
1687 |
$sth->execute($title, $author, $isbn, $issn, $import_record_id); |
1684 |
$sth->execute($title, $author, $isbn, $issn, $controlnumber, $lccn, $pubdate, $import_record_id); |
1688 |
$sth->finish(); |
1685 |
$sth->finish(); |
1689 |
} |
1686 |
} |
1690 |
|
1687 |
|
Lines 1693-1699
sub _parse_biblio_fields {
Link Here
|
1693 |
|
1690 |
|
1694 |
my $dbh = C4::Context->dbh; |
1691 |
my $dbh = C4::Context->dbh; |
1695 |
my $bibliofields = TransformMarcToKoha($marc_record, ''); |
1692 |
my $bibliofields = TransformMarcToKoha($marc_record, ''); |
1696 |
return ($bibliofields->{'title'}, $bibliofields->{'author'}, $bibliofields->{'isbn'}, $bibliofields->{'issn'}); |
1693 |
my $controlnumber; |
|
|
1694 |
if ($marc_record->field('001')) { |
1695 |
$controlnumber = $marc_record->field('001')->data(); |
1696 |
} |
1697 |
my $pubdate; |
1698 |
if ($marc_record->field('008')) { |
1699 |
$pubdate = substr( $marc_record->field('008')->data(), 7, 4 ); |
1700 |
} |
1701 |
return ($bibliofields->{'title'}, $bibliofields->{'author'}, $bibliofields->{'isbn'}, $bibliofields->{'issn'}, $controlnumber, $bibliofields->{'lccn'}, $pubdate); |
1697 |
|
1702 |
|
1698 |
} |
1703 |
} |
1699 |
|
1704 |
|