|
Lines 1717-1732
sub _add_auth_fields {
Link Here
|
| 1717 |
sub _add_biblio_fields { |
1717 |
sub _add_biblio_fields { |
| 1718 |
my ($import_record_id, $marc_record) = @_; |
1718 |
my ($import_record_id, $marc_record) = @_; |
| 1719 |
|
1719 |
|
| 1720 |
my $controlnumber; |
1720 |
my ($title, $author, $isbn, $issn, $controlnumber, $lccn, $pubdate) = _parse_biblio_fields($marc_record); |
| 1721 |
if ($marc_record->field('001')) { |
|
|
| 1722 |
$controlnumber = $marc_record->field('001')->data(); |
| 1723 |
} |
| 1724 |
my ($title, $author, $isbn, $issn) = _parse_biblio_fields($marc_record); |
| 1725 |
my $dbh = C4::Context->dbh; |
1721 |
my $dbh = C4::Context->dbh; |
| 1726 |
# FIXME no originalsource |
1722 |
# FIXME no originalsource |
| 1727 |
$isbn = C4::Koha::GetNormalizedISBN($isbn); |
1723 |
$isbn = C4::Koha::GetNormalizedISBN($isbn); |
| 1728 |
my $sth = $dbh->prepare("INSERT INTO import_biblios (import_record_id, title, author, isbn, issn, control_number) VALUES (?, ?, ?, ?, ?, ?)"); |
1724 |
my $sth = $dbh->prepare("INSERT INTO import_biblios (import_record_id, title, author, isbn, issn, control_number, lccn, pubdate) VALUES (?, ?, ?, ?, ?, ?, ?, ?)"); |
| 1729 |
$sth->execute($import_record_id, $title, $author, $isbn, $issn, $controlnumber); |
1725 |
$sth->execute($import_record_id, $title, $author, $isbn, $issn, $controlnumber, $lccn, $pubdate); |
| 1730 |
$sth->finish(); |
1726 |
$sth->finish(); |
| 1731 |
|
1727 |
|
| 1732 |
} |
1728 |
} |
|
Lines 1734-1747
sub _add_biblio_fields {
Link Here
|
| 1734 |
sub _update_biblio_fields { |
1730 |
sub _update_biblio_fields { |
| 1735 |
my ($import_record_id, $marc_record) = @_; |
1731 |
my ($import_record_id, $marc_record) = @_; |
| 1736 |
|
1732 |
|
| 1737 |
my ($title, $author, $isbn, $issn) = _parse_biblio_fields($marc_record); |
1733 |
my ($title, $author, $isbn, $issn, $controlnumber, $lccn, $pubdate) = _parse_biblio_fields($marc_record); |
| 1738 |
my $dbh = C4::Context->dbh; |
1734 |
my $dbh = C4::Context->dbh; |
| 1739 |
# FIXME no originalsource |
1735 |
# FIXME no originalsource |
| 1740 |
# FIXME 2 - should regularize normalization of ISBN wherever it is done |
1736 |
# FIXME 2 - should regularize normalization of ISBN wherever it is done |
| 1741 |
$isbn = C4::Koha::GetNormalizedISBN($isbn); |
1737 |
$isbn = C4::Koha::GetNormalizedISBN($isbn); |
| 1742 |
my $sth = $dbh->prepare("UPDATE import_biblios SET title = ?, author = ?, isbn = ?, issn = ? |
1738 |
my $sth = $dbh->prepare("UPDATE import_biblios SET title = ?, author = ?, isbn = ?, issn = ?, control_number = ?, lccn = ?, pubdate = ? |
| 1743 |
WHERE import_record_id = ?"); |
1739 |
WHERE import_record_id = ?"); |
| 1744 |
$sth->execute($title, $author, $isbn, $issn, $import_record_id); |
1740 |
$sth->execute($title, $author, $isbn, $issn, $controlnumber, $lccn, $pubdate, $import_record_id); |
| 1745 |
$sth->finish(); |
1741 |
$sth->finish(); |
| 1746 |
} |
1742 |
} |
| 1747 |
|
1743 |
|
|
Lines 1750-1756
sub _parse_biblio_fields {
Link Here
|
| 1750 |
|
1746 |
|
| 1751 |
my $dbh = C4::Context->dbh; |
1747 |
my $dbh = C4::Context->dbh; |
| 1752 |
my $bibliofields = TransformMarcToKoha($marc_record, ''); |
1748 |
my $bibliofields = TransformMarcToKoha($marc_record, ''); |
| 1753 |
return ($bibliofields->{'title'}, $bibliofields->{'author'}, $bibliofields->{'isbn'}, $bibliofields->{'issn'}); |
1749 |
my $controlnumber; |
|
|
1750 |
if ($marc_record->field('001')) { |
| 1751 |
$controlnumber = $marc_record->field('001')->data(); |
| 1752 |
} |
| 1753 |
my $pubdate; |
| 1754 |
if ($marc_record->field('008')) { |
| 1755 |
$pubdate = substr( $marc_record->field('008')->data(), 7, 4 ); |
| 1756 |
} |
| 1757 |
return ($bibliofields->{'title'}, $bibliofields->{'author'}, $bibliofields->{'isbn'}, $bibliofields->{'issn'}, $controlnumber, $bibliofields->{'lccn'}, $pubdate); |
| 1754 |
|
1758 |
|
| 1755 |
} |
1759 |
} |
| 1756 |
|
1760 |
|