Index: t3lib/class.t3lib_tceforms.php
===================================================================
--- t3lib/class.t3lib_tceforms.php	(Revision 2512)
+++ t3lib/class.t3lib_tceforms.php	(Arbeitskopie)
@@ -816,7 +816,7 @@
 		t3lib_div::loadTCA($table);
 
 			// Get the TCA configuration for the current field:
-		$PA['fieldConf'] = $TCA[$table]['columns'][$field];
+		$PA['fieldConf'] = t3lib_div::getFieldConfiguration($table, $field, $row);
 		$PA['fieldConf']['config']['form_type'] = $PA['fieldConf']['config']['form_type'] ? $PA['fieldConf']['config']['form_type'] : $PA['fieldConf']['config']['type'];	// Using "form_type" locally in this script
 
 		$skipThisField = $this->inline->skipField($table, $field, $row, $PA['fieldConf']['config']);
@@ -2698,24 +2698,10 @@
 	 * @param	string		The table name. MUST be in $TCA
 	 * @param	array		The row from the table, should contain at least the "type" field, if applicable.
 	 * @return	string		Return the "type" value for this record, ready to pick a "types" configuration from the $TCA array.
+	 * @deprecated			This method was moved to t3lib_div::getRTypeNum in TYPO3 4.2.0.
 	 */
 	function getRTypeNum($table,$row)	{
-		global $TCA;
-			// If there is a "type" field configured...
-		if ($TCA[$table]['ctrl']['type'])	{
-			$typeFieldName = $TCA[$table]['ctrl']['type'];
-			$typeNum=$row[$typeFieldName];	// Get value of the row from the record which contains the type value.
-			if (!strcmp($typeNum,''))	$typeNum=0;			// If that value is an empty string, set it to "0" (zero)
-		} else {
-			$typeNum = 0;	// If no "type" field, then set to "0" (zero)
-		}
-
-		$typeNum = (string)$typeNum;		// Force to string. Necessary for eg '-1' to be recognized as a type value.
-		if (!$TCA[$table]['types'][$typeNum])	{	// However, if the type "0" is not found in the "types" array, then default to "1" (for historical reasons)
-			$typeNum = 1;
-		}
-
-		return $typeNum;
+		return t3lib_div::getRTypeNum($table, $row);
 	}
 
 	/**
@@ -3031,7 +3017,7 @@
 	function renderDefaultLanguageContent($table,$field,$row,$item)	{
 		if (is_array($this->defaultLanguageData[$table.':'.$row['uid']]))	{
 			$dLVal = t3lib_BEfunc::getProcessedValue($table,$field,$this->defaultLanguageData[$table.':'.$row['uid']][$field],0,1);
-			$fCfg = $GLOBALS['TCA'][$table]['columns'][$field];
+			$fCfg = $this->getFieldConfiguration($table, $field, $row);
 
 			if (strcmp($dLVal,''))	{
 				$item.='<div class="typo3-TCEforms-originalLanguageValue">'.$this->getLanguageIcon($table,$row,0).$this->previewFieldValue($dLVal,$fCfg).'&nbsp;</div>';
Index: t3lib/class.t3lib_div.php
===================================================================
--- t3lib/class.t3lib_div.php	(Revision 2512)
+++ t3lib/class.t3lib_div.php	(Arbeitskopie)
@@ -1753,6 +1753,42 @@
 		}
 		return $out;
 	}
+	
+	/**
+	 * Walk a path through an array to a sub-part/sub-key.
+	 * Example:
+	 * $array = array('first' => array('second' => 1));
+	 * $path = 'first/second';
+	 * -> This would return '1'
+	 *
+	 * @param	array		$array: The array to walk through
+	 * @param	string		$path: The path (=keys) to walk in the array, delimited by a slash ('/')
+	 * @return	mixed		The value found at the given path - returns false if something went wrong
+	 */
+	function arrayWalkByPath($array, $path) {
+		$result = false;
+		if (is_array($array) && count($array)) {
+				// If path contains only one element (thus, not really a path):
+			if (!strpos($path, '/')) {
+				$result = (isset($array[$path]) ? $array[$path] : false);
+				// If path contains more elements delimited by slashes:
+			} else {
+				$steps = self::trimExplode('/');
+				if (count($steps)) {
+					$result = $array;
+					foreach ($steps as $step) {
+						if (isset($result[$step])) {
+							$result =& $result[$step];
+						} else {
+							$result = false;
+							break;
+						}
+					}
+				}
+			}
+		}
+		return $result;
+	}
 
 
 
@@ -3840,6 +3876,64 @@
 	}
 
 	/**
+	 * Calculate and return the current "types" pointer value for a record
+	 *
+	 * @param	string		$table: The table name. MUST be in $TCA
+	 * @param	array		$row: The row from the table, should contain at least the "type" field, if applicable.
+	 * @return	string		Return the "type" value for this record, ready to pick a "types" configuration from the $TCA array.
+	 */
+	public function getRTypeNum($table, $row) {
+		global $TCA;
+		self::loadTCA($table);
+			// If there is a "type" field configured...
+		if ($TCA[$table]['ctrl']['type'])	{
+			$typeFieldName = $TCA[$table]['ctrl']['type'];
+			$typeNum=$row[$typeFieldName];	// Get value of the row from the record which contains the type value.
+			if (!strcmp($typeNum,''))	$typeNum=0;			// If that value is an empty string, set it to "0" (zero)
+		} else {
+			$typeNum = 0;	// If no "type" field, then set to "0" (zero)
+		}
+
+		$typeNum = (string)$typeNum;		// Force to string. Necessary for eg '-1' to be recognized as a type value.
+		if (!$TCA[$table]['types'][$typeNum])	{	// However, if the type "0" is not found in the "types" array, then default to "1" (for historical reasons)
+			$typeNum = 1;
+		}
+
+		return $typeNum;
+	}
+
+	/**
+	 * Get the configuration of a field defined in $TCA ($TCA[<table>]['columns'][<field>]).
+	 * The configuration will be merged with a overrideColumns setting for the current type and field, if any.
+	 *
+	 * @param	string		$table: The table name
+	 * @param	string		$field: The field name
+	 * @param	string		$row: The record to edit from the database table
+	 * @param	string		$returnProperty: Return only a specified property (e.g. 'config' or 'config/type')
+	 * @return	array		The (overriden) field configuration found in $TCA[<table>]['columns'][<field>].
+	 */
+	public function getFieldConfiguration($table, $field, $row, $returnProperty=null) {
+		self::loadTCA($table);
+		$fieldConf = $GLOBALS['TCA'][$table]['columns'][$field];
+		$typeNum = self::getRTypeNum($table, $row);
+		if (isset($GLOBALS['TCA'][$table]['types'][$typeNum]['overrideColumns'][$field])) {
+			$overrideField =& $GLOBALS['TCA'][$table]['types'][$typeNum]['overrideColumns'][$field];
+			if (is_array($overrideField)) {
+					// The type of a field cannot be changed, since it might have negative side-effects:
+				if (isset($overrideField['config']['type'])) {
+					unset($overrideField['config']['type']);
+				}
+					// Override the field configuration:
+				$fieldConf = t3lib_div::array_merge_recursive_overrule($fieldConf, $overrideField);
+			}
+		}
+		if ($returnProperty) {
+			$fieldConf = self::arrayWalkByPath($fieldConf, $returnProperty);
+		}
+		return $fieldConf;
+	}
+
+	/**
 	 * Looks for a sheet-definition in the input data structure array. If found it will return the data structure for the sheet given as $sheet (if found).
 	 * If the sheet definition is in an external file that file is parsed and the data structure inside of that is returned.
 	 * Usage: 5
Index: t3lib/class.t3lib_tcemain.php
===================================================================
--- t3lib/class.t3lib_tcemain.php	(Revision 2512)
+++ t3lib/class.t3lib_tcemain.php	(Arbeitskopie)
@@ -1235,11 +1235,12 @@
 		}
 
 			// Get current value:
-		$curValueRec = $this->recordInfo($table,$id,$field);
+		$typeField = $TCA[$table]['ctrl']['type'];
+		$curValueRec = $this->recordInfo($table, $id, $field.($typeField ? ','.$typeField : ''));
 		$curValue = $curValueRec[$field];
 
 			// Getting config for the field
-		$tcaFieldConf = $TCA[$table]['columns'][$field]['config'];
+		$tcaFieldConf = t3lib_div::getFieldConfiguration($table, $field, $curValueRec, 'config');
 
 			// Preform processing:
 		$res = $this->checkValue_SW($res,$value,$tcaFieldConf,$table,$id,$curValue,$status,$realPid,$recFID,$field,$this->uploadedFileArray[$table][$id][$field],$tscPID);
@@ -2564,7 +2565,7 @@
 						if (!in_array($field,$nonFields))	{
 
 								// Get TCA configuration for the field:
-							$conf = $TCA[$table]['columns'][$field]['config'];
+							$conf = t3lib_div::getFieldConfiguration($table, $field, $row, 'config');
 
 								// Preparation/Processing of the value:
 							if ($field=='pid')	{	// "pid" is hardcoded of course:
@@ -2751,7 +2752,7 @@
 						if (!in_array($field,$nonFields))	{
 
 								// Get TCA configuration for the field:
-							$conf = $TCA[$table]['columns'][$field]['config'];
+							$conf = t3lib_div::getFieldConfiguration($table, $field, $row, 'config');
 							if (is_array($conf))	{
 									// Processing based on the TCA config field type (files, references, flexforms...)
 								$value = $this->copyRecord_procBasedOnFieldType($table,$uid,$field,$value,$row,$conf,$pid);
@@ -3769,7 +3770,7 @@
 						if ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($mres))	{
 							$fArray = $fileFieldArr;
 							foreach($fArray as $theField)	{	// MISSING: Support for MM file relations!
-								$this->extFileFunctions($table,$theField,$row[$theField],'deleteAll');		// This deletes files that belonged to this record.
+								$this->extFileFunctions($table,$theField,$row,'deleteAll');		// This deletes files that belonged to this record.
 							}
 						} else {
 							$this->log($table,$uid,3,0,100,'Delete: Zero rows in result when trying to read filenames from record which should be deleted');
@@ -4782,7 +4783,7 @@
 	function getVersionizedIncomingFieldArray($table, $id, &$incomingFieldArray, &$registerDBList) {
 		if (is_array($registerDBList[$table][$id])) {
 			foreach ($incomingFieldArray as $field => $value) {
-				$fieldConf = $GLOBALS['TCA'][$table]['columns'][$field]['config'];
+				$fieldConf = t3lib_div::getFieldConfiguration($table, $field, $incomingFieldArray, 'config');
 				if ($registerDBList[$table][$id][$field] && $foreignTable = $fieldConf['foreign_table']) {
 					$newValueArray = array();
 					$origValueArray = explode(',', $value);
@@ -6218,14 +6219,15 @@
 	 *
 	 * @param	string		Table name
 	 * @param	string		Field name
-	 * @param	string		List of files to work on from field
+	 * @param	string		Record row
 	 * @param	string		Function, eg. "deleteAll" which will delete all files listed.
 	 * @return	void
 	 */
-	function extFileFunctions($table,$field,$filelist,$func)	{
+	function extFileFunctions($table,$field,$row,$func)	{
 		global $TCA;
 		t3lib_div::loadTCA($table);
-		$uploadFolder = $TCA[$table]['columns'][$field]['config']['uploadfolder'];
+		$uploadFolder = t3lib_div::getFieldConfiguration($table, $field, $row, 'config/uploadfolder');
+		$filelist = $row[$field];
 		if ($uploadFolder && trim($filelist))	{
 			$uploadPath = $this->destPathFromUploadFolder($uploadFolder);
 			$fileArray = explode(',',$filelist);
