Lines 1931-1936
sub generate_marc_host_field {
Link Here
|
1931 |
return $link_field; |
1931 |
return $link_field; |
1932 |
} |
1932 |
} |
1933 |
|
1933 |
|
|
|
1934 |
|
1935 |
|
1936 |
=head3 unlink_marc_host |
1937 |
|
1938 |
$biblio->unlink_marc_host({ host => $biblio }); |
1939 |
$biblio->unlink_marc_host({ host => $biblionumber }); |
1940 |
|
1941 |
Remove the link to the parent created by link_marc_host. Expects either the biblio object or biblionumber of the host to link to. |
1942 |
|
1943 |
=cut |
1944 |
|
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 |
} |
1964 |
} |
1965 |
|
1966 |
C4::Biblio::ModBiblio($record, $self->biblionumber); |
1967 |
} |
1968 |
|
1969 |
|
1934 |
=head3 link_marc_host |
1970 |
=head3 link_marc_host |
1935 |
|
1971 |
|
1936 |
$biblio->link_marc_host({ field => $link_field}); |
1972 |
$biblio->link_marc_host({ field => $link_field}); |