Bug 14092 - Add ability to search on 'all statuses' to orders search
Summary: Add ability to search on 'all statuses' to orders search
Status: RESOLVED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Acquisitions (show other bugs)
Version: Main
Hardware: All All
: P5 - low enhancement (vote)
Assignee: Katrin Fischer
QA Contact: Marcel de Rooy
URL:
Keywords:
: 23014 30919 (view as bug list)
Depends on:
Blocks:
 
Reported: 2015-04-29 21:47 UTC by Nicole C. Engard
Modified: 2024-01-11 21:14 UTC (History)
10 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Small patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
This enhancement adds an 'all statuses' option to the status select option in the orders search panel. **Sponsored by** *Bibliotheksservice-Zentrum Baden-Württemberg (BSZ)*
Version(s) released in:
23.11.00


Attachments
status pull down (62.58 KB, image/png)
2015-04-29 21:47 UTC, Nicole C. Engard
Details
Bug 14092: Add 'any status' option to acq order search form (4.80 KB, patch)
2023-09-18 16:28 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug 14092: Add 'any status' option to acq order search form (4.33 KB, patch)
2023-09-18 16:45 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug 14092: Add 'any status' option to acq order search form (4.39 KB, patch)
2023-09-22 13:28 UTC, PTFS Europe Sandboxes
Details | Diff | Splinter Review
Bug 14092: Add 'any status' option to acq order search form (4.33 KB, patch)
2023-09-22 14:15 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug 14092: (QA follow-up) Avoid fiddling with he hash in the template (2.39 KB, patch)
2023-09-22 14:15 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug 14092: Add 'any status' option to acq order search form (4.33 KB, patch)
2023-09-22 14:34 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug 14092: (QA follow-up) Avoid fiddling with he hash in the template (4.92 KB, patch)
2023-09-22 14:34 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug 14092: Add 'any status' option to acq order search form (4.33 KB, patch)
2023-10-04 12:21 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug 14092: (QA follow-up) Avoid fiddling with the hash in the template (4.88 KB, patch)
2023-10-04 12:21 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug 14092: Add 'any status' option to acq order search form (4.43 KB, patch)
2023-10-06 07:10 UTC, Marcel de Rooy
Details | Diff | Splinter Review
Bug 14092: (QA follow-up) Avoid fiddling with the hash in the template (4.97 KB, patch)
2023-10-06 07:10 UTC, Marcel de Rooy
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Nicole C. Engard 2015-04-29 21:47:09 UTC
Created attachment 38702 [details]
status pull down

You can do all statuses except cancelled or individual statuses but not all statuses.
Comment 1 Katrin Fischer 2022-06-07 13:44:50 UTC
*** Bug 30919 has been marked as a duplicate of this bug. ***
Comment 2 Katrin Fischer 2023-09-18 16:28:40 UTC
Created attachment 155851 [details] [review]
Bug 14092: Add 'any status' option to acq order search form

Sometimes it's really helpful to see all orders for a basket, a
vendor or a standing order, including the cancelled ones.
Currently this is not possible, as we have search options for
every single status and one for "any except cancelled",
but no "Any status" option.

This patch adds the "Any status" option. The sometimes
appearing empty entry is updated to "Any status except cancelled"
as this is what it does.

Testing data:
* Requires multiple order lines with different order status
* Must include at least one order line with status 'cancelled'

To test:
* Go to acquisitions
* Open the advanced search page from the top search options:
  Order search > config icon > Advanced search link
* Verify the status pull down looks as described above
* Apply patch
* Verify there is now an "Any status" option in the pull down
* Try searches for different status, including "Any status"
* Verify the results are as expected
* Create a new basket
* Create an order line by 'From an existing order (copy)'
* Verify the search form there also works as expected
Comment 3 Katrin Fischer 2023-09-18 16:45:29 UTC
Created attachment 155853 [details] [review]
Bug 14092: Add 'any status' option to acq order search form

Sometimes it's really helpful to see all orders for a basket, a
vendor or a standing order, including the cancelled ones.
Currently this is not possible, as we have search options for
every single status and one for "any except cancelled",
but no "Any status" option.

This patch adds the "Any status" option. The sometimes
appearing empty entry is updated to "Any status except cancelled"
as this is what it does.

Testing data:
* Requires multiple order lines with different order status
* Must include at least one order line with status 'cancelled'

To test:
* Go to acquisitions
* Open the advanced search page from the top search options:
  Order search > config icon > Advanced search link
* Verify the status pull down looks as described above
* Apply patch
* Verify there is now an "Any status" option in the pull down
* Try searches for different status, including "Any status"
* Verify the results are as expected
* Create a new basket
* Create an order line by 'From an existing order (copy)'
* Verify the search form there also works as expected
Comment 4 Katrin Fischer 2023-09-18 16:50:30 UTC
I tried to find a good way of making this change, while meeting some requirements:

