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

(-)a/acqui/neworderempty.pl (-2 / +13 lines)
Lines 361-368 my @itemtypes; Link Here
361
@itemtypes = Koha::ItemTypes->search unless C4::Context->preference('item-level_itypes');
361
@itemtypes = Koha::ItemTypes->search unless C4::Context->preference('item-level_itypes');
362
362
363
if ( defined $from_subscriptionid ) {
363
if ( defined $from_subscriptionid ) {
364
    my $lastOrderReceived = GetLastOrderReceivedFromSubscriptionid $from_subscriptionid;
364
    # Get the last received order for this subscription
365
    if ( defined $lastOrderReceived ) {
365
    my $lastOrderReceived = Koha::Acquisition::Orders->search(
366
        {
367
            subscriptionid => $from_subscriptionid,
368
            datereceived   => { '!=' => undef }
369
        },
370
        {
371
            order_by =>
372
              [ { -desc => 'datereceived' }, { -desc => 'ordernumber' } ]
373
        }
374
    );
375
    if ( $lastOrderReceived->count ) {
376
        $lastOrderReceived = $lastOrderReceived->next->unblessed; # FIXME We should send the object to the template
366
        $budget_id              = $lastOrderReceived->{budgetid};
377
        $budget_id              = $lastOrderReceived->{budgetid};
367
        $data->{listprice}      = $lastOrderReceived->{listprice};
378
        $data->{listprice}      = $lastOrderReceived->{listprice};
368
        $data->{uncertainprice} = $lastOrderReceived->{uncertainprice};
379
        $data->{uncertainprice} = $lastOrderReceived->{uncertainprice};
(-)a/t/db_dependent/Acquisition/OrderFromSubscription.t (-5 / +13 lines)
Lines 80-86 my $ordernumber = $order->ordernumber; Link Here
80
my $is_currently_on_order = subscriptionCurrentlyOnOrder( $subscription->{subscriptionid} );
80
my $is_currently_on_order = subscriptionCurrentlyOnOrder( $subscription->{subscriptionid} );
81
is ( $is_currently_on_order, 1, "The subscription is currently on order");
81
is ( $is_currently_on_order, 1, "The subscription is currently on order");
82
82
83
$order = GetLastOrderNotReceivedFromSubscriptionid( $subscription->{subscriptionid} );
83
$order = Koha::Acquisition::Orders->search({ subscriptionid => $subscription->{subscriptionid}, datereceived => undef })->next->unblessed;
84
is ( $order->{subscriptionid}, $subscription->{subscriptionid}, "test subscriptionid for the last order not received");
84
is ( $order->{subscriptionid}, $subscription->{subscriptionid}, "test subscriptionid for the last order not received");
85
ok( $order->{ecost} == $cost, "test cost for the last order not received");
85
ok( $order->{ecost} == $cost, "test cost for the last order not received");
86
86
Lines 100-111 my ( $datereceived, $new_ordernumber ) = ModReceiveOrder( Link Here
100
    }
100
    }
101
);
101
);
102
102
103
$order = GetLastOrderReceivedFromSubscriptionid( $subscription->{subscriptionid} );
103
$order = Koha::Acquisition::Orders->search(
104
    {
105
        subscriptionid => $subscriptionid,
106
        datereceived   => { '!=' => undef }
107
    },
108
    {
109
        order_by => [ { -desc => 'datereceived' }, { -desc => 'ordernumber' } ]
110
    }
111
)->next->unblessed;
112
104
is ( $order->{subscriptionid}, $subscription->{subscriptionid}, "test subscriptionid for the last order received");
113
is ( $order->{subscriptionid}, $subscription->{subscriptionid}, "test subscriptionid for the last order received");
105
ok( $order->{ecost} == $cost, "test cost for the last order received");
114
ok( $order->{ecost} == $cost, "test cost for the last order received");
106
115
107
$order = GetLastOrderNotReceivedFromSubscriptionid( $subscription->{subscriptionid} );
116
$order = Koha::Acquisition::Orders->search({ subscriptionid => $subscription->{subscriptionid}, datereceived => undef });
108
is ( $order, undef, "test no not received order for a received order");
117
is ( $order->count, 0, "test no not received order for a received order");
109
118
110
my @invoices = GetInvoices();
119
my @invoices = GetInvoices();
111
my @invoices_linked_to_subscriptions = grep { $_->{is_linked_to_subscriptions} } @invoices;
120
my @invoices_linked_to_subscriptions = grep { $_->{is_linked_to_subscriptions} } @invoices;
112
- 

Return to bug 20728