View | Details | Raw Unified | Return to bug 35044
Collapse All | Expand All

(-)a/acqui/addorder.pl (-10 / +11 lines)
Lines 374-390 if ( $basket->{is_standing} || $orderinfo->{quantity} ne '0' ) { Link Here
374
    ModOrderUsers( $order->ordernumber, @order_users );
374
    ModOrderUsers( $order->ordernumber, @order_users );
375
375
376
    # Retrieve and save additional fields values
376
    # Retrieve and save additional fields values
377
    my @additional_fields = Koha::AdditionalFields->search({ tablename => 'aqorders' })->as_list;
377
    my @additional_fields;
378
    my @additional_field_values;
378
    my $order_fields = Koha::AdditionalFields->search( { tablename => 'aqorders' } );
379
    foreach my $af (@additional_fields) {
379
    while ( my $field = $order_fields->next ) {
380
        my $id = $af->id;
380
        my @field_values = $input->param( 'additional_field_' . $field->id );
381
        my $value = $input->param("additional_field_$id");
381
        foreach my $value (@field_values) {
382
        push @additional_field_values, {
382
            push @additional_fields, {
383
            id => $id,
383
                id    => $field->id,
384
            value => $value,
384
                value => $value,
385
        };
385
            } if $value;
386
        }
386
    }
387
    }
387
    $order->set_additional_fields(\@additional_field_values);
388
    $order->set_additional_fields(\@additional_fields);
388
389
389
    # now, add items if applicable
390
    # now, add items if applicable
390
    if ($basket->effective_create_items eq 'ordering') {
391
    if ($basket->effective_create_items eq 'ordering') {
(-)a/acqui/neworderempty.pl (-6 / +9 lines)
Lines 419-444 $quantity //= 0; Link Here
419
# Get additional fields
419
# Get additional fields
420
my $record;
420
my $record;
421
my @additional_fields = Koha::AdditionalFields->search({ tablename => 'aqorders' })->as_list;
421
my @additional_fields = Koha::AdditionalFields->search({ tablename => 'aqorders' })->as_list;
422
my %additional_field_values;
422
my $additional_field_values;
423
my $items;
423
my $items;
424
if ($ordernumber) {
424
if ($ordernumber) {
425
    my $order = Koha::Acquisition::Orders->find($ordernumber);
425
    my $order = Koha::Acquisition::Orders->find($ordernumber);
426
    foreach my $value ($order->additional_field_values->as_list) {
426
    $additional_field_values = $order->get_additional_field_values_for_template;
427
        $additional_field_values{$value->field_id} = $value->value;
428
    }
429
    $items = $order->items;
427
    $items = $order->items;
430
} elsif ( $biblionumber ) {
428
} elsif ( $biblionumber ) {
429
    my %additional_field_values;
431
    foreach my $af (@additional_fields) {
430
    foreach my $af (@additional_fields) {
431
        my @marc_field_values;
432
        if ($af->marcfield) {
432
        if ($af->marcfield) {
433
            $record //= Koha::Biblios->find($biblionumber)->metadata->record;
433
            $record //= Koha::Biblios->find($biblionumber)->metadata->record;
434
            my ($field, $subfield) = split /\$/, $af->marcfield;
434
            my ($field, $subfield) = split /\$/, $af->marcfield;
435
            $additional_field_values{$af->id} = $record->subfield($field, $subfield);
435
            push @marc_field_values, $record->subfield( $field, $subfield ) if $record->subfield( $field, $subfield );
436
            $additional_field_values{ $af->id } = \@marc_field_values;
436
        }
437
        }
437
    }
438
    }
439
    $additional_field_values = \%additional_field_values
438
}
440
}
441
439
$template->param(
442
$template->param(
440
    additional_fields => \@additional_fields,
443
    additional_fields => \@additional_fields,
441
    additional_field_values => \%additional_field_values,
444
    additional_field_values => $additional_field_values,
442
    items => $items,
445
    items => $items,
443
);
446
);
444
447
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt (-1 / +1 lines)
Lines 50-55 Link Here
50
    [% Asset.js("js/acq.js") | $raw %]
50
    [% Asset.js("js/acq.js") | $raw %]
51
    [% Asset.js("js/additem.js") | $raw %]
51
    [% Asset.js("js/additem.js") | $raw %]
52
    [% Asset.js("js/cataloging.js") | $raw %]
52
    [% Asset.js("js/cataloging.js") | $raw %]
53
    [% Asset.js("js/additional-fields-entry.js") | $raw %]
53
    [% INCLUDE 'calendar.inc' %]
54
    [% INCLUDE 'calendar.inc' %]
54
    [% INCLUDE 'select2.inc' %]
55
    [% INCLUDE 'select2.inc' %]
55
    <script>
56
    <script>
56
- 

Return to bug 35044