@@ -, +, @@ --- acqui/addorder.pl | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) --- a/acqui/addorder.pl +++ a/acqui/addorder.pl @@ -129,6 +129,8 @@ use C4::Biblio; # AddBiblio TransformKohaToMarc use C4::Budgets; use C4::Items; use C4::Output; +use C4::Koha qw( subfield_is_koha_internal_p ); +use MARC::Field; ### "-------------------- addorder.pl ----------" @@ -259,6 +261,25 @@ if ( $orderinfo->{quantity} ne '0' ) { "aqorders.discount" => $$orderinfo{discount} ? $$orderinfo{discount} : "", }); + + my $tagslib = C4::Biblio::GetMarcStructure( 1, 'ACQ' ); + if ( $tagslib ) { + my ( $itemfield ) = C4::Biblio::GetMarcFromKohaField( 'items.itemnumber', '' ); + for my $tag ( sort keys %$tagslib ) { + next unless $tag; + next if $tag == $itemfield; + for my $subfield ( sort keys %{ $tagslib->{$tag} } ) { + next if ( subfield_is_koha_internal_p($subfield) ); + my $defaultvalue = $tagslib->{$tag}{$subfield}{defaultvalue}; + if ( defined $defaultvalue and $defaultvalue ne '' ) { + $record->insert_fields_ordered( + MARC::Field->new( $tag, '', '', $subfield => $defaultvalue ) + ); + } + } + } + } + # create the record in catalogue, with framework '' my ($biblionumber,$bibitemnum) = AddBiblio($record,''); # change suggestion status if applicable --