Bug 17667

Summary: Standing orders - cancelling a receipt increase the original quantity
Product: Koha Reporter: Jonathan Druart <jonathan.druart>
Component: AcquisitionsAssignee: Jonathan Druart <jonathan.druart>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: major    
Priority: P2 CC: 1joynelson, diane.westerfield, hayleypelham, katrin.fischer, kelly, lucas
Version: Main   
Hardware: PC   
OS: All   
Change sponsored?: --- Patch complexity: Small patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
20.05.00, 19.11.03, 19.05.08, 18.11.14
Bug Depends on: 15531    
Bug Blocks:    
Attachments: Example
Bug 17667: Do not modify quantity of the original standing order when a receipt is cancelled
Bug 17667: Do not modify quantity of the original standing order when a receipt is cancelled
Bug 17667: Add tests
Bug 17667: Do not modify quantity of the original standing order when a receipt is cancelled
Bug 17667: Add tests
Bug 17667: Do not modify quantity of the original standing order when a receipt is cancelled
Bug 17667: Add tests

Description Jonathan Druart 2016-11-22 09:31:45 UTC
When cancelling a receipt, the quantity of the original order is increased.
That does not sound correct.
Comment 1 Diane Westerfield 2019-12-18 15:59:16 UTC
Have run into this bug when I accidentally received the same title twice on one invoice, then tried to cancel/unreceive the duplicate. Very frustrating.
Comment 2 Diane Westerfield 2019-12-18 16:02:55 UTC
Created attachment 96427 [details]
Example
Comment 3 Jonathan Druart 2019-12-18 17:13:04 UTC
Created attachment 96433 [details] [review]
Bug 17667: Do not modify quantity of the original standing order when a receipt is cancelled

When cancelling a receipt, the quantity of the original order is
increased.

Test plan:
Create a basket, mark is as "standing orders"
Create an order
receive it
cancel the receipt
=> Without this patch the quantity of the original order is 2
=> With this patch applied the quantity it always 1
Comment 4 Jonathan Druart 2019-12-18 17:14:35 UTC
It surprises me that this bug did not get attention earlier.
Comment 5 Katrin Fischer 2019-12-22 13:16:04 UTC
Should the warn not be removed?

+            warn "setting ".
+                $order->{'quantity'} + $parent_order->{'quantity'} . " to $parent_ordernumber";
Comment 6 Jonathan Druart 2019-12-27 16:26:32 UTC
Created attachment 96663 [details] [review]
Bug 17667: Do not modify quantity of the original standing order when a receipt is cancelled

When cancelling a receipt, the quantity of the original order is
increased.

Test plan:
Create a basket, mark is as "standing orders"
Create an order
receive it
cancel the receipt
=> Without this patch the quantity of the original order is 2
=> With this patch applied the quantity it always 1
Comment 7 Jonathan Druart 2019-12-27 16:26:35 UTC
Created attachment 96664 [details] [review]
Bug 17667: Add tests
Comment 8 ByWater Sandboxes 2020-01-13 15:11:41 UTC
Created attachment 97317 [details] [review]
Bug 17667: Do not modify quantity of the original standing order when a receipt is cancelled

When cancelling a receipt, the quantity of the original order is
increased.

Test plan:
Create a basket, mark is as "standing orders"
Create an order
receive it
cancel the receipt
=> Without this patch the quantity of the original order is 2
=> With this patch applied the quantity it always 1

Signed-off-by: Kelly McElligott <kelly@bywatersolutions.com>
Comment 9 ByWater Sandboxes 2020-01-13 15:11:43 UTC
Created attachment 97318 [details] [review]
Bug 17667: Add tests

Signed-off-by: Kelly McElligott <kelly@bywatersolutions.com>
Comment 10 Katrin Fischer 2020-01-19 22:01:35 UTC
Created attachment 97593 [details] [review]
Bug 17667: Do not modify quantity of the original standing order when a receipt is cancelled

When cancelling a receipt, the quantity of the original order is
increased.

Test plan:
Create a basket, mark is as "standing orders"
Create an order
receive it
cancel the receipt
=> Without this patch the quantity of the original order is 2
=> With this patch applied the quantity it always 1

Signed-off-by: Kelly McElligott <kelly@bywatersolutions.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 11 Katrin Fischer 2020-01-19 22:01:39 UTC
Created attachment 97594 [details] [review]
Bug 17667: Add tests

Signed-off-by: Kelly McElligott <kelly@bywatersolutions.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 12 Martin Renvoize 2020-01-20 14:01:49 UTC
Nice work everyone!

Pushed to master for 20.05
Comment 13 Martin Renvoize 2020-01-20 14:04:11 UTC
Nice work everyone!

Pushed to master for 20.05
Comment 14 Joy Nelson 2020-01-31 23:47:33 UTC
Pushed to 19.11.x branch for 19.11.03
Comment 15 Lucas Gass 2020-02-13 16:52:27 UTC
backported to 19.05.x for 19.05.08
Comment 16 Hayley Pelham 2020-02-14 02:17:17 UTC
Backported to 18.11.x for 18.11.14.