* I wanted "Any status" to be an additional entry in the status pull down, not a checkbox or similar on the form 
* We need to make sure that the right status is always selected, especially after completing the search, so it shows correctly in the filters on the right
Comment 5 PTFS Europe Sandboxes 2023-09-22 13:28:42 UTC
Created attachment 156093 [details] [review]
Bug 14092: Add 'any status' option to acq order search form

Sometimes it's really helpful to see all orders for a basket, a
vendor or a standing order, including the cancelled ones.
Currently this is not possible, as we have search options for
every single status and one for "any except cancelled",
but no "Any status" option.

This patch adds the "Any status" option. The sometimes
appearing empty entry is updated to "Any status except cancelled"
as this is what it does.

Testing data:
* Requires multiple order lines with different order status
* Must include at least one order line with status 'cancelled'

To test:
* Go to acquisitions
* Open the advanced search page from the top search options:
  Order search > config icon > Advanced search link
* Verify the status pull down looks as described above
* Apply patch
* Verify there is now an "Any status" option in the pull down
* Try searches for different status, including "Any status"
* Verify the results are as expected
* Create a new basket
* Create an order line by 'From an existing order (copy)'
* Verify the search form there also works as expected

Signed-off-by: Michaela Sieber <michaela.sieber@kit.edu>
Comment 6 Katrin Fischer 2023-09-22 14:15:31 UTC
Created attachment 156097 [details] [review]
Bug 14092: Add 'any status' option to acq order search form

Sometimes it's really helpful to see all orders for a basket, a
vendor or a standing order, including the cancelled ones.
Currently this is not possible, as we have search options for
every single status and one for "any except cancelled",
but no "Any status" option.

This patch adds the "Any status" option. The sometimes
appearing empty entry is updated to "Any status except cancelled"
as this is what it does.

Testing data:
* Requires multiple order lines with different order status
* Must include at least one order line with status 'cancelled'

To test:
* Go to acquisitions
* Open the advanced search page from the top search options:
  Order search > config icon > Advanced search link
* Verify the status pull down looks as described above
* Apply patch
* Verify there is now an "Any status" option in the pull down
* Try searches for different status, including "Any status"
* Verify the results are as expected
* Create a new basket
* Create an order line by 'From an existing order (copy)'
* Verify the search form there also works as expected
Comment 7 Katrin Fischer 2023-09-22 14:15:34 UTC
Created attachment 156098 [details] [review]
Bug 14092: (QA follow-up) Avoid fiddling with he hash in the template
Comment 8 Katrin Fischer 2023-09-22 14:34:45 UTC
Created attachment 156100 [details] [review]
Bug 14092: Add 'any status' option to acq order search form

Sometimes it's really helpful to see all orders for a basket, a
vendor or a standing order, including the cancelled ones.
Currently this is not possible, as we have search options for
every single status and one for "any except cancelled",
but no "Any status" option.

This patch adds the "Any status" option. The sometimes
appearing empty entry is updated to "Any status except cancelled"
as this is what it does.

Testing data:
* Requires multiple order lines with different order status
* Must include at least one order line with status 'cancelled'

To test:
* Go to acquisitions
* Open the advanced search page from the top search options:
  Order search > config icon > Advanced search link
* Verify the status pull down looks as described above
* Apply patch
* Verify there is now an "Any status" option in the pull down
* Try searches for different status, including "Any status"
* Verify the results are as expected
* Create a new basket
* Create an order line by 'From an existing order (copy)'
* Verify the search form there also works as expected
Comment 9 Katrin Fischer 2023-09-22 14:34:48 UTC
Created attachment 156101 [details] [review]
Bug 14092: (QA follow-up) Avoid fiddling with he hash in the template

prove t/db_dependent/Acquisition.t
Comment 10 Marcel de Rooy 2023-10-03 11:59:13 UTC
This is much better!
One final thing:

+    $orders = GetHistory( order_status => "new", vendornote => 'status search' );
+    is( scalar(@$orders), 1, 'GetHistory with order status "new" returns 1 order' );
+
+    my $orders = GetHistory( get_canceled_order => 1, order_status => "any", vendornote => 'status search' );
+    is( scalar(@$orders), 2, 'GetHistory with order status "any" returns all orders' );
+
+    $orders = GetHistory( order_status => "", vendornote => 'status search' );
+    is( scalar(@$orders), 1, 'GetHistory with order status "all except cancelled" returns zero orders' );

The last test does not read very well. If orders == 1 then it returns 0 orders?? Please adjust.

No big blocker but you assume that there are no orders in the system when you get a count. So your test may very well fail with some orders being there.
Since you created a new basket, you could also pass the param basket to GetHistory [my $basket = $params{basket} ]. Which would resolve the issue with other orders.

