Created attachment 31470 [details] [review] 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.
Created attachment 31492 [details] [review] 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>
Thanks, this fixes regression.
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.
Patch pushed to master. Thanks Jonathan!