From 04fe8d99e24285e9a294bd1e12502f54a2cbe7df Mon Sep 17 00:00:00 2001 From: Thibaud Guillot Date: Thu, 9 Feb 2023 16:25:46 +0100 Subject: [PATCH] Bug 32928: Add filters on Orders::filter_by_active To have the same behavior than before 21.xx.xx filters must be added to the filter_by_active function. If not you can have on your list, some orders that can be cancelled, or orders with quantity totally received. Requirements: Have instances with different Koha version (20.11 VS Master for example) Test plan: 1) Apply this patch on Master Just have the same database with pending orders, and see differences between both instances on parcel.pl receptions. You will see that total of orders will be not the same --- Koha/Acquisition/Orders.pm | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/Koha/Acquisition/Orders.pm b/Koha/Acquisition/Orders.pm index e429475dc3..8c70b20ce0 100644 --- a/Koha/Acquisition/Orders.pm +++ b/Koha/Acquisition/Orders.pm @@ -160,10 +160,16 @@ sub filter_by_active { my ($self) = @_; return $self->search( { - '-or' => [ - { 'basket.is_standing' => 1, - 'orderstatus' => [ 'new', 'ordered', 'partial' ] }, - { 'orderstatus' => [ 'ordered', 'partial' ] } + 'datecancellationprinted' => undef, + '-or' => [ + { + 'basket.is_standing' => 1, + 'orderstatus' => [ 'new', 'ordered', 'partial' ] + }, + { + 'orderstatus' => [ 'ordered', 'partial' ], + 'quantityreceived' => { '<' => \'me.quantity' } + } ] }, { join => 'basket' } -- 2.25.1