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

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

Return to bug 35044