Lines 1783-1789
sub generate_marc_host_field {
Link Here
|
1783 |
|
1783 |
|
1784 |
my $marcflavour = C4::Context->preference('marcflavour'); |
1784 |
my $marcflavour = C4::Context->preference('marcflavour'); |
1785 |
my $marc_host = $self->metadata->record; |
1785 |
my $marc_host = $self->metadata->record; |
1786 |
my %sfd; |
1786 |
my @sfd; |
1787 |
my $host_field; |
1787 |
my $host_field; |
1788 |
my $link_field; |
1788 |
my $link_field; |
1789 |
|
1789 |
|
Lines 1793-1811
sub generate_marc_host_field {
Link Here
|
1793 |
if ( $host_field = $marc_host->field('100') || $marc_host->field('110') || $marc_host->field('111') ) { |
1793 |
if ( $host_field = $marc_host->field('100') || $marc_host->field('110') || $marc_host->field('111') ) { |
1794 |
my $s = $host_field->as_string('ab'); |
1794 |
my $s = $host_field->as_string('ab'); |
1795 |
if ($s) { |
1795 |
if ($s) { |
1796 |
$sfd{a} = $s; |
1796 |
push @sfd, ( a => $s ); |
1797 |
} |
1797 |
} |
1798 |
} |
1798 |
} |
1799 |
|
1799 |
|
1800 |
# Edition |
1800 |
# Title |
1801 |
if ( $host_field = $marc_host->field('250') ) { |
1801 |
if ( $host_field = $marc_host->field('245') ) { |
1802 |
my $s = $host_field->as_string('ab'); |
1802 |
my $s = $host_field->as_string('abnp'); |
1803 |
if ($s) { |
1803 |
if ($s) { |
1804 |
$sfd{b} = $s; |
1804 |
push @sfd, ( t => $s ); |
1805 |
} |
1805 |
} |
1806 |
} |
1806 |
} |
1807 |
|
1807 |
|
1808 |
# Publication |
1808 |
# Publication |
|
|
1809 |
my $p; |
1809 |
my @publication_fields = $marc_host->field('264'); |
1810 |
my @publication_fields = $marc_host->field('264'); |
1810 |
@publication_fields = $marc_host->field('260') unless (@publication_fields); |
1811 |
@publication_fields = $marc_host->field('260') unless (@publication_fields); |
1811 |
my $index = 0; |
1812 |
my $index = 0; |
Lines 1815-1846
sub generate_marc_host_field {
Link Here
|
1815 |
if ( $index == 0 ) { |
1816 |
if ( $index == 0 ) { |
1816 |
my $s = $host_field->as_string('abc'); |
1817 |
my $s = $host_field->as_string('abc'); |
1817 |
if ($s) { |
1818 |
if ($s) { |
1818 |
$sfd{d} = $s; |
1819 |
$p = $s; |
1819 |
} |
1820 |
} |
1820 |
$index++; |
1821 |
$index++; |
1821 |
} |
1822 |
} |
1822 |
if ( $host_field->indicator(1) && ( $host_field->indicator(1) == 3 ) ) { |
1823 |
if ( $host_field->indicator(1) && ( $host_field->indicator(1) eq '3' ) ) { |
1823 |
my $s = $host_field->as_string('abc'); |
1824 |
my $s = $host_field->as_string('abc'); |
1824 |
if ($s) { |
1825 |
if ($s) { |
1825 |
$sfd{d} = $s; |
1826 |
$p = $s; |
1826 |
} |
1827 |
} |
1827 |
last; |
1828 |
last; |
1828 |
} |
1829 |
} |
1829 |
} |
1830 |
} |
|
|
1831 |
push @sfd, ( d => $p ) if $p; |
1830 |
|
1832 |
|
1831 |
# Uniform title |
1833 |
# Uniform title |
1832 |
if ( $host_field = $marc_host->field('240') ) { |
1834 |
if ( $host_field = $marc_host->field('240') ) { |
1833 |
my $s = $host_field->as_string('a'); |
1835 |
my $s = $host_field->as_string('a'); |
1834 |
if ($s) { |
1836 |
if ($s) { |
1835 |
$sfd{s} = $s; |
1837 |
push @sfd, ( s => $s ); |
1836 |
} |
1838 |
} |
1837 |
} |
1839 |
} |
1838 |
|
1840 |
|
1839 |
# Title |
1841 |
# Edition |
1840 |
if ( $host_field = $marc_host->field('245') ) { |
1842 |
if ( $host_field = $marc_host->field('250') ) { |
1841 |
my $s = $host_field->as_string('abnp'); |
1843 |
my $s = $host_field->as_string('ab'); |
1842 |
if ($s) { |
1844 |
if ($s) { |
1843 |
$sfd{t} = $s; |
1845 |
push @sfd, ( b => $s ); |
1844 |
} |
1846 |
} |
1845 |
} |
1847 |
} |
1846 |
|
1848 |
|
Lines 1848-1854
sub generate_marc_host_field {
Link Here
|
1848 |
if ( $host_field = $marc_host->field('022') ) { |
1850 |
if ( $host_field = $marc_host->field('022') ) { |
1849 |
my $s = $host_field->as_string('a'); |
1851 |
my $s = $host_field->as_string('a'); |
1850 |
if ($s) { |
1852 |
if ($s) { |
1851 |
$sfd{x} = $s; |
1853 |
push @sfd, ( x => $s ); |
1852 |
} |
1854 |
} |
1853 |
} |
1855 |
} |
1854 |
|
1856 |
|
Lines 1856-1884
sub generate_marc_host_field {
Link Here
|
1856 |
if ( $host_field = $marc_host->field('020') ) { |
1858 |
if ( $host_field = $marc_host->field('020') ) { |
1857 |
my $s = $host_field->as_string('a'); |
1859 |
my $s = $host_field->as_string('a'); |
1858 |
if ($s) { |
1860 |
if ($s) { |
1859 |
$sfd{z} = $s; |
1861 |
push @sfd, ( z => $s ); |
1860 |
} |
1862 |
} |
1861 |
} |
1863 |
} |
1862 |
if ( C4::Context->preference('UseControlNumber') ) { |
1864 |
if ( C4::Context->preference('UseControlNumber') ) { |
1863 |
|
1865 |
|
|
|
1866 |
my $w; |
1867 |
|
1864 |
# Control number |
1868 |
# Control number |
1865 |
if ( $host_field = $marc_host->field('001') ) { |
1869 |
if ( $host_field = $marc_host->field('001') ) { |
1866 |
$sfd{w} = $host_field->data(); |
1870 |
$w = $host_field->data(); |
1867 |
} |
1871 |
} |
1868 |
|
1872 |
|
1869 |
# Control number identifier |
1873 |
# Control number identifier |
1870 |
if ( $host_field = $marc_host->field('003') ) { |
1874 |
if ( $host_field = $marc_host->field('003') ) { |
1871 |
$sfd{w} = '(' . $host_field->data() . ')' . $sfd{w}; |
1875 |
$w = '(' . $host_field->data() . ')' . $w; |
1872 |
} |
1876 |
} |
|
|
1877 |
|
1878 |
push @sfd, ( w => $w ); |
1873 |
} |
1879 |
} |
1874 |
$link_field = MARC::Field->new( 773, '0', ' ', %sfd ); |
1880 |
$link_field = MARC::Field->new( 773, '0', ' ', @sfd ); |
1875 |
} elsif ( $marcflavour eq 'UNIMARC' ) { |
1881 |
} elsif ( $marcflavour eq 'UNIMARC' ) { |
1876 |
|
1882 |
|
1877 |
# Author |
1883 |
# Author |
1878 |
if ( $host_field = $marc_host->field('700') || $marc_host->field('710') || $marc_host->field('720') ) { |
1884 |
if ( $host_field = $marc_host->field('700') || $marc_host->field('710') || $marc_host->field('720') ) { |
1879 |
my $s = $host_field->as_string('ab'); |
1885 |
my $s = $host_field->as_string('ab'); |
1880 |
if ($s) { |
1886 |
if ($s) { |
1881 |
$sfd{a} = $s; |
1887 |
push @sfd, ( a => $s ); |
|
|
1888 |
} |
1889 |
} |
1890 |
|
1891 |
# Title |
1892 |
if ( $host_field = $marc_host->field('200') ) { |
1893 |
my $s = $host_field->as_string('a'); |
1894 |
if ($s) { |
1895 |
push @sfd, ( t => $s ); |
1882 |
} |
1896 |
} |
1883 |
} |
1897 |
} |
1884 |
|
1898 |
|
Lines 1886-1892
sub generate_marc_host_field {
Link Here
|
1886 |
if ( $host_field = $marc_host->field('210') ) { |
1900 |
if ( $host_field = $marc_host->field('210') ) { |
1887 |
my $s = $host_field->as_string('a'); |
1901 |
my $s = $host_field->as_string('a'); |
1888 |
if ($s) { |
1902 |
if ($s) { |
1889 |
$sfd{c} = $s; |
1903 |
push @sfd, ( c => $s ); |
1890 |
} |
1904 |
} |
1891 |
} |
1905 |
} |
1892 |
|
1906 |
|
Lines 1894-1900
sub generate_marc_host_field {
Link Here
|
1894 |
if ( $host_field = $marc_host->field('210') ) { |
1908 |
if ( $host_field = $marc_host->field('210') ) { |
1895 |
my $s = $host_field->as_string('d'); |
1909 |
my $s = $host_field->as_string('d'); |
1896 |
if ($s) { |
1910 |
if ($s) { |
1897 |
$sfd{d} = $s; |
1911 |
push @sfd, ( d => $s ); |
1898 |
} |
1912 |
} |
1899 |
} |
1913 |
} |
1900 |
|
1914 |
|
Lines 1902-1916
sub generate_marc_host_field {
Link Here
|
1902 |
if ( $host_field = $marc_host->field('205') ) { |
1916 |
if ( $host_field = $marc_host->field('205') ) { |
1903 |
my $s = $host_field->as_string(); |
1917 |
my $s = $host_field->as_string(); |
1904 |
if ($s) { |
1918 |
if ($s) { |
1905 |
$sfd{e} = $s; |
1919 |
push @sfd, ( e => $s ); |
1906 |
} |
|
|
1907 |
} |
1908 |
|
1909 |
# Title |
1910 |
if ( $host_field = $marc_host->field('200') ) { |
1911 |
my $s = $host_field->as_string('a'); |
1912 |
if ($s) { |
1913 |
$sfd{t} = $s; |
1914 |
} |
1920 |
} |
1915 |
} |
1921 |
} |
1916 |
|
1922 |
|
Lines 1918-1924
sub generate_marc_host_field {
Link Here
|
1918 |
if ( $host_field = $marc_host->field('856') ) { |
1924 |
if ( $host_field = $marc_host->field('856') ) { |
1919 |
my $s = $host_field->as_string('u'); |
1925 |
my $s = $host_field->as_string('u'); |
1920 |
if ($s) { |
1926 |
if ($s) { |
1921 |
$sfd{u} = $s; |
1927 |
push @sfd, ( u => $s ); |
1922 |
} |
1928 |
} |
1923 |
} |
1929 |
} |
1924 |
|
1930 |
|
Lines 1926-1932
sub generate_marc_host_field {
Link Here
|
1926 |
if ( $host_field = $marc_host->field('011') ) { |
1932 |
if ( $host_field = $marc_host->field('011') ) { |
1927 |
my $s = $host_field->as_string('a'); |
1933 |
my $s = $host_field->as_string('a'); |
1928 |
if ($s) { |
1934 |
if ($s) { |
1929 |
$sfd{x} = $s; |
1935 |
push @sfd, ( x => $s ); |
1930 |
} |
1936 |
} |
1931 |
} |
1937 |
} |
1932 |
|
1938 |
|
Lines 1934-1946
sub generate_marc_host_field {
Link Here
|
1934 |
if ( $host_field = $marc_host->field('010') ) { |
1940 |
if ( $host_field = $marc_host->field('010') ) { |
1935 |
my $s = $host_field->as_string('a'); |
1941 |
my $s = $host_field->as_string('a'); |
1936 |
if ($s) { |
1942 |
if ($s) { |
1937 |
$sfd{y} = $s; |
1943 |
push @sfd, ( y => $s ); |
1938 |
} |
1944 |
} |
1939 |
} |
1945 |
} |
1940 |
if ( $host_field = $marc_host->field('001') ) { |
1946 |
if ( $host_field = $marc_host->field('001') ) { |
1941 |
$sfd{0} = $host_field->data(); |
1947 |
|
|
|
1948 |
push @sfd, ( 0 => $host_field->data() ); |
1942 |
} |
1949 |
} |
1943 |
$link_field = MARC::Field->new( 461, '0', ' ', %sfd ); |
1950 |
$link_field = MARC::Field->new( 461, '0', ' ', @sfd ); |
1944 |
} |
1951 |
} |
1945 |
|
1952 |
|
1946 |
return $link_field; |
1953 |
return $link_field; |
1947 |
- |
|
|