Bug 20829: Handle non-existent barcode when linking to host item
authorJonathan Druart <jonathan.druart@bugs.koha-community.org>
Wed, 30 May 2018 15:10:58 +0000 (12:10 -0300)
committerNick Clemens <nick@bywatersolutions.com>
Fri, 8 Jun 2018 13:48:11 +0000 (09:48 -0400)
commit564e9ce1ee4fbaa4a52bccd3f087abfafb69d985
tree8aad589cfca223e2029840e177f2df59f15b9067
parent3f01fcae9723edf0485f431878a34551e814090a
Bug 20829: Handle non-existent barcode when linking to host item

Since commit 2c9aeb9b0f4449d1a25274b8fbf8dae4ec11d3bf
  Bug 18277: Remove GetBiblionumberFromItemnumber - linkitem

$item is not defined if the barcode is invalid, we should not call
method on it in that case.

Test plan:
- Turn on EasyAnalyticalRecords
- Go to a detail page
- Edit > Link to host item
- Enter an invalid barcode
=> With the patch you get a friendly error message
=> Without this patch it explodes with
Can't call method "itemnumber" on an undefined value at
/home/vagrant/kohaclone/cataloguing/linkitem.pl line 86.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
cataloguing/linkitem.pl