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

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

Return to bug 20728