Bug 22565

Summary: Partially receiving order and adding internal note on invoice updates note on every order on the system
Product: Koha Reporter: Janet McGowan <janet.mcgowan>
Component: AcquisitionsAssignee: Martin Renvoize (ashimema) <martin.renvoize>
Status: CLOSED FIXED QA Contact: Josef Moravec <josef.moravec>
Severity: blocker    
Priority: P5 - low CC: fiona.borthwick, janet.mcgowan, josef.moravec, lucas, martin.renvoize, nick
Version: 18.11   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Trivial patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:
Bug Depends on: 21467    
Bug Blocks:    
Attachments: Bug 22565: Do NOT replace all internalnote's on receive
Bug 22565: Add test for ModReceiveOrder regression
Bug 22565: Do NOT replace all internalnote's on receive
Bug 22565: Add test for ModReceiveOrder regression
Bug 22565: (QA follow-up) Fix test Acquisition.t
Bug 22565: (QA follow-up) Fix test Acquisition.t

Description Janet McGowan 2019-03-22 16:14:32 UTC
Tested on 18.11.01 and 18.11.03

If you have an order for multiple copies and only receipt one or more of those copies but not the entire number, and edit the internal note field on the invoice screen, the internal note field then updates every order on the system. 
The internal note is applied to all orders but also it overwrites any other note that was there.
Comment 1 Katrin Fischer 2019-03-24 12:18:11 UTC
Data loss bug - updating severity.
Comment 2 Martin Renvoize (ashimema) 2019-03-25 10:43:08 UTC
Looks like this was caused by bug 21467. There's a really clear mistake in the Update statement that's called in that it's missing a WHERE clause... Ooops.
Comment 3 Martin Renvoize (ashimema) 2019-03-25 10:52:49 UTC
Created attachment 86965 [details] [review]
Bug 22565: Do NOT replace all internalnote's on receive

Bug 21467 introduced a but whereby setting any order_internalnote on
receive one would end up setting all orders to have that internalnote.

This patch adds the missing WHERE clause to the database query which was
likely lost during a rebase?

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 4 Martin Renvoize (ashimema) 2019-03-25 11:06:09 UTC
Created attachment 86966 [details] [review]
Bug 22565: Add test for ModReceiveOrder regression

This test checks that order_internalnote is only updated for the given
orderline in ModReceiveOrder.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 5 Josef Moravec 2019-03-25 11:25:38 UTC
Created attachment 86967 [details] [review]
Bug 22565: Do NOT replace all internalnote's on receive

Bug 21467 introduced a but whereby setting any order_internalnote on
receive one would end up setting all orders to have that internalnote.

This patch adds the missing WHERE clause to the database query which was
likely lost during a rebase?

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Comment 6 Josef Moravec 2019-03-25 11:25:41 UTC
Created attachment 86968 [details] [review]
Bug 22565: Add test for ModReceiveOrder regression

This test checks that order_internalnote is only updated for the given
orderline in ModReceiveOrder.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Comment 7 Josef Moravec 2019-03-25 11:25:44 UTC
Created attachment 86969 [details] [review]
Bug 22565: (QA follow-up) Fix test Acquisition.t

Test plan:
prove t/db_dependent/Acquisition.t
should pass

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Comment 8 Martin Renvoize (ashimema) 2019-03-25 11:55:03 UTC
Created attachment 86970 [details] [review]
Bug 22565: (QA follow-up) Fix test Acquisition.t

Test plan:
prove t/db_dependent/Acquisition.t
should pass

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 9 Martin Renvoize (ashimema) 2019-03-25 11:56:12 UTC
Thanks Josef, looking good.
Comment 10 Nick Clemens (kidclamp) 2019-03-25 12:14:16 UTC
Awesome work all!

Pushed to master for 19.05
Comment 11 Martin Renvoize (ashimema) 2019-03-25 15:09:43 UTC
Pushed to 18.11.x for 18.11.04
Comment 12 Lucas Gass (lukeg) 2019-04-01 15:47:40 UTC
missing dependency for 18.05.x, not backporting.