Bug 20728: Replace the calls by their Koha::Acq::Orders->search equivalent
There are 2 subroutines from C4::Acquisition that could be removed: - GetLastOrderReceivedFromSubscriptionid - GetLastOrderNotReceivedFromSubscriptionid After bug 20726 only GetLastOrderReceivedFromSubscriptionid will be used (from acqui/neworderempty.pl) and this call could be replaced easily with Koha::Acquisition::Orders The code (+ tests) related to these 2 subroutines could then be removed. The parameters for the search is basic and does no really deserve its own subroutine. Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
This commit is contained in:
parent
220c4906bf
commit
91f9f8cdfd
|
|
@ -355,8 +355,19 @@ my @itemtypes;
|
|||
@itemtypes = Koha::ItemTypes->search unless C4::Context->preference('item-level_itypes');
|
||||
|
||||
if ( defined $from_subscriptionid ) {
|
||||
my $lastOrderReceived = GetLastOrderReceivedFromSubscriptionid $from_subscriptionid;
|
||||
if ( defined $lastOrderReceived ) {
|
||||
# Get the last received order for this subscription
|
||||
my $lastOrderReceived = Koha::Acquisition::Orders->search(
|
||||
{
|
||||
subscriptionid => $from_subscriptionid,
|
||||
datereceived => { '!=' => undef }
|
||||
},
|
||||
{
|
||||
order_by =>
|
||||
[ { -desc => 'datereceived' }, { -desc => 'ordernumber' } ]
|
||||
}
|
||||
);
|
||||
if ( $lastOrderReceived->count ) {
|
||||
$lastOrderReceived = $lastOrderReceived->next->unblessed; # FIXME We should send the object to the template
|
||||
$budget_id = $lastOrderReceived->{budgetid};
|
||||
$data->{listprice} = $lastOrderReceived->{listprice};
|
||||
$data->{uncertainprice} = $lastOrderReceived->{uncertainprice};
|
||||
|
|
|
|||
|
|
@ -79,7 +79,7 @@ my $ordernumber = $order->ordernumber;
|
|||
my $is_currently_on_order = subscriptionCurrentlyOnOrder( $subscription->{subscriptionid} );
|
||||
is ( $is_currently_on_order, 1, "The subscription is currently on order");
|
||||
|
||||
$order = GetLastOrderNotReceivedFromSubscriptionid( $subscription->{subscriptionid} );
|
||||
$order = Koha::Acquisition::Orders->search({ subscriptionid => $subscription->{subscriptionid}, datereceived => undef })->next->unblessed;
|
||||
is ( $order->{subscriptionid}, $subscription->{subscriptionid}, "test subscriptionid for the last order not received");
|
||||
ok( $order->{ecost} == $cost, "test cost for the last order not received");
|
||||
|
||||
|
|
@ -99,12 +99,21 @@ my ( $datereceived, $new_ordernumber ) = ModReceiveOrder(
|
|||
}
|
||||
);
|
||||
|
||||
$order = GetLastOrderReceivedFromSubscriptionid( $subscription->{subscriptionid} );
|
||||
$order = Koha::Acquisition::Orders->search(
|
||||
{
|
||||
subscriptionid => $subscriptionid,
|
||||
datereceived => { '!=' => undef }
|
||||
},
|
||||
{
|
||||
order_by => [ { -desc => 'datereceived' }, { -desc => 'ordernumber' } ]
|
||||
}
|
||||
)->next->unblessed;
|
||||
|
||||
is ( $order->{subscriptionid}, $subscription->{subscriptionid}, "test subscriptionid for the last order received");
|
||||
ok( $order->{ecost} == $cost, "test cost for the last order received");
|
||||
|
||||
$order = GetLastOrderNotReceivedFromSubscriptionid( $subscription->{subscriptionid} );
|
||||
is ( $order, undef, "test no not received order for a received order");
|
||||
$order = Koha::Acquisition::Orders->search({ subscriptionid => $subscription->{subscriptionid}, datereceived => undef });
|
||||
is ( $order->count, 0, "test no not received order for a received order");
|
||||
|
||||
my @invoices = GetInvoices();
|
||||
my @invoices_linked_to_subscriptions = grep { $_->{is_linked_to_subscriptions} } @invoices;
|
||||
|
|
|
|||
Loading…
Reference in New Issue