Bug 12891 - NewOrder does not return ordernumber
Summary: NewOrder does not return ordernumber
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Acquisitions (show other bugs)
Version: master
Hardware: All All
: P5 - low critical (vote)
Assignee: Jonathan Druart
QA Contact: Testopia
URL:
Keywords:
Depends on: 12626
Blocks: 12827
  Show dependency treegraph
 
Reported: 2014-09-08 18:23 UTC by Jonathan Druart
Modified: 2019-06-27 09:24 UTC (History)
2 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Small patch
Who signed the patch off:
Text to go in the release notes:
Version(s) released in:


Attachments
Bug 12891: NewOrder does not return ordernumber if ordernumber is defined (2.24 KB, patch)
2014-09-08 18:30 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 12891: NewOrder does not return ordernumber if ordernumber is defined (2.30 KB, patch)
2014-09-09 14:46 UTC, Dobrica Pavlinusic
Details | Diff | Splinter Review
[PASSED QA] Bug 12891: NewOrder does not return ordernumber if ordernumber is defined (2.53 KB, patch)
2014-09-10 21:06 UTC, Katrin Fischer
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Jonathan Druart 2014-09-08 18:23:54 UTC

    
Comment 1 Jonathan Druart 2014-09-08 18:30:28 UTC Comment hidden (obsolete)
Comment 2 Dobrica Pavlinusic 2014-09-09 14:46:55 UTC Comment hidden (obsolete)
Comment 3 Dobrica Pavlinusic 2014-09-09 14:48:48 UTC
Thanks, this fixes regression.
Comment 4 Katrin Fischer 2014-09-10 21:06:12 UTC
Created attachment 31515 [details] [review]
[PASSED QA] Bug 12891: NewOrder does not return ordernumber if ordernumber is defined

The behavior is quite weird, but
  $schema->resultset('Table')->create($data)->id
does not return the id inserted if $data contains the key.

To be more clear, in this case
  $schema->resultset('Aqorder')->create($new_order)->id
returns an empty string because $new_order->{ordernumber} is an empty
string!

This was not caught by the unit tests, I added one.

Test plan:
- AcqCreateItem set to ordering
- Create an order with items and verify items are correctly linked to the
  order.

Signed-off-by: Dobrica Pavlinusic <dpavlin@rot13.org>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Confirmed that without the patch the created item is not linked to the
order (entry in aqorders_items). With the patch, it works as expected.
Passes tests and Koha QA script.
Comment 5 Tomás Cohen Arazi 2014-09-18 00:36:57 UTC
Patch pushed to master.

Thanks Jonathan!