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