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

(-)a/t/db_dependent/Items.t (-2 / +19 lines)
Lines 766-772 subtest 'Split subfields in Item2Marc (Bug 21774)' => sub { Link Here
766
};
766
};
767
767
768
subtest 'ModItemFromMarc' => sub {
768
subtest 'ModItemFromMarc' => sub {
769
    plan tests => 7;
769
    plan tests => 8;
770
    $schema->storage->txn_begin;
770
    $schema->storage->txn_begin;
771
771
772
    my $builder = t::lib::TestBuilder->new;
772
    my $builder = t::lib::TestBuilder->new;
Lines 840-845 subtest 'ModItemFromMarc' => sub { Link Here
840
        is( $item->get_from_storage->onloan, '2022-03-26', 'onloan has been updated when passed in' );
840
        is( $item->get_from_storage->onloan, '2022-03-26', 'onloan has been updated when passed in' );
841
    };
841
    };
842
842
843
    subtest 'dateaccessioned' => sub {
844
        plan tests => 3;
845
846
        my $item = $builder->build_sample_item;
847
        $item->set({ dateaccessioned => '2022-03-19' })->store->discard_changes;
848
        is( $item->dateaccessioned, '2022-03-19', 'init values set are expected' );
849
850
        my $marc = C4::Items::Item2Marc( $item->get_from_storage->unblessed, $item->biblionumber );
851
        my ( $MARCfield, $MARCsubfield ) = GetMarcFromKohaField( 'items.dateaccessioned' );
852
        $marc->field($MARCfield)->delete_subfield( code => $MARCsubfield );
853
        ModItemFromMarc( $marc, $item->biblionumber, $item->itemnumber );
854
        is( $item->get_from_storage->dateaccessioned, '2022-03-19', 'dateaccessioned has not been updated if not passed' );
855
856
        $marc = C4::Items::Item2Marc( { %{$item->unblessed}, dateaccessioned => '2022-03-26' }, $item->biblionumber );
857
        ModItemFromMarc( $marc, $item->biblionumber, $item->itemnumber );
858
        is( $item->get_from_storage->dateaccessioned, '2022-03-26', 'dateaccessioned has been updated when passed in' );
859
    };
860
843
    subtest 'permanent_location' => sub {
861
    subtest 'permanent_location' => sub {
844
        plan tests => 10;
862
        plan tests => 10;
845
863
846
- 

Return to bug 32456