Project

General

Profile

Bug #16166 » 3531_t3lib_tcemain-all-tables3.diff

Administrator Admin, 2007-07-25 22:29

View differences:

class.t3lib_tcemain.php (.../branches/bug-3531/t3lib) (Revision 81)
}
}
// traverse through all columns and check for mm-refs to update
foreach ($TCA[$table]['columns'] as $col) {
if ($col['config']['MM'] != '') {
$addWhere = ' AND tablenames="'.$table.'"';
if (is_array($col['config']['MM_match_fields'])) {
foreach ($col['config']['MM_match_fields'] as $field_name => $field_value) {
$addWhere .= ' AND '.$field_name.'="'.$field_value.'"';
}
}
// first swap the records for the new element to the negative uid
$GLOBALS['TYPO3_DB']->exec_UPDATEquery($col['config']['MM'], 'uid_foreign='.$swapWith.$addWhere, Array('uid_foreign' => -$swapWith));
// then swap the old record to the new uid
$GLOBALS['TYPO3_DB']->exec_UPDATEquery($col['config']['MM'], 'uid_foreign='.$id.$addWhere, Array('uid_foreign' => $swapWith));
// and then finally swap the new record to the old uid
$GLOBALS['TYPO3_DB']->exec_UPDATEquery($col['config']['MM'], 'uid_foreign=-'.$swapWith.$addWhere, Array('uid_foreign' => $id));
}
}
if (!count($sqlErrors)) {
// Checking for delete:
(10-10/13)