Lines 691-696
if ($op eq "additem") {
Link Here
|
691 |
# FIXME Handle non existent item |
691 |
# FIXME Handle non existent item |
692 |
my $olditemlost = $item->itemlost; |
692 |
my $olditemlost = $item->itemlost; |
693 |
my @columns = Koha::Items->columns; |
693 |
my @columns = Koha::Items->columns; |
|
|
694 |
my $new_values = $item->unblessed; |
694 |
for my $c ( @columns ) { |
695 |
for my $c ( @columns ) { |
695 |
if ( $c eq 'more_subfields_xml' ) { |
696 |
if ( $c eq 'more_subfields_xml' ) { |
696 |
my @more_subfields_xml = $input->multi_param("items.more_subfields_xml"); |
697 |
my @more_subfields_xml = $input->multi_param("items.more_subfields_xml"); |
Lines 705-720
if ($op eq "additem") {
Link Here
|
705 |
# used in the framework |
706 |
# used in the framework |
706 |
$marc->append_fields(MARC::Field->new('999', ' ', ' ', @unlinked_item_subfields)); |
707 |
$marc->append_fields(MARC::Field->new('999', ' ', ' ', @unlinked_item_subfields)); |
707 |
$marc->encoding("UTF-8"); |
708 |
$marc->encoding("UTF-8"); |
708 |
$item->more_subfields_xml($marc->as_xml("USMARC")); |
709 |
$new_values->{more_subfields_xml} = $marc->as_xml("USMARC"); |
709 |
next; |
710 |
next; |
710 |
} |
711 |
} |
711 |
$item->more_subfields_xml(undef); |
712 |
$item->more_subfields_xml(undef); |
712 |
} else { |
713 |
} else { |
713 |
my @v = $input->multi_param("items.".$c); |
714 |
my @v = map { ( defined $_ && $_ eq '' ) ? undef : $_ } $input->multi_param( "items." . $c ); |
714 |
next unless @v; |
715 |
next unless @v; |
715 |
$item->$c(join ' | ', uniq @v); |
716 |
|
|
|
717 |
if ( scalar(@v) == 1 && not defined $v[0] ) { |
718 |
delete $new_values->{$c}; |
719 |
} else { |
720 |
$new_values->{$c} = join ' | ', @v; |
721 |
} |
716 |
} |
722 |
} |
717 |
} |
723 |
} |
|
|
724 |
$item = $item->set_or_blank($new_values); |
718 |
|
725 |
|
719 |
# check that the barcode don't exist already |
726 |
# check that the barcode don't exist already |
720 |
if ( |
727 |
if ( |
721 |
- |
|
|