Bug 8684: Fix duplicate check on creating items in the acquisition module
authorJonathan Druart <jonathan.druart@biblibre.com>
Tue, 7 Apr 2015 12:14:18 +0000 (14:14 +0200)
committerChris Cormack <chrisc@catalyst.net.nz>
Sun, 9 Aug 2015 21:29:49 +0000 (09:29 +1200)
commitf5b38743c5676254d15801bac1529be4d6d2361a
tree179dca0b5b67002fb5735ac319ee28d76d52fbe0
parent8ffe9410af465e618ddf4e59c97c3797cfdd4866
Bug 8684: Fix duplicate check on creating items in the acquisition module

The script acqui/check_uniqueness.pl has been introduced by bug 7178.
But bug 11425 added a call to a new subroutine SearchItemsByField in
order to refactore some code. This subroutine calls SearchItems with an
arrayref, which is not what SearchItems is expecting.
This broke the duplicate check done on creating items in the acquisition
module.

To reproduce the issue:
1/ Fill the pref UniqueItemFields with "barcode" and AcqCreateItem with
"placing an order"
2/ Create a new basket
3/ Create a new order
4/ Close the basket
5/ Receive items and set barcode with one already in your DB
6/ Save
7/ Nothing happen on the interface, but an error should have been added
in your Koha log file:
  Can't use an undefined value as an ARRAY reference at
  /home/koha/src/acqui/check_uniqueness.pl line 48.

Test plan:
1/ Repeat steps 1-6
2/ You should see a warning on the interface

Note that this should also happen with AcqCreateItem set to "creating an
order".

Works well, no errors.

Signed-off-by: Amit Gupta <amit.gupta@informaticsglobal.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit fa5104a6a1c7e3b0bcb232e4d888066dd20eebe8)
Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
C4/Items.pm