Lines 1606-1611
sub _create_import_record {
Link Here
|
1606 |
return $import_record_id; |
1606 |
return $import_record_id; |
1607 |
} |
1607 |
} |
1608 |
|
1608 |
|
|
|
1609 |
sub _get_import_record_timestamp { |
1610 |
my ( $marc_record ) = @_; |
1611 |
my $upload_timestamp = DateTime->now(); |
1612 |
|
1613 |
# Attempt to parse the 005 timestamp. This is a bit weird because we have to parse the |
1614 |
# tenth-of-a-second ourselves. |
1615 |
my $f005 = $marc_record->field('005'); |
1616 |
if ($f005 && $f005->data =~ /(\d{8}\d{6})\.(\d)/ ) { |
1617 |
my $parser = DateTime::Format::Strptime->new( pattern => '%Y%m%d%H%M%S' ); |
1618 |
my $parsed_timestamp = $parser->parse_datetime($1); |
1619 |
|
1620 |
# We still check for success because we only did enough validation above to extract the |
1621 |
# tenth-of-a-second; the timestamp could still be some nonsense like the 50th of Jantober. |
1622 |
if ( $parsed_timestamp ) { |
1623 |
$parsed_timestamp->set_nanosecond( $2 * 100_000_000 ); |
1624 |
$upload_timestamp = $parsed_timestamp; |
1625 |
} |
1626 |
} |
1627 |
|
1628 |
return $upload_timestamp; |
1629 |
} |
1630 |
|
1631 |
|
1609 |
sub _update_import_record_marc { |
1632 |
sub _update_import_record_marc { |
1610 |
my ($import_record_id, $marc_record, $marc_type) = @_; |
1633 |
my ($import_record_id, $marc_record, $marc_type) = @_; |
1611 |
|
1634 |
|
Lines 1654-1664
sub _update_biblio_fields {
Link Here
|
1654 |
|
1677 |
|
1655 |
my ($title, $author, $isbn, $issn) = _parse_biblio_fields($marc_record); |
1678 |
my ($title, $author, $isbn, $issn) = _parse_biblio_fields($marc_record); |
1656 |
my $dbh = C4::Context->dbh; |
1679 |
my $dbh = C4::Context->dbh; |
1657 |
# FIXME no controlnumber, originalsource |
1680 |
# FIXME no originalsource |
1658 |
# FIXME 2 - should regularize normalization of ISBN wherever it is done |
1681 |
# FIXME 2 - should regularize normalization of ISBN wherever it is done |
1659 |
$isbn =~ s/\(.*$//; |
1682 |
$isbn = C4::Koha::GetNormalizedISBN($isbn); |
1660 |
$isbn =~ tr/ -_//; |
|
|
1661 |
$isbn = uc $isbn; |
1662 |
my $sth = $dbh->prepare("UPDATE import_biblios SET title = ?, author = ?, isbn = ?, issn = ? |
1683 |
my $sth = $dbh->prepare("UPDATE import_biblios SET title = ?, author = ?, isbn = ?, issn = ? |
1663 |
WHERE import_record_id = ?"); |
1684 |
WHERE import_record_id = ?"); |
1664 |
$sth->execute($title, $author, $isbn, $issn, $import_record_id); |
1685 |
$sth->execute($title, $author, $isbn, $issn, $import_record_id); |