Lines 418-424
subtest 'SearchItems test' => sub {
Link Here
|
418 |
|
418 |
|
419 |
my $item3_record = new MARC::Record; |
419 |
my $item3_record = new MARC::Record; |
420 |
$item3_record->append_fields( |
420 |
$item3_record->append_fields( |
421 |
new MARC::Field($itemfield, '', '', 'z' => 'foobar') |
421 |
new MARC::Field( |
|
|
422 |
$itemfield, '', '', |
423 |
'z' => 'foobar', |
424 |
'y' => $itemtype->{itemtype} |
425 |
) |
422 |
); |
426 |
); |
423 |
my (undef, undef, $item3_itemnumber) = AddItemFromMarc($item3_record, |
427 |
my (undef, undef, $item3_itemnumber) = AddItemFromMarc($item3_record, |
424 |
$biblionumber); |
428 |
$biblionumber); |
Lines 652-657
subtest 'C4::Items::_build_default_values_for_mod_marc' => sub {
Link Here
|
652 |
} |
656 |
} |
653 |
}); |
657 |
}); |
654 |
|
658 |
|
|
|
659 |
my $mss_itemtype = $builder->build({ |
660 |
source => 'MarcSubfieldStructure', |
661 |
value => { |
662 |
frameworkcode => $framework->{frameworkcode}, |
663 |
kohafield => 'items.itype', |
664 |
tagfield => '952', |
665 |
tagsubfield => 'y', |
666 |
} |
667 |
}); |
668 |
|
669 |
my $itemtype = $builder->build({ source => 'Itemtype' })->{itemtype}; |
670 |
|
655 |
# Create a record with a barcode |
671 |
# Create a record with a barcode |
656 |
my ($biblionumber) = get_biblio( $framework->{frameworkcode} ); |
672 |
my ($biblionumber) = get_biblio( $framework->{frameworkcode} ); |
657 |
my $item_record = new MARC::Record; |
673 |
my $item_record = new MARC::Record; |
Lines 659-674
subtest 'C4::Items::_build_default_values_for_mod_marc' => sub {
Link Here
|
659 |
my $barcode_field = MARC::Field->new( |
675 |
my $barcode_field = MARC::Field->new( |
660 |
'952', ' ', ' ', |
676 |
'952', ' ', ' ', |
661 |
p => $a_barcode, |
677 |
p => $a_barcode, |
|
|
678 |
y => $itemtype |
679 |
); |
680 |
my $itemtype_field = MARC::Field->new( |
681 |
'952', ' ', ' ', |
682 |
y => $itemtype |
662 |
); |
683 |
); |
663 |
$item_record->append_fields( $barcode_field ); |
684 |
$item_record->append_fields( $barcode_field ); |
664 |
my (undef, undef, $item_itemnumber) = AddItemFromMarc($item_record, $biblionumber); |
685 |
my (undef, undef, $item_itemnumber) = AddItemFromMarc($item_record, $biblionumber); |
665 |
|
686 |
use Data::Printer colored => 1; |
666 |
# Make sure everything has been set up |
687 |
# Make sure everything has been set up |
667 |
my $item = GetItem($item_itemnumber); |
688 |
my $item = GetItem($item_itemnumber); |
668 |
is( $item->{barcode}, $a_barcode, 'Everything has been set up correctly, the barcode is defined as expected' ); |
689 |
is( $item->{barcode}, $a_barcode, 'Everything has been set up correctly, the barcode is defined as expected' ); |
669 |
|
690 |
|
670 |
# Delete the barcode field and save the record |
691 |
# Delete the barcode field and save the record |
671 |
$item_record->delete_fields( $barcode_field ); |
692 |
$item_record->delete_fields( $barcode_field ); |
|
|
693 |
$item_record->append_fields( $itemtype_field ); # itemtype is mandatory |
672 |
ModItemFromMarc($item_record, $biblionumber, $item_itemnumber); |
694 |
ModItemFromMarc($item_record, $biblionumber, $item_itemnumber); |
673 |
$item = GetItem($item_itemnumber); |
695 |
$item = GetItem($item_itemnumber); |
674 |
is( $item->{barcode}, undef, 'The default value should have been set to the barcode, the field is mapped to a kohafield' ); |
696 |
is( $item->{barcode}, undef, 'The default value should have been set to the barcode, the field is mapped to a kohafield' ); |
675 |
- |
|
|