From c8fa6bc4018a686f07f43a9690e6ac453920996d Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Wed, 30 May 2018 12:10:58 -0300 Subject: [PATCH] Bug 20829: Handle non-existent barcode when linking to host item Content-Type: text/plain; charset=utf-8 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 --- cataloguing/linkitem.pl | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cataloguing/linkitem.pl b/cataloguing/linkitem.pl index 40e2a98..4ea4727 100755 --- a/cataloguing/linkitem.pl +++ b/cataloguing/linkitem.pl @@ -75,6 +75,9 @@ if ( $barcode && $biblionumber ) { errornomodbiblio => 1 ); } + $template->param( + hostitemnumber => $item->itemnumber, + ); } else { $template->param( @@ -85,7 +88,6 @@ if ( $barcode && $biblionumber ) { $template->param( barcode => $barcode, - hostitemnumber => $item->itemnumber, ); } -- 2.1.4