Lines 566-572
sub LinkBibHeadingsToAuthorities {
Link Here
|
566 |
my $authtypedata = |
566 |
my $authtypedata = |
567 |
C4::AuthoritiesMarc::GetAuthType( $heading->auth_type() ); |
567 |
C4::AuthoritiesMarc::GetAuthType( $heading->auth_type() ); |
568 |
my $marcrecordauth = MARC::Record->new(); |
568 |
my $marcrecordauth = MARC::Record->new(); |
569 |
if ( C4::Context->preference('marcflavour') eq 'MARC21' ) { |
569 |
if ( C4::Context->preference('MarcFormat') eq 'MARC21' ) { |
570 |
$marcrecordauth->leader(' nz a22 o 4500'); |
570 |
$marcrecordauth->leader(' nz a22 o 4500'); |
571 |
SetMarcUnicodeFlag( $marcrecordauth, 'MARC21' ); |
571 |
SetMarcUnicodeFlag( $marcrecordauth, 'MARC21' ); |
572 |
} |
572 |
} |
Lines 588-594
sub LinkBibHeadingsToAuthorities {
Link Here
|
588 |
# use UTF-8, but as of 2008-08-05, did not want to introduce that kind |
588 |
# use UTF-8, but as of 2008-08-05, did not want to introduce that kind |
589 |
# of change to a core API just before the 3.0 release. |
589 |
# of change to a core API just before the 3.0 release. |
590 |
|
590 |
|
591 |
if ( C4::Context->preference('marcflavour') eq 'MARC21' ) { |
591 |
if ( C4::Context->preference('MarcFormat') eq 'MARC21' ) { |
592 |
$marcrecordauth->insert_fields_ordered( |
592 |
$marcrecordauth->insert_fields_ordered( |
593 |
MARC::Field->new( |
593 |
MARC::Field->new( |
594 |
'667', '', '', |
594 |
'667', '', '', |
Lines 1256-1266
sub GetMarcBiblio {
Link Here
|
1256 |
$sth->execute($biblionumber); |
1256 |
$sth->execute($biblionumber); |
1257 |
my $row = $sth->fetchrow_hashref; |
1257 |
my $row = $sth->fetchrow_hashref; |
1258 |
my $marcxml = StripNonXmlChars( $row->{'marcxml'} ); |
1258 |
my $marcxml = StripNonXmlChars( $row->{'marcxml'} ); |
1259 |
MARC::File::XML->default_record_format( C4::Context->preference('marcflavour') ); |
1259 |
MARC::File::XML->default_record_format( C4::Context->preference('MarcFormat') ); |
1260 |
my $record = MARC::Record->new(); |
1260 |
my $record = MARC::Record->new(); |
1261 |
|
1261 |
|
1262 |
if ($marcxml) { |
1262 |
if ($marcxml) { |
1263 |
$record = eval { MARC::Record::new_from_xml( $marcxml, "utf8", C4::Context->preference('marcflavour') ) }; |
1263 |
$record = eval { MARC::Record::new_from_xml( $marcxml, "utf8", C4::Context->preference('MarcFormat') ) }; |
1264 |
if ($@) { warn " problem with :$biblionumber : $@ \n$marcxml"; } |
1264 |
if ($@) { warn " problem with :$biblionumber : $@ \n$marcxml"; } |
1265 |
return unless $record; |
1265 |
return unless $record; |
1266 |
|
1266 |
|
Lines 1368-1374
sub GetCOinSBiblio {
Link Here
|
1368 |
|
1368 |
|
1369 |
$genre = ( $mtx eq 'dc' ) ? "&rft.type=$genre" : "&rft.genre=$genre"; |
1369 |
$genre = ( $mtx eq 'dc' ) ? "&rft.type=$genre" : "&rft.genre=$genre"; |
1370 |
|
1370 |
|
1371 |
if ( C4::Context->preference("marcflavour") eq "UNIMARC" ) { |
1371 |
if ( C4::Context->preference("MarcFormat") eq "UNIMARC" ) { |
1372 |
|
1372 |
|
1373 |
# Setting datas |
1373 |
# Setting datas |
1374 |
$aulast = $record->subfield( '700', 'a' ) || ''; |
1374 |
$aulast = $record->subfield( '700', 'a' ) || ''; |
Lines 1448-1461
return the prices in accordance with the Marc format.
Link Here
|
1448 |
=cut |
1448 |
=cut |
1449 |
|
1449 |
|
1450 |
sub GetMarcPrice { |
1450 |
sub GetMarcPrice { |
1451 |
my ( $record, $marcflavour ) = @_; |
1451 |
my ( $record, $MarcFormat ) = @_; |
1452 |
my @listtags; |
1452 |
my @listtags; |
1453 |
my $subfield; |
1453 |
my $subfield; |
1454 |
|
1454 |
|
1455 |
if ( $marcflavour eq "MARC21" ) { |
1455 |
if ( $MarcFormat eq "MARC21" ) { |
1456 |
@listtags = ('345', '020'); |
1456 |
@listtags = ('345', '020'); |
1457 |
$subfield="c"; |
1457 |
$subfield="c"; |
1458 |
} elsif ( $marcflavour eq "UNIMARC" ) { |
1458 |
} elsif ( $MarcFormat eq "UNIMARC" ) { |
1459 |
@listtags = ('345', '010'); |
1459 |
@listtags = ('345', '010'); |
1460 |
$subfield="d"; |
1460 |
$subfield="d"; |
1461 |
} else { |
1461 |
} else { |
Lines 1523-1535
Warning : this is not really in the marc standard. In Unimarc, Electre (the most
Link Here
|
1523 |
=cut |
1523 |
=cut |
1524 |
|
1524 |
|
1525 |
sub GetMarcQuantity { |
1525 |
sub GetMarcQuantity { |
1526 |
my ( $record, $marcflavour ) = @_; |
1526 |
my ( $record, $MarcFormat ) = @_; |
1527 |
my @listtags; |
1527 |
my @listtags; |
1528 |
my $subfield; |
1528 |
my $subfield; |
1529 |
|
1529 |
|
1530 |
if ( $marcflavour eq "MARC21" ) { |
1530 |
if ( $MarcFormat eq "MARC21" ) { |
1531 |
return 0 |
1531 |
return 0 |
1532 |
} elsif ( $marcflavour eq "UNIMARC" ) { |
1532 |
} elsif ( $MarcFormat eq "UNIMARC" ) { |
1533 |
@listtags = ('969'); |
1533 |
@listtags = ('969'); |
1534 |
$subfield="a"; |
1534 |
$subfield="a"; |
1535 |
} else { |
1535 |
} else { |
Lines 1602-1619
sub GetAuthorisedValueDesc {
Link Here
|
1602 |
|
1602 |
|
1603 |
=head2 GetMarcControlnumber |
1603 |
=head2 GetMarcControlnumber |
1604 |
|
1604 |
|
1605 |
$marccontrolnumber = GetMarcControlnumber($record,$marcflavour); |
1605 |
$marccontrolnumber = GetMarcControlnumber($record,$MarcFormat); |
1606 |
|
1606 |
|
1607 |
Get the control number / record Identifier from the MARC record and return it. |
1607 |
Get the control number / record Identifier from the MARC record and return it. |
1608 |
|
1608 |
|
1609 |
=cut |
1609 |
=cut |
1610 |
|
1610 |
|
1611 |
sub GetMarcControlnumber { |
1611 |
sub GetMarcControlnumber { |
1612 |
my ( $record, $marcflavour ) = @_; |
1612 |
my ( $record, $MarcFormat ) = @_; |
1613 |
my $controlnumber = ""; |
1613 |
my $controlnumber = ""; |
1614 |
# Control number or Record identifier are the same field in MARC21, UNIMARC and NORMARC |
1614 |
# Control number or Record identifier are the same field in MARC21, UNIMARC and NORMARC |
1615 |
# Keep $marcflavour for possible later use |
1615 |
# Keep $MarcFormat for possible later use |
1616 |
if ($marcflavour eq "MARC21" || $marcflavour eq "UNIMARC" || $marcflavour eq "NORMARC") { |
1616 |
if ($MarcFormat eq "MARC21" || $MarcFormat eq "UNIMARC" || $MarcFormat eq "NORMARC") { |
1617 |
my $controlnumberField = $record->field('001'); |
1617 |
my $controlnumberField = $record->field('001'); |
1618 |
if ($controlnumberField) { |
1618 |
if ($controlnumberField) { |
1619 |
$controlnumber = $controlnumberField->data(); |
1619 |
$controlnumber = $controlnumberField->data(); |
Lines 1624-1630
sub GetMarcControlnumber {
Link Here
|
1624 |
|
1624 |
|
1625 |
=head2 GetMarcISBN |
1625 |
=head2 GetMarcISBN |
1626 |
|
1626 |
|
1627 |
$marcisbnsarray = GetMarcISBN( $record, $marcflavour ); |
1627 |
$marcisbnsarray = GetMarcISBN( $record, $MarcFormat ); |
1628 |
|
1628 |
|
1629 |
Get all ISBNs from the MARC record and returns them in an array. |
1629 |
Get all ISBNs from the MARC record and returns them in an array. |
1630 |
ISBNs stored in different fields depending on MARC flavour |
1630 |
ISBNs stored in different fields depending on MARC flavour |
Lines 1632-1640
ISBNs stored in different fields depending on MARC flavour
Link Here
|
1632 |
=cut |
1632 |
=cut |
1633 |
|
1633 |
|
1634 |
sub GetMarcISBN { |
1634 |
sub GetMarcISBN { |
1635 |
my ( $record, $marcflavour ) = @_; |
1635 |
my ( $record, $MarcFormat ) = @_; |
1636 |
my $scope; |
1636 |
my $scope; |
1637 |
if ( $marcflavour eq "UNIMARC" ) { |
1637 |
if ( $MarcFormat eq "UNIMARC" ) { |
1638 |
$scope = '010'; |
1638 |
$scope = '010'; |
1639 |
} else { # assume marc21 if not unimarc |
1639 |
} else { # assume marc21 if not unimarc |
1640 |
$scope = '020'; |
1640 |
$scope = '020'; |
Lines 1665-1671
sub GetMarcISBN {
Link Here
|
1665 |
|
1665 |
|
1666 |
=head2 GetMarcISSN |
1666 |
=head2 GetMarcISSN |
1667 |
|
1667 |
|
1668 |
$marcissnsarray = GetMarcISSN( $record, $marcflavour ); |
1668 |
$marcissnsarray = GetMarcISSN( $record, $MarcFormat ); |
1669 |
|
1669 |
|
1670 |
Get all valid ISSNs from the MARC record and returns them in an array. |
1670 |
Get all valid ISSNs from the MARC record and returns them in an array. |
1671 |
ISSNs are stored in different fields depending on MARC flavour |
1671 |
ISSNs are stored in different fields depending on MARC flavour |
Lines 1673-1681
ISSNs are stored in different fields depending on MARC flavour
Link Here
|
1673 |
=cut |
1673 |
=cut |
1674 |
|
1674 |
|
1675 |
sub GetMarcISSN { |
1675 |
sub GetMarcISSN { |
1676 |
my ( $record, $marcflavour ) = @_; |
1676 |
my ( $record, $MarcFormat ) = @_; |
1677 |
my $scope; |
1677 |
my $scope; |
1678 |
if ( $marcflavour eq "UNIMARC" ) { |
1678 |
if ( $MarcFormat eq "UNIMARC" ) { |
1679 |
$scope = '011'; |
1679 |
$scope = '011'; |
1680 |
} |
1680 |
} |
1681 |
else { # assume MARC21 or NORMARC |
1681 |
else { # assume MARC21 or NORMARC |
Lines 1690-1696
sub GetMarcISSN {
Link Here
|
1690 |
|
1690 |
|
1691 |
=head2 GetMarcNotes |
1691 |
=head2 GetMarcNotes |
1692 |
|
1692 |
|
1693 |
$marcnotesarray = GetMarcNotes( $record, $marcflavour ); |
1693 |
$marcnotesarray = GetMarcNotes( $record, $MarcFormat ); |
1694 |
|
1694 |
|
1695 |
Get all notes from the MARC record and returns them in an array. |
1695 |
Get all notes from the MARC record and returns them in an array. |
1696 |
The note are stored in different fields depending on MARC flavour |
1696 |
The note are stored in different fields depending on MARC flavour |
Lines 1698-1706
The note are stored in different fields depending on MARC flavour
Link Here
|
1698 |
=cut |
1698 |
=cut |
1699 |
|
1699 |
|
1700 |
sub GetMarcNotes { |
1700 |
sub GetMarcNotes { |
1701 |
my ( $record, $marcflavour ) = @_; |
1701 |
my ( $record, $MarcFormat ) = @_; |
1702 |
my $scope; |
1702 |
my $scope; |
1703 |
if ( $marcflavour eq "UNIMARC" ) { |
1703 |
if ( $MarcFormat eq "UNIMARC" ) { |
1704 |
$scope = '3..'; |
1704 |
$scope = '3..'; |
1705 |
} else { # assume marc21 if not unimarc |
1705 |
} else { # assume marc21 if not unimarc |
1706 |
$scope = '5..'; |
1706 |
$scope = '5..'; |
Lines 1734-1740
sub GetMarcNotes {
Link Here
|
1734 |
|
1734 |
|
1735 |
=head2 GetMarcSubjects |
1735 |
=head2 GetMarcSubjects |
1736 |
|
1736 |
|
1737 |
$marcsubjcts = GetMarcSubjects($record,$marcflavour); |
1737 |
$marcsubjcts = GetMarcSubjects($record,$MarcFormat); |
1738 |
|
1738 |
|
1739 |
Get all subjects from the MARC record and returns them in an array. |
1739 |
Get all subjects from the MARC record and returns them in an array. |
1740 |
The subjects are stored in different fields depending on MARC flavour |
1740 |
The subjects are stored in different fields depending on MARC flavour |
Lines 1742-1750
The subjects are stored in different fields depending on MARC flavour
Link Here
|
1742 |
=cut |
1742 |
=cut |
1743 |
|
1743 |
|
1744 |
sub GetMarcSubjects { |
1744 |
sub GetMarcSubjects { |
1745 |
my ( $record, $marcflavour ) = @_; |
1745 |
my ( $record, $MarcFormat ) = @_; |
1746 |
my ( $mintag, $maxtag, $fields_filter ); |
1746 |
my ( $mintag, $maxtag, $fields_filter ); |
1747 |
if ( $marcflavour eq "UNIMARC" ) { |
1747 |
if ( $MarcFormat eq "UNIMARC" ) { |
1748 |
$mintag = "600"; |
1748 |
$mintag = "600"; |
1749 |
$maxtag = "611"; |
1749 |
$maxtag = "611"; |
1750 |
$fields_filter = '6..'; |
1750 |
$fields_filter = '6..'; |
Lines 1780-1788
sub GetMarcSubjects {
Link Here
|
1780 |
next if ( $subject_subfield->[0] eq '9' ); |
1780 |
next if ( $subject_subfield->[0] eq '9' ); |
1781 |
|
1781 |
|
1782 |
# don't load unimarc subfields 3,4,5 |
1782 |
# don't load unimarc subfields 3,4,5 |
1783 |
next if ( ( $marcflavour eq "UNIMARC" ) and ( $subject_subfield->[0] =~ /2|3|4|5/ ) ); |
1783 |
next if ( ( $MarcFormat eq "UNIMARC" ) and ( $subject_subfield->[0] =~ /2|3|4|5/ ) ); |
1784 |
# don't load MARC21 subfields 2 (FIXME: any more subfields??) |
1784 |
# don't load MARC21 subfields 2 (FIXME: any more subfields??) |
1785 |
next if ( ( $marcflavour eq "MARC21" ) and ( $subject_subfield->[0] =~ /2/ ) ); |
1785 |
next if ( ( $MarcFormat eq "MARC21" ) and ( $subject_subfield->[0] =~ /2/ ) ); |
1786 |
|
1786 |
|
1787 |
my $code = $subject_subfield->[0]; |
1787 |
my $code = $subject_subfield->[0]; |
1788 |
my $value = $subject_subfield->[1]; |
1788 |
my $value = $subject_subfield->[1]; |
Lines 1819-1825
sub GetMarcSubjects {
Link Here
|
1819 |
|
1819 |
|
1820 |
=head2 GetMarcAuthors |
1820 |
=head2 GetMarcAuthors |
1821 |
|
1821 |
|
1822 |
authors = GetMarcAuthors($record,$marcflavour); |
1822 |
authors = GetMarcAuthors($record,$MarcFormat); |
1823 |
|
1823 |
|
1824 |
Get all authors from the MARC record and returns them in an array. |
1824 |
Get all authors from the MARC record and returns them in an array. |
1825 |
The authors are stored in different fields depending on MARC flavour |
1825 |
The authors are stored in different fields depending on MARC flavour |
Lines 1827-1839
The authors are stored in different fields depending on MARC flavour
Link Here
|
1827 |
=cut |
1827 |
=cut |
1828 |
|
1828 |
|
1829 |
sub GetMarcAuthors { |
1829 |
sub GetMarcAuthors { |
1830 |
my ( $record, $marcflavour ) = @_; |
1830 |
my ( $record, $MarcFormat ) = @_; |
1831 |
my ( $mintag, $maxtag, $fields_filter ); |
1831 |
my ( $mintag, $maxtag, $fields_filter ); |
1832 |
|
1832 |
|
1833 |
# tagslib useful for UNIMARC author reponsabilities |
1833 |
# tagslib useful for UNIMARC author reponsabilities |
1834 |
my $tagslib = |
1834 |
my $tagslib = |
1835 |
&GetMarcStructure( 1, '' ); # FIXME : we don't have the framework available, we take the default framework. May be buggy on some setups, will be usually correct. |
1835 |
&GetMarcStructure( 1, '' ); # FIXME : we don't have the framework available, we take the default framework. May be buggy on some setups, will be usually correct. |
1836 |
if ( $marcflavour eq "UNIMARC" ) { |
1836 |
if ( $MarcFormat eq "UNIMARC" ) { |
1837 |
$mintag = "700"; |
1837 |
$mintag = "700"; |
1838 |
$maxtag = "712"; |
1838 |
$maxtag = "712"; |
1839 |
$fields_filter = '7..'; |
1839 |
$fields_filter = '7..'; |
Lines 1866-1879
sub GetMarcAuthors {
Link Here
|
1866 |
next if ( $authors_subfield->[0] eq '9' ); |
1866 |
next if ( $authors_subfield->[0] eq '9' ); |
1867 |
|
1867 |
|
1868 |
# don't load unimarc subfields 3, 5 |
1868 |
# don't load unimarc subfields 3, 5 |
1869 |
next if ( $marcflavour eq 'UNIMARC' and ( $authors_subfield->[0] =~ /3|5/ ) ); |
1869 |
next if ( $MarcFormat eq 'UNIMARC' and ( $authors_subfield->[0] =~ /3|5/ ) ); |
1870 |
|
1870 |
|
1871 |
my $code = $authors_subfield->[0]; |
1871 |
my $code = $authors_subfield->[0]; |
1872 |
my $value = $authors_subfield->[1]; |
1872 |
my $value = $authors_subfield->[1]; |
1873 |
my $linkvalue = $value; |
1873 |
my $linkvalue = $value; |
1874 |
$linkvalue =~ s/(\(|\))//g; |
1874 |
$linkvalue =~ s/(\(|\))//g; |
1875 |
# UNIMARC author responsibility |
1875 |
# UNIMARC author responsibility |
1876 |
if ( $marcflavour eq 'UNIMARC' and $code eq '4' ) { |
1876 |
if ( $MarcFormat eq 'UNIMARC' and $code eq '4' ) { |
1877 |
$value = GetAuthorisedValueDesc( $field->tag(), $code, $value, '', $tagslib ); |
1877 |
$value = GetAuthorisedValueDesc( $field->tag(), $code, $value, '', $tagslib ); |
1878 |
$linkvalue = "($value)"; |
1878 |
$linkvalue = "($value)"; |
1879 |
} |
1879 |
} |
Lines 1907-1913
sub GetMarcAuthors {
Link Here
|
1907 |
|
1907 |
|
1908 |
=head2 GetMarcUrls |
1908 |
=head2 GetMarcUrls |
1909 |
|
1909 |
|
1910 |
$marcurls = GetMarcUrls($record,$marcflavour); |
1910 |
$marcurls = GetMarcUrls($record,$MarcFormat); |
1911 |
|
1911 |
|
1912 |
Returns arrayref of URLs from MARC data, suitable to pass to tmpl loop. |
1912 |
Returns arrayref of URLs from MARC data, suitable to pass to tmpl loop. |
1913 |
Assumes web resources (not uncommon in MARC21 to omit resource type ind) |
1913 |
Assumes web resources (not uncommon in MARC21 to omit resource type ind) |
Lines 1915-1921
Assumes web resources (not uncommon in MARC21 to omit resource type ind)
Link Here
|
1915 |
=cut |
1915 |
=cut |
1916 |
|
1916 |
|
1917 |
sub GetMarcUrls { |
1917 |
sub GetMarcUrls { |
1918 |
my ( $record, $marcflavour ) = @_; |
1918 |
my ( $record, $MarcFormat ) = @_; |
1919 |
|
1919 |
|
1920 |
my @marcurls; |
1920 |
my @marcurls; |
1921 |
for my $field ( $record->field('856') ) { |
1921 |
for my $field ( $record->field('856') ) { |
Lines 1926-1932
sub GetMarcUrls {
Link Here
|
1926 |
my @urls = $field->subfield('u'); |
1926 |
my @urls = $field->subfield('u'); |
1927 |
foreach my $url (@urls) { |
1927 |
foreach my $url (@urls) { |
1928 |
my $marcurl; |
1928 |
my $marcurl; |
1929 |
if ( $marcflavour eq 'MARC21' ) { |
1929 |
if ( $MarcFormat eq 'MARC21' ) { |
1930 |
my $s3 = $field->subfield('3'); |
1930 |
my $s3 = $field->subfield('3'); |
1931 |
my $link = $field->subfield('y'); |
1931 |
my $link = $field->subfield('y'); |
1932 |
unless ( $url =~ /^\w+:/ ) { |
1932 |
unless ( $url =~ /^\w+:/ ) { |
Lines 1962-1968
sub GetMarcUrls {
Link Here
|
1962 |
|
1962 |
|
1963 |
=head2 GetMarcSeries |
1963 |
=head2 GetMarcSeries |
1964 |
|
1964 |
|
1965 |
$marcseriesarray = GetMarcSeries($record,$marcflavour); |
1965 |
$marcseriesarray = GetMarcSeries($record,$MarcFormat); |
1966 |
|
1966 |
|
1967 |
Get all series from the MARC record and returns them in an array. |
1967 |
Get all series from the MARC record and returns them in an array. |
1968 |
The series are stored in different fields depending on MARC flavour |
1968 |
The series are stored in different fields depending on MARC flavour |
Lines 1970-1978
The series are stored in different fields depending on MARC flavour
Link Here
|
1970 |
=cut |
1970 |
=cut |
1971 |
|
1971 |
|
1972 |
sub GetMarcSeries { |
1972 |
sub GetMarcSeries { |
1973 |
my ( $record, $marcflavour ) = @_; |
1973 |
my ( $record, $MarcFormat ) = @_; |
1974 |
my ( $mintag, $maxtag, $fields_filter ); |
1974 |
my ( $mintag, $maxtag, $fields_filter ); |
1975 |
if ( $marcflavour eq "UNIMARC" ) { |
1975 |
if ( $MarcFormat eq "UNIMARC" ) { |
1976 |
$mintag = "600"; |
1976 |
$mintag = "600"; |
1977 |
$maxtag = "619"; |
1977 |
$maxtag = "619"; |
1978 |
$fields_filter = '6..'; |
1978 |
$fields_filter = '6..'; |
Lines 2032-2054
sub GetMarcSeries {
Link Here
|
2032 |
|
2032 |
|
2033 |
=head2 GetMarcHosts |
2033 |
=head2 GetMarcHosts |
2034 |
|
2034 |
|
2035 |
$marchostsarray = GetMarcHosts($record,$marcflavour); |
2035 |
$marchostsarray = GetMarcHosts($record,$MarcFormat); |
2036 |
|
2036 |
|
2037 |
Get all host records (773s MARC21, 461 UNIMARC) from the MARC record and returns them in an array. |
2037 |
Get all host records (773s MARC21, 461 UNIMARC) from the MARC record and returns them in an array. |
2038 |
|
2038 |
|
2039 |
=cut |
2039 |
=cut |
2040 |
|
2040 |
|
2041 |
sub GetMarcHosts { |
2041 |
sub GetMarcHosts { |
2042 |
my ( $record, $marcflavour ) = @_; |
2042 |
my ( $record, $MarcFormat ) = @_; |
2043 |
my ( $tag,$title_subf,$bibnumber_subf,$itemnumber_subf); |
2043 |
my ( $tag,$title_subf,$bibnumber_subf,$itemnumber_subf); |
2044 |
$marcflavour ||="MARC21"; |
2044 |
$MarcFormat ||="MARC21"; |
2045 |
if ( $marcflavour eq "MARC21" || $marcflavour eq "NORMARC" ) { |
2045 |
if ( $MarcFormat eq "MARC21" || $MarcFormat eq "NORMARC" ) { |
2046 |
$tag = "773"; |
2046 |
$tag = "773"; |
2047 |
$title_subf = "t"; |
2047 |
$title_subf = "t"; |
2048 |
$bibnumber_subf ="0"; |
2048 |
$bibnumber_subf ="0"; |
2049 |
$itemnumber_subf='9'; |
2049 |
$itemnumber_subf='9'; |
2050 |
} |
2050 |
} |
2051 |
elsif ($marcflavour eq "UNIMARC") { |
2051 |
elsif ($MarcFormat eq "UNIMARC") { |
2052 |
$tag = "461"; |
2052 |
$tag = "461"; |
2053 |
$title_subf = "t"; |
2053 |
$title_subf = "t"; |
2054 |
$bibnumber_subf ="0"; |
2054 |
$bibnumber_subf ="0"; |
Lines 2103-2109
entry from user entry
Link Here
|
2103 |
sub TransformKohaToMarc { |
2103 |
sub TransformKohaToMarc { |
2104 |
my $hash = shift; |
2104 |
my $hash = shift; |
2105 |
my $record = MARC::Record->new(); |
2105 |
my $record = MARC::Record->new(); |
2106 |
SetMarcUnicodeFlag( $record, C4::Context->preference("marcflavour") ); |
2106 |
SetMarcUnicodeFlag( $record, C4::Context->preference("MarcFormat") ); |
2107 |
my $db_to_marc = C4::Context->marcfromkohafield; |
2107 |
my $db_to_marc = C4::Context->marcfromkohafield; |
2108 |
while ( my ($name, $value) = each %$hash ) { |
2108 |
while ( my ($name, $value) = each %$hash ) { |
2109 |
next unless my $dtm = $db_to_marc->{''}->{$name}; |
2109 |
next unless my $dtm = $db_to_marc->{''}->{$name}; |
Lines 2125-2146
sub TransformKohaToMarc {
Link Here
|
2125 |
|
2125 |
|
2126 |
=head2 PrepHostMarcField |
2126 |
=head2 PrepHostMarcField |
2127 |
|
2127 |
|
2128 |
$hostfield = PrepHostMarcField ( $hostbiblionumber,$hostitemnumber,$marcflavour ) |
2128 |
$hostfield = PrepHostMarcField ( $hostbiblionumber,$hostitemnumber,$MarcFormat ) |
2129 |
|
2129 |
|
2130 |
This function returns a host field populated with data from the host record, the field can then be added to an analytical record |
2130 |
This function returns a host field populated with data from the host record, the field can then be added to an analytical record |
2131 |
|
2131 |
|
2132 |
=cut |
2132 |
=cut |
2133 |
|
2133 |
|
2134 |
sub PrepHostMarcField { |
2134 |
sub PrepHostMarcField { |
2135 |
my ($hostbiblionumber,$hostitemnumber, $marcflavour) = @_; |
2135 |
my ($hostbiblionumber,$hostitemnumber, $MarcFormat) = @_; |
2136 |
$marcflavour ||="MARC21"; |
2136 |
$MarcFormat ||="MARC21"; |
2137 |
|
2137 |
|
2138 |
require C4::Items; |
2138 |
require C4::Items; |
2139 |
my $hostrecord = GetMarcBiblio($hostbiblionumber); |
2139 |
my $hostrecord = GetMarcBiblio($hostbiblionumber); |
2140 |
my $item = C4::Items::GetItem($hostitemnumber); |
2140 |
my $item = C4::Items::GetItem($hostitemnumber); |
2141 |
|
2141 |
|
2142 |
my $hostmarcfield; |
2142 |
my $hostmarcfield; |
2143 |
if ( $marcflavour eq "MARC21" || $marcflavour eq "NORMARC" ) { |
2143 |
if ( $MarcFormat eq "MARC21" || $MarcFormat eq "NORMARC" ) { |
2144 |
|
2144 |
|
2145 |
#main entry |
2145 |
#main entry |
2146 |
my $mainentry; |
2146 |
my $mainentry; |
Lines 2191-2197
sub PrepHostMarcField {
Link Here
|
2191 |
'x' => $issn, |
2191 |
'x' => $issn, |
2192 |
'z' => $isbn |
2192 |
'z' => $isbn |
2193 |
); |
2193 |
); |
2194 |
} elsif ($marcflavour eq "UNIMARC") { |
2194 |
} elsif ($MarcFormat eq "UNIMARC") { |
2195 |
$hostmarcfield = MARC::Field->new( |
2195 |
$hostmarcfield = MARC::Field->new( |
2196 |
461, '', '', |
2196 |
461, '', '', |
2197 |
'0' => $hostbiblionumber, |
2197 |
'0' => $hostbiblionumber, |
Lines 2226-2232
sub TransformHtmlToXml {
Link Here
|
2226 |
my ( $tags, $subfields, $values, $indicator, $ind_tag, $auth_type ) = @_; |
2226 |
my ( $tags, $subfields, $values, $indicator, $ind_tag, $auth_type ) = @_; |
2227 |
my $xml = MARC::File::XML::header('UTF-8'); |
2227 |
my $xml = MARC::File::XML::header('UTF-8'); |
2228 |
$xml .= "<record>\n"; |
2228 |
$xml .= "<record>\n"; |
2229 |
$auth_type = C4::Context->preference('marcflavour') unless $auth_type; |
2229 |
$auth_type = C4::Context->preference('MarcFormat') unless $auth_type; |
2230 |
MARC::File::XML->default_record_format($auth_type); |
2230 |
MARC::File::XML->default_record_format($auth_type); |
2231 |
|
2231 |
|
2232 |
# in UNIMARC, field 100 contains the encoding |
2232 |
# in UNIMARC, field 100 contains the encoding |
Lines 2240-2246
sub TransformHtmlToXml {
Link Here
|
2240 |
my $j = -1; |
2240 |
my $j = -1; |
2241 |
for ( my $i = 0 ; $i < @$tags ; $i++ ) { |
2241 |
for ( my $i = 0 ; $i < @$tags ; $i++ ) { |
2242 |
|
2242 |
|
2243 |
if ( C4::Context->preference('marcflavour') eq 'UNIMARC' and @$tags[$i] eq "100" and @$subfields[$i] eq "a" ) { |
2243 |
if ( C4::Context->preference('MarcFormat') eq 'UNIMARC' and @$tags[$i] eq "100" and @$subfields[$i] eq "a" ) { |
2244 |
|
2244 |
|
2245 |
# if we have a 100 field and it's values are not correct, skip them. |
2245 |
# if we have a 100 field and it's values are not correct, skip them. |
2246 |
# if we don't have any valid 100 field, we will create a default one at the end |
2246 |
# if we don't have any valid 100 field, we will create a default one at the end |
Lines 2324-2330
sub TransformHtmlToXml {
Link Here
|
2324 |
$prevtag = @$tags[$i]; |
2324 |
$prevtag = @$tags[$i]; |
2325 |
} |
2325 |
} |
2326 |
$xml .= "</datafield>\n" if $xml =~ m/<datafield/; |
2326 |
$xml .= "</datafield>\n" if $xml =~ m/<datafield/; |
2327 |
if ( C4::Context->preference('marcflavour') eq 'UNIMARC' and !$unimarc_and_100_exist ) { |
2327 |
if ( C4::Context->preference('MarcFormat') eq 'UNIMARC' and !$unimarc_and_100_exist ) { |
2328 |
|
2328 |
|
2329 |
# warn "SETTING 100 for $auth_type"; |
2329 |
# warn "SETTING 100 for $auth_type"; |
2330 |
my $string = strftime( "%Y%m%d", localtime(time) ); |
2330 |
my $string = strftime( "%Y%m%d", localtime(time) ); |
Lines 3275-3281
sub ModBiblioMarc {
Link Here
|
3275 |
my $sth = $dbh->prepare("UPDATE biblio SET frameworkcode=? WHERE biblionumber=?"); |
3275 |
my $sth = $dbh->prepare("UPDATE biblio SET frameworkcode=? WHERE biblionumber=?"); |
3276 |
$sth->execute( $frameworkcode, $biblionumber ); |
3276 |
$sth->execute( $frameworkcode, $biblionumber ); |
3277 |
$sth->finish; |
3277 |
$sth->finish; |
3278 |
my $encoding = C4::Context->preference("marcflavour"); |
3278 |
my $encoding = C4::Context->preference("MarcFormat"); |
3279 |
|
3279 |
|
3280 |
# deal with UNIMARC field 100 (encoding) : create it if needed & set encoding to unicode |
3280 |
# deal with UNIMARC field 100 (encoding) : create it if needed & set encoding to unicode |
3281 |
if ( $encoding eq "UNIMARC" ) { |
3281 |
if ( $encoding eq "UNIMARC" ) { |
Lines 3445-3465
sub GetHolds {
Link Here
|
3445 |
|
3445 |
|
3446 |
=head2 prepare_host_field |
3446 |
=head2 prepare_host_field |
3447 |
|
3447 |
|
3448 |
$marcfield = prepare_host_field( $hostbiblioitem, $marcflavour ); |
3448 |
$marcfield = prepare_host_field( $hostbiblioitem, $MarcFormat ); |
3449 |
Generate the host item entry for an analytic child entry |
3449 |
Generate the host item entry for an analytic child entry |
3450 |
|
3450 |
|
3451 |
=cut |
3451 |
=cut |
3452 |
|
3452 |
|
3453 |
sub prepare_host_field { |
3453 |
sub prepare_host_field { |
3454 |
my ( $hostbiblio, $marcflavour ) = @_; |
3454 |
my ( $hostbiblio, $MarcFormat ) = @_; |
3455 |
$marcflavour ||= C4::Context->preference('marcflavour'); |
3455 |
$MarcFormat ||= C4::Context->preference('MarcFormat'); |
3456 |
my $host = GetMarcBiblio($hostbiblio); |
3456 |
my $host = GetMarcBiblio($hostbiblio); |
3457 |
# unfortunately as_string does not 'do the right thing' |
3457 |
# unfortunately as_string does not 'do the right thing' |
3458 |
# if field returns undef |
3458 |
# if field returns undef |
3459 |
my %sfd; |
3459 |
my %sfd; |
3460 |
my $field; |
3460 |
my $field; |
3461 |
my $host_field; |
3461 |
my $host_field; |
3462 |
if ( $marcflavour eq 'MARC21' || $marcflavour eq 'NORMARC' ) { |
3462 |
if ( $MarcFormat eq 'MARC21' || $MarcFormat eq 'NORMARC' ) { |
3463 |
if ( $field = $host->field('100') || $host->field('110') || $host->field('11') ) { |
3463 |
if ( $field = $host->field('100') || $host->field('110') || $host->field('11') ) { |
3464 |
my $s = $field->as_string('ab'); |
3464 |
my $s = $field->as_string('ab'); |
3465 |
if ($s) { |
3465 |
if ($s) { |
Lines 3502-3508
sub prepare_host_field {
Link Here
|
3502 |
$host_field = MARC::Field->new( 773, '0', ' ', %sfd ); |
3502 |
$host_field = MARC::Field->new( 773, '0', ' ', %sfd ); |
3503 |
return $host_field; |
3503 |
return $host_field; |
3504 |
} |
3504 |
} |
3505 |
elsif ( $marcflavour eq 'UNIMARC' ) { |
3505 |
elsif ( $MarcFormat eq 'UNIMARC' ) { |
3506 |
#author |
3506 |
#author |
3507 |
if ( $field = $host->field('700') || $host->field('710') || $host->field('720') ) { |
3507 |
if ( $field = $host->field('700') || $host->field('710') || $host->field('720') ) { |
3508 |
my $s = $field->as_string('ab'); |
3508 |
my $s = $field->as_string('ab'); |