Bug 12891: NewOrder does not return ordernumber if ordernumber is defined
authorJonathan Druart <jonathan.druart@biblibre.com>
Mon, 8 Sep 2014 18:25:27 +0000 (20:25 +0200)
committerTomas Cohen Arazi <tomascohen@gmail.com>
Thu, 18 Sep 2014 00:19:35 +0000 (21:19 -0300)
commit55e5c82ab593c180e0b73f1cd13bbc71ee7a39c6
treea417a41811a89fd3317678ed81fdf74a19621f01
parentd15cecacedd58abdafa0b0276a3002af7b266090
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.

Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
C4/Acquisition.pm
t/db_dependent/Acquisition.t