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

(-)a/Koha/Item/Attributes.pm (-2 / +2 lines)
Lines 60-66 sub new_from_marcxml { Link Here
60
        my $more_subfields = [ uniq map { $_->[0] } $field->subfields ];
60
        my $more_subfields = [ uniq map { $_->[0] } $field->subfields ];
61
        for my $more_subfield (@$more_subfields) {
61
        for my $more_subfield (@$more_subfields) {
62
            my @s = $field->subfield($more_subfield);
62
            my @s = $field->subfield($more_subfield);
63
            $self->{$more_subfield} = join '|', @s;
63
            $self->{$more_subfield} = join ' | ', @s;
64
        }
64
        }
65
    }
65
    }
66
    return bless $self, $class;
66
    return bless $self, $class;
Lines 113-119 sub to_marcxml { Link Here
113
          or $self->{$tagsubfield} eq "";
113
          or $self->{$tagsubfield} eq "";
114
114
115
        if ( $tagslib->{$itemtag}->{$tagsubfield}->{repeatable} ) {
115
        if ( $tagslib->{$itemtag}->{$tagsubfield}->{repeatable} ) {
116
            my @values = split '\|', $self->{$tagsubfield};
116
            my @values = split ' \| ', $self->{$tagsubfield};
117
            push @subfields, ( $tagsubfield => $_ ) for @values;
117
            push @subfields, ( $tagsubfield => $_ ) for @values;
118
        }
118
        }
119
        else {
119
        else {
(-)a/t/db_dependent/Koha/Item/Attributes.t (-8 / +7 lines)
Lines 66-72 my $some_marc_xml = q{<?xml version="1.0" encoding="UTF-8"?> Link Here
66
    <subfield code="y">value for y</subfield>
66
    <subfield code="y">value for y</subfield>
67
    <subfield code="é">value for é 1</subfield>
67
    <subfield code="é">value for é 1</subfield>
68
    <subfield code="é">value for é 2</subfield>
68
    <subfield code="é">value for é 2</subfield>
69
    <subfield code="z">value for z 1|value for z 2</subfield>
69
    <subfield code="z">value for z 1 | value for z 2</subfield>
70
  </datafield>
70
  </datafield>
71
</record>
71
</record>
72
72
Lines 76-94 $item->more_subfields_xml($some_marc_xml)->store; Link Here
76
76
77
$attributes = $item->additional_attributes;
77
$attributes = $item->additional_attributes;
78
is( ref($attributes), 'Koha::Item::Attributes' );
78
is( ref($attributes), 'Koha::Item::Attributes' );
79
is( $attributes->{'x'}, "value for x 1|value for x 2");
79
is( $attributes->{'x'}, "value for x 1 | value for x 2");
80
is( $attributes->{'y'}, "value for y");
80
is( $attributes->{'y'}, "value for y");
81
is( $attributes->{'é'}, "value for é 1|value for é 2");
81
is( $attributes->{'é'}, "value for é 1 | value for é 2");
82
is( $attributes->{'z'}, "value for z 1|value for z 2");
82
is( $attributes->{'z'}, "value for z 1 | value for z 2");
83
83
84
is( $attributes->to_marcxml, $some_marc_xml );
84
is( $attributes->to_marcxml, $some_marc_xml );
85
is_deeply(
85
is_deeply(
86
    $attributes->to_hashref,
86
    $attributes->to_hashref,
87
    {
87
    {
88
        'x' => "value for x 1|value for x 2",
88
        'x' => "value for x 1 | value for x 2",
89
        'y' => "value for y",
89
        'y' => "value for y",
90
        'é' => "value for é 1|value for é 2",
90
        'é' => "value for é 1 | value for é 2",
91
        'z' => "value for z 1|value for z 2",
91
        'z' => "value for z 1 | value for z 2",
92
    }
92
    }
93
);
93
);
94
94
95
- 

Return to bug 28445