Lines 1921-1927
sub generate_marc_host_field {
Link Here
|
1921 |
|
1921 |
|
1922 |
my $marcflavour = C4::Context->preference('marcflavour'); |
1922 |
my $marcflavour = C4::Context->preference('marcflavour'); |
1923 |
my $marc_host = $self->metadata->record; |
1923 |
my $marc_host = $self->metadata->record; |
1924 |
my %sfd; |
1924 |
my @sfd; |
1925 |
my $host_field; |
1925 |
my $host_field; |
1926 |
my $link_field; |
1926 |
my $link_field; |
1927 |
|
1927 |
|
Lines 1931-1949
sub generate_marc_host_field {
Link Here
|
1931 |
if ( $host_field = $marc_host->field('100') || $marc_host->field('110') || $marc_host->field('111') ) { |
1931 |
if ( $host_field = $marc_host->field('100') || $marc_host->field('110') || $marc_host->field('111') ) { |
1932 |
my $s = $host_field->as_string('ab'); |
1932 |
my $s = $host_field->as_string('ab'); |
1933 |
if ($s) { |
1933 |
if ($s) { |
1934 |
$sfd{a} = $s; |
1934 |
push @sfd, ( a => $s ); |
1935 |
} |
1935 |
} |
1936 |
} |
1936 |
} |
1937 |
|
1937 |
|
1938 |
# Edition |
1938 |
# Title |
1939 |
if ( $host_field = $marc_host->field('250') ) { |
1939 |
if ( $host_field = $marc_host->field('245') ) { |
1940 |
my $s = $host_field->as_string('ab'); |
1940 |
my $s = $host_field->as_string('abnp'); |
1941 |
if ($s) { |
1941 |
if ($s) { |
1942 |
$sfd{b} = $s; |
1942 |
push @sfd, ( t => $s ); |
1943 |
} |
1943 |
} |
1944 |
} |
1944 |
} |
1945 |
|
1945 |
|
1946 |
# Publication |
1946 |
# Publication |
|
|
1947 |
my $p; |
1947 |
my @publication_fields = $marc_host->field('264'); |
1948 |
my @publication_fields = $marc_host->field('264'); |
1948 |
@publication_fields = $marc_host->field('260') unless (@publication_fields); |
1949 |
@publication_fields = $marc_host->field('260') unless (@publication_fields); |
1949 |
my $index = 0; |
1950 |
my $index = 0; |
Lines 1953-1984
sub generate_marc_host_field {
Link Here
|
1953 |
if ( $index == 0 ) { |
1954 |
if ( $index == 0 ) { |
1954 |
my $s = $host_field->as_string('abc'); |
1955 |
my $s = $host_field->as_string('abc'); |
1955 |
if ($s) { |
1956 |
if ($s) { |
1956 |
$sfd{d} = $s; |
1957 |
$p = $s; |
1957 |
} |
1958 |
} |
1958 |
$index++; |
1959 |
$index++; |
1959 |
} |
1960 |
} |
1960 |
if ( $host_field->indicator(1) && ( $host_field->indicator(1) eq '3' ) ) { |
1961 |
if ( $host_field->indicator(1) && ( $host_field->indicator(1) eq '3' ) ) { |
1961 |
my $s = $host_field->as_string('abc'); |
1962 |
my $s = $host_field->as_string('abc'); |
1962 |
if ($s) { |
1963 |
if ($s) { |
1963 |
$sfd{d} = $s; |
1964 |
$p = $s; |
1964 |
} |
1965 |
} |
1965 |
last; |
1966 |
last; |
1966 |
} |
1967 |
} |
1967 |
} |
1968 |
} |
|
|
1969 |
push @sfd, ( d => $p ) if $p; |
1968 |
|
1970 |
|
1969 |
# Uniform title |
1971 |
# Uniform title |
1970 |
if ( $host_field = $marc_host->field('240') ) { |
1972 |
if ( $host_field = $marc_host->field('240') ) { |
1971 |
my $s = $host_field->as_string('a'); |
1973 |
my $s = $host_field->as_string('a'); |
1972 |
if ($s) { |
1974 |
if ($s) { |
1973 |
$sfd{s} = $s; |
1975 |
push @sfd, ( s => $s ); |
1974 |
} |
1976 |
} |
1975 |
} |
1977 |
} |
1976 |
|
1978 |
|
1977 |
# Title |
1979 |
# Edition |
1978 |
if ( $host_field = $marc_host->field('245') ) { |
1980 |
if ( $host_field = $marc_host->field('250') ) { |
1979 |
my $s = $host_field->as_string('abnp'); |
1981 |
my $s = $host_field->as_string('ab'); |
1980 |
if ($s) { |
1982 |
if ($s) { |
1981 |
$sfd{t} = $s; |
1983 |
push @sfd, ( b => $s); |
1982 |
} |
1984 |
} |
1983 |
} |
1985 |
} |
1984 |
|
1986 |
|
Lines 1986-1992
sub generate_marc_host_field {
Link Here
|
1986 |
if ( $host_field = $marc_host->field('022') ) { |
1988 |
if ( $host_field = $marc_host->field('022') ) { |
1987 |
my $s = $host_field->as_string('a'); |
1989 |
my $s = $host_field->as_string('a'); |
1988 |
if ($s) { |
1990 |
if ($s) { |
1989 |
$sfd{x} = $s; |
1991 |
push @sfd, ( x => $s ); |
1990 |
} |
1992 |
} |
1991 |
} |
1993 |
} |
1992 |
|
1994 |
|
Lines 1994-2022
sub generate_marc_host_field {
Link Here
|
1994 |
if ( $host_field = $marc_host->field('020') ) { |
1996 |
if ( $host_field = $marc_host->field('020') ) { |
1995 |
my $s = $host_field->as_string('a'); |
1997 |
my $s = $host_field->as_string('a'); |
1996 |
if ($s) { |
1998 |
if ($s) { |
1997 |
$sfd{z} = $s; |
1999 |
push @sfd, ( z => $s ); |
1998 |
} |
2000 |
} |
1999 |
} |
2001 |
} |
2000 |
if ( C4::Context->preference('UseControlNumber') ) { |
2002 |
if ( C4::Context->preference('UseControlNumber') ) { |
2001 |
|
2003 |
|
|
|
2004 |
my $w; |
2005 |
|
2002 |
# Control number |
2006 |
# Control number |
2003 |
if ( $host_field = $marc_host->field('001') ) { |
2007 |
if ( $host_field = $marc_host->field('001') ) { |
2004 |
$sfd{w} = $host_field->data(); |
2008 |
$w = $host_field->data(); |
2005 |
} |
2009 |
} |
2006 |
|
2010 |
|
2007 |
# Control number identifier |
2011 |
# Control number identifier |
2008 |
if ( $host_field = $marc_host->field('003') ) { |
2012 |
if ( $host_field = $marc_host->field('003') ) { |
2009 |
$sfd{w} = '(' . $host_field->data() . ')' . $sfd{w}; |
2013 |
$w = '(' . $host_field->data() . ')' . $w; |
2010 |
} |
2014 |
} |
|
|
2015 |
|
2016 |
push @sfd, ( w => $w ); |
2011 |
} |
2017 |
} |
2012 |
$link_field = MARC::Field->new( 773, '0', ' ', %sfd ); |
2018 |
$link_field = MARC::Field->new( 773, '0', ' ', @sfd ); |
2013 |
} elsif ( $marcflavour eq 'UNIMARC' ) { |
2019 |
} elsif ( $marcflavour eq 'UNIMARC' ) { |
2014 |
|
2020 |
|
2015 |
# Author |
2021 |
# Author |
2016 |
if ( $host_field = $marc_host->field('700') || $marc_host->field('710') || $marc_host->field('720') ) { |
2022 |
if ( $host_field = $marc_host->field('700') || $marc_host->field('710') || $marc_host->field('720') ) { |
2017 |
my $s = $host_field->as_string('ab'); |
2023 |
my $s = $host_field->as_string('ab'); |
2018 |
if ($s) { |
2024 |
if ($s) { |
2019 |
$sfd{a} = $s; |
2025 |
push @sfd, ( a => $s ); |
|
|
2026 |
} |
2027 |
} |
2028 |
|
2029 |
# Title |
2030 |
if ( $host_field = $marc_host->field('200') ) { |
2031 |
my $s = $host_field->as_string('a'); |
2032 |
if ($s) { |
2033 |
push @sfd, ( t => $s ); |
2020 |
} |
2034 |
} |
2021 |
} |
2035 |
} |
2022 |
|
2036 |
|
Lines 2024-2030
sub generate_marc_host_field {
Link Here
|
2024 |
if ( $host_field = $marc_host->field('210') ) { |
2038 |
if ( $host_field = $marc_host->field('210') ) { |
2025 |
my $s = $host_field->as_string('a'); |
2039 |
my $s = $host_field->as_string('a'); |
2026 |
if ($s) { |
2040 |
if ($s) { |
2027 |
$sfd{c} = $s; |
2041 |
push @sfd, ( c => $s ); |
2028 |
} |
2042 |
} |
2029 |
} |
2043 |
} |
2030 |
|
2044 |
|
Lines 2032-2038
sub generate_marc_host_field {
Link Here
|
2032 |
if ( $host_field = $marc_host->field('210') ) { |
2046 |
if ( $host_field = $marc_host->field('210') ) { |
2033 |
my $s = $host_field->as_string('d'); |
2047 |
my $s = $host_field->as_string('d'); |
2034 |
if ($s) { |
2048 |
if ($s) { |
2035 |
$sfd{d} = $s; |
2049 |
push @sfd, ( d => $s ); |
2036 |
} |
2050 |
} |
2037 |
} |
2051 |
} |
2038 |
|
2052 |
|
Lines 2040-2054
sub generate_marc_host_field {
Link Here
|
2040 |
if ( $host_field = $marc_host->field('205') ) { |
2054 |
if ( $host_field = $marc_host->field('205') ) { |
2041 |
my $s = $host_field->as_string(); |
2055 |
my $s = $host_field->as_string(); |
2042 |
if ($s) { |
2056 |
if ($s) { |
2043 |
$sfd{e} = $s; |
2057 |
push @sfd, ( e => $s ); |
2044 |
} |
|
|
2045 |
} |
2046 |
|
2047 |
# Title |
2048 |
if ( $host_field = $marc_host->field('200') ) { |
2049 |
my $s = $host_field->as_string('a'); |
2050 |
if ($s) { |
2051 |
$sfd{t} = $s; |
2052 |
} |
2058 |
} |
2053 |
} |
2059 |
} |
2054 |
|
2060 |
|
Lines 2056-2062
sub generate_marc_host_field {
Link Here
|
2056 |
if ( $host_field = $marc_host->field('856') ) { |
2062 |
if ( $host_field = $marc_host->field('856') ) { |
2057 |
my $s = $host_field->as_string('u'); |
2063 |
my $s = $host_field->as_string('u'); |
2058 |
if ($s) { |
2064 |
if ($s) { |
2059 |
$sfd{u} = $s; |
2065 |
push @sfd, ( u => $s ); |
2060 |
} |
2066 |
} |
2061 |
} |
2067 |
} |
2062 |
|
2068 |
|
Lines 2064-2070
sub generate_marc_host_field {
Link Here
|
2064 |
if ( $host_field = $marc_host->field('011') ) { |
2070 |
if ( $host_field = $marc_host->field('011') ) { |
2065 |
my $s = $host_field->as_string('a'); |
2071 |
my $s = $host_field->as_string('a'); |
2066 |
if ($s) { |
2072 |
if ($s) { |
2067 |
$sfd{x} = $s; |
2073 |
push @sfd, ( x => $s ); |
2068 |
} |
2074 |
} |
2069 |
} |
2075 |
} |
2070 |
|
2076 |
|
Lines 2072-2084
sub generate_marc_host_field {
Link Here
|
2072 |
if ( $host_field = $marc_host->field('010') ) { |
2078 |
if ( $host_field = $marc_host->field('010') ) { |
2073 |
my $s = $host_field->as_string('a'); |
2079 |
my $s = $host_field->as_string('a'); |
2074 |
if ($s) { |
2080 |
if ($s) { |
2075 |
$sfd{y} = $s; |
2081 |
push @sfd, ( y => $s ); |
2076 |
} |
2082 |
} |
2077 |
} |
2083 |
} |
2078 |
if ( $host_field = $marc_host->field('001') ) { |
2084 |
if ( $host_field = $marc_host->field('001') ) { |
2079 |
$sfd{0} = $host_field->data(); |
2085 |
|
|
|
2086 |
push @sfd, ( 0 => $host_field->data() ); |
2080 |
} |
2087 |
} |
2081 |
$link_field = MARC::Field->new( 461, '0', ' ', %sfd ); |
2088 |
$link_field = MARC::Field->new( 461, '0', ' ', @sfd ); |
2082 |
} |
2089 |
} |
2083 |
|
2090 |
|
2084 |
return $link_field; |
2091 |
return $link_field; |
2085 |
- |
|
|