Lines 252-257
sub AddBiblio {
Link Here
|
252 |
my $frameworkcode = shift; |
252 |
my $frameworkcode = shift; |
253 |
my $options = @_ ? shift : undef; |
253 |
my $options = @_ ? shift : undef; |
254 |
my $defer_marc_save = 0; |
254 |
my $defer_marc_save = 0; |
|
|
255 |
if (!$record) { |
256 |
carp('AddBiblio called with undefined record'); |
257 |
return; |
258 |
} |
255 |
if ( defined $options and exists $options->{'defer_marc_save'} and $options->{'defer_marc_save'} ) { |
259 |
if ( defined $options and exists $options->{'defer_marc_save'} and $options->{'defer_marc_save'} ) { |
256 |
$defer_marc_save = 1; |
260 |
$defer_marc_save = 1; |
257 |
} |
261 |
} |
Lines 301-311
in the C<biblio> and C<biblioitems> tables, as well as
Link Here
|
301 |
which fields are used to store embedded item, biblioitem, |
305 |
which fields are used to store embedded item, biblioitem, |
302 |
and biblionumber data for indexing. |
306 |
and biblionumber data for indexing. |
303 |
|
307 |
|
|
|
308 |
Returns 1 on success 0 on failure |
309 |
|
304 |
=cut |
310 |
=cut |
305 |
|
311 |
|
306 |
sub ModBiblio { |
312 |
sub ModBiblio { |
307 |
my ( $record, $biblionumber, $frameworkcode ) = @_; |
313 |
my ( $record, $biblionumber, $frameworkcode ) = @_; |
308 |
croak "No record" unless $record; |
314 |
if (!$record) { |
|
|
315 |
carp 'No record passed to ModBiblio'; |
316 |
return 0; |
317 |
} |
309 |
|
318 |
|
310 |
if ( C4::Context->preference("CataloguingLog") ) { |
319 |
if ( C4::Context->preference("CataloguingLog") ) { |
311 |
my $newrecord = GetMarcBiblio($biblionumber); |
320 |
my $newrecord = GetMarcBiblio($biblionumber); |
Lines 475-485
sub DelBiblio {
Link Here
|
475 |
|
484 |
|
476 |
Automatically links headings in a bib record to authorities. |
485 |
Automatically links headings in a bib record to authorities. |
477 |
|
486 |
|
|
|
487 |
Returns the number of headings changed |
488 |
|
478 |
=cut |
489 |
=cut |
479 |
|
490 |
|
480 |
sub BiblioAutoLink { |
491 |
sub BiblioAutoLink { |
481 |
my $record = shift; |
492 |
my $record = shift; |
482 |
my $frameworkcode = shift; |
493 |
my $frameworkcode = shift; |
|
|
494 |
if (!$record) { |
495 |
carp('Undefined record passed to BiblioAutoLink'); |
496 |
return 0; |
497 |
} |
483 |
my ( $num_headings_changed, %results ); |
498 |
my ( $num_headings_changed, %results ); |
484 |
|
499 |
|
485 |
my $linker_module = |
500 |
my $linker_module = |
Lines 487-493
sub BiblioAutoLink {
Link Here
|
487 |
unless ( can_load( modules => { $linker_module => undef } ) ) { |
502 |
unless ( can_load( modules => { $linker_module => undef } ) ) { |
488 |
$linker_module = 'C4::Linker::Default'; |
503 |
$linker_module = 'C4::Linker::Default'; |
489 |
unless ( can_load( modules => { $linker_module => undef } ) ) { |
504 |
unless ( can_load( modules => { $linker_module => undef } ) ) { |
490 |
return 0, 0; |
505 |
return 0; |
491 |
} |
506 |
} |
492 |
} |
507 |
} |
493 |
|
508 |
|
Lines 524-529
sub LinkBibHeadingsToAuthorities {
Link Here
|
524 |
my $frameworkcode = shift; |
539 |
my $frameworkcode = shift; |
525 |
my $allowrelink = shift; |
540 |
my $allowrelink = shift; |
526 |
my %results; |
541 |
my %results; |
|
|
542 |
if (!$bib) { |
543 |
carp 'LinkBibHeadingsToAuthorities called on undefined bib record'; |
544 |
return ( 0, {}); |
545 |
} |
527 |
require C4::Heading; |
546 |
require C4::Heading; |
528 |
require C4::AuthoritiesMarc; |
547 |
require C4::AuthoritiesMarc; |
529 |
|
548 |
|
Lines 673-678
Get MARC fields from a keyword defined in fieldmapping table.
Link Here
|
673 |
|
692 |
|
674 |
sub GetRecordValue { |
693 |
sub GetRecordValue { |
675 |
my ( $field, $record, $frameworkcode ) = @_; |
694 |
my ( $field, $record, $frameworkcode ) = @_; |
|
|
695 |
|
696 |
if (!$record) { |
697 |
carp 'GetRecordValue called with undefined record'; |
698 |
return; |
699 |
} |
676 |
my $dbh = C4::Context->dbh; |
700 |
my $dbh = C4::Context->dbh; |
677 |
|
701 |
|
678 |
my $sth = $dbh->prepare('SELECT fieldcode, subfieldcode FROM fieldmapping WHERE frameworkcode = ? AND field = ?'); |
702 |
my $sth = $dbh->prepare('SELECT fieldcode, subfieldcode FROM fieldmapping WHERE frameworkcode = ? AND field = ?'); |
Lines 1304-1310
sub GetCOinSBiblio {
Link Here
|
1304 |
|
1328 |
|
1305 |
# get the coin format |
1329 |
# get the coin format |
1306 |
if ( ! $record ) { |
1330 |
if ( ! $record ) { |
1307 |
return; |
1331 |
carp 'GetCOinSBiblio called with undefined record'; |
|
|
1332 |
return; |
1308 |
} |
1333 |
} |
1309 |
my $pos7 = substr $record->leader(), 7, 1; |
1334 |
my $pos7 = substr $record->leader(), 7, 1; |
1310 |
my $pos6 = substr $record->leader(), 6, 1; |
1335 |
my $pos6 = substr $record->leader(), 6, 1; |
Lines 1445-1454
sub GetCOinSBiblio {
Link Here
|
1445 |
=head2 GetMarcPrice |
1470 |
=head2 GetMarcPrice |
1446 |
|
1471 |
|
1447 |
return the prices in accordance with the Marc format. |
1472 |
return the prices in accordance with the Marc format. |
|
|
1473 |
|
1474 |
returns 0 if no price found |
1475 |
returns undef if called without a marc record or with |
1476 |
an unrecognized marc format |
1477 |
|
1448 |
=cut |
1478 |
=cut |
1449 |
|
1479 |
|
1450 |
sub GetMarcPrice { |
1480 |
sub GetMarcPrice { |
1451 |
my ( $record, $marcflavour ) = @_; |
1481 |
my ( $record, $marcflavour ) = @_; |
|
|
1482 |
if (!$record) { |
1483 |
carp 'GetMarcPrice called on undefined record'; |
1484 |
return; |
1485 |
} |
1486 |
|
1452 |
my @listtags; |
1487 |
my @listtags; |
1453 |
my $subfield; |
1488 |
my $subfield; |
1454 |
|
1489 |
|
Lines 1520-1529
sub MungeMarcPrice {
Link Here
|
1520 |
return the quantity of a book. Used in acquisition only, when importing a file an iso2709 from a bookseller |
1555 |
return the quantity of a book. Used in acquisition only, when importing a file an iso2709 from a bookseller |
1521 |
Warning : this is not really in the marc standard. In Unimarc, Electre (the most widely used bookseller) use the 969$a |
1556 |
Warning : this is not really in the marc standard. In Unimarc, Electre (the most widely used bookseller) use the 969$a |
1522 |
|
1557 |
|
|
|
1558 |
returns 0 if no quantity found |
1559 |
returns undef if called without a marc record or with |
1560 |
an unrecognized marc format |
1561 |
|
1523 |
=cut |
1562 |
=cut |
1524 |
|
1563 |
|
1525 |
sub GetMarcQuantity { |
1564 |
sub GetMarcQuantity { |
1526 |
my ( $record, $marcflavour ) = @_; |
1565 |
my ( $record, $marcflavour ) = @_; |
|
|
1566 |
if (!$record) { |
1567 |
carp 'GetMarcQuantity called on undefined record'; |
1568 |
return; |
1569 |
} |
1570 |
|
1527 |
my @listtags; |
1571 |
my @listtags; |
1528 |
my $subfield; |
1572 |
my $subfield; |
1529 |
|
1573 |
|
Lines 1610-1615
Get the control number / record Identifier from the MARC record and return it.
Link Here
|
1610 |
|
1654 |
|
1611 |
sub GetMarcControlnumber { |
1655 |
sub GetMarcControlnumber { |
1612 |
my ( $record, $marcflavour ) = @_; |
1656 |
my ( $record, $marcflavour ) = @_; |
|
|
1657 |
if (!$record) { |
1658 |
carp 'GetMarcControlnumber called on undefined record'; |
1659 |
return; |
1660 |
} |
1613 |
my $controlnumber = ""; |
1661 |
my $controlnumber = ""; |
1614 |
# Control number or Record identifier are the same field in MARC21, UNIMARC and NORMARC |
1662 |
# Control number or Record identifier are the same field in MARC21, UNIMARC and NORMARC |
1615 |
# Keep $marcflavour for possible later use |
1663 |
# Keep $marcflavour for possible later use |
Lines 1633-1638
ISBNs stored in different fields depending on MARC flavour
Link Here
|
1633 |
|
1681 |
|
1634 |
sub GetMarcISBN { |
1682 |
sub GetMarcISBN { |
1635 |
my ( $record, $marcflavour ) = @_; |
1683 |
my ( $record, $marcflavour ) = @_; |
|
|
1684 |
if (!$record) { |
1685 |
carp 'GetMarcISBN called on undefined record'; |
1686 |
return; |
1687 |
} |
1636 |
my $scope; |
1688 |
my $scope; |
1637 |
if ( $marcflavour eq "UNIMARC" ) { |
1689 |
if ( $marcflavour eq "UNIMARC" ) { |
1638 |
$scope = '010'; |
1690 |
$scope = '010'; |
Lines 1674-1679
ISSNs are stored in different fields depending on MARC flavour
Link Here
|
1674 |
|
1726 |
|
1675 |
sub GetMarcISSN { |
1727 |
sub GetMarcISSN { |
1676 |
my ( $record, $marcflavour ) = @_; |
1728 |
my ( $record, $marcflavour ) = @_; |
|
|
1729 |
if (!$record) { |
1730 |
carp 'GetMarcISSN called on undefined record'; |
1731 |
return; |
1732 |
} |
1677 |
my $scope; |
1733 |
my $scope; |
1678 |
if ( $marcflavour eq "UNIMARC" ) { |
1734 |
if ( $marcflavour eq "UNIMARC" ) { |
1679 |
$scope = '011'; |
1735 |
$scope = '011'; |
Lines 1699-1704
The note are stored in different fields depending on MARC flavour
Link Here
|
1699 |
|
1755 |
|
1700 |
sub GetMarcNotes { |
1756 |
sub GetMarcNotes { |
1701 |
my ( $record, $marcflavour ) = @_; |
1757 |
my ( $record, $marcflavour ) = @_; |
|
|
1758 |
if (!$record) { |
1759 |
carp 'GetMarcNotes called on undefined record'; |
1760 |
return; |
1761 |
} |
1702 |
my $scope; |
1762 |
my $scope; |
1703 |
if ( $marcflavour eq "UNIMARC" ) { |
1763 |
if ( $marcflavour eq "UNIMARC" ) { |
1704 |
$scope = '3..'; |
1764 |
$scope = '3..'; |
Lines 1743-1748
The subjects are stored in different fields depending on MARC flavour
Link Here
|
1743 |
|
1803 |
|
1744 |
sub GetMarcSubjects { |
1804 |
sub GetMarcSubjects { |
1745 |
my ( $record, $marcflavour ) = @_; |
1805 |
my ( $record, $marcflavour ) = @_; |
|
|
1806 |
if (!$record) { |
1807 |
carp 'GetMarcSubjects called on undefined record'; |
1808 |
return; |
1809 |
} |
1746 |
my ( $mintag, $maxtag, $fields_filter ); |
1810 |
my ( $mintag, $maxtag, $fields_filter ); |
1747 |
if ( $marcflavour eq "UNIMARC" ) { |
1811 |
if ( $marcflavour eq "UNIMARC" ) { |
1748 |
$mintag = "600"; |
1812 |
$mintag = "600"; |
Lines 1828-1833
The authors are stored in different fields depending on MARC flavour
Link Here
|
1828 |
|
1892 |
|
1829 |
sub GetMarcAuthors { |
1893 |
sub GetMarcAuthors { |
1830 |
my ( $record, $marcflavour ) = @_; |
1894 |
my ( $record, $marcflavour ) = @_; |
|
|
1895 |
if (!$record) { |
1896 |
carp 'GetMarcAuthors called on undefined record'; |
1897 |
return; |
1898 |
} |
1831 |
my ( $mintag, $maxtag, $fields_filter ); |
1899 |
my ( $mintag, $maxtag, $fields_filter ); |
1832 |
|
1900 |
|
1833 |
# tagslib useful for UNIMARC author reponsabilities |
1901 |
# tagslib useful for UNIMARC author reponsabilities |
Lines 1916-1921
Assumes web resources (not uncommon in MARC21 to omit resource type ind)
Link Here
|
1916 |
|
1984 |
|
1917 |
sub GetMarcUrls { |
1985 |
sub GetMarcUrls { |
1918 |
my ( $record, $marcflavour ) = @_; |
1986 |
my ( $record, $marcflavour ) = @_; |
|
|
1987 |
if (!$record) { |
1988 |
carp 'GetMarcUrls called on undefined record'; |
1989 |
return; |
1990 |
} |
1919 |
|
1991 |
|
1920 |
my @marcurls; |
1992 |
my @marcurls; |
1921 |
for my $field ( $record->field('856') ) { |
1993 |
for my $field ( $record->field('856') ) { |
Lines 1971-1976
The series are stored in different fields depending on MARC flavour
Link Here
|
1971 |
|
2043 |
|
1972 |
sub GetMarcSeries { |
2044 |
sub GetMarcSeries { |
1973 |
my ( $record, $marcflavour ) = @_; |
2045 |
my ( $record, $marcflavour ) = @_; |
|
|
2046 |
if (!$record) { |
2047 |
carp 'GetMarcSeries called on undefined record'; |
2048 |
return; |
2049 |
} |
2050 |
|
1974 |
my ( $mintag, $maxtag, $fields_filter ); |
2051 |
my ( $mintag, $maxtag, $fields_filter ); |
1975 |
if ( $marcflavour eq "UNIMARC" ) { |
2052 |
if ( $marcflavour eq "UNIMARC" ) { |
1976 |
$mintag = "225"; |
2053 |
$mintag = "225"; |
Lines 2040-2045
Get all host records (773s MARC21, 461 UNIMARC) from the MARC record and returns
Link Here
|
2040 |
|
2117 |
|
2041 |
sub GetMarcHosts { |
2118 |
sub GetMarcHosts { |
2042 |
my ( $record, $marcflavour ) = @_; |
2119 |
my ( $record, $marcflavour ) = @_; |
|
|
2120 |
if (!$record) { |
2121 |
carp 'GetMarcHosts called on undefined record'; |
2122 |
return; |
2123 |
} |
2124 |
|
2043 |
my ( $tag,$title_subf,$bibnumber_subf,$itemnumber_subf); |
2125 |
my ( $tag,$title_subf,$bibnumber_subf,$itemnumber_subf); |
2044 |
$marcflavour ||="MARC21"; |
2126 |
$marcflavour ||="MARC21"; |
2045 |
if ( $marcflavour eq "MARC21" || $marcflavour eq "NORMARC" ) { |
2127 |
if ( $marcflavour eq "MARC21" || $marcflavour eq "NORMARC" ) { |
Lines 2483-2494
our $inverted_field_map;
Link Here
|
2483 |
Extract data from a MARC bib record into a hashref representing |
2565 |
Extract data from a MARC bib record into a hashref representing |
2484 |
Koha biblio, biblioitems, and items fields. |
2566 |
Koha biblio, biblioitems, and items fields. |
2485 |
|
2567 |
|
|
|
2568 |
If passed an undefined record will log the error and return an empty |
2569 |
hash_ref |
2570 |
|
2486 |
=cut |
2571 |
=cut |
2487 |
|
2572 |
|
2488 |
sub TransformMarcToKoha { |
2573 |
sub TransformMarcToKoha { |
2489 |
my ( $dbh, $record, $frameworkcode, $limit_table ) = @_; |
2574 |
my ( $dbh, $record, $frameworkcode, $limit_table ) = @_; |
2490 |
|
2575 |
|
2491 |
my $result; |
2576 |
my $result = {}; |
|
|
2577 |
if (!defined $record) { |
2578 |
carp('TransformMarcToKoha called with undefined record'); |
2579 |
return $result; |
2580 |
} |
2492 |
$limit_table = $limit_table || 0; |
2581 |
$limit_table = $limit_table || 0; |
2493 |
$frameworkcode = '' unless defined $frameworkcode; |
2582 |
$frameworkcode = '' unless defined $frameworkcode; |
2494 |
|
2583 |
|
Lines 2801-2807
if $itemnumbers is defined, only specified itemnumbers are embedded
Link Here
|
2801 |
|
2890 |
|
2802 |
sub EmbedItemsInMarcBiblio { |
2891 |
sub EmbedItemsInMarcBiblio { |
2803 |
my ($marc, $biblionumber, $itemnumbers) = @_; |
2892 |
my ($marc, $biblionumber, $itemnumbers) = @_; |
2804 |
croak "No MARC record" unless $marc; |
2893 |
if ( !$marc ) { |
|
|
2894 |
carp 'EmbedItemsInMarcBiblio: No MARC record passed'; |
2895 |
return; |
2896 |
} |
2805 |
|
2897 |
|
2806 |
$itemnumbers = [] unless defined $itemnumbers; |
2898 |
$itemnumbers = [] unless defined $itemnumbers; |
2807 |
|
2899 |
|
Lines 3264-3269
sub ModBiblioMarc {
Link Here
|
3264 |
# pass the MARC::Record to this function, and it will create the records in |
3356 |
# pass the MARC::Record to this function, and it will create the records in |
3265 |
# the marc field |
3357 |
# the marc field |
3266 |
my ( $record, $biblionumber, $frameworkcode ) = @_; |
3358 |
my ( $record, $biblionumber, $frameworkcode ) = @_; |
|
|
3359 |
if ( !$record ) { |
3360 |
carp 'ModBiblioMarc passed an undefined record'; |
3361 |
return; |
3362 |
} |
3267 |
|
3363 |
|
3268 |
# Clone record as it gets modified |
3364 |
# Clone record as it gets modified |
3269 |
$record = $record->clone(); |
3365 |
$record = $record->clone(); |
Lines 3625-3630
Removes all nsb/nse chars from a record
Link Here
|
3625 |
|
3721 |
|
3626 |
sub RemoveAllNsb { |
3722 |
sub RemoveAllNsb { |
3627 |
my $record = shift; |
3723 |
my $record = shift; |
|
|
3724 |
if (!$record) { |
3725 |
carp 'RemoveAllNsb called with undefined record'; |
3726 |
return; |
3727 |
} |
3628 |
|
3728 |
|
3629 |
SetUTF8Flag($record); |
3729 |
SetUTF8Flag($record); |
3630 |
|
3730 |
|