Index: t3lib/stddb/tbl_be.php =================================================================== --- t3lib/stddb/tbl_be.php (revision 6899) +++ t3lib/stddb/tbl_be.php (working copy) @@ -107,7 +107,10 @@ 'pid' => '0', ), 'script' => 'wizard_list.php', - ) + ), + 'suggest' => array( + 'type' => 'suggest', + ), ) ) ), Index: t3lib/tceforms/class.t3lib_tceforms_suggest.php =================================================================== --- t3lib/tceforms/class.t3lib_tceforms_suggest.php (revision 6899) +++ t3lib/tceforms/class.t3lib_tceforms_suggest.php (working copy) @@ -134,9 +134,17 @@ } $TSconfig = t3lib_BEfunc::getPagesTSconfig($pageId); - + $queryTables = array(); + $foreign_table_where = ''; $wizardConfig = $GLOBALS['TCA'][$table]['columns'][$field]['config']['wizards']['suggest']; - $queryTables = t3lib_div::trimExplode(',', $GLOBALS['TCA'][$table]['columns'][$field]['config']['allowed']); + if (isset($GLOBALS['TCA'][$table]['columns'][$field]['config']['allowed'])) { + $queryTables = t3lib_div::trimExplode(',', $GLOBALS['TCA'][$table]['columns'][$field]['config']['allowed']); + } elseif (isset($GLOBALS['TCA'][$table]['columns'][$field]['config']['foreign_table'])) { + $queryTables = array($GLOBALS['TCA'][$table]['columns'][$field]['config']['foreign_table']); + $foreign_table_where = $GLOBALS['TCA'][$table]['columns'][$field]['config']['foreign_table_where']; + // strip ORDER BY clause + $foreign_table_where = trim(preg_replace('/ORDER[[:space:]]+BY.*/i', '', $foreign_table_where)); + } $resultRows = array(); // fetch the records for each query table. A query table is a table from which records are allowed to @@ -173,6 +181,17 @@ if (is_array($TSconfig['TCEFORM.'][$table.'.'][$field.'.']['suggest.'][$queryTable.'.'])) { $config = t3lib_div::array_merge_recursive_overrule($config, $TSconfig['TCEFORM.'][$table.'.'][$field.'.']['suggest.'][$queryTable.'.']); } + + //process addWhere + if (!isset($config['addWhere']) && $foreign_table_where) { + $config['addWhere'] = $foreign_table_where; + } + if (isset($config['addWhere'])) { + $config['addWhere'] = strtr(' ' . $config['addWhere'], array( + '###THIS_UID###' => intval($uid), + '###CURRENT_PID###' => intval($pageId), + )); + } // instantiate the class that should fetch the records for this $queryTable $receiverClassName = $config['receiverClass']; if (!class_exists($receiverClassName)) { Index: t3lib/tceforms/class.t3lib_tceforms_suggest_defaultreceiver.php =================================================================== --- t3lib/tceforms/class.t3lib_tceforms_suggest_defaultreceiver.php (revision 6899) +++ t3lib/tceforms/class.t3lib_tceforms_suggest_defaultreceiver.php (working copy) @@ -131,6 +131,10 @@ if ($GLOBALS['TCA'][$this->table]['ctrl']['versioningWS'] == true) { $this->addWhere .= ' AND t3ver_wsid = 0'; } + + if (isset($config['addWhere'])) { + $this->addWhere .= ' ' . $config['addWhere']; + } } /** @@ -161,7 +165,6 @@ $this->orderByStatement, $start . ', 50'); - $allRowsCount = $GLOBALS['TYPO3_DB']->sql_num_rows($res); if ($allRowsCount) { Index: typo3/sysext/cms/ext_tables.php =================================================================== --- typo3/sysext/cms/ext_tables.php (revision 6899) +++ typo3/sysext/cms/ext_tables.php (working copy) @@ -175,6 +175,11 @@ 'exclusiveKeys' => '-1,-2', 'foreign_table' => 'fe_groups', 'foreign_table_where' => 'ORDER BY fe_groups.title', + 'wizards' => array( + 'suggest' => array( + 'type' => 'suggest', + ) + ), ) ), 'extendToSubpages' => array ( Index: typo3/sysext/cms/tbl_cms.php =================================================================== --- typo3/sysext/cms/tbl_cms.php (revision 6899) +++ typo3/sysext/cms/tbl_cms.php (working copy) @@ -74,7 +74,12 @@ 'foreign_table_where' => 'ORDER BY fe_groups.title', 'size' => '6', 'minitems' => '1', - 'maxitems' => '50' + 'maxitems' => '50', + 'wizards' => array( + 'suggest' => array( + 'type' => 'suggest', + ) + ), ) ), 'lockToDomain' => array( @@ -368,7 +373,12 @@ 'size' => 6, 'autoSizeMax' => 10, 'minitems' => 0, - 'maxitems' => 20 + 'maxitems' => 20, + 'wizards' => array( + 'suggest' => array( + 'type' => 'suggest', + ) + ), ) ), 'lockToDomain' => array(