GetMarcSubjects
GetMarcAuthors
GetMarcSeries
- GetMarcHosts
GetMarcUrls
GetUsedMarcStructure
GetXmlBiblio
return $error if $error;
- # We delete attached subscriptions
- require C4::Serials;
- my $subscriptions = C4::Serials::GetFullSubscriptionsFromBiblionumber($biblionumber);
- foreach my $subscription (@$subscriptions) {
- C4::Serials::DelSubscription( $subscription->{subscriptionid} );
- }
-
# We delete any existing holds
my $holds = $biblio->holds;
while ( my $hold = $holds->next ) {
next;
}
- my ( $authid, $fuzzy ) = $linker->get_link($heading);
+ my ( $authid, $fuzzy, $match_count ) = $linker->get_link($heading);
if ($authid) {
$results{ $fuzzy ? 'fuzzy' : 'linked' }
->{ $heading->display_form() }++;
if ( _check_valid_auth_link( $current_link, $field ) ) {
$results{'linked'}->{ $heading->display_form() }++;
}
- else {
+ elsif ( !$match_count ) {
my $authority_type = Koha::Authority::Types->find( $heading->auth_type() );
my $marcrecordauth = MARC::Record->new();
if ( C4::Context->preference('marcflavour') eq 'MARC21' ) {
590 => 1
);
- my %blacklist = map { $_ => 1 }
- split( /,/, C4::Context->preference('NotesBlacklist'));
+ my %hiddenlist = map { $_ => 1 }
+ split( /,/, C4::Context->preference('NotesToHide'));
foreach my $field ( $record->field($scope) ) {
my $tag = $field->tag();
- next if $blacklist{ $tag };
+ next if $hiddenlist{ $tag };
next if $opac && $maybe_private{$tag} && !$field->indicator(1);
if( $marcflavour ne 'UNIMARC' && $field->subfield('u') ) {
# Field 5XX$u always contains URI
return \@marcseries;
} #end getMARCseriess
-=head2 GetMarcHosts
-
- $marchostsarray = GetMarcHosts($record,$marcflavour);
-
-Get all host records (773s MARC21, 461 UNIMARC) from the MARC record and returns them in an array.
-
-=cut
-
-sub GetMarcHosts {
- my ( $record, $marcflavour ) = @_;
- if (!$record) {
- carp 'GetMarcHosts called on undefined record';
- return;
- }
-
- my ( $tag,$title_subf,$bibnumber_subf,$itemnumber_subf);
- $marcflavour ||="MARC21";
- if ( $marcflavour eq "MARC21" || $marcflavour eq "NORMARC" ) {
- $tag = "773";
- $title_subf = "t";
- $bibnumber_subf ="0";
- $itemnumber_subf='9';
- }
- elsif ($marcflavour eq "UNIMARC") {
- $tag = "461";
- $title_subf = "t";
- $bibnumber_subf ="0";
- $itemnumber_subf='9';
- };
-
- my @marchosts;
-
- foreach my $field ( $record->field($tag)) {
-
- my @fields_loop;
-
- my $hostbiblionumber = $field->subfield("$bibnumber_subf");
- my $hosttitle = $field->subfield($title_subf);
- my $hostitemnumber=$field->subfield($itemnumber_subf);
- push @fields_loop, { hostbiblionumber => $hostbiblionumber, hosttitle => $hosttitle, hostitemnumber => $hostitemnumber};
- push @marchosts, { MARCHOSTS_FIELDS_LOOP => \@fields_loop };
-
- }
- my $marchostsarray = \@marchosts;
- return $marchostsarray;
-}
-
=head2 UpsertMarcSubfield
my $record = C4::Biblio::UpsertMarcSubfield($MARC::Record, $fieldTag, $subfieldCode, $subfieldContent);
# In the next call we use the Default framework, since it is considered
# authoritative for Koha to Marc mappings.
- my $mss = GetMarcSubfieldStructure( '', { unsafe => 1 } ); # do not change framewok
+ my $mss = GetMarcSubfieldStructure( '', { unsafe => 1 } ); # do not change framework
my $tag_hr = {};
while ( my ($kohafield, $value) = each %$hash ) {
foreach my $fld ( @{ $mss->{$kohafield} } ) {
my $tagfield = $fld->{tagfield};
my $tagsubfield = $fld->{tagsubfield};
next if !$tagfield;
- my @values = $params->{no_split}
- ? ( $value )
- : split(/\s?\|\s?/, $value, -1);
+
+ # BZ 21800: split value if field is repeatable.
+ my @values = _check_split($params, $fld, $value)
+ ? split(/\s?\|\s?/, $value, -1)
+ : ( $value );
foreach my $value ( @values ) {
next if $value eq '';
$tag_hr->{$tagfield} //= [];
return $record;
}
+sub _check_split {
+# Checks if $value must be split; may consult passed framework
+ my ($params, $fld, $value) = @_;
+ return if index($value,'|') == -1; # nothing to worry about
+ return if $params->{no_split};
+
+ # if we did not get a specific framework, check default in $mss
+ return $fld->{repeatable} if !$params->{framework};
+
+ # here we need to check the specific framework
+ my $mss = GetMarcSubfieldStructure($params->{framework}, { unsafe => 1 });
+ foreach my $fld2 ( @{ $mss->{ $fld->{kohafield} } } ) {
+ next if $fld2->{tagfield} ne $fld->{tagfield};
+ next if $fld2->{tagsubfield} ne $fld->{tagsubfield};
+ return 1 if $fld2->{repeatable};
+ }
+ return;
+}
+
=head2 PrepHostMarcField
$hostfield = PrepHostMarcField ( $hostbiblionumber,$hostitemnumber,$marcflavour )
# MARC::Record->new_from_xml will fail (and Koha will die)
my $unimarc_and_100_exist = 0;
$unimarc_and_100_exist = 1 if $auth_type eq 'ITEM'; # if we rebuild an item, no need of a 100 field
- my $prevvalue;
my $prevtag = -1;
my $first = 1;
my $j = -1;
$server is the server that we want to update
-$record is the update MARC record if it's available. If it's not supplied
-and is needed, it'll be loaded from the database.
+$record is the updated MARC record. If it's not supplied
+and is needed it will be loaded from the database.
=cut
biblionumber => $biblionumber,
embed_items => 1 });
}
- my $records = [$record];
$indexer->update_index_background( [$biblionumber], [$record] );
}
elsif ( $op eq 'recordDelete' ) {
my $biblio_id = $args->{biblio_id};
my $action = $args->{action};
- if ( C4::Context->preference('UseKohaPlugins') && C4::Context->config("enable_plugins") ) {
-
- my @plugins = Koha::Plugins->new->GetPlugins({
- method => 'after_biblio_action',
- });
-
- if (@plugins) {
-
- my $biblio = Koha::Biblios->find( $biblio_id );
-
- foreach my $plugin ( @plugins ) {
- try {
- $plugin->after_biblio_action({ action => $action, biblio => $biblio, biblio_id => $biblio_id });
- }
- catch {
- warn "$_";
- };
- }
+ my $biblio = Koha::Biblios->find( $biblio_id );
+ Koha::Plugins->call(
+ 'after_biblio_action',
+ {
+ action => $action,
+ biblio => $biblio,
+ biblio_id => $biblio_id,
}
- }
+ );
}
__END__