Index: trunk/core/kernel/utility/temp_handler.php =================================================================== diff -u -r3703 -r3845 --- trunk/core/kernel/utility/temp_handler.php (.../temp_handler.php) (revision 3703) +++ trunk/core/kernel/utility/temp_handler.php (.../temp_handler.php) (revision 3845) @@ -119,7 +119,8 @@ 'Prefix' => $prefix, 'TableId' => $this->TableIdCounter++, ); - + $this->FinalRefs[ $tables['TableName'] ] = $tables['TableId']; // don't forget to add main table to FinalRefs too + $SubItems = $this->Application->getUnitOption($prefix,'SubItems'); if (is_array($SubItems)) { foreach ($SubItems as $prefix) { @@ -287,7 +288,7 @@ $sub_ids = $this->Conn->GetCol($query); - $parent_key = $object->GetDBField($sub_table['ParentTableKey']); + $parent_key = $object->GetDBField(is_array($sub_table['ParentTableKey']) ? $sub_table['ParentTableKey'][$prefix] : $sub_table['ParentTableKey']); $this->DeleteItems($sub_table['Prefix'], '', $sub_ids, $sub_table, $parent_key); }