Bug 34736 - Item checkboxes move to wrong order line in multi-receive, breaking partial receive
Summary: Item checkboxes move to wrong order line in multi-receive, breaking partial r...
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Acquisitions (show other bugs)
Version: Main
Hardware: All All
: P5 - low major
Assignee: Nick Clemens (kidclamp)
QA Contact: Testopia
URL:
Keywords:
Depends on: 8179
Blocks: 34880 35004
  Show dependency treegraph
 
Reported: 2023-09-07 10:07 UTC by Katrin Fischer
Modified: 2024-07-04 20:38 UTC (History)
7 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Trivial patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
23.11.00,23.05.04
Circulation function:


Attachments
Bug 34736: Don't trigger quantity change on loading order (3.07 KB, patch)
2023-09-07 19:08 UTC, Nick Clemens (kidclamp)
Details | Diff | Splinter Review
Bug 34736: Don't trigger quantity change on loading order (3.13 KB, patch)
2023-09-08 09:40 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug 34736: Don't trigger quantity change on loading order (3.18 KB, patch)
2023-09-12 22:19 UTC, Victor Grousset/tuxayo
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Katrin Fischer 2023-09-07 10:07:18 UTC
If multiple items were ordered and only a part of those are received, the order line is split into 2, received and pending. When you work with multi-receive and switch back and forth between entries, things get confused and you end up with a broken partial receive where the received items have not been re-linked to the new order line.

This might also have other bad side effects. Sorry for the somewhat complicated test plan:

To test:
* Create a new basket, create items on placing the order
* Create an order line with 4 items
* Create another order line with 2 items
* Close the basket
* Receive shipment and create an invoice
* Select both orders via the checkboxes got multi-receive
* Click "receive selected"
* Edit first order line, quantity received = 1 (1 out of 4)
* Verify that one item is also selected in the table
* Switch to "next order"
* Quantity received is 0, no items checked in the second order
* Switch to "Previous order"
* ERROR: Item checkbox was lost, quantity received still correct
* Switch to next order
* ERROR: item is now checked, quantity received 0
* Note: We see a mix up of the information entered, one has the checkbox now, the other the quantity.
* Save changes
* Click confirm
* Continue (complaint about the second order left unchanged)

You are back on the summary:
* pending order: quantity changed from 4 to 3 - correct
* received order: quantity shows 1 - correct

* Click on receive for your updated order line (with 3 items) 
* 4 items show to be received (should be 3)
Comment 1 Nick Clemens (kidclamp) 2023-09-07 19:08:24 UTC
Created attachment 155342 [details] [review]
Bug 34736: Don't trigger quantity change on loading order

We have a change event to automatically check or uncheck the first items on a list when
the value is changed directly.

The code is calling this when setting the quantity when loading an order, but this is causing a problem
in that we are setting the quantity to load.switch orders and triggering the checkboxes wrongly

To test:
 1 - Create a new basket, create items on placing the order
 2 - Create an order line with 4 items
 3 - Create another order line with 2 items
 4 - Close the basket
 5 - Receive shipment and create an invoice
 6 - Select both orders via the checkboxes got multi-receive
 7 - Click "receive selected"
 8 - Edit first order line, quantity received = 1 (1 out of 4)
 9 - Verify that one item is also selected in the table
10 - Switch to "next order"
11 - Quantity received is 0, no items checked in the second order
12 - Switch to "Previous order"
13 - ERROR: Item checkbox was lost, quantity received still correct
14 - Switch to next order
15 - ERROR: item is now checked, quantity received 0
16 - Note: We see a mix up of the information entered, one has the checkbox now, the other the quantity.
17 - Save changes
18 - Click confirm
19 - Continue (complaint about the second order left unchanged)
20 - You are back on the summary:
     * pending order: quantity changed from 4 to 3 - correct
     * received order: quantity shows 1 - correct
21 - Click on receive for your updated order line (with 3 items)
     * 4 items show to be received (should be 3)
22 - Apply patch
23 - Cancel receipt of items
24 - Repeat 1-12
25 - Items are loaded correctly
26 - Try with various checkboxes and switch back and forth
27 - Confirm that manually adjusting quantity received checks the first n boxes
28 - Confirm setting quantity to 0 unchecks the boxes
Comment 2 Katrin Fischer 2023-09-08 09:40:07 UTC
Created attachment 155384 [details] [review]
Bug 34736: Don't trigger quantity change on loading order

We have a change event to automatically check or uncheck the first items on a list when
the value is changed directly.

