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

(-)a/C4/Items.pm (-3 / +1 lines)
Lines 1348-1356 sub Item2Marc { Link Here
1348
        } keys %{ $itemrecord } 
1348
        } keys %{ $itemrecord } 
1349
    };
1349
    };
1350
    my $framework = C4::Biblio::GetFrameworkCode( $biblionumber );
1350
    my $framework = C4::Biblio::GetFrameworkCode( $biblionumber );
1351
    my $itemmarc = C4::Biblio::TransformKohaToMarc(
1351
    my $itemmarc = C4::Biblio::TransformKohaToMarc( $mungeditem ); # Bug 21774: no_split parameter removed to allow cloned subfields
1352
        $mungeditem, { no_split => 1},
1353
    );
1354
    my ( $itemtag, $itemsubfield ) = C4::Biblio::GetMarcFromKohaField(
1352
    my ( $itemtag, $itemsubfield ) = C4::Biblio::GetMarcFromKohaField(
1355
        "items.itemnumber", $framework,
1353
        "items.itemnumber", $framework,
1356
    );
1354
    );
(-)a/t/db_dependent/Items.t (-2 / +23 lines)
Lines 33-39 use Koha::Caches; Link Here
33
use t::lib::Mocks;
33
use t::lib::Mocks;
34
use t::lib::TestBuilder;
34
use t::lib::TestBuilder;
35
35
36
use Test::More tests => 14;
36
use Test::More tests => 15;
37
37
38
use Test::Warn;
38
use Test::Warn;
39
39
Lines 934-939 subtest 'Check add_to_rota method' => sub { Link Here
934
    $schema->storage->txn_rollback;
934
    $schema->storage->txn_rollback;
935
};
935
};
936
936
937
subtest 'Split subfields in Item2Marc (Bug 21774)' => sub {
938
    plan tests => 3;
939
    $schema->storage->txn_begin;
940
941
    my $builder = t::lib::TestBuilder->new;
942
    my $biblio = $builder->build({ source => 'Biblio', value => { frameworkcode => q{} } });
943
    my $item = $builder->build({ source => 'Item', value => { biblionumber => $biblio->{biblionumber}, ccode => 'A|B' } });
944
945
    Koha::MarcSubfieldStructures->search({ tagfield => '952', tagsubfield => '8' })->delete; # theoretical precaution
946
    Koha::MarcSubfieldStructures->search({ kohafield => 'items.ccode' })->delete;
947
    my $mapping = Koha::MarcSubfieldStructure->new({ frameworkcode => q{}, tagfield => '952', tagsubfield => '8', kohafield => 'items.ccode' })->store;
948
949
    # Start testing
950
    my $marc = C4::Items::Item2Marc( $item, $biblio->{biblionumber} );
951
    my @subs = $marc->subfield( $mapping->tagfield, $mapping->tagsubfield );
952
    is( @subs, 2, 'Expect two subfields' );
953
    is( $subs[0], 'A', 'First subfield matches' );
954
    is( $subs[1], 'B', 'Second subfield matches' );
955
956
    $schema->storage->txn_rollback;
957
};
958
937
# Helper method to set up a Biblio.
959
# Helper method to set up a Biblio.
938
sub get_biblio {
960
sub get_biblio {
939
    my ( $frameworkcode ) = @_;
961
    my ( $frameworkcode ) = @_;
940
- 

Return to bug 21774