From 349da224b98e2efe2c259aa4d337ec3020316a7d 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 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 Signed-off-by: Nick Clemens Signed-off-by: Martin Renvoize (cherry picked from commit b004818515a5b5fbc7748da614b758d1516c0ff2) Signed-off-by: Fridolin Somers --- cataloguing/linkitem.pl | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cataloguing/linkitem.pl b/cataloguing/linkitem.pl index e23ff25fb1..adf0642452 100755 --- a/cataloguing/linkitem.pl +++ b/cataloguing/linkitem.pl @@ -74,6 +74,9 @@ if ( $barcode && $biblionumber ) { errornomodbiblio => 1 ); } + $template->param( + hostitemnumber => $item->itemnumber, + ); } else { $template->param( @@ -84,7 +87,6 @@ if ( $barcode && $biblionumber ) { $template->param( barcode => $barcode, - hostitemnumber => $item->itemnumber, ); } -- 2.39.5