Lines 250-255
sub AddBiblio {
Link Here
|
250 |
my $frameworkcode = shift; |
250 |
my $frameworkcode = shift; |
251 |
my $options = @_ ? shift : undef; |
251 |
my $options = @_ ? shift : undef; |
252 |
my $defer_marc_save = 0; |
252 |
my $defer_marc_save = 0; |
|
|
253 |
if (!$record) { |
254 |
carp('AddBiblio called with undefined record'); |
255 |
return; |
256 |
} |
253 |
if ( defined $options and exists $options->{'defer_marc_save'} and $options->{'defer_marc_save'} ) { |
257 |
if ( defined $options and exists $options->{'defer_marc_save'} and $options->{'defer_marc_save'} ) { |
254 |
$defer_marc_save = 1; |
258 |
$defer_marc_save = 1; |
255 |
} |
259 |
} |
Lines 299-309
in the C<biblio> and C<biblioitems> tables, as well as
Link Here
|
299 |
which fields are used to store embedded item, biblioitem, |
303 |
which fields are used to store embedded item, biblioitem, |
300 |
and biblionumber data for indexing. |
304 |
and biblionumber data for indexing. |
301 |
|
305 |
|
|
|
306 |
Returns 1 on success 0 on failure |
307 |
|
302 |
=cut |
308 |
=cut |
303 |
|
309 |
|
304 |
sub ModBiblio { |
310 |
sub ModBiblio { |
305 |
my ( $record, $biblionumber, $frameworkcode ) = @_; |
311 |
my ( $record, $biblionumber, $frameworkcode ) = @_; |
306 |
croak "No record" unless $record; |
312 |
if (!$record) { |
|
|
313 |
carp 'No record passed to ModBiblio'; |
314 |
return 0; |
315 |
} |
307 |
|
316 |
|
308 |
if ( C4::Context->preference("CataloguingLog") ) { |
317 |
if ( C4::Context->preference("CataloguingLog") ) { |
309 |
my $newrecord = GetMarcBiblio($biblionumber); |
318 |
my $newrecord = GetMarcBiblio($biblionumber); |
Lines 473-483
sub DelBiblio {
Link Here
|
473 |
|
482 |
|
474 |
Automatically links headings in a bib record to authorities. |
483 |
Automatically links headings in a bib record to authorities. |
475 |
|
484 |
|
|
|
485 |
Returns the number of headings changed |
486 |
|
476 |
=cut |
487 |
=cut |
477 |
|
488 |
|
478 |
sub BiblioAutoLink { |
489 |
sub BiblioAutoLink { |
479 |
my $record = shift; |
490 |
my $record = shift; |
480 |
my $frameworkcode = shift; |
491 |
my $frameworkcode = shift; |
|
|
492 |
if (!$record) { |
493 |
carp('Undefined record passed to BiblioAutoLink'); |
494 |
return 0; |
495 |
} |
481 |
my ( $num_headings_changed, %results ); |
496 |
my ( $num_headings_changed, %results ); |
482 |
|
497 |
|
483 |
my $linker_module = |
498 |
my $linker_module = |
Lines 485-491
sub BiblioAutoLink {
Link Here
|
485 |
unless ( can_load( modules => { $linker_module => undef } ) ) { |
500 |
unless ( can_load( modules => { $linker_module => undef } ) ) { |
486 |
$linker_module = 'C4::Linker::Default'; |
501 |
$linker_module = 'C4::Linker::Default'; |
487 |
unless ( can_load( modules => { $linker_module => undef } ) ) { |
502 |
unless ( can_load( modules => { $linker_module => undef } ) ) { |
488 |
return 0, 0; |
503 |
return 0; |
489 |
} |
504 |
} |
490 |
} |
505 |
} |
491 |
|
506 |
|
Lines 522-527
sub LinkBibHeadingsToAuthorities {
Link Here
|
522 |
my $frameworkcode = shift; |
537 |
my $frameworkcode = shift; |
523 |
my $allowrelink = shift; |
538 |
my $allowrelink = shift; |
524 |
my %results; |
539 |
my %results; |
|
|
540 |
if (!$bib) { |
541 |
carp 'LinkBibHeadingsToAuthorities called on undefined bib record'; |
542 |
return ( 0, {}); |
543 |
} |
525 |
require C4::Heading; |
544 |
require C4::Heading; |
526 |
require C4::AuthoritiesMarc; |
545 |
require C4::AuthoritiesMarc; |
527 |
|
546 |
|
Lines 671-676
Get MARC fields from a keyword defined in fieldmapping table.
Link Here
|
671 |
|
690 |
|
672 |
sub GetRecordValue { |
691 |
sub GetRecordValue { |
673 |
my ( $field, $record, $frameworkcode ) = @_; |
692 |
my ( $field, $record, $frameworkcode ) = @_; |
|
|
693 |
|
694 |
if (!$record) { |
695 |
carp 'GetRecordValue called with undefined record'; |
696 |
return; |
697 |
} |
674 |
my $dbh = C4::Context->dbh; |
698 |
my $dbh = C4::Context->dbh; |
675 |
|
699 |
|
676 |
my $sth = $dbh->prepare('SELECT fieldcode, subfieldcode FROM fieldmapping WHERE frameworkcode = ? AND field = ?'); |
700 |
my $sth = $dbh->prepare('SELECT fieldcode, subfieldcode FROM fieldmapping WHERE frameworkcode = ? AND field = ?'); |
Lines 1302-1308
sub GetCOinSBiblio {
Link Here
|
1302 |
|
1326 |
|
1303 |
# get the coin format |
1327 |
# get the coin format |
1304 |
if ( ! $record ) { |
1328 |
if ( ! $record ) { |
1305 |
return; |
1329 |
carp 'GetCOinSBiblio called with undefined record'; |
|
|
1330 |
return; |
1306 |
} |
1331 |
} |
1307 |
my $pos7 = substr $record->leader(), 7, 1; |
1332 |
my $pos7 = substr $record->leader(), 7, 1; |
1308 |
my $pos6 = substr $record->leader(), 6, 1; |
1333 |
my $pos6 = substr $record->leader(), 6, 1; |
Lines 1443-1452
sub GetCOinSBiblio {
Link Here
|
1443 |
=head2 GetMarcPrice |
1468 |
=head2 GetMarcPrice |
1444 |
|
1469 |
|
1445 |
return the prices in accordance with the Marc format. |
1470 |
return the prices in accordance with the Marc format. |
|
|
1471 |
|
1472 |
returns 0 if no price found |
1473 |
returns undef if called without a marc record or with |
1474 |
an unrecognized marc format |
1475 |
|
1446 |
=cut |
1476 |
=cut |
1447 |
|
1477 |
|
1448 |
sub GetMarcPrice { |
1478 |
sub GetMarcPrice { |
1449 |
my ( $record, $marcflavour ) = @_; |
1479 |
my ( $record, $marcflavour ) = @_; |
|
|
1480 |
if (!$record) { |
1481 |
carp 'GetMarcPrice called on undefined record'; |
1482 |
return; |
1483 |
} |
1484 |
|
1450 |
my @listtags; |
1485 |
my @listtags; |
1451 |
my $subfield; |
1486 |
my $subfield; |
1452 |
|
1487 |
|
Lines 1518-1527
sub MungeMarcPrice {
Link Here
|
1518 |
return the quantity of a book. Used in acquisition only, when importing a file an iso2709 from a bookseller |
1553 |
return the quantity of a book. Used in acquisition only, when importing a file an iso2709 from a bookseller |
1519 |
Warning : this is not really in the marc standard. In Unimarc, Electre (the most widely used bookseller) use the 969$a |
1554 |
Warning : this is not really in the marc standard. In Unimarc, Electre (the most widely used bookseller) use the 969$a |
1520 |
|
1555 |
|
|
|
1556 |
returns 0 if no quantity found |
1557 |
returns undef if called without a marc record or with |
1558 |
an unrecognized marc format |
1559 |
|
1521 |
=cut |
1560 |
=cut |
1522 |
|
1561 |
|
1523 |
sub GetMarcQuantity { |
1562 |
sub GetMarcQuantity { |
1524 |
my ( $record, $marcflavour ) = @_; |
1563 |
my ( $record, $marcflavour ) = @_; |
|
|
1564 |
if (!$record) { |
1565 |
carp 'GetMarcQuantity called on undefined record'; |
1566 |
return; |
1567 |
} |
1568 |
|
1525 |
my @listtags; |
1569 |
my @listtags; |
1526 |
my $subfield; |
1570 |
my $subfield; |
1527 |
|
1571 |
|
Lines 1608-1613
Get the control number / record Identifier from the MARC record and return it.
Link Here
|
1608 |
|
1652 |
|
1609 |
sub GetMarcControlnumber { |
1653 |
sub GetMarcControlnumber { |
1610 |
my ( $record, $marcflavour ) = @_; |
1654 |
my ( $record, $marcflavour ) = @_; |
|
|
1655 |
if (!$record) { |
1656 |
carp 'GetMarcControlnumber called on undefined record'; |
1657 |
return; |
1658 |
} |
1611 |
my $controlnumber = ""; |
1659 |
my $controlnumber = ""; |
1612 |
# Control number or Record identifier are the same field in MARC21, UNIMARC and NORMARC |
1660 |
# Control number or Record identifier are the same field in MARC21, UNIMARC and NORMARC |
1613 |
# Keep $marcflavour for possible later use |
1661 |
# Keep $marcflavour for possible later use |
Lines 1631-1636
ISBNs stored in different fields depending on MARC flavour
Link Here
|
1631 |
|
1679 |
|
1632 |
sub GetMarcISBN { |
1680 |
sub GetMarcISBN { |
1633 |
my ( $record, $marcflavour ) = @_; |
1681 |
my ( $record, $marcflavour ) = @_; |
|
|
1682 |
if (!$record) { |
1683 |
carp 'GetMarcISBN called on undefined record'; |
1684 |
return; |
1685 |
} |
1634 |
my $scope; |
1686 |
my $scope; |
1635 |
if ( $marcflavour eq "UNIMARC" ) { |
1687 |
if ( $marcflavour eq "UNIMARC" ) { |
1636 |
$scope = '010'; |
1688 |
$scope = '010'; |
Lines 1672-1677
ISSNs are stored in different fields depending on MARC flavour
Link Here
|
1672 |
|
1724 |
|
1673 |
sub GetMarcISSN { |
1725 |
sub GetMarcISSN { |
1674 |
my ( $record, $marcflavour ) = @_; |
1726 |
my ( $record, $marcflavour ) = @_; |
|
|
1727 |
if (!$record) { |
1728 |
carp 'GetMarcISSN called on undefined record'; |
1729 |
return; |
1730 |
} |
1675 |
my $scope; |
1731 |
my $scope; |
1676 |
if ( $marcflavour eq "UNIMARC" ) { |
1732 |
if ( $marcflavour eq "UNIMARC" ) { |
1677 |
$scope = '011'; |
1733 |
$scope = '011'; |
Lines 1697-1702
The note are stored in different fields depending on MARC flavour
Link Here
|
1697 |
|
1753 |
|
1698 |
sub GetMarcNotes { |
1754 |
sub GetMarcNotes { |
1699 |
my ( $record, $marcflavour ) = @_; |
1755 |
my ( $record, $marcflavour ) = @_; |
|
|
1756 |
if (!$record) { |
1757 |
carp 'GetMarcNotes called on undefined record'; |
1758 |
return; |
1759 |
} |
1700 |
my $scope; |
1760 |
my $scope; |
1701 |
if ( $marcflavour eq "UNIMARC" ) { |
1761 |
if ( $marcflavour eq "UNIMARC" ) { |
1702 |
$scope = '3..'; |
1762 |
$scope = '3..'; |
Lines 1741-1746
The subjects are stored in different fields depending on MARC flavour
Link Here
|
1741 |
|
1801 |
|
1742 |
sub GetMarcSubjects { |
1802 |
sub GetMarcSubjects { |
1743 |
my ( $record, $marcflavour ) = @_; |
1803 |
my ( $record, $marcflavour ) = @_; |
|
|
1804 |
if (!$record) { |
1805 |
carp 'GetMarcSubjects called on undefined record'; |
1806 |
return; |
1807 |
} |
1744 |
my ( $mintag, $maxtag, $fields_filter ); |
1808 |
my ( $mintag, $maxtag, $fields_filter ); |
1745 |
if ( $marcflavour eq "UNIMARC" ) { |
1809 |
if ( $marcflavour eq "UNIMARC" ) { |
1746 |
$mintag = "600"; |
1810 |
$mintag = "600"; |
Lines 1826-1831
The authors are stored in different fields depending on MARC flavour
Link Here
|
1826 |
|
1890 |
|
1827 |
sub GetMarcAuthors { |
1891 |
sub GetMarcAuthors { |
1828 |
my ( $record, $marcflavour ) = @_; |
1892 |
my ( $record, $marcflavour ) = @_; |
|
|
1893 |
if (!$record) { |
1894 |
carp 'GetMarcAuthors called on undefined record'; |
1895 |
return; |
1896 |
} |
1829 |
my ( $mintag, $maxtag, $fields_filter ); |
1897 |
my ( $mintag, $maxtag, $fields_filter ); |
1830 |
|
1898 |
|
1831 |
# tagslib useful for UNIMARC author reponsabilities |
1899 |
# tagslib useful for UNIMARC author reponsabilities |
Lines 1914-1919
Assumes web resources (not uncommon in MARC21 to omit resource type ind)
Link Here
|
1914 |
|
1982 |
|
1915 |
sub GetMarcUrls { |
1983 |
sub GetMarcUrls { |
1916 |
my ( $record, $marcflavour ) = @_; |
1984 |
my ( $record, $marcflavour ) = @_; |
|
|
1985 |
if (!$record) { |
1986 |
carp 'GetMarcUrls called on undefined record'; |
1987 |
return; |
1988 |
} |
1917 |
|
1989 |
|
1918 |
my @marcurls; |
1990 |
my @marcurls; |
1919 |
for my $field ( $record->field('856') ) { |
1991 |
for my $field ( $record->field('856') ) { |
Lines 1969-1974
The series are stored in different fields depending on MARC flavour
Link Here
|
1969 |
|
2041 |
|
1970 |
sub GetMarcSeries { |
2042 |
sub GetMarcSeries { |
1971 |
my ( $record, $marcflavour ) = @_; |
2043 |
my ( $record, $marcflavour ) = @_; |
|
|
2044 |
if (!$record) { |
2045 |
carp 'GetMarcSeries called on undefined record'; |
2046 |
return; |
2047 |
} |
2048 |
|
1972 |
my ( $mintag, $maxtag, $fields_filter ); |
2049 |
my ( $mintag, $maxtag, $fields_filter ); |
1973 |
if ( $marcflavour eq "UNIMARC" ) { |
2050 |
if ( $marcflavour eq "UNIMARC" ) { |
1974 |
$mintag = "225"; |
2051 |
$mintag = "225"; |
Lines 2038-2043
Get all host records (773s MARC21, 461 UNIMARC) from the MARC record and returns
Link Here
|
2038 |
|
2115 |
|
2039 |
sub GetMarcHosts { |
2116 |
sub GetMarcHosts { |
2040 |
my ( $record, $marcflavour ) = @_; |
2117 |
my ( $record, $marcflavour ) = @_; |
|
|
2118 |
if (!$record) { |
2119 |
carp 'GetMarcHosts called on undefined record'; |
2120 |
return; |
2121 |
} |
2122 |
|
2041 |
my ( $tag,$title_subf,$bibnumber_subf,$itemnumber_subf); |
2123 |
my ( $tag,$title_subf,$bibnumber_subf,$itemnumber_subf); |
2042 |
$marcflavour ||="MARC21"; |
2124 |
$marcflavour ||="MARC21"; |
2043 |
if ( $marcflavour eq "MARC21" || $marcflavour eq "NORMARC" ) { |
2125 |
if ( $marcflavour eq "MARC21" || $marcflavour eq "NORMARC" ) { |
Lines 2481-2492
our $inverted_field_map;
Link Here
|
2481 |
Extract data from a MARC bib record into a hashref representing |
2563 |
Extract data from a MARC bib record into a hashref representing |
2482 |
Koha biblio, biblioitems, and items fields. |
2564 |
Koha biblio, biblioitems, and items fields. |
2483 |
|
2565 |
|
|
|
2566 |
If passed an undefined record will log the error and return an empty |
2567 |
hash_ref |
2568 |
|
2484 |
=cut |
2569 |
=cut |
2485 |
|
2570 |
|
2486 |
sub TransformMarcToKoha { |
2571 |
sub TransformMarcToKoha { |
2487 |
my ( $dbh, $record, $frameworkcode, $limit_table ) = @_; |
2572 |
my ( $dbh, $record, $frameworkcode, $limit_table ) = @_; |
2488 |
|
2573 |
|
2489 |
my $result; |
2574 |
my $result = {}; |
|
|
2575 |
if (!defined $record) { |
2576 |
carp('TransformMarcToKoha called with undefined record'); |
2577 |
return $result; |
2578 |
} |
2490 |
$limit_table = $limit_table || 0; |
2579 |
$limit_table = $limit_table || 0; |
2491 |
$frameworkcode = '' unless defined $frameworkcode; |
2580 |
$frameworkcode = '' unless defined $frameworkcode; |
2492 |
|
2581 |
|
Lines 2799-2805
if $itemnumbers is defined, only specified itemnumbers are embedded
Link Here
|
2799 |
|
2888 |
|
2800 |
sub EmbedItemsInMarcBiblio { |
2889 |
sub EmbedItemsInMarcBiblio { |
2801 |
my ($marc, $biblionumber, $itemnumbers) = @_; |
2890 |
my ($marc, $biblionumber, $itemnumbers) = @_; |
2802 |
croak "No MARC record" unless $marc; |
2891 |
if ( !$marc ) { |
|
|
2892 |
carp 'EmbedItemsInMarcBiblio: No MARC record passed'; |
2893 |
return; |
2894 |
} |
2803 |
|
2895 |
|
2804 |
$itemnumbers = [] unless defined $itemnumbers; |
2896 |
$itemnumbers = [] unless defined $itemnumbers; |
2805 |
|
2897 |
|
Lines 3262-3267
sub ModBiblioMarc {
Link Here
|
3262 |
# pass the MARC::Record to this function, and it will create the records in |
3354 |
# pass the MARC::Record to this function, and it will create the records in |
3263 |
# the marc field |
3355 |
# the marc field |
3264 |
my ( $record, $biblionumber, $frameworkcode ) = @_; |
3356 |
my ( $record, $biblionumber, $frameworkcode ) = @_; |
|
|
3357 |
if ( !$record ) { |
3358 |
carp 'ModBiblioMarc passed an undefined record'; |
3359 |
return; |
3360 |
} |
3265 |
|
3361 |
|
3266 |
# Clone record as it gets modified |
3362 |
# Clone record as it gets modified |
3267 |
$record = $record->clone(); |
3363 |
$record = $record->clone(); |
Lines 3623-3628
Removes all nsb/nse chars from a record
Link Here
|
3623 |
|
3719 |
|
3624 |
sub RemoveAllNsb { |
3720 |
sub RemoveAllNsb { |
3625 |
my $record = shift; |
3721 |
my $record = shift; |
|
|
3722 |
if (!$record) { |
3723 |
carp 'RemoveAllNsb called with undefined record'; |
3724 |
return; |
3725 |
} |
3626 |
|
3726 |
|
3627 |
SetUTF8Flag($record); |
3727 |
SetUTF8Flag($record); |
3628 |
|
3728 |
|