Bug 11549

Summary: After transferring an order, receive and cancel the receipt will delete the order
Product: Koha Reporter: Jonathan Druart <jonathan.druart>
Component: AcquisitionsAssignee: Jonathan Druart <jonathan.druart>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: major    
Priority: P5 - low CC: fridolin.somers, gmcharlt, julian.maurice, koha, sandboxes
Version: Main   
Hardware: All   
OS: All   
See Also: http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=11744
Change sponsored?: --- Patch complexity: Small patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:
Bug Depends on:    
Bug Blocks: 11552    
Attachments: Bug 11549: Add regression test
Bug 11549: FIX receive and cancel the receipt after a transfer.
Bug 11549: Interpolate variables into SQL statements should not be allowed
Bug 11549: Add regression test
Bug 11549: FIX receive and cancel the receipt after a transfer.
Bug 11549: Interpolate variables into SQL statements should not be allowed
Bug 11549: [follow-up] Make NewOrder calculate new parent_ordernumber
Bug 11549: [follow-up] Make NewOrder calculate new parent_ordernumber
[PASSED QA] Bug 11549: Add regression test
[PASSED QA] Bug 11549: FIX receive and cancel the receipt after a transfer.
[PASSED QA] Bug 11549: Interpolate variables into SQL statements should not be allowed
[PASSED QA] Bug 11549: [follow-up] Make NewOrder calculate new parent_ordernumber

Description Jonathan Druart 2014-01-14 11:03:53 UTC
Bug 5349 introduces the ability to transfer an order from a basket to another.
After a transfer, if an order is received and the receipt is canceled, the order will be deleted.
Comment 1 Jonathan Druart 2014-01-14 11:19:28 UTC Comment hidden (obsolete)
Comment 2 Jonathan Druart 2014-01-14 11:19:33 UTC Comment hidden (obsolete)
Comment 3 Jonathan Druart 2014-01-14 11:19:37 UTC Comment hidden (obsolete)
Comment 4 Koha Team University Lyon 3 2014-01-15 14:55:26 UTC
I did several tests of transfers (from a basket, from the receipt page, after a double transfer). Every time, I received the document and cancelled the reception: the document returns as awaiting to be received. The discount of document to be received is OK. Everything is OK for me.
Comment 5 Biblibre Sandboxes 2014-01-15 14:57:04 UTC
Patch tested with a sandbox, by Sonia BOUIS <sonia.bouis@univ-lyon3.fr>
Comment 6 Biblibre Sandboxes 2014-01-15 14:57:38 UTC Comment hidden (obsolete)
Comment 7 Biblibre Sandboxes 2014-01-15 14:57:41 UTC Comment hidden (obsolete)
Comment 8 Biblibre Sandboxes 2014-01-15 14:57:45 UTC Comment hidden (obsolete)
Comment 9 Julian Maurice 2014-01-17 10:26:05 UTC Comment hidden (obsolete)
Comment 10 Jonathan Druart 2014-01-17 14:20:09 UTC Comment hidden (obsolete)
Comment 11 Katrin Fischer 2014-01-18 20:09:13 UTC
Created attachment 24546 [details] [review]
[PASSED QA] Bug 11549: Add regression test

test plan:
prove t/db_dependent/Acquisition/TransferOrder.t should fail before the
patch and success after applying it.

Signed-off-by: Sonia BOUIS <sonia.bouis@univ-lyon3.fr>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Testing notes on last patch.
Comment 12 Katrin Fischer 2014-01-18 20:09:25 UTC
Created attachment 24547 [details] [review]
[PASSED QA] Bug 11549: FIX receive and cancel the receipt after a transfer.

To reproduce the issue:
- transfer an order from a basket to another. Note the previous
ordernumber (X) and the new one (Y).
- receive the order
- cancel the receipt
- verify the order has been deleted:
select count(*) from aqorders where ordernumber=Y;
select * from aqorders_transfers where ordernumber_from = X;
The value for ordernumber_to is null.

To test this patch:
- apply this patch
- transfer an order from a basket to another
- receive the order
- cancel the receipt
- verify the order still exist in the basket where the transfer has been
  done.

Signed-off-by: Sonia BOUIS <sonia.bouis@univ-lyon3.fr>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Comment 13 Katrin Fischer 2014-01-18 20:09:36 UTC
Created attachment 24548 [details] [review]
[PASSED QA] Bug 11549: Interpolate variables into SQL statements should not be allowed

Signed-off-by: Sonia BOUIS <sonia.bouis@univ-lyon3.fr>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Comment 14 Katrin Fischer 2014-01-18 20:09:46 UTC
Created attachment 24549 [details] [review]
[PASSED QA] Bug 11549: [follow-up] Make NewOrder calculate new parent_ordernumber

If parent_ordernumber is not set in NewOrder parameter, it is
automatically set to ordernumber.
This patch only avoid code duplication.

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
This solution is better!

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Passes all tests and QA script. Also all tests in
t/db_dependent/Acquisitions/.

Confirmed bug and that the patch fixes it.
Comment 15 Galen Charlton 2014-01-23 16:59:27 UTC
Pushed to master.  Thanks, Jonathan!
Comment 16 Fridolin Somers 2014-04-23 16:54:41 UTC
Patches pushed to 3.14.x, will be in 3.14.06