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

(-)a/C4/Biblio.pm (-6 / +12 lines)
Lines 2076-2081 sub TransformHtmlToXml { Link Here
2076
    my ( $tags, $subfields, $values, $indicator, $ind_tag, $auth_type ) = @_;
2076
    my ( $tags, $subfields, $values, $indicator, $ind_tag, $auth_type ) = @_;
2077
    # NOTE: The parameter $ind_tag is NOT USED -- BZ 11247
2077
    # NOTE: The parameter $ind_tag is NOT USED -- BZ 11247
2078
2078
2079
    my ( $perm_loc_tag, $perm_loc_subfield ) = C4::Biblio::GetMarcFromKohaField( "items.permanent_location" );
2080
2079
    my $xml = MARC::File::XML::header('UTF-8');
2081
    my $xml = MARC::File::XML::header('UTF-8');
2080
    $xml .= "<record>\n";
2082
    $xml .= "<record>\n";
2081
    $auth_type = C4::Context->preference('marcflavour') unless $auth_type;
2083
    $auth_type = C4::Context->preference('marcflavour') unless $auth_type;
Lines 2091-2097 sub TransformHtmlToXml { Link Here
2091
    my $j       = -1;
2093
    my $j       = -1;
2092
    my $close_last_tag;
2094
    my $close_last_tag;
2093
    for ( my $i = 0 ; $i < @$tags ; $i++ ) {
2095
    for ( my $i = 0 ; $i < @$tags ; $i++ ) {
2094
2095
        if ( C4::Context->preference('marcflavour') eq 'UNIMARC' and @$tags[$i] eq "100" and @$subfields[$i] eq "a" ) {
2096
        if ( C4::Context->preference('marcflavour') eq 'UNIMARC' and @$tags[$i] eq "100" and @$subfields[$i] eq "a" ) {
2096
2097
2097
            # if we have a 100 field and it's values are not correct, skip them.
2098
            # if we have a 100 field and it's values are not correct, skip them.
Lines 2109-2114 sub TransformHtmlToXml { Link Here
2109
        @$values[$i] =~ s/"/&quot;/g;
2110
        @$values[$i] =~ s/"/&quot;/g;
2110
        @$values[$i] =~ s/'/&apos;/g;
2111
        @$values[$i] =~ s/'/&apos;/g;
2111
2112
2113
        my $skip = @$values[$i] eq "";
2114
        $skip = 0
2115
          if $perm_loc_tag
2116
          && $perm_loc_subfield
2117
          && @$tags[$i] eq $perm_loc_tag
2118
          && @$subfields[$i] eq $perm_loc_subfield;
2119
2112
        if ( ( @$tags[$i] ne $prevtag ) ) {
2120
        if ( ( @$tags[$i] ne $prevtag ) ) {
2113
            $close_last_tag = 0;
2121
            $close_last_tag = 0;
2114
            $j++ unless ( @$tags[$i] eq "" );
2122
            $j++ unless ( @$tags[$i] eq "" );
Lines 2118-2124 sub TransformHtmlToXml { Link Here
2118
            if ( !$first ) {
2126
            if ( !$first ) {
2119
                $xml .= "</datafield>\n";
2127
                $xml .= "</datafield>\n";
2120
                if (   ( @$tags[$i] && @$tags[$i] > 10 )
2128
                if (   ( @$tags[$i] && @$tags[$i] > 10 )
2121
                    && ( @$values[$i] ne "" ) ) {
2129
                    && ( !$skip ) ) {
2122
                    $xml .= "<datafield tag=\"@$tags[$i]\" ind1=\"$ind1\" ind2=\"$ind2\">\n";
2130
                    $xml .= "<datafield tag=\"@$tags[$i]\" ind1=\"$ind1\" ind2=\"$ind2\">\n";
2123
                    $xml .= "<subfield code=\"@$subfields[$i]\">@$values[$i]</subfield>\n";
2131
                    $xml .= "<subfield code=\"@$subfields[$i]\">@$values[$i]</subfield>\n";
2124
                    $first = 0;
2132
                    $first = 0;
Lines 2127-2133 sub TransformHtmlToXml { Link Here
2127
                    $first = 1;
2135
                    $first = 1;
2128
                }
2136
                }
2129
            } else {
2137
            } else {
2130
                if ( @$values[$i] ne "" ) {
2138
                if ( !$skip ) {
2131
2139
2132
                    # leader
2140
                    # leader
2133
                    if ( @$tags[$i] eq "000" ) {
2141
                    if ( @$tags[$i] eq "000" ) {
Lines 2147-2154 sub TransformHtmlToXml { Link Here
2147
                }
2155
                }
2148
            }
2156
            }
2149
        } else {    # @$tags[$i] eq $prevtag
2157
        } else {    # @$tags[$i] eq $prevtag
2150
            if ( @$values[$i] eq "" ) {
2158
            if ( !$skip ) {
2151
            } else {
2152
                if ($first) {
2159
                if ($first) {
2153
                    my $str = ( $indicator->[$j] // q{} ) . '  '; # extra space prevents substr outside of string warn
2160
                    my $str = ( $indicator->[$j] // q{} ) . '  '; # extra space prevents substr outside of string warn
2154
                    my $ind1 = _default_ind_to_space( substr( $str, 0, 1 ) );
2161
                    my $ind1 = _default_ind_to_space( substr( $str, 0, 1 ) );
2155
- 

Return to bug 27837