&GetAuthorisedValueDesc
&GetMarcStructure
+ &IsMarcStructureInternal
&GetMarcFromKohaField
&GetMarcSubfieldStructureFromKohaField
&GetFrameworkCode
=head1 FUNCTIONS FOR HANDLING MARC MANAGEMENT
+=head2 IsMarcStructureInternal
+
+ my $tagslib = C4::Biblio::GetMarcStructure();
+ for my $tag ( sort keys %$tagslib ) {
+ next unless $tag;
+ for my $subfield ( sort keys %{ $tagslib->{$tag} } ) {
+ next if IsMarcStructureInternal($tagslib->{$tag}{$subfield});
+ }
+ # Process subfield
+ }
+
+GetMarcStructure creates keys (lib, tab, mandatory, repeatable) for a display purpose.
+These different values should not be processed as valid subfields.
+
+=cut
+
+sub IsMarcStructureInternal {
+ my ( $subfield ) = @_;
+ return ref $subfield ? 0 : 1;
+}
+
=head2 GetMarcStructure
$res = GetMarcStructure($forlibrarian,$frameworkcode);
=head2 GetMarcNotes
- $marcnotesarray = GetMarcNotes( $record, $marcflavour );
+ $marcnotesarray = GetMarcNotes( $record, $marcflavour );
-Get all notes from the MARC record and returns them in an array.
-The note are stored in different fields depending on MARC flavour
+ Get all notes from the MARC record and returns them in an array.
+ The notes are stored in different fields depending on MARC flavour.
+ MARC21 field 555 gets special attention for the $u subfields.
=cut
carp 'GetMarcNotes called on undefined record';
return;
}
- my $scope;
- if ( $marcflavour eq "UNIMARC" ) {
- $scope = '3..';
- } else { # assume marc21 if not unimarc
- $scope = '5..';
- }
+
+ my $scope = $marcflavour eq "UNIMARC"? '3..': '5..';
my @marcnotes;
- my $note = "";
- my $tag = "";
- my $marcnote;
- my %blacklist = map { $_ => 1 } split(/,/,C4::Context->preference('NotesBlacklist'));
+ my %blacklist = map { $_ => 1 }
+ split( /,/, C4::Context->preference('NotesBlacklist'));
foreach my $field ( $record->field($scope) ) {
my $tag = $field->tag();
- if (!$blacklist{$tag}) {
- my $value = $field->as_string();
- if ( $note ne "" ) {
- $marcnote = { marcnote => $note, };
- push @marcnotes, $marcnote;
- $note = $value;
- }
- if ( $note ne $value ) {
- $note = $note . " " . $value;
+ next if $blacklist{ $tag };
+ if( $marcflavour ne 'UNIMARC' && $tag =~ /555/ ) {
+ # Field 555$u contains URLs
+ # We first push the regular subfields and all $u's separately
+ # Leave further actions to the template
+ push @marcnotes, { marcnote => $field->as_string('abcd') };
+ foreach my $sub ( $field->subfield('u') ) {
+ push @marcnotes, { marcnote => $sub };
}
+ } else {
+ push @marcnotes, { marcnote => $field->as_string() };
}
}
-
- if ($note) {
- $marcnote = { marcnote => $note };
- push @marcnotes, $marcnote; #load last tag into array
- }
return \@marcnotes;
-} # end GetMarcNotes
+}
=head2 GetMarcSubjects
if ( $field = $host->field('205') ) {
my $s = $field->as_string();
if ($s) {
- $sfd{a} = $s;
+ $sfd{e} = $s;
}
}
#URL