diff --git a/Classes/Mapping/AbstractMapping.php b/Classes/Mapping/AbstractMapping.php index fed910d..b2ffbe4 100644 --- a/Classes/Mapping/AbstractMapping.php +++ b/Classes/Mapping/AbstractMapping.php @@ -810,10 +810,17 @@ protected function importObjectWithDimensionMappings(array $data, $object, Event $GLOBALS['TSFE']->config['sys_language_uid'] = 0; $GLOBALS['TSFE']->settingLanguage(); + // the soft delete feature needs to be taken into account, otherwise a deleted record might be updated + // and thus will not have any effect in the frontend and backend + $softDeleteField = $this->getSoftDeleteFieldForTable($this->getTableName()); + if ($softDeleteField !== '') { + $softDeleteField = ' AND ' . $softDeleteField . ' = 0'; + } + $existingRow = $GLOBALS['TYPO3_DB']->exec_SELECTgetSingleRow( 'uid,l10n_parent,sys_language_uid', $this->getTableName(), - 'sys_language_uid = ' . $languageUid . ' AND l10n_parent = ' . $object->getUid() + 'sys_language_uid = ' . $languageUid . ' AND l10n_parent = ' . $object->getUid() . $softDeleteField ); $translationObject = $this->createObject($event, $languageUid, $object->getUid(), $existingRow); @@ -832,6 +839,14 @@ protected function importObjectWithDimensionMappings(array $data, $object, Event return $mappingProblemsOccurred; } + protected function getSoftDeleteFieldForTable(string $tablename): string + { + if (! empty($GLOBALS['TCA'][$tablename]['ctrl']['delete'])) { + return $GLOBALS['TCA'][$tablename]['ctrl']['delete']; + } + return ''; + } + protected function logProblem($message) { GeneralUtility::makeInstance(LogManager::class)->getLogger(__CLASS__)->alert($message);