Lines 1934-1939
sub generate_marc_host_field {
Link Here
|
1934 |
return $link_field; |
1934 |
return $link_field; |
1935 |
} |
1935 |
} |
1936 |
|
1936 |
|
|
|
1937 |
=head3 unlink_marc_host |
1938 |
|
1939 |
$biblio->unlink_marc_host({ host => $biblio }); |
1940 |
$biblio->unlink_marc_host({ host => $biblionumber }); |
1941 |
|
1942 |
Remove the link to the parent created by link_marc_host. Expects either the biblio object or biblionumber of the host to link to. |
1943 |
|
1944 |
=cut |
1945 |
|
1946 |
sub unlink_marc_host { |
1947 |
my ( $self, $params ) = @_; |
1948 |
my $host_biblionumber; |
1949 |
if ( ref( $params->{host} ) eq 'Koha::Biblio' ) { |
1950 |
$host_biblionumber = $params->{host}->biblionumber; |
1951 |
} else { |
1952 |
$host_biblionumber = $params->{host}; |
1953 |
} |
1954 |
|
1955 |
my $record = $self->metadata->record; |
1956 |
my $field_number = C4::Context->preference('marcflavour') eq 'MARC21' ? '773' : '461'; |
1957 |
my @fields = $record->field($field_number); |
1958 |
|
1959 |
foreach my $field (@fields) { |
1960 |
my $subfield_biblionumber = $field->subfield('0') // q{}; |
1961 |
if ( $host_biblionumber eq $subfield_biblionumber ) { |
1962 |
$record->delete_field($field); |
1963 |
last; |
1964 |
} |
1965 |
} |
1966 |
|
1967 |
C4::Biblio::ModBiblio( $record, $self->biblionumber ); |
1968 |
} |
1969 |
|
1970 |
|
1937 |
=head3 link_marc_host |
1971 |
=head3 link_marc_host |
1938 |
|
1972 |
|
1939 |
$biblio->link_marc_host({ field => $link_field}); |
1973 |
$biblio->link_marc_host({ field => $link_field}); |