Fixed bug with enable fields condition on tables without enable fields, resolves...
authorfrancois <francois@735d13b6-9817-0410-8766-e36946ffe9aa>
Mon, 27 Jun 2011 20:11:37 +0000 (20:11 +0000)
committerfrancois <francois@735d13b6-9817-0410-8766-e36946ffe9aa>
Mon, 27 Jun 2011 20:11:37 +0000 (20:11 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Extensions/overlays/trunk@49160 735d13b6-9817-0410-8766-e36946ffe9aa

ChangeLog
class.tx_overlays.php

index cc82027..84377fe 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2011-06-27 Francois Suter (Cobweb)  <typo3@cobweb.ch>
+
+       * Fixed bug with enable fields condition on tables without enable fields, resolves #27551
+
 2011-03-22 Francois Suter (Cobweb)  <typo3@cobweb.ch>
 
        * Released to TER as version 2.0.0
index b69f291..ac74bd9 100644 (file)
@@ -624,13 +624,13 @@ final class tx_overlays {
                if (is_array($uids) && count($uids) > 0) {
                        $tableCtrl = $GLOBALS['TCA'][$table]['ctrl'];
                                // Select overlays for all records
-                       $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
-                               '*',
-                               $table,
-                                       $tableCtrl['languageField'].' = '.intval($currentLanguage).
-                                       ' AND ' . $tableCtrl['transOrigPointerField'] . ' IN (' . implode(', ', $uids) . ')' .
-                                       ' AND ' . self::getEnableFieldsCondition($table)
-                       );
+                       $where = $tableCtrl['languageField'] . ' = ' . intval($currentLanguage) .
+                               ' AND ' . $tableCtrl['transOrigPointerField'] . ' IN (' . implode(', ', $uids) . ')';
+                       $enableCondition = self::getEnableFieldsCondition($table);
+                       if (!empty($enableCondition)) {
+                               $where .= ' AND ' . $enableCondition;
+                       }
+                       $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', $table, $where);
                                // Arrange overlay records according to transOrigPointerField, so that it's easy to relate them to the originals
                                // This structure is actually a 2-dimensional array, with the pid as the second key
                                // Because of versioning, there may be several overlays for a given original and matching the pid too
@@ -669,13 +669,13 @@ final class tx_overlays {
                if (is_array($uids) && count($uids) > 0) {
                        $tableCtrl = $GLOBALS['TCA'][$table]['ctrl'];
                                // Select overlays for all records
-                       $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
-                               '*',
-                               $table,
-                                       $tableCtrl['languageField'].' = ' . intval($currentLanguage).
-                                       ' AND ' . $tableCtrl['transOrigPointerField'] . ' IN (' . implode(', ', $uids) . ')' .
-                                       ' AND ' . self::getEnableFieldsCondition($table)
-                       );
+                       $where = $tableCtrl['languageField'] . ' = ' . intval($currentLanguage) .
+                               ' AND ' . $tableCtrl['transOrigPointerField'] . ' IN (' . implode(', ', $uids) . ')';
+                       $enableCondition = self::getEnableFieldsCondition($table);
+                       if (!empty($enableCondition)) {
+                               $where .= ' AND ' . $enableCondition;
+                       }
+                       $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', $table, $where);
                                // Arrange overlay records according to transOrigPointerField, so that it's easy to relate them to the originals
                        while (($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res))) {
                                        // Perform version overlays, if needed