Lines 33-39
use Koha::AuthorisedValues;
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 975-977
subtest 'Split subfields in Item2Marc (Bug 21774)' => sub {
Link Here
|
975 |
|
975 |
|
976 |
$schema->storage->txn_rollback; |
976 |
$schema->storage->txn_rollback; |
977 |
}; |
977 |
}; |
|
|
978 |
|
979 |
subtest 'ModItemFromMarc' => sub { |
980 |
plan tests => 2; |
981 |
$schema->storage->txn_begin; |
982 |
|
983 |
my $builder = t::lib::TestBuilder->new; |
984 |
my ($itemfield) = GetMarcFromKohaField( 'items.itemnumber' ); |
985 |
my $itemtype = $builder->build_object({ class => 'Koha::ItemTypes' }); |
986 |
my $biblio = $builder->build_sample_biblio; |
987 |
my ( $lost_tag, $lost_sf ) = GetMarcFromKohaField( 'items.itemlost' ); |
988 |
my $item_record = new MARC::Record; |
989 |
$item_record->append_fields( |
990 |
MARC::Field->new( |
991 |
$itemfield, '', '', |
992 |
'y' => $itemtype->itemtype, |
993 |
), |
994 |
MARC::Field->new( |
995 |
$itemfield, '', '', |
996 |
$lost_sf => '1', |
997 |
), |
998 |
); |
999 |
my (undef, undef, $itemnumber) = AddItemFromMarc($item_record, |
1000 |
$biblio->biblionumber); |
1001 |
|
1002 |
my $item = Koha::Items->find($itemnumber); |
1003 |
is( $item->itemlost, 1, 'itemlost picked from the item marc'); |
1004 |
|
1005 |
my $updated_item_record = new MARC::Record; |
1006 |
$updated_item_record->append_fields( |
1007 |
MARC::Field->new( |
1008 |
$itemfield, '', '', |
1009 |
'y' => $itemtype->itemtype, |
1010 |
) |
1011 |
); |
1012 |
|
1013 |
my $updated_item = ModItemFromMarc($updated_item_record, $biblio->biblionumber, $itemnumber); |
1014 |
is( $updated_item->{itemlost}, 0, 'itemlost should have been reset to the default value in DB' ); |
1015 |
|
1016 |
$schema->storage->txn_rollback; |
1017 |
}; |