diff --git a/acqui/basket.pl b/acqui/basket.pl index 38a555ef52..1a6ef3ca47 100755 --- a/acqui/basket.pl +++ b/acqui/basket.pl @@ -442,9 +442,8 @@ if ( $op eq 'list' ) { duplinbatch => $duplinbatch, csv_profiles => Koha::CsvProfiles->search({ type => 'sql', used_for => 'export_basket' }), available_additional_fields => Koha::AdditionalFields->search( { tablename => 'aqbasket' } ), - additional_field_values => { map { - $_->field->name => $_->value - } Koha::Acquisition::Baskets->find($basketno)->additional_field_values->as_list }, + additional_field_values => + Koha::Acquisition::Baskets->find($basketno)->get_additional_field_values_for_template, ); } diff --git a/acqui/basketheader.pl b/acqui/basketheader.pl index 70a424941f..96a7e95e26 100755 --- a/acqui/basketheader.pl +++ b/acqui/basketheader.pl @@ -96,11 +96,8 @@ if ( $op eq 'add_form' ) { } } $template->param( is_an_edit => 1); - $template->param( - additional_field_values => { map { - $_->field->id => $_->value - } Koha::Acquisition::Baskets->find($basketno)->additional_field_values->as_list }, - ); + $template->param( additional_field_values => + Koha::Acquisition::Baskets->find($basketno)->get_additional_field_values_for_template ); } else { #new basket my $basket; @@ -168,11 +165,13 @@ if ( $op eq 'add_form' ) { my @additional_fields; my $basket_fields = Koha::AdditionalFields->search({ tablename => 'aqbasket' }); while ( my $field = $basket_fields->next ) { - my $value = $input->param('additional_field_' . $field->id); - push @additional_fields, { - id => $field->id, - value => $value, - }; + my @field_values = $input->param( 'additional_field_' . $field->id ); + foreach my $value (@field_values) { + push @additional_fields, { + id => $field->id, + value => $value, + } if $value; + } } Koha::Acquisition::Baskets->find($basketno)->set_additional_fields(\@additional_fields); diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basketheader.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basketheader.tt index e31a06c4bb..75a5443193 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basketheader.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basketheader.tt @@ -164,6 +164,7 @@ [% MACRO jsinclude BLOCK %] [% Asset.js("js/acquisitions-menu.js") | $raw %] [% Asset.js("js/acq.js") | $raw %] + [% Asset.js("js/additional-fields-entry.js") | $raw %] [% INCLUDE 'select2.inc' %]