From 30d15e764ca91b655cb6f8557ea08009f1d48403 Mon Sep 17 00:00:00 2001 From: Colin Campbell Date: Fri, 31 Jul 2015 15:05:27 +0100 Subject: [PATCH] [SIGNED-OFF] Bug 14627: Check for undef passed to GetAuthorisedValueByCode Dont prepare or execute unnecessary sql if passed an undef value routine is used in various places that dont check if the value returned from a nullable field is defined or not (e.g. streettype in the borrower record which many sites do not use) Lets save those cpu cycles for something useful Signed-off-by: Bernardo Gonzalez Kriegel --- C4/Koha.pm | 3 +++ 1 file changed, 3 insertions(+) diff --git a/C4/Koha.pm b/C4/Koha.pm index 0a90bb3..052147e 100644 --- a/C4/Koha.pm +++ b/C4/Koha.pm @@ -1337,6 +1337,9 @@ by the passed category and code sub GetAuthorisedValueByCode { my ( $category, $authvalcode, $opac ) = @_; + if (!defined $authvalcode) { + return; + } my $field = $opac ? 'lib_opac' : 'lib'; my $dbh = C4::Context->dbh; -- 1.9.1