View | Details | Raw Unified | Return to bug 19820
Collapse All | Expand All

(-)a/C4/Biblio.pm (-7 / +6 lines)
Lines 1079-1091 sub GetUsedMarcStructure { Link Here
1079
=cut
1079
=cut
1080
1080
1081
sub GetMarcSubfieldStructure {
1081
sub GetMarcSubfieldStructure {
1082
    my ( $frameworkcode ) = @_;
1082
    my ( $frameworkcode, $params ) = @_;
1083
1083
1084
    $frameworkcode //= '';
1084
    $frameworkcode //= '';
1085
1085
1086
    my $cache     = Koha::Caches->get_instance();
1086
    my $cache     = Koha::Caches->get_instance();
1087
    my $cache_key = "MarcSubfieldStructure-$frameworkcode";
1087
    my $cache_key = "MarcSubfieldStructure-$frameworkcode";
1088
    my $cached    = $cache->get_from_cache($cache_key);
1088
    my $cached  = $cache->get_from_cache($cache_key, { unsafe => ($params && $params->{unsafe}) });
1089
    return $cached if $cached;
1089
    return $cached if $cached;
1090
1090
1091
    my $dbh = C4::Context->dbh;
1091
    my $dbh = C4::Context->dbh;
Lines 1129-1135 sub GetMarcFromKohaField { Link Here
1129
    return unless $kohafield;
1129
    return unless $kohafield;
1130
    # The next call uses the Default framework since it is AUTHORITATIVE
1130
    # The next call uses the Default framework since it is AUTHORITATIVE
1131
    # for all Koha to MARC mappings.
1131
    # for all Koha to MARC mappings.
1132
    my $mss = GetMarcSubfieldStructure( '' ); # Do not change framework
1132
    my $mss = GetMarcSubfieldStructure( '', { unsafe => 1 } ); # Do not change framework
1133
    my @retval;
1133
    my @retval;
1134
    foreach( @{ $mss->{$kohafield} } ) {
1134
    foreach( @{ $mss->{$kohafield} } ) {
1135
        push @retval, $_->{tagfield}, $_->{tagsubfield};
1135
        push @retval, $_->{tagfield}, $_->{tagsubfield};
Lines 1156-1162 sub GetMarcSubfieldStructureFromKohaField { Link Here
1156
1156
1157
    # The next call uses the Default framework since it is AUTHORITATIVE
1157
    # The next call uses the Default framework since it is AUTHORITATIVE
1158
    # for all Koha to MARC mappings.
1158
    # for all Koha to MARC mappings.
1159
    my $mss = GetMarcSubfieldStructure(''); # Do not change framework
1159
    my $mss = GetMarcSubfieldStructure( '', { unsafe => 1 } ); # Do not change framework
1160
    return unless $mss->{$kohafield};
1160
    return unless $mss->{$kohafield};
1161
    return wantarray ? @{$mss->{$kohafield}} : $mss->{$kohafield}->[0];
1161
    return wantarray ? @{$mss->{$kohafield}} : $mss->{$kohafield}->[0];
1162
}
1162
}
Lines 2192-2198 sub TransformKohaToMarc { Link Here
2192
2192
2193
    # In the next call we use the Default framework, since it is considered
2193
    # In the next call we use the Default framework, since it is considered
2194
    # authoritative for Koha to Marc mappings.
2194
    # authoritative for Koha to Marc mappings.
2195
    my $mss = GetMarcSubfieldStructure( '' ); # do not change framework
2195
    my $mss = GetMarcSubfieldStructure( '', { unsafe => 1 } ); # do not change framewok
2196
    my $tag_hr = {};
2196
    my $tag_hr = {};
2197
    while ( my ($kohafield, $value) = each %$hash ) {
2197
    while ( my ($kohafield, $value) = each %$hash ) {
2198
        foreach my $fld ( @{ $mss->{$kohafield} } ) {
2198
        foreach my $fld ( @{ $mss->{$kohafield} } ) {
Lines 2605-2611 sub TransformMarcToKoha { Link Here
2605
2605
2606
    # The next call acknowledges Default as the authoritative framework
2606
    # The next call acknowledges Default as the authoritative framework
2607
    # for Koha to MARC mappings.
2607
    # for Koha to MARC mappings.
2608
    my $mss = GetMarcSubfieldStructure(''); # Do not change framework
2608
    my $mss = GetMarcSubfieldStructure( '', { unsafe => 1 } ); # Do not change framework
2609
    foreach my $kohafield ( keys %{ $mss } ) {
2609
    foreach my $kohafield ( keys %{ $mss } ) {
2610
        my ( $table, $column ) = split /[.]/, $kohafield, 2;
2610
        my ( $table, $column ) = split /[.]/, $kohafield, 2;
2611
        next unless $tables{$table};
2611
        next unless $tables{$table};
2612
- 

Return to bug 19820