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

(-)a/t/db_dependent/Items.t (-2 / +43 lines)
Lines 34-40 use Koha::AuthorisedValues; Link Here
34
use t::lib::Mocks;
34
use t::lib::Mocks;
35
use t::lib::TestBuilder;
35
use t::lib::TestBuilder;
36
36
37
use Test::More tests => 15;
37
use Test::More tests => 16;
38
38
39
use Test::Warn;
39
use Test::Warn;
40
40
Lines 992-994 subtest 'Split subfields in Item2Marc (Bug 21774)' => sub { Link Here
992
992
993
    $schema->storage->txn_rollback;
993
    $schema->storage->txn_rollback;
994
};
994
};
995
- 
995
996
subtest 'tests for GetMarcItem' => sub {
997
    plan tests => 1;
998
    $schema->storage->txn_begin;
999
1000
    my $builder  = t::lib::TestBuilder->new;
1001
    my $library  = $builder->build({ source => 'Branch', });
1002
    my $itemtype = $builder->build({ source => 'Itemtype', });
1003
    my $biblio   = $builder->build({
1004
        source => 'Biblio',
1005
        value=>{
1006
            frameworkcode => "",
1007
        }
1008
    });
1009
    my $biblioitem = $builder->build({
1010
        source => 'Biblioitem',
1011
        value => { biblionumber => $biblio->{biblionumber} },
1012
    });
1013
    my $item1 = $builder->build_object({
1014
        class => 'Koha::Items',
1015
        value => {
1016
            biblionumber     => $biblio->{biblionumber},
1017
            biblioitemnumber => $biblioitem->{biblioitemnumber},
1018
            itype            => $itemtype->{itype},
1019
            homebranch       => $library->{branchcode},
1020
            barcode          => undef,
1021
            restricted       => 1,
1022
            itemcallnumber   => "",
1023
            cn_sort          => "",
1024
        }
1025
    });
1026
    my ($itemtag, $item_num_subfield )=C4::Biblio::GetMarcFromKohaField("items.itemnumber");
1027
    my $get_itemnumber = $item1->itemnumber;
1028
    my $item1_marc = C4::Items::GetMarcItem( $biblio->{biblionumber}, $item1->itemnumber );
1029
    my (undef, undef, $itemnumber2 ) = AddItemFromMarc( $item1_marc, $biblio->{biblionumber} );
1030
    my $item2_marc = C4::Items::GetMarcItem( $biblio->{biblionumber}, $itemnumber2 );
1031
    ($itemtag, $item_num_subfield )=C4::Biblio::GetMarcFromKohaField("items.itemnumber"); #get itemnumber tag
1032
    $item1_marc->field($itemtag)->delete_subfield(code => $item_num_subfield); #and remove it
1033
    $item2_marc->field($itemtag)->delete_subfield(code => $item_num_subfield); #because it won't match
1034
    is_deeply( $item1_marc, $item2_marc, "The Marc should match if the items are the same");
1035
    $schema->storage->txn_rollback;
1036
};

Return to bug 20664