Index: t3lib/class.t3lib_transl8tools.php =================================================================== --- t3lib/class.t3lib_transl8tools.php (révision 8742) +++ t3lib/class.t3lib_transl8tools.php (copie de travail) @@ -146,41 +146,48 @@ if (is_array($row)) { $trTable = $this->getTranslationTable($table); if ($trTable) { - if ($trTable!==$table || $row[$TCA[$table]['ctrl']['languageField']] <= 0) { - if ($trTable!==$table || $row[$TCA[$table]['ctrl']['transOrigPointerField']] == 0) { + $transOrigPointerField = $TCA[$trTable]['ctrl']['transOrigPointerField']; + $the_sys_language_uid = intval($row[$TCA[$table]['ctrl']['languageField']]); - // Look for translations of this record, index by language field value: - $translationsTemp = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows( - ($selFieldList ? $selFieldList : 'uid,'.$TCA[$trTable]['ctrl']['languageField']), - $trTable, - $TCA[$trTable]['ctrl']['transOrigPointerField'] . '=' . intval($uid) . - ' AND pid=' . intval($table === 'pages' ? $row['uid'] : $row['pid']). // Making exception for pages of course where the translations will always be ON the page, not on the level above... - ' AND '.$TCA[$trTable]['ctrl']['languageField'].(!$sys_language_uid ? '>0' : '='.intval($sys_language_uid)). - t3lib_BEfunc::deleteClause($trTable). - t3lib_BEfunc::versioningPlaceholderClause($trTable) - ); + if ($TCA[$table]['ctrl']['transOrigPointerTable'] != '' || $the_sys_language_uid > 0) { + $wherePart1 = $transOrigPointerField . '=' . intval($row[$transOrigPointerField]); + } else { + $wherePart1 = $transOrigPointerField . '=' . intval($uid); + } + $where = + $wherePart1 . + ' AND pid=' . intval($table === 'pages' ? $row['uid'] : $row['pid']) . // Making exception for pages of course where the translations will always be ON the page, not on the level above... + ' AND ' . $TCA[$trTable]['ctrl']['languageField'] . (!$sys_language_uid ? ' NOT IN (0,'.$the_sys_language_uid.')' : '=' . intval($sys_language_uid)) . + t3lib_BEfunc::deleteClause($trTable) . + t3lib_BEfunc::versioningPlaceholderClause($trTable); - $translations = array(); - $translations_errors = array(); - foreach($translationsTemp as $r) { - if (!isset($translations[$r[$TCA[$trTable]['ctrl']['languageField']]])) { - $translations[$r[$TCA[$trTable]['ctrl']['languageField']]] = $r; - } else { - $translations_errors[$r[$TCA[$trTable]['ctrl']['languageField']]][] = $r; - } - } + // Look for translations of this record, index by language field value: + $translationRows = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows( + ($selFieldList ? $selFieldList : 'uid,'.$TCA[$trTable]['ctrl']['languageField']), + $trTable, + $where + ); - return array( - 'table' => $table, - 'uid' => $uid, - 'CType' => $row['CType'], - 'sys_language_uid' => $row[$TCA[$table]['ctrl']['languageField']], - 'translation_table' => $trTable, - 'translations' => $translations, - 'excessive_translations' => $translations_errors - ); - } else return 'Record "'.$table.'_'.$uid.'" seems to be a translation already (has a relation to record "'.$row[$TCA[$table]['ctrl']['transOrigPointerField']].'")'; - } else return 'Record "'.$table.'_'.$uid.'" seems to be a translation already (has a language value "'.$row[$TCA[$table]['ctrl']['languageField']].'", relation to record "'.$row[$TCA[$table]['ctrl']['transOrigPointerField']].'")'; + $translations = array(); + $translations_errors = array(); + + foreach($translationRows as $r) { + if (!isset($translations[$r[$TCA[$trTable]['ctrl']['languageField']]])) { + $translations[$r[$TCA[$trTable]['ctrl']['languageField']]] = $r; + } else { + $translations_errors[$r[$TCA[$trTable]['ctrl']['languageField']]][] = $r; + } + } + + return array( + 'table' => $table, + 'uid' => $uid, + 'CType' => $row['CType'], + 'sys_language_uid' => $row[$TCA[$table]['ctrl']['languageField']], + 'translation_table' => $trTable, + 'translations' => $translations, + 'excessive_translations' => $translations_errors + ); } else return 'Translation is not supported for this table!'; } else return 'Record "'.$table.'_'.$uid.'" was not found'; } else return 'No table "'.$table.'" or no UID value'; @@ -205,7 +212,7 @@ function isTranslationInOwnTable($table) { global $TCA; - return $TCA[$table]['ctrl']['languageField'] && $TCA[$table]['ctrl']['transOrigPointerField'] && !$TCA[$table]['ctrl']['transOrigPointerTable']; + return $TCA[$table]['ctrl']['languageField'] && $TCA[$table]['ctrl']['transOrigPointerField']; } /** Index: typo3/class.db_list.inc =================================================================== --- typo3/class.db_list.inc (révision 8742) +++ typo3/class.db_list.inc (copie de travail) @@ -288,6 +288,7 @@ } else { $fields = array(); } + $addWhere = ''; // Find ID to use (might be different for "versioning_followPages" tables) if (intval($this->searchLevels)==0) { @@ -297,9 +298,9 @@ $this->pidSelect = 'pid='.intval($this->id); } } // Finally, render the list: - $this->HTMLcode.=$this->getTable($tableName, $this->id, implode(',',$fields)); + $this->HTMLcode.=$this->getTable($tableName, $this->id, implode(',',$fields), $addWhere); } } } @@ -745,9 +746,8 @@ $fieldListArr = array(); // Check table: - if (is_array($TCA[$table])) { + if (is_array($TCA[$table]) && isset($TCA[$table]['columns']) && is_array($TCA[$table]['columns'])) { t3lib_div::loadTCA($table); - // Traverse configured columns and add them to field array, if available for user. foreach($TCA[$table]['columns'] as $fN => $fieldValue) { if ($dontCheckUser || Index: typo3/class.db_list_extra.inc =================================================================== --- typo3/class.db_list_extra.inc (révision 8742) +++ typo3/class.db_list_extra.inc (copie de travail) @@ -292,24 +292,94 @@ } /** + * Creates the SQL selection field list + * + * @param string Table name + * @return array List of fields to show in the listing. Pseudo fields will be added including the record header. + */ + function getSelectionFieldList($table,$l10nEnabled,$thumbsCol) { + global $TCA, $TYPO3_CONF_VARS; + + // Creating the list of fields to include in the SQL query: + $selectFields = $this->fieldArray; + $selectFields[] = 'uid'; + $selectFields[] = 'pid'; + if ($thumbsCol) $selectFields[] = $thumbsCol; // adding column for thumbnails + if ($table=='pages') { + if (t3lib_extMgm::isLoaded('cms')) { + $selectFields[] = 'module'; + $selectFields[] = 'extendToSubpages'; + $selectFields[] = 'nav_hide'; + } + $selectFields[] = 'doktype'; + } + if (is_array($TCA[$table]['ctrl']['enablecolumns'])) { + $selectFields = array_merge($selectFields,$TCA[$table]['ctrl']['enablecolumns']); + } + if ($TCA[$table]['ctrl']['type']) { + $selectFields[] = $TCA[$table]['ctrl']['type']; + } + if ($TCA[$table]['ctrl']['typeicon_column']) { + $selectFields[] = $TCA[$table]['ctrl']['typeicon_column']; + } + if ($TCA[$table]['ctrl']['versioningWS']) { + $selectFields[] = 't3ver_id'; + $selectFields[] = 't3ver_state'; + $selectFields[] = 't3ver_wsid'; + $selectFields[] = 't3ver_swapmode'; // Filtered out when pages in makeFieldList() + } + if ($l10nEnabled || $TCA[$table]['ctrl']['transOrigPointerTable']) { + $selectFields[] = $TCA[$table]['ctrl']['languageField']; + $selectFields[] = $TCA[$table]['ctrl']['transOrigPointerField']; + } + if ($TCA[$table]['ctrl']['label_alt']) { + $selectFields = array_merge($selectFields,t3lib_div::trimExplode(',',$TCA[$table]['ctrl']['label_alt'],1)); + } + $selectFields = array_unique($selectFields); // Unique list! + $selectFields = array_intersect($selectFields,$this->makeFieldList($table,1)); // Making sure that the fields in the field-list ARE in the field-list from TCA! + $selFieldList = implode(',',$selectFields); // implode it into a list of fields for the SQL-statement. + return $selFieldList; + } + + /** * Creates the listing of records from a single table * * @param string Table name * @param integer Page id * @param string List of fields to show in the listing. Pseudo fields will be added including the record header. + * @param string filter SQL clause * @return string HTML table with the listing for the record. */ - function getTable($table,$id,$rowlist) { + function getTable($table,$id,$rowlist,$addWhere='') { global $TCA, $TYPO3_CONF_VARS; // Loading all TCA details for this table: t3lib_div::loadTCA($table); // Init - $addWhere = ''; $titleCol = $TCA[$table]['ctrl']['label']; $thumbsCol = $TCA[$table]['ctrl']['thumbnail']; $l10nEnabled = $TCA[$table]['ctrl']['languageField'] && $TCA[$table]['ctrl']['transOrigPointerField'] && !$TCA[$table]['ctrl']['transOrigPointerTable']; + + $lForeignEnabled = $TCA[$table]['ctrl']['transForeignTable'] != ''; + if ($TCA[$table]['ctrl']['transOrigPointerField']) { + $transOrigPointerTable = $TCA[$table]['ctrl']['transOrigPointerTable']; + } + $transTable = $table; + + if ($lForeignEnabled) { + $transTable = $TCA[$table]['ctrl']['transForeignTable']; + if ($transTable != $table) { + // Loading all TCA details for this table: + t3lib_div::loadTCA($transTable); + } + } + if ($transOrigPointerTable) { + if ($transOrigPointerTable != $table) { + // Loading all TCA details for this table: + t3lib_div::loadTCA($transOrigPointerTable); + } + } $tableCollapsed = (!$this->tablesCollapsed[$table]) ? false : true; // prepare space icon @@ -338,14 +408,21 @@ $this->fieldArray[]='_PATH_'; } // Localization - if ($this->localizationView && $l10nEnabled) { - $this->fieldArray[] = '_LOCALIZATION_'; - $this->fieldArray[] = '_LOCALIZATION_b'; - $addWhere.=' AND ( - '.$TCA[$table]['ctrl']['languageField'].'<=0 - OR - '.$TCA[$table]['ctrl']['transOrigPointerField'].' = 0 - )'; + if ($this->localizationView) { + if ($l10nEnabled) { + $this->fieldArray[] = '_LOCALIZATION_'; + $this->fieldArray[] = '_LOCALIZATION_b'; + $addWhere.=' AND ( + '.$TCA[$table]['ctrl']['languageField'].'<=0 + OR + '.$TCA[$table]['ctrl']['transOrigPointerField'].' = 0 + )'; + + } else if ($lForeignEnabled || $transOrigPointerTable) { + $this->fieldArray[] = '_LOCALIZATION_'; + $this->fieldArray[] = '_LOCALIZATION_b'; + } } // Cleaning up: $this->fieldArray=array_unique(array_merge($this->fieldArray,t3lib_div::trimExplode(',',$rowlist,1))); @@ -356,45 +433,7 @@ $this->fieldArray = array_keys($tempArray); } - // Creating the list of fields to include in the SQL query: - $selectFields = $this->fieldArray; - $selectFields[] = 'uid'; - $selectFields[] = 'pid'; - if ($thumbsCol) $selectFields[] = $thumbsCol; // adding column for thumbnails - if ($table=='pages') { - if (t3lib_extMgm::isLoaded('cms')) { - $selectFields[] = 'module'; - $selectFields[] = 'extendToSubpages'; - $selectFields[] = 'nav_hide'; - } - $selectFields[] = 'doktype'; - } - if (is_array($TCA[$table]['ctrl']['enablecolumns'])) { - $selectFields = array_merge($selectFields,$TCA[$table]['ctrl']['enablecolumns']); - } - if ($TCA[$table]['ctrl']['type']) { - $selectFields[] = $TCA[$table]['ctrl']['type']; - } - if ($TCA[$table]['ctrl']['typeicon_column']) { - $selectFields[] = $TCA[$table]['ctrl']['typeicon_column']; - } - if ($TCA[$table]['ctrl']['versioningWS']) { - $selectFields[] = 't3ver_id'; - $selectFields[] = 't3ver_state'; - $selectFields[] = 't3ver_wsid'; - $selectFields[] = 't3ver_swapmode'; // Filtered out when pages in makeFieldList() - } - if ($l10nEnabled) { - $selectFields[] = $TCA[$table]['ctrl']['languageField']; - $selectFields[] = $TCA[$table]['ctrl']['transOrigPointerField']; - } - if ($TCA[$table]['ctrl']['label_alt']) { - $selectFields = array_merge($selectFields,t3lib_div::trimExplode(',',$TCA[$table]['ctrl']['label_alt'],1)); - } - $selectFields = array_unique($selectFields); // Unique list! - $selectFields = array_intersect($selectFields,$this->makeFieldList($table,1)); // Making sure that the fields in the field-list ARE in the field-list from TCA! - $selFieldList = implode(',',$selectFields); // implode it into a list of fields for the SQL-statement. - $this->selFieldList = $selFieldList; + $selFieldList = $this->getSelectionFieldList($table,$l10nEnabled,$thumbsCol); /** * @hook DB-List getTable @@ -558,29 +601,49 @@ $iOut = ''; $cc = 0; - + $transThumbsCol = $thumbsCol; + if ($lForeignEnabled) { + $transThumbsCol = $TCA[$transTable]['ctrl']['thumbnail']; + $selFieldList = $this->getSelectionFieldList($transTable,TRUE,$transThumbsCol); + } + $pageStartWhere = ($table != 'pages' && $table != 'pages_language_overlay' ? 'pid=' . $id . ' AND ' : ''); foreach($accRows as $row) { // Render item row if counter < limit if ($cc < $this->iLimit) { $cc++; - $this->translations = FALSE; + $translations = FALSE; $iOut.= $this->renderListRow($table,$row,$cc,$titleCol,$thumbsCol); // If localization view is enabled it means that the selected records are either default or All language and here we will not select translations which point to the main record: - if ($this->localizationView && $l10nEnabled) { + if ($this->localizationView) { + + if ($l10nEnabled || $lForeignEnabled) { + + // Look for translations of this record: + $translations = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows( + $selFieldList, + $transTable, + $pageStartWhere . + $TCA[$transTable]['ctrl']['languageField'] . '>0' . + ' AND ' . $TCA[$transTable]['ctrl']['transOrigPointerField'] . '=' . intval($row['uid']) . + t3lib_BEfunc::deleteClause($transTable) . + t3lib_BEfunc::versioningPlaceholderClause($transTable) + ); + } + // For each available translation, render the record: - if (is_array($this->translations)) { - foreach ($this->translations as $lRow) { + if (is_array($translations)) { + foreach ($translations as $lRow) { // $lRow isn't always what we want - if record was moved we've to work with the placeholder records otherwise the list is messed up a bit if ($row['_MOVE_PLH_uid'] && $row['_MOVE_PLH_pid']) { - $tmpRow = t3lib_BEfunc::getRecordRaw($table, 't3ver_move_id="'.intval($lRow['uid']) . '" AND pid="' . $row['_MOVE_PLH_pid'] . '" AND t3ver_wsid=' . $row['t3ver_wsid'] . t3lib_beFunc::deleteClause($table), $selFieldList); + $tmpRow = t3lib_BEfunc::getRecordRaw($transTable, 't3ver_move_id="'.intval($lRow['uid']) . '" AND pid="' . $row['_MOVE_PLH_pid'] . '" AND t3ver_wsid=' . $row['t3ver_wsid'] . t3lib_beFunc::deleteClause($transTable), $selFieldList); $lRow = is_array($tmpRow)?$tmpRow:$lRow; } // In offline workspace, look for alternative record: - t3lib_BEfunc::workspaceOL($table, $lRow, $GLOBALS['BE_USER']->workspace, true); - if (is_array($lRow) && $GLOBALS['BE_USER']->checkLanguageAccess($lRow[$TCA[$table]['ctrl']['languageField']])) { + t3lib_BEfunc::workspaceOL($transTable, $lRow, $GLOBALS['BE_USER']->workspace, true); + if (is_array($lRow) && $GLOBALS['BE_USER']->checkLanguageAccess($lRow[$TCA[$transTable]['ctrl']['languageField']])) { $currentIdList[] = $lRow['uid']; - $iOut.=$this->renderListRow($table,$lRow,$cc,$titleCol,$thumbsCol,18); + $iOut.=$this->renderListRow($transTable,$lRow,$cc,$titleCol,$thumbsCol,18); } } } @@ -913,7 +976,7 @@ // If mod.web_list.newContentWiz.overrideWithExtension is set, use that extension's create new content wizard instead: $tmpTSc = t3lib_BEfunc::getModTSconfig($this->pageinfo['uid'],'mod.web_list'); $tmpTSc = $tmpTSc ['properties']['newContentWiz.']['overrideWithExtension']; - $newContentWizScriptPath = $this->backPath.t3lib_extMgm::isLoaded($tmpTSc) ? (t3lib_extMgm::extRelPath($tmpTSc).'mod1/db_new_content_el.php') : 'sysext/cms/layout/db_new_content_el.php'; + $newContentWizScriptPath = $this->backPath.t3lib_extMgm::isLoaded($tmpTSc) ? (t3lib_extMgm::extRelPath($tmpTSc).'mod1/db_new_content_el.php') : $this->backPath . 'typo3/sysext/cms/layout/db_new_content_el.php'; $icon = ''. ($table == 'pages' ? t3lib_iconWorks::getSpriteIcon('actions-page-new') : t3lib_iconWorks::getSpriteIcon('actions-document-new')) . @@ -1559,17 +1622,19 @@ ); $translations = $this->translateTools->translationInfo($table, $row['uid'], 0, $row, $this->selFieldList); - $this->translations = $translations['translations']; + $languageField = $TCA[$table]['ctrl']['languageField']; + $sys_language_uid = intval($row[$languageField]); // Language title and icon: - $out[0] = $this->languageFlag($row[$TCA[$table]['ctrl']['languageField']]); + $out[0] = $this->languageFlag($sys_language_uid); if (is_array($translations)) { // Traverse page translations and add icon for each language that does NOT yet exist: $lNew = ''; foreach($this->pageOverlays as $lUid_OnPage => $lsysRec) { - if (!isset($translations['translations'][$lUid_OnPage]) && $GLOBALS['BE_USER']->checkLanguageAccess($lUid_OnPage)) { + if (!isset($translations['translations'][$lUid_OnPage]) && ($sys_language_uid != $lUid_OnPage) && $GLOBALS['BE_USER']->checkLanguageAccess($lUid_OnPage)) { + $url = substr($this->listURL(), strlen($this->backPath)); $href = $GLOBALS['SOBE']->doc->issueCommand( '&cmd[' . $table . '][' . $row['uid'] . '][localize]=' . $lUid_OnPage, Index: t3lib/class.t3lib_tcemain.php =================================================================== --- t3lib/class.t3lib_tcemain.php (révision 8742) +++ t3lib/class.t3lib_tcemain.php (copie de travail) @@ -3895,81 +3895,85 @@ if ($TCA[$table] && $uid) { t3lib_div::loadTCA($table); - if (($TCA[$table]['ctrl']['languageField'] && $TCA[$table]['ctrl']['transOrigPointerField'] && !$TCA[$table]['ctrl']['transOrigPointerTable']) || $table==='pages') { + if ($TCA[$table]['ctrl']['transForeignTable'] != '') { + $Ttable = $TCA[$table]['ctrl']['transForeignTable']; + } + + if (($TCA[$table]['ctrl']['languageField'] && $TCA[$table]['ctrl']['transOrigPointerField']) || $Ttable != '') { if ($langRec = t3lib_BEfunc::getRecord('sys_language',intval($language),'uid,title')) { if ($this->doesRecordExist($table,$uid,'show')) { $row = t3lib_BEfunc::getRecordWSOL($table,$uid); // Getting workspace overlay if possible - this will localize versions in workspace if any if (is_array($row)) { - if ($row[$TCA[$table]['ctrl']['languageField']] <= 0 || $table==='pages') { - if ($row[$TCA[$table]['ctrl']['transOrigPointerField']] == 0 || $table==='pages') { - if ($table==='pages') { - $pass = $TCA[$table]['ctrl']['transForeignTable']==='pages_language_overlay' && !t3lib_BEfunc::getRecordsByField('pages_language_overlay','pid',$uid,' AND '.$TCA['pages_language_overlay']['ctrl']['languageField'].'='.intval($langRec['uid'])); - $Ttable = 'pages_language_overlay'; - t3lib_div::loadTCA($Ttable); - } else { - $pass = !t3lib_BEfunc::getRecordLocalization($table, $uid, $langRec['uid'], 'AND pid='.intval($row['pid'])); - $Ttable = $table; - } + if ($Ttable != '') { + if ($table==='pages') { + $pass = $TCA[$table]['ctrl']['transForeignTable']==='pages_language_overlay' && !t3lib_BEfunc::getRecordsByField('pages_language_overlay','pid',$uid,' AND '.$TCA['pages_language_overlay']['ctrl']['languageField'].'='.intval($langRec['uid'])); + $Ttable = 'pages_language_overlay'; + t3lib_div::loadTCA($Ttable); + } else { + $pass = !t3lib_BEfunc::getRecordsByField($Ttable, $TCA[$Ttable]['ctrl']['transOrigPointerField'], $uid, ' AND ' . $TCA[$Ttable]['ctrl']['languageField'] . '=' . intval($langRec['uid'])); + } + } else { + $pass = !t3lib_BEfunc::getRecordLocalization($table, $uid, $langRec['uid'], 'AND pid='.intval($row['pid'])); + $Ttable = $table; + } - if ($pass) { + if ($pass) { - // Initialize: - $overrideValues = array(); - $excludeFields = array(); + // Initialize: + $overrideValues = array(); + $excludeFields = array(); - // Set override values: - $overrideValues[$TCA[$Ttable]['ctrl']['languageField']] = $langRec['uid']; - $overrideValues[$TCA[$Ttable]['ctrl']['transOrigPointerField']] = $uid; + // Set override values: + $overrideValues[$TCA[$Ttable]['ctrl']['languageField']] = $langRec['uid']; + $overrideValues[$TCA[$Ttable]['ctrl']['transOrigPointerField']] = $uid; - // Set exclude Fields: - foreach($TCA[$Ttable]['columns'] as $fN => $fCfg) { - if ($fCfg['l10n_mode']=='prefixLangTitle') { // Check if we are just prefixing: - if (($fCfg['config']['type']=='text' || $fCfg['config']['type']=='input') && strlen($row[$fN])) { - list($tscPID) = t3lib_BEfunc::getTSCpid($table,$uid,''); - $TSConfig = $this->getTCEMAIN_TSconfig($tscPID); + // Set exclude Fields: + foreach($TCA[$Ttable]['columns'] as $fN => $fCfg) { + if ($fCfg['l10n_mode']=='prefixLangTitle') { // Check if we are just prefixing: + if (($fCfg['config']['type']=='text' || $fCfg['config']['type']=='input') && strlen($row[$fN])) { + list($tscPID) = t3lib_BEfunc::getTSCpid($table,$uid,''); + $TSConfig = $this->getTCEMAIN_TSconfig($tscPID); - if (isset($TSConfig['translateToMessage']) && strlen($TSConfig['translateToMessage'])) { - $translateToMsg = @sprintf($TSConfig['translateToMessage'], $langRec['title']); - } - if (!strlen($translateToMsg)) { - $translateToMsg = 'Translate to '.$langRec['title'].':'; - } + if (isset($TSConfig['translateToMessage']) && strlen($TSConfig['translateToMessage'])) { + $translateToMsg = @sprintf($TSConfig['translateToMessage'], $langRec['title']); + } + if (!strlen($translateToMsg)) { + $translateToMsg = 'Translate to '.$langRec['title'].':'; + } - $overrideValues[$fN] = '['.$translateToMsg.'] '.$row[$fN]; - } - } elseif (t3lib_div::inList('exclude,noCopy,mergeIfNotBlank',$fCfg['l10n_mode']) && $fN!=$TCA[$Ttable]['ctrl']['languageField'] && $fN!=$TCA[$Ttable]['ctrl']['transOrigPointerField']) { // Otherwise, do not copy field (unless it is the language field or pointer to the original language) - $excludeFields[] = $fN; - } + $overrideValues[$fN] = '['.$translateToMsg.'] '.$row[$fN]; } + } elseif (t3lib_div::inList('exclude,noCopy,mergeIfNotBlank',$fCfg['l10n_mode']) && $fN!=$TCA[$Ttable]['ctrl']['languageField'] && $fN!=$TCA[$Ttable]['ctrl']['transOrigPointerField']) { // Otherwise, do not copy field (unless it is the language field or pointer to the original language) + $excludeFields[] = $fN; + } + } - if ($Ttable === $table) { + if ($Ttable === $table) { - // Execute the copy: - $newId = $this->copyRecord($table, $uid, -$uid, 1, $overrideValues, implode(',', $excludeFields), $language); - } else { + // Execute the copy: + $newId = $this->copyRecord($table, $uid, -$uid, 1, $overrideValues, implode(',', $excludeFields), $language); + } else { - // Create new record: - $copyTCE = t3lib_div::makeInstance('t3lib_TCEmain'); - /* @var $copyTCE t3lib_TCEmain */ - $copyTCE->stripslashes_values = 0; - $copyTCE->cachedTSconfig = $this->cachedTSconfig; // Copy forth the cached TSconfig - $copyTCE->dontProcessTransformations=1; // Transformations should NOT be carried out during copy + // Create new record: + $copyTCE = t3lib_div::makeInstance('t3lib_TCEmain'); + /* @var $copyTCE t3lib_TCEmain */ + $copyTCE->stripslashes_values = 0; + $copyTCE->cachedTSconfig = $this->cachedTSconfig; // Copy forth the cached TSconfig + $copyTCE->dontProcessTransformations=1; // Transformations should NOT be carried out during copy - $copyTCE->start(array($Ttable=>array('NEW'=>$overrideValues)),'',$this->BE_USER); - $copyTCE->process_datamap(); + $copyTCE->start(array($Ttable=>array('NEW'=>$overrideValues)),'',$this->BE_USER); + $copyTCE->process_datamap(); - // Getting the new UID as if it had been copied: - $theNewSQLID = $copyTCE->substNEWwithIDs['NEW']; - if ($theNewSQLID) { - // If is by design that $Ttable is used and not $table! See "l10nmgr" extension. Could be debated, but this is what I chose for this "pseudo case" - $this->copyMappingArray[$Ttable][$uid] = $theNewSQLID; - $newId = $theNewSQLID; - } - } - } else $this->newlog('Localization failed; There already was a localization for this language of the record!',1); - } else $this->newlog('Localization failed; Source record contained a reference to an original default record (which is strange)!',1); - } else $this->newlog('Localization failed; Source record had another language than "Default" or "All" defined!',1); + // Getting the new UID as if it had been copied: + $theNewSQLID = $copyTCE->substNEWwithIDs['NEW']; + if ($theNewSQLID) { + // If is by design that $Ttable is used and not $table! See "l10nmgr" extension. Could be debated, but this is what I chose for this "pseudo case" + $this->copyMappingArray[$Ttable][$uid] = $theNewSQLID; + $newId = $theNewSQLID; + } + } + } else $this->newlog('Localization failed; There already was a localization for this language of the record!',1); } else $this->newlog('Attempt to localize record that did not exist!',1); } else $this->newlog('Attempt to localize record without permission',1); } else $this->newlog('Sys language UID "'.$language.'" not found valid!',1);