Bugzilla – Attachment 99656 Details for
Bug 20728
Remove subroutines GetLastOrder*
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 20728: Replace the calls by their Koha::Acq::Orders->search equivalent
Bug-20728-Replace-the-calls-by-their-KohaAcqOrders.patch (text/plain), 3.69 KB, created by
Martin Renvoize (ashimema)
on 2020-02-26 15:54:07 UTC
(
hide
)
Description:
Bug 20728: Replace the calls by their Koha::Acq::Orders->search equivalent
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2020-02-26 15:54:07 UTC
Size:
3.69 KB
patch
obsolete
>From 97aa5e25e82c06029ec585d7a863d63b4091eb99 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Fri, 15 Mar 2019 19:37:52 -0300 >Subject: [PATCH] Bug 20728: Replace the calls by their > Koha::Acq::Orders->search equivalent > >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > acqui/neworderempty.pl | 15 +++++++++++++-- > .../Acquisition/OrderFromSubscription.t | 17 +++++++++++++---- > 2 files changed, 26 insertions(+), 6 deletions(-) > >diff --git a/acqui/neworderempty.pl b/acqui/neworderempty.pl >index f41e598861..34746fdc89 100755 >--- a/acqui/neworderempty.pl >+++ b/acqui/neworderempty.pl >@@ -354,8 +354,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}; >diff --git a/t/db_dependent/Acquisition/OrderFromSubscription.t b/t/db_dependent/Acquisition/OrderFromSubscription.t >index cc691d0585..6d2e6d09e4 100644 >--- a/t/db_dependent/Acquisition/OrderFromSubscription.t >+++ b/t/db_dependent/Acquisition/OrderFromSubscription.t >@@ -80,7 +80,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"); > >@@ -100,12 +100,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; >-- >2.20.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 20728
:
86693
|
86694
|
86695
|
99655
|
99656
|
99657
|
99877
|
99878
|
99879
|
102873
|
102874
|
102875