Added a test to avoid overlay preprocessing when default language is shown
authorfrancois <francois@735d13b6-9817-0410-8766-e36946ffe9aa>
Tue, 16 Sep 2008 09:30:06 +0000 (09:30 +0000)
committerfrancois <francois@735d13b6-9817-0410-8766-e36946ffe9aa>
Tue, 16 Sep 2008 09:30:06 +0000 (09:30 +0000)
Corrected wrong SQL statement for getting all overlays

git-svn-id: https://svn.typo3.org/TYPO3v4/Extensions/overlays/trunk@11998 735d13b6-9817-0410-8766-e36946ffe9aa

class.tx_overlays.php

index 79ea5e1..1b5fdb6 100644 (file)
@@ -63,13 +63,19 @@ class tx_overlays {
                if (!empty($where)) $where .= ' AND ';
                $where .= self::getEnableFieldsCondition($fromTable);
 
-                       // Make sure the list of selected fields includes "uid", "pid" and language fields so that language overlays can be gotten properly
-                       // If these do not exist in the queried table, the recordset is returned as is, without overlay
-               try {
-                       $selectFields = self::selectOverlayFields($fromTable, $selectFields);
-                       $doOverlays = true;
+                       // If the language is not default, prepare for overlays
+               if ($GLOBALS['TSFE']->sys_language_content > 0) {
+                               // Make sure the list of selected fields includes "uid", "pid" and language fields so that language overlays can be gotten properly
+                               // If these do not exist in the queried table, the recordset is returned as is, without overlay
+                       try {
+                               $selectFields = self::selectOverlayFields($fromTable, $selectFields);
+                               $doOverlays = true;
+                       }
+                       catch (Exception $e) {
+                               $doOverlays = false;
+                       }
                }
-               catch (Exception $e) {
+               else {
                        $doOverlays = false;
                }
 
@@ -255,7 +261,7 @@ class tx_overlays {
                                                                        '*',
                                                                        $table,
                                                                                $tableCtrl['languageField'].' = '.intval($sys_language_content).
-                                                                               ' AND '.$tableCtrl['transOrigPointerField'].' = '.intval($row['uid']).
+                                                                               ' AND '.$tableCtrl['transOrigPointerField'].' IN ('.implode(', ', $uidList).')'.
                                                                                ' AND '.self::getEnableFieldsCondition($table)
                                                                );
                                                                        // Arrange overlay records according to transOrigPointerField, so that it's easy to relate them to the originals