GetHistory( basket => $order_basket->{basketno}, etc.
Comment 11 Marcel de Rooy 2023-10-03 11:59:21 UTC
diff --git a/t/db_dependent/Acquisition.t b/t/db_dependent/Acquisition.t
index d102a343a0..a5a165d777 100755
--- a/t/db_dependent/Acquisition.t
+++ b/t/db_dependent/Acquisition.t
@@ -995,13 +995,13 @@ subtest 'GetHistory status search' => sub {
     };
     $order = $builder->build( { source => 'Aqorder', value => $orderinfo2 } );

-    $orders = GetHistory( order_status => "new", vendornote => 'status search' );
+    $orders = GetHistory( basket => $order_basket->{basketno}, order_status => "new", vendornote => 'status search' );
     is( scalar(@$orders), 1, 'GetHistory with order status "new" returns 1 order' );

-    my $orders = GetHistory( get_canceled_order => 1, order_status => "any", vendornote => 'status search' );
+    my $orders = GetHistory( basket => $order_basket->{basketno}, get_canceled_order => 1, order_status => "any", vendornote => 'status search' );
     is( scalar(@$orders), 2, 'GetHistory with order status "any" returns all orders' );

-    $orders = GetHistory( order_status => "", vendornote => 'status search' );
+    $orders = GetHistory( basket => $order_basket->{basketno}, order_status => "", vendornote => 'status search' );
     is( scalar(@$orders), 1, 'GetHistory with order status "all except cancelled" returns zero orders' );
 };
Comment 12 Marcel de Rooy 2023-10-03 11:59:57 UTC
Patches may be squashed.
Comment 13 Katrin Fischer 2023-10-03 12:14:21 UTC
Note to myself: instead of note we could use the basketno.
Comment 14 Katrin Fischer 2023-10-04 12:21:56 UTC
Created attachment 156526 [details] [review]
Bug 14092: Add 'any status' option to acq order search form

Sometimes it's really helpful to see all orders for a basket, a
vendor or a standing order, including the cancelled ones.
Currently this is not possible, as we have search options for
every single status and one for "any except cancelled",
but no "Any status" option.

This patch adds the "Any status" option. The sometimes
appearing empty entry is updated to "Any status except cancelled"
as this is what it does.

Testing data:
* Requires multiple order lines with different order status
* Must include at least one order line with status 'cancelled'

To test:
* Go to acquisitions
* Open the advanced search page from the top search options:
  Order search > config icon > Advanced search link
* Verify the status pull down looks as described above
* Apply patch
* Verify there is now an "Any status" option in the pull down
* Try searches for different status, including "Any status"
* Verify the results are as expected
* Create a new basket
* Create an order line by 'From an existing order (copy)'
* Verify the search form there also works as expected
Comment 15 Katrin Fischer 2023-10-04 12:21:59 UTC
Created attachment 156527 [details] [review]
Bug 14092: (QA follow-up) Avoid fiddling with the hash in the template

prove t/db_dependent/Acquisition.t
Comment 16 Katrin Fischer 2023-10-04 12:24:19 UTC
Hi Marcel,

ready for another go. As you suggested a squash I added my follow-up into the last patch:

* Corrected the unit test result message
* Removed the vendor_note as 'identifier' for the order lines in favor of the basketno
Comment 17 Marcel de Rooy 2023-10-06 07:10:22 UTC
Created attachment 156590 [details] [review]
Bug 14092: Add 'any status' option to acq order search form

Sometimes it's really helpful to see all orders for a basket, a
vendor or a standing order, including the cancelled ones.
Currently this is not possible, as we have search options for
every single status and one for "any except cancelled",
but no "Any status" option.

This patch adds the "Any status" option. The sometimes
appearing empty entry is updated to "Any status except cancelled"
as this is what it does.

Testing data:
* Requires multiple order lines with different order status
* Must include at least one order line with status 'cancelled'

To test:
* Go to acquisitions
* Open the advanced search page from the top search options:
  Order search > config icon > Advanced search link
* Verify the status pull down looks as described above
* Apply patch
* Verify there is now an "Any status" option in the pull down
* Try searches for different status, including "Any status"
* Verify the results are as expected
* Create a new basket
* Create an order line by 'From an existing order (copy)'
* Verify the search form there also works as expected

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Comment 18 Marcel de Rooy 2023-10-06 07:10:25 UTC
Created attachment 156591 [details] [review]
Bug 14092: (QA follow-up) Avoid fiddling with the hash in the template

prove t/db_dependent/Acquisition.t

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Comment 19 Katrin Fischer 2023-10-08 01:19:15 UTC
*** Bug 23014 has been marked as a duplicate of this bug. ***
Comment 20 Tomás Cohen Arazi 2023-10-20 19:31:49 UTC
Pushed to master for 23.11.

Nice work everyone, thanks!
Comment 21 Fridolin Somers 2023-10-26 06:16:23 UTC
Enhancement not pushed to 23.05.x
Comment 22 Caroline Cyr La Rose 2024-01-11 21:14:42 UTC
The orders advanced search is already documented in the manual, without specifying details and options of each field. I will close this.