Bugzilla – Attachment 162321 Details for
Bug 36018
Improve consistency in Acquisition/Order(s) regarding active/current orders
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 36018: $orders->filter_by_active should check quantityreceived
Bug-36018-orders-filterbyactive-should-check-quant.patch (text/plain), 4.11 KB, created by
Marcel de Rooy
on 2024-02-21 15:48:34 UTC
(
hide
)
Description:
Bug 36018: $orders->filter_by_active should check quantityreceived
Filename:
MIME Type:
Creator:
Marcel de Rooy
Created:
2024-02-21 15:48:34 UTC
Size:
4.11 KB
patch
obsolete
>From ef59cedee9e041ae5f9bbe03a50f797e1b8a77e5 Mon Sep 17 00:00:00 2001 >From: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Date: Wed, 21 Feb 2024 15:20:23 +0000 >Subject: [PATCH] Bug 36018: $orders->filter_by_active should check > quantityreceived >Content-Type: text/plain; charset=utf-8 > >An active order that has no items to receive any more is actually >not very active anymore :) > >Test plan: >Run t/db_dependent/Koha/Acquisition/Orders.t >Enable OPACAcquisitionDetails. >Add order on basket for new biblio. Check that opac-detail does not >yet count the item as on order (since status is still new). >Close basket. Check opac-detail again. Should count it now. >Reopen basket. Cancel line. Check opac-detail again. > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >--- > Koha/Acquisition/Orders.pm | 6 ++++-- > t/db_dependent/Koha/Acquisition/Orders.t | 22 +++++++++++++++------- > 2 files changed, 19 insertions(+), 9 deletions(-) > >diff --git a/Koha/Acquisition/Orders.pm b/Koha/Acquisition/Orders.pm >index 8672de10c9..43e0832277 100644 >--- a/Koha/Acquisition/Orders.pm >+++ b/Koha/Acquisition/Orders.pm >@@ -152,7 +152,8 @@ sub filter_by_lates { > Returns a new resultset containing active orders only. > > Note: An active order (line) has status ordered or partial, or it has status new >-and the basket is marked as standing order. >+and the basket is marked as standing order. Additionally, we still expect items >+on this order (checking quantity and quantityreceived). > > =cut > >@@ -164,7 +165,8 @@ sub filter_by_active { > { 'basket.is_standing' => 1, > 'orderstatus' => [ 'new', 'ordered', 'partial' ] }, > { 'orderstatus' => [ 'ordered', 'partial' ] } >- ] >+ ], >+ quantityreceived => { '<', \['COALESCE(quantity,0)'] }, > }, > { join => 'basket' } > ); >diff --git a/t/db_dependent/Koha/Acquisition/Orders.t b/t/db_dependent/Koha/Acquisition/Orders.t >index cf28bd07b7..f34dc7c2d9 100755 >--- a/t/db_dependent/Koha/Acquisition/Orders.t >+++ b/t/db_dependent/Koha/Acquisition/Orders.t >@@ -32,7 +32,7 @@ my $builder = t::lib::TestBuilder->new; > > subtest 'filter_by_active() tests' => sub { > >- plan tests => 4; >+ plan tests => 5; > > $schema->storage->txn_begin; > >@@ -66,29 +66,33 @@ subtest 'filter_by_active() tests' => sub { > { > class => 'Koha::Acquisition::Orders', > value => { >- basketno => $basket_1->basketno, >- orderstatus => 'new' >+ basketno => $basket_1->basketno, >+ orderstatus => 'new', >+ quantity => 1, >+ quantityreceived => 0, > } > } > ); > my $order_4 = $builder->build_object( > { > class => 'Koha::Acquisition::Orders', >- value => { orderstatus => 'ordered' } >+ value => { orderstatus => 'ordered', quantity => 1, quantityreceived => 0 } > } > ); > my $order_5 = $builder->build_object( > { > class => 'Koha::Acquisition::Orders', >- value => { orderstatus => 'partial' } >+ value => { orderstatus => 'partial', quantity => 2, quantityreceived => 1 } > } > ); > my $order_6 = $builder->build_object( > { > class => 'Koha::Acquisition::Orders', > value => { >- basketno => $basket_2->basketno, >- orderstatus => 'new' >+ basketno => $basket_2->basketno, >+ orderstatus => 'new', >+ quantity => 1, >+ quantityreceived => 0, > } > } > ); >@@ -116,6 +120,10 @@ subtest 'filter_by_active() tests' => sub { > is( $rs->next->ordernumber, $order_4->ordernumber , 'Expected order in resultset' ); > is( $rs->next->ordernumber, $order_5->ordernumber , 'Expected order in resultset' ); > >+ # If we change quantities on order_5 (partial), we should no longer see it >+ $order_5->quantityreceived(2)->store; >+ is( $this_orders_rs->filter_by_active->count, 2, 'Dropped one order as expected' ); >+ > $schema->storage->txn_rollback; > }; > >-- >2.30.2
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 36018
:
162318
|
162320
|
162321
|
163769
|
163770
|
163771
|
163772
|
164953
|
164954
|
164955
|
164956
|
165153
|
166503
|
166504
|
166505
|
166506
|
166507
|
166677