diff --git a/t3lib/class.t3lib_loaddbgroup.php b/t3lib/class.t3lib_loaddbgroup.php index 12912c32b53244fb22e4ede6dbfe1be4a872a73d..c1327268b51d01447942c1e4e31178fae47ba866 100644 --- a/t3lib/class.t3lib_loaddbgroup.php +++ b/t3lib/class.t3lib_loaddbgroup.php @@ -514,6 +514,7 @@ class t3lib_loadDBGroup { $foreign_table = $conf['foreign_table']; $foreign_table_field = $conf['foreign_table_field']; $useDeleteClause = $this->undeleteRecord ? FALSE : TRUE; + $foreign_match_fields = is_array($conf['foreign_match_fields']) ? $conf['foreign_match_fields'] : array(); // search for $uid in foreign_field, and if we have symmetric relations, do this also on symmetric_field if ($conf['symmetric_field']) { @@ -531,6 +532,11 @@ class t3lib_loadDBGroup { $whereClause .= ' AND ' . $foreign_table_field . '=' . $GLOBALS['TYPO3_DB']->fullQuoteStr($this->currentTable, $foreign_table); } + // Add additional where clause if foreign_match_fields are defined + foreach ($foreign_match_fields as $field => $value) { + $whereClause .= ' AND ' . $field . '=' . $GLOBALS['TYPO3_DB']->fullQuoteStr($value, $foreign_table); + } + // Select children in the same workspace: if (t3lib_BEfunc::isTableWorkspaceEnabled($this->currentTable) && t3lib_BEfunc::isTableWorkspaceEnabled($foreign_table)) { $currentRecord = t3lib_BEfunc::getRecord($this->currentTable, $uid, 't3ver_wsid', '', $useDeleteClause); @@ -589,6 +595,7 @@ class t3lib_loadDBGroup { $foreign_field = $conf['foreign_field']; $symmetric_field = $conf['symmetric_field']; $foreign_table_field = $conf['foreign_table_field']; + $foreign_match_fields = is_array($conf['foreign_match_fields']) ? $conf['foreign_match_fields'] : array(); // if there are table items and we have a proper $parentUid if (t3lib_utility_Math::canBeInterpretedAsInteger($parentUid) && count($this->tableArray)) { @@ -622,7 +629,7 @@ class t3lib_loadDBGroup { $isOnSymmetricSide = t3lib_loadDBGroup::isOnSymmetricSide($parentUid, $conf, $row); } - $updateValues = array(); + $updateValues = $foreign_match_fields; $workspaceValues = array(); // no update to the uid is requested, so this is the normal behaviour