Bugzilla – Attachment 156527 Details for
Bug 14092
Add ability to search on 'all statuses' to orders search
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 14092: (QA follow-up) Avoid fiddling with the hash in the template
Bug-14092-QA-follow-up-Avoid-fiddling-with-the-has.patch (text/plain), 4.88 KB, created by
Katrin Fischer
on 2023-10-04 12:21:59 UTC
(
hide
)
Description:
Bug 14092: (QA follow-up) Avoid fiddling with the hash in the template
Filename:
MIME Type:
Creator:
Katrin Fischer
Created:
2023-10-04 12:21:59 UTC
Size:
4.88 KB
patch
obsolete
>From c6bb0a11a943717cb03163b6ff5584ea560cefc2 Mon Sep 17 00:00:00 2001 >From: Katrin Fischer <katrin.fischer@bsz-bw.de> >Date: Fri, 22 Sep 2023 14:11:23 +0000 >Subject: [PATCH] Bug 14092: (QA follow-up) Avoid fiddling with the hash in the > template > >prove t/db_dependent/Acquisition.t >--- > C4/Acquisition.pm | 2 +- > acqui/duplicate_orders.pl | 6 ----- > acqui/histsearch.pl | 6 ----- > t/db_dependent/Acquisition.t | 43 +++++++++++++++++++++++++++++++++++- > 4 files changed, 43 insertions(+), 14 deletions(-) > >diff --git a/C4/Acquisition.pm b/C4/Acquisition.pm >index da62c17afe..370030895e 100644 >--- a/C4/Acquisition.pm >+++ b/C4/Acquisition.pm >@@ -2277,7 +2277,7 @@ sub GetHistory { > push @query_params, $to_placed_on; > } > >- if ( defined $orderstatus and $orderstatus ne '') { >+ if ( defined $orderstatus and $orderstatus ne '' and $orderstatus ne 'any') { > $query .= " AND aqorders.orderstatus = ? "; > push @query_params, "$orderstatus"; > } >diff --git a/acqui/duplicate_orders.pl b/acqui/duplicate_orders.pl >index d8f38993be..d37b3f3240 100755 >--- a/acqui/duplicate_orders.pl >+++ b/acqui/duplicate_orders.pl >@@ -85,7 +85,6 @@ if ( $op eq 'select' ) { > > # Set filter for 'all status' > if ( $filters->{orderstatus} eq "any" ) { >- delete( $filters->{orderstatus} ); > $filters->{get_canceled_order} = 1; > } > >@@ -94,11 +93,6 @@ if ( $op eq 'select' ) { > ( grep {$_ eq $order->{ordernumber}} @ordernumbers ) ? () : $order > } @{ C4::Acquisition::GetHistory(%$filters) }; > >- # Reset order status for 'all status' >- if ( $filters->{get_canceled_order} ) { >- $filters->{orderstatus} = "any"; >- } >- > @selected_order_loop = > scalar @ordernumbers > ? @{ C4::Acquisition::GetHistory( ordernumbers => \@ordernumbers ) } >diff --git a/acqui/histsearch.pl b/acqui/histsearch.pl >index 289c1c1e59..571cbeb132 100755 >--- a/acqui/histsearch.pl >+++ b/acqui/histsearch.pl >@@ -116,7 +116,6 @@ $filters->{additional_fields} = \@additional_field_filters; > > # Set filter for 'all status' > if ( $filters->{orderstatus} eq "any" ) { >- delete( $filters->{orderstatus} ); > $filters->{get_canceled_order} = 1; > } > >@@ -126,11 +125,6 @@ if ($do_search) { > $order_loop = GetHistory(%$filters); > } > >-# Reset order status for 'all status' >-if ( $filters->{get_canceled_order} ) { >- $filters->{orderstatus} = "any"; >-} >- > my $budgetperiods = C4::Budgets::GetBudgetPeriods; > my $bp_loop = $budgetperiods; > for my $bp ( @{$budgetperiods} ) { >diff --git a/t/db_dependent/Acquisition.t b/t/db_dependent/Acquisition.t >index 67e405d07d..fabe7cfff5 100755 >--- a/t/db_dependent/Acquisition.t >+++ b/t/db_dependent/Acquisition.t >@@ -19,7 +19,7 @@ use Modern::Perl; > > use POSIX qw(strftime); > >-use Test::More tests => 72; >+use Test::More tests => 73; > use t::lib::Mocks; > use Koha::Database; > use Koha::DateUtils qw(dt_from_string output_pref); >@@ -965,6 +965,47 @@ subtest 'ModReceiveOrder invoice_unitprice and invoice_currency' => sub { > > }; > >+subtest 'GetHistory status search' => sub { >+ plan tests => 3; >+ >+ my $builder = t::lib::TestBuilder->new; >+ my $order_basket = $builder->build( { source => 'Aqbasket', value => { is_standing => 0 } } ); >+ my $orderinfo = { >+ basketno => $order_basket->{basketno}, >+ rrp => 19.99, >+ replacementprice => undef, >+ quantity => 1, >+ quantityreceived => 0, >+ datereceived => undef, >+ orderstatus => 'cancelled', >+ datecancellationprinted => '1990-01-01', >+ }; >+ my $order = $builder->build( { source => 'Aqorder', value => $orderinfo } ); >+ my $orderinfo2 = { >+ basketno => $order_basket->{basketno}, >+ rrp => 19.99, >+ replacementprice => undef, >+ quantity => 1, >+ quantityreceived => 0, >+ datereceived => undef, >+ orderstatus => 'new', >+ datecancellationprinted => undef, >+ }; >+ $order = $builder->build( { source => 'Aqorder', value => $orderinfo2 } ); >+ >+ $orders = GetHistory( order_status => "new", basket => $order_basket->{basketno} ); >+ is( scalar(@$orders), 1, 'GetHistory with order status "new" returns 1 order' ); >+ >+ my $orders = GetHistory( get_canceled_order => 1, order_status => "any", basket => $order_basket->{basketno} ); >+ is( scalar(@$orders), 2, 'GetHistory with order status "any" returns all (2) orders' ); >+ >+ $orders = GetHistory( order_status => "", basket => $order_basket->{basketno} ); >+ is( >+ scalar(@$orders), 1, >+ 'GetHistory with order status "all except cancelled" returns only order with status new (1)' >+ ); >+}; >+ > subtest 'GetHistory with additional fields' => sub { > plan tests => 3; > my $builder = t::lib::TestBuilder->new; >-- >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 14092
:
38702
|
155851
|
155853
|
156093
|
156097
|
156098
|
156100
|
156101
|
156526
|
156527
|
156590
|
156591