From 5e1b601cd88c64f498b06b90af35258954e24d6a Mon Sep 17 00:00:00 2001 From: Colin Campbell Date: Fri, 31 Jul 2015 15:05:27 +0100 Subject: [PATCH] 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 --- C4/Koha.pm | 3 +++ 1 file changed, 3 insertions(+) diff --git a/C4/Koha.pm b/C4/Koha.pm index bca12d6..910d6bb 100644 --- a/C4/Koha.pm +++ b/C4/Koha.pm @@ -1257,6 +1257,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; -- 2.1.4