Bug 18403: Fix error triggered by subgroups being added to group
authorKyle M Hall <kyle@bywatetsolutions.com>
Fri, 9 Feb 2018 13:51:02 +0000 (08:51 -0500)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Mon, 12 Feb 2018 18:41:42 +0000 (15:41 -0300)
With one root group and two child groups and it works fine.
But if I create any groups under *those* groups, not only does it not work,
I get the following error:
Template process failed: undef error - SQL::Abstract::puke(): [SQL::Abstract::__ANON__]
Fatal: SQL::Abstract before v1.75 used to generate incorrect SQL when the -IN operator was
given an undef-containing list: !!!AUDIT YOUR CODE AND DATA!!! (the
upcoming Data::Query-based version of SQL::Abstract will
emit the logically correct SQL instead of raising this
exception) at /home/vagrant/kohaclone/Koha/Objects.pm line 269

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Koha/Patron.pm

index 0d7cca4..b5506e4 100644 (file)
@@ -791,7 +791,9 @@ sub libraries_where_can_see_patrons {
         }
     }
 
-    return sort(uniq(@restricted_branchcodes));
+    @restricted_branchcodes = grep { defined $_ } @restricted_branchcodes;
+    @restricted_branchcodes = uniq(@restricted_branchcodes);
+    return sort (@restricted_branchcodes);
 }
 
 sub can {