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

(-)a/acqui/neworderempty.pl (-2 / +13 lines)
Lines 354-361 my @itemtypes; Link Here
354
@itemtypes = Koha::ItemTypes->search unless C4::Context->preference('item-level_itypes');
354
@itemtypes = Koha::ItemTypes->search unless C4::Context->preference('item-level_itypes');
355
355
356
if ( defined $from_subscriptionid ) {
356
if ( defined $from_subscriptionid ) {
357
    my $lastOrderReceived = GetLastOrderReceivedFromSubscriptionid $from_subscriptionid;
357
    # Get the last received order for this subscription
358
    if ( defined $lastOrderReceived ) {
358
    my $lastOrderReceived = Koha::Acquisition::Orders->search(
359
        {
360
            subscriptionid => $from_subscriptionid,
361
            datereceived   => { '!=' => undef }
362
        },
363
        {
364
            order_by =>
365
              [ { -desc => 'datereceived' }, { -desc => 'ordernumber' } ]
366
        }
367
    );
368
    if ( $lastOrderReceived->count ) {
369
        $lastOrderReceived = $lastOrderReceived->next->unblessed; # FIXME We should send the object to the template
359
        $budget_id              = $lastOrderReceived->{budgetid};
370
        $budget_id              = $lastOrderReceived->{budgetid};
360
        $data->{listprice}      = $lastOrderReceived->{listprice};
371
        $data->{listprice}      = $lastOrderReceived->{listprice};
361
        $data->{uncertainprice} = $lastOrderReceived->{uncertainprice};
372
        $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