Index: typo3/sysext/dbal/class.ux_t3lib_db.php =================================================================== --- typo3/sysext/dbal/class.ux_t3lib_db.php (revision 5387) +++ typo3/sysext/dbal/class.ux_t3lib_db.php (working copy) @@ -2406,12 +2406,22 @@ // do we have a field name in the value? // this is a very simplistic check, beware - if(is_array($this->mapping[$t]['mapFieldNames']) && (!is_numeric($sqlPartArray[$k]['value'][0]) && !isset($sqlPartArray[$k]['value'][1]))) { + if (!is_numeric($sqlPartArray[$k]['value'][0]) && !isset($sqlPartArray[$k]['value'][1])) { $fieldArray = explode('.', $sqlPartArray[$k]['value'][0]); - if(count($fieldArray)==1 && isset($this->mapping[$t]['mapFieldNames'][$fieldArray[0]])) { + if (count($fieldArray) == 1 && is_array($this->mapping[$t]['mapFieldNames']) && isset($this->mapping[$t]['mapFieldNames'][$fieldArray[0]])) { $sqlPartArray[$k]['value'][0] = $this->mapping[$t]['mapFieldNames'][$fieldArray[0]]; - } elseif(count($fieldArray)==2 && isset($this->mapping[$t]['mapFieldNames'][$fieldArray[1]])) { - $sqlPartArray[$k]['value'][0] = $fieldArray[0].'.'.$this->mapping[$t]['mapFieldNames'][$fieldArray[1]]; + } elseif (count($fieldArray) == 2) { + // Map the external table + $table = $fieldArray[0]; + if (isset($this->mapping[$fieldArray[0]]['mapTableName'])) { + $table = $this->mapping[$fieldArray[0]]['mapTableName']; + } + // Map the field itself + $field = $fieldArray[1]; + if (is_array($this->mapping[$fieldArray[0]]['mapFieldNames']) && isset($this->mapping[$fieldArray[0]]['mapFieldNames'][$fieldArray[1]])) { + $field = $this->mapping[$fieldArray[0]]['mapFieldNames'][$fieldArray[1]]; + } + $sqlPartArray[$k]['value'][0] = $table . '.' . $field; } }