The code is calling this when setting the quantity when loading an order, but this is causing a problem
in that we are setting the quantity to load.switch orders and triggering the checkboxes wrongly

To test:
 1 - Create a new basket, create items on placing the order
 2 - Create an order line with 4 items
 3 - Create another order line with 2 items
 4 - Close the basket
 5 - Receive shipment and create an invoice
 6 - Select both orders via the checkboxes got multi-receive
 7 - Click "receive selected"
 8 - Edit first order line, quantity received = 1 (1 out of 4)
 9 - Verify that one item is also selected in the table
10 - Switch to "next order"
11 - Quantity received is 0, no items checked in the second order
12 - Switch to "Previous order"
13 - ERROR: Item checkbox was lost, quantity received still correct
14 - Switch to next order
15 - ERROR: item is now checked, quantity received 0
16 - Note: We see a mix up of the information entered, one has the checkbox now, the other the quantity.
17 - Save changes
18 - Click confirm
19 - Continue (complaint about the second order left unchanged)
20 - You are back on the summary:
     * pending order: quantity changed from 4 to 3 - correct
     * received order: quantity shows 1 - correct
21 - Click on receive for your updated order line (with 3 items)
     * 4 items show to be received (should be 3)
22 - Apply patch
23 - Cancel receipt of items
24 - Repeat 1-12
25 - Items are loaded correctly
26 - Try with various checkboxes and switch back and forth
27 - Confirm that manually adjusting quantity received checks the first n boxes
28 - Confirm setting quantity to 0 unchecks the boxes

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
Comment 3 Katrin Fischer 2023-09-08 09:40:44 UTC
Bad bug, small fix - just how I like it. Thanks a lot Nick!
Comment 4 Victor Grousset/tuxayo 2023-09-12 22:19:17 UTC
Created attachment 155579 [details] [review]
Bug 34736: Don't trigger quantity change on loading order

We have a change event to automatically check or uncheck the first items on a list when
the value is changed directly.

The code is calling this when setting the quantity when loading an order, but this is causing a problem
in that we are setting the quantity to load.switch orders and triggering the checkboxes wrongly

To test:
 1 - Create a new basket, create items on placing the order
 2 - Create an order line with 4 items
 3 - Create another order line with 2 items
 4 - Close the basket
 5 - Receive shipment and create an invoice
 6 - Select both orders via the checkboxes got multi-receive
 7 - Click "receive selected"
 8 - Edit first order line, quantity received = 1 (1 out of 4)
 9 - Verify that one item is also selected in the table
10 - Switch to "next order"
11 - Quantity received is 0, no items checked in the second order
12 - Switch to "Previous order"
13 - ERROR: Item checkbox was lost, quantity received still correct
14 - Switch to next order
15 - ERROR: item is now checked, quantity received 0
16 - Note: We see a mix up of the information entered, one has the checkbox now, the other the quantity.
17 - Save changes
18 - Click confirm
19 - Continue (complaint about the second order left unchanged)
20 - You are back on the summary:
     * pending order: quantity changed from 4 to 3 - correct
     * received order: quantity shows 1 - correct
21 - Click on receive for your updated order line (with 3 items)
     * 4 items show to be received (should be 3)
22 - Apply patch
23 - Cancel receipt of items
24 - Repeat 1-12
25 - Items are loaded correctly
26 - Try with various checkboxes and switch back and forth
27 - Confirm that manually adjusting quantity received checks the first n boxes
28 - Confirm setting quantity to 0 unchecks the boxes

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Comment 5 Victor Grousset/tuxayo 2023-09-12 22:21:01 UTC
Works, makes sense, QA script happy, code looks good, passing QA :)

It was a nasty one, well done all ^^
Comment 6 Tomás Cohen Arazi (tcohen) 2023-09-15 14:59:01 UTC
Pushed to master for 23.11.

Nice work everyone, thanks!
Comment 7 Fridolin Somers 2023-09-18 07:38:09 UTC
Pushed to 23.05.x for 23.05.04
Comment 8 Katrin Fischer 2023-09-22 08:19:41 UTC
I am afraid we have an unwanted side-effect here if my git-bisect is correct :( 

Bug 34880 - Receive impossible if items created 'in cataloguing'
Comment 9 Victor Grousset/tuxayo 2023-09-25 05:58:55 UTC
oh no, very weird it did that. Thanks for finding it out.
Comment 10 Matt Blenkinsop 2023-10-12 15:21:02 UTC
Dependency missing for 22.11.x - not backporting