@@ -, +, @@ --- acqui/invoice.pl | 16 ++++++++-------- acqui/parcels.pl | 6 +++--- .../prog/en/modules/acqui/invoice.tt | 1 + .../prog/en/modules/acqui/invoices.tt | 1 + .../prog/en/modules/acqui/parcels.tt | 1 + 5 files changed, 14 insertions(+), 11 deletions(-) --- a/acqui/invoice.pl +++ a/acqui/invoice.pl @@ -131,11 +131,13 @@ elsif ( $op && $op eq 'cud-mod' ) { my @additional_fields; my $invoice_fields = Koha::AdditionalFields->search({ tablename => 'aqinvoices' }); while ( my $field = $invoice_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::Invoices->find($invoiceid)->set_additional_fields(\@additional_fields); @@ -320,9 +322,7 @@ if ( $adjustments ) { $template->param( adjustments => $adjustments ); } my $invoice = Koha::Acquisition::Invoices->find($invoiceid); $template->param( available_additional_fields => Koha::AdditionalFields->search( { tablename => 'aqinvoices' } ), - additional_field_values => { map { - $_->field->id => $_->value - } $invoice->additional_field_values->as_list }, + additional_field_values => $invoice->get_additional_field_values_for_template, ); $template->param( --- a/acqui/parcels.pl +++ a/acqui/parcels.pl @@ -134,12 +134,12 @@ if ($op and $op eq 'cud-confirm') { my @additional_fields; my $invoice_fields = Koha::AdditionalFields->search({ tablename => 'aqinvoices' }); while ( my $field = $invoice_fields->next ) { - my $value = $input->param('additional_field_' . $field->id); - if (defined $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; } } if (@additional_fields) { --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/invoice.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/invoice.tt @@ -540,6 +540,7 @@ [% Asset.js("js/acquisitions-menu.js") | $raw %] [% Asset.js("lib/jquery/plugins/humanmsg.js") | $raw %] [% Asset.js("js/acq.js") | $raw %] + [% Asset.js("js/additional-fields-entry.js") | $raw %] [% INCLUDE 'calendar.inc' %] [% INCLUDE 'datatables.inc' %]