|
Lines 1161-1184
sub GetMarcSubfieldStructure {
Link Here
|
| 1161 |
|
1161 |
|
| 1162 |
=head2 GetMarcFromKohaField |
1162 |
=head2 GetMarcFromKohaField |
| 1163 |
|
1163 |
|
| 1164 |
( $field,$subfield ) = GetMarcFromKohaField( $kohafield ); |
1164 |
my ( $field, $subfield ) = GetMarcFromKohaField($kohafield); |
| 1165 |
@fields = GetMarcFromKohaField( $kohafield ); |
1165 |
my ( $f1, $sf1, $f2, $sf2 ) = GetMarcFromKohaField($kohafield); |
| 1166 |
$field = GetMarcFromKohaField( $kohafield ); |
|
|
| 1167 |
|
1166 |
|
| 1168 |
Returns the MARC fields & subfields mapped to $kohafield. |
1167 |
Returns list of MARC fields and subfields mapped to $kohafield. |
| 1169 |
Since the Default framework is considered as authoritative for such |
1168 |
Since the Default framework is considered as authoritative for such |
| 1170 |
mappings, the former frameworkcode parameter is obsoleted. |
1169 |
mappings, the former frameworkcode parameter is obsoleted. |
| 1171 |
|
1170 |
|
| 1172 |
In list context all mappings are returned; there can be multiple |
1171 |
NOTE: There may be multiple mappings! In the first example above |
| 1173 |
mappings. Note that in the above example you could miss a second |
1172 |
you could miss the second mapping (altough only a few of these |
| 1174 |
mappings in the first call. |
1173 |
will normally exist). |
| 1175 |
In scalar context only the field tag of the first mapping is returned. |
1174 |
Calling in scalar context has been deprecated as of 10/2023. |
| 1176 |
|
1175 |
|
| 1177 |
=cut |
1176 |
=cut |
| 1178 |
|
1177 |
|
| 1179 |
sub GetMarcFromKohaField { |
1178 |
sub GetMarcFromKohaField { |
| 1180 |
my ( $kohafield ) = @_; |
1179 |
my ($kohafield) = @_; |
|
|
1180 |
warn "GetMarcFromKohaField: framework parameter has been obsoleted for long" if @_ > 1; # TODO Remove later |
| 1181 |
return unless $kohafield; |
1181 |
return unless $kohafield; |
|
|
1182 |
|
| 1182 |
# The next call uses the Default framework since it is AUTHORITATIVE |
1183 |
# The next call uses the Default framework since it is AUTHORITATIVE |
| 1183 |
# for all Koha to MARC mappings. |
1184 |
# for all Koha to MARC mappings. |
| 1184 |
my $mss = GetMarcSubfieldStructure( '', { unsafe => 1 } ); # Do not change framework |
1185 |
my $mss = GetMarcSubfieldStructure( '', { unsafe => 1 } ); # Do not change framework |
|
Lines 1186-1192
sub GetMarcFromKohaField {
Link Here
|
| 1186 |
foreach( @{ $mss->{$kohafield} } ) { |
1187 |
foreach( @{ $mss->{$kohafield} } ) { |
| 1187 |
push @retval, $_->{tagfield}, $_->{tagsubfield}; |
1188 |
push @retval, $_->{tagfield}, $_->{tagsubfield}; |
| 1188 |
} |
1189 |
} |
| 1189 |
return wantarray ? @retval : ( @retval ? $retval[0] : undef ); |
1190 |
return @retval; |
| 1190 |
} |
1191 |
} |
| 1191 |
|
1192 |
|
| 1192 |
=head2 GetMarcSubfieldStructureFromKohaField |
1193 |
=head2 GetMarcSubfieldStructureFromKohaField |