From 39e20aa3829150fe90067a2a8e1ef813cd3e08f4 Mon Sep 17 00:00:00 2001
From: Chris Cormack <chrisc@catalyst.net.nz>
Date: Sat, 8 Sep 2012 21:31:48 +1200
Subject: [PATCH] Bug 8089 : Follow up fixing an error
Content-Type: text/plain; charset="UTF-8"

scalar = grep  returns the number of hits
array = grep returns the matches

We had changed the behaviour so could no longer find any primary keys

Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
Tests pass following patch
---
 C4/SQLHelper.pm |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/C4/SQLHelper.pm b/C4/SQLHelper.pm
index e86d2b7..d781220 100644
--- a/C4/SQLHelper.pm
+++ b/C4/SQLHelper.pm
@@ -234,22 +234,22 @@ Get the Primary Key field names of the table
 
 sub GetPrimaryKeys($) {
 	my $tablename=shift;
-    my $result;
+    my @result;
     my $cache;
     if (Koha::Cache->is_cache_active()) {
         $cache = Koha::Cache->new();
         if (defined $cache) {
-            $result = $cache->get_from_cache("sqlhelper:GetPrimaryKeys:$tablename");
+            @result = $cache->get_from_cache("sqlhelper:GetPrimaryKeys:$tablename");
         }
     }
-    unless (defined $result) {
+    unless (@result) {
         my $hash_columns=_get_columns($tablename);
-        $result = grep { $hash_columns->{$_}->{'Key'} =~/PRI/i}  keys %$hash_columns;
+        @result = grep { $hash_columns->{$_}->{'Key'} =~/PRI/i}  keys %$hash_columns;
         if (Koha::Cache->is_cache_active() && defined $cache) {
-            $cache->set_in_cache("sqlhelper:GetPrimaryKeys:$tablename", $result);
+            $cache->set_in_cache("sqlhelper:GetPrimaryKeys:$tablename", @result);
         }
     }
-    return $result;
+    return @result;
 }
 
 
-- 
1.7.2.5