Index: translate.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/l10n_server/l10n_community/Attic/translate.inc,v
retrieving revision 1.1.2.7.2.31.2.27
diff -u -p -r1.1.2.7.2.31.2.27 translate.inc
--- translate.inc	24 Jun 2010 16:00:59 -0000	1.1.2.7.2.31.2.27
+++ translate.inc	10 Aug 2010 18:12:21 -0000
@@ -795,7 +795,8 @@ function l10n_community_get_strings($lan
   $join = $join_args = $where = $where_args = array();
   $sql = $sql_count = '';
 
-  $select = "SELECT DISTINCT s.sid, s.value, s.context, t.tid, t.language, t.translation, t.uid_entered, t.uid_approved, t.time_entered, t.time_approved, t.is_suggestion, t.is_active, u.name as username, u2.name as username_approved, ts.has_suggestion, ts.has_translation FROM {l10n_server_string} s";
+  $select_sid = "SELECT DISTINCT s.sid FROM {l10n_server_string} s";
+  $select = "SELECT s.sid, s.value, s.context, t.tid, t.language, t.translation, t.uid_entered, t.uid_approved, t.time_entered, t.time_approved, t.is_suggestion, t.is_active, u.name as username, u2.name as username_approved, ts.has_suggestion, ts.has_translation FROM {l10n_server_string} s";
   $select_count = "SELECT COUNT(DISTINCT(s.sid)) FROM {l10n_server_string} s";
   $join[] = "LEFT JOIN {l10n_server_status_flag} ts ON s.sid = ts.sid AND ts.language = '%s'";
   $join_args[] = $langcode;
@@ -872,16 +873,29 @@ function l10n_community_get_strings($lan
   // Build the queries
   $sql_args = array_merge($join_args, $where_args);
   $sql_where = implode(' ', $join) . (count($where) ? (' WHERE '. implode(' AND ', $where)) : '');
-  $sql = $select .' '. $sql_where;
+
+  $sql_sid = $select_sid .' '. $sql_where;
   $sql_count = $select_count .' '. $sql_where;
 
-  // We either need a pager or a full result.
   if (isset($pager)) {
-    $strings = pager_query($sql, $pager, 0, $sql_count, $sql_args);
+    $strings_sid = pager_query($sql_sid, $pager, 0, $sql_count, $sql_args);
+  }else {
+    $strings_sid = db_query($sql_sid, $sql_args);
   }
-  else {
-    $strings = db_query($sql, $sql_args);
+
+  while ($string = db_fetch_object($strings_sid)) {
+    $sid_array[] = $string->sid;
+  }
+
+  if(count($sid_array)){
+    $sid_array = implode(",", $sid_array);
+    $where[] = "s.sid IN ($sid_array)";
   }
+
+  $sql_where = implode(' ', $join) . (count($where) ? (' WHERE '. implode(' AND ', $where)) : '');
+  $sql = $select .' '. $sql_where;
+  $strings = db_query($sql, $sql_args);
+
   $result = array();
   while ($string = db_fetch_object($strings)) {
     if ($string->is_suggestion) {
