Lines 1905-1923
sub get_marc_hostinfo_only {
Link Here
|
1905 |
=head3 generate_marc_host_field |
1905 |
=head3 generate_marc_host_field |
1906 |
|
1906 |
|
1907 |
my $link_field = $biblio->generate_marc_host_field; |
1907 |
my $link_field = $biblio->generate_marc_host_field; |
|
|
1908 |
my $link_field = $biblio->generate_marc_host_field( { item => $item } ); |
1908 |
$child->link_marc_host( $link_field ); |
1909 |
$child->link_marc_host( $link_field ); |
1909 |
|
1910 |
|
1910 |
This method generates a MARC link field from the host record that can be added to child |
1911 |
This method generates a MARC link field from the host record that can be added to child |
1911 |
records to link them to the host record. |
1912 |
records to link them to the host record. |
1912 |
|
1913 |
|
1913 |
NOTE: This replicates and partially enhances C4::Biblio::prepare_marc_host(). We should merge |
1914 |
When an item is passed and EasyAnalyticalRecords is enabled, item-specific data (barcode and |
1914 |
functionality from C4::Biblio::PrepareMarcHost() too and then replace all calls to those methods |
1915 |
itemnumber) will be included in the host field. This is non-standard MARC and should only be |
1915 |
with this one and remove those alternatives from the codebase. |
1916 |
used when the easy analytics workflow is specifically enabled. |
|
|
1917 |
|
1918 |
NOTE: This replaces C4::Biblio::PrepHostMarcField() which has been removed to eliminate |
1919 |
code duplication. |
1916 |
|
1920 |
|
1917 |
=cut |
1921 |
=cut |
1918 |
|
1922 |
|
1919 |
sub generate_marc_host_field { |
1923 |
sub generate_marc_host_field { |
1920 |
my ($self) = @_; |
1924 |
my ( $self, $params ) = @_; |
|
|
1925 |
$params //= {}; |
1926 |
|
1927 |
my $item = $params->{item}; |
1921 |
|
1928 |
|
1922 |
my $marcflavour = C4::Context->preference('marcflavour'); |
1929 |
my $marcflavour = C4::Context->preference('marcflavour'); |
1923 |
my $marc_host = $self->metadata->record; |
1930 |
my $marc_host = $self->metadata->record; |
Lines 2050-2055
sub generate_marc_host_field {
Link Here
|
2050 |
} |
2057 |
} |
2051 |
} |
2058 |
} |
2052 |
|
2059 |
|
|
|
2060 |
# Item-specific subfields (only when EasyAnalyticalRecords is enabled) |
2061 |
if ( $item && C4::Context->preference('EasyAnalyticalRecords') ) { |
2062 |
|
2063 |
# Subfield 0 - host biblionumber |
2064 |
push @sfd, ( '0' => $self->biblionumber ); |
2065 |
|
2066 |
# Subfield 9 - host itemnumber |
2067 |
push @sfd, ( '9' => $item->itemnumber ); |
2068 |
|
2069 |
# Subfield o - barcode |
2070 |
push @sfd, ( 'o' => $item->barcode ) if $item->barcode; |
2071 |
} |
2072 |
|
2053 |
# Construct 773 link field |
2073 |
# Construct 773 link field |
2054 |
$link_field = MARC::Field->new( 773, '0', ' ', @sfd ); |
2074 |
$link_field = MARC::Field->new( 773, '0', ' ', @sfd ); |
2055 |
|
2075 |
|
Lines 2103-2111
sub generate_marc_host_field {
Link Here
|
2103 |
push @sfd, ( y => $s ) if ($s); |
2123 |
push @sfd, ( y => $s ) if ($s); |
2104 |
} |
2124 |
} |
2105 |
|
2125 |
|
2106 |
# Control number (001) |
2126 |
# Item-specific subfields (only when EasyAnalyticalRecords is enabled) |
2107 |
if ( $host_field = $marc_host->field('001') ) { |
2127 |
if ( $item && C4::Context->preference('EasyAnalyticalRecords') ) { |
2108 |
push @sfd, ( 0 => $host_field->data() ); |
2128 |
|
|
|
2129 |
# Subfield 0 - host biblionumber (takes precedence over control number) |
2130 |
push @sfd, ( 0 => $self->biblionumber ); |
2131 |
|
2132 |
# Subfield 9 - host itemnumber |
2133 |
push @sfd, ( 9 => $item->itemnumber ); |
2134 |
} else { |
2135 |
|
2136 |
# Control number (001) - only when not using item-specific data |
2137 |
if ( $host_field = $marc_host->field('001') ) { |
2138 |
push @sfd, ( 0 => $host_field->data() ); |
2139 |
} |
2109 |
} |
2140 |
} |
2110 |
|
2141 |
|
2111 |
# Construct 461 link field |
2142 |
# Construct 461 link field |