--- orig\t3lib\class.t3lib_loaddbgroup.php 2011-10-18 11:22:01.000000000 +0200 +++ new\t3lib\class.t3lib_loaddbgroup.php 2011-11-02 16:29:46.132647900 +0100 @@ -539,6 +539,9 @@ $foreign_table_field = $conf['foreign_table_field']; $useDeleteClause = $this->undeleteRecord ? FALSE : TRUE; +// KIOS +$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']) { $whereClause = '(' . $conf['foreign_field'] . '=' . $uid . ' OR ' . $conf['symmetric_field'] . '=' . $uid . ')'; @@ -555,6 +558,12 @@ $whereClause .= ' AND ' . $foreign_table_field . '=' . $GLOBALS['TYPO3_DB']->fullQuoteStr($this->currentTable, $foreign_table); } +// KIOS + // 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); @@ -614,6 +623,9 @@ $symmetric_field = $conf['symmetric_field']; $foreign_table_field = $conf['foreign_table_field']; +// KIOS +$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_div::testInt($parentUid) && count($this->tableArray)) { // if updateToUid is not a positive integer, set it to '0', so it will be ignored @@ -647,6 +659,10 @@ } $updateValues = array(); + +// KIOS +$updateValues = $foreign_match_fields; + $workspaceValues = array(); // no update to the uid is requested, so this is the normal behaviour