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

(-)a/Koha/REST/V1/Acquisitions/Orders.pm (-4 / +4 lines)
Lines 129-141 sub add { Link Here
129
129
130
        my $bookseller = $basket->bookseller;
130
        my $bookseller = $basket->bookseller;
131
131
132
        unless (defined $order->tax_rate_on_ordering) {
132
        unless ( defined $order->tax_rate_on_ordering ) {
133
            $order->tax_rate_on_ordering($bookseller->tax_rate || 0);
133
            $order->tax_rate_on_ordering( $bookseller->tax_rate || 0 );
134
        }
134
        }
135
        $order->populate_with_prices_for_ordering();
135
        $order->populate_with_prices_for_ordering();
136
136
137
        unless (defined $order->tax_rate_on_receiving) {
137
        unless ( defined $order->tax_rate_on_receiving ) {
138
            $order->tax_rate_on_receiving($bookseller->tax_rate || 0);
138
            $order->tax_rate_on_receiving( $bookseller->tax_rate || 0 );
139
        }
139
        }
140
        $order->populate_with_prices_for_receiving();
140
        $order->populate_with_prices_for_receiving();
141
141
(-)a/t/db_dependent/api/v1/acquisitions_orders.t (-19 / +13 lines)
Lines 371-398 subtest 'add() tests' => sub { Link Here
371
371
372
    # Check that prices are correctly populated
372
    # Check that prices are correctly populated
373
    my $order_without_prices = {
373
    my $order_without_prices = {
374
        basket_id => $order->{basket_id},
374
        basket_id             => $order->{basket_id},
375
        biblio_id => $order->{biblio_id},
375
        biblio_id             => $order->{biblio_id},
376
        fund_id => $order->{fund_id},
376
        fund_id               => $order->{fund_id},
377
        quantity => 1,
377
        quantity              => 1,
378
        tax_rate_on_ordering => '0.5',
378
        tax_rate_on_ordering  => '0.5',
379
        tax_rate_on_receiving => '0.5',
379
        tax_rate_on_receiving => '0.5',
380
        unit_price => 4.20,
380
        unit_price            => 4.20,
381
        rrp => 4.20,
381
        rrp                   => 4.20,
382
        discount_rate => 0.10,
382
        discount_rate         => 0.10,
383
    };
383
    };
384
384
385
    $order_obj->basket->bookseller->listincgst(0)->invoiceincgst(0)->store();
385
    $order_obj->basket->bookseller->listincgst(0)->invoiceincgst(0)->store();
386
    $t->post_ok("//$auth_userid:$password@/api/v1/acquisitions/orders" => json => $order_without_prices)
386
    $t->post_ok( "//$auth_userid:$password@/api/v1/acquisitions/orders" => json => $order_without_prices )
387
        ->status_is(201)
387
        ->status_is(201)->json_is( '/tax_value_on_ordering', '2.1' )->json_is( '/tax_value_on_receiving', '2.1' )
388
        ->json_is('/tax_value_on_ordering', '2.1')
388
        ->json_is( '/rrp_tax_included',        '6.3' )->json_is( '/rrp_tax_excluded',        '4.2' )
389
        ->json_is('/tax_value_on_receiving', '2.1')
389
        ->json_is( '/unit_price_tax_included', '6.3' )->json_is( '/unit_price_tax_excluded', '4.2' )
390
        ->json_is('/rrp_tax_included', '6.3')
390
        ->json_is( '/ecost_tax_included',      '5.67' )->json_is( '/ecost_tax_excluded', '3.78' );
391
        ->json_is('/rrp_tax_excluded', '4.2')
392
        ->json_is('/unit_price_tax_included', '6.3')
393
        ->json_is('/unit_price_tax_excluded', '4.2')
394
        ->json_is('/ecost_tax_included', '5.67')
395
        ->json_is('/ecost_tax_excluded', '3.78');
396
391
397
    $schema->storage->txn_rollback;
392
    $schema->storage->txn_rollback;
398
};
393
};
399
- 

Return to bug 29959