Index: trunk/core/kernel/utility/temp_handler.php =================================================================== diff -u -r2794 -r2795 --- trunk/core/kernel/utility/temp_handler.php (.../temp_handler.php) (revision 2794) +++ trunk/core/kernel/utility/temp_handler.php (.../temp_handler.php) (revision 2795) @@ -25,6 +25,8 @@ var $FinalRefs = Array(); + var $CopiedTables = Array(); + /** * Description * @@ -301,7 +303,9 @@ $ids = join(',', $ids); } - if ($ids != '') { + $table_sig = $master['TableName'].(isset($master['Constrain']) ? $master['Constrain'] : ''); + + if ($ids != '' && !in_array($table_sig, $this->CopiedTables)) { if ( getArrayValue($master, 'ForeignKey') ) { if ( is_array($master['ForeignKey']) ) { $key_field = $master['ForeignKey'][$parent_prefix]; @@ -320,6 +324,8 @@ if (isset($master['Constrain'])) $query .= ' AND '.$master['Constrain']; $this->Conn->Query($query); + $this->CopiedTables[] = $table_sig; + $query = 'SELECT '.$master['IdField'].' FROM '.$master['TableName'].' WHERE '.$key_field.' IN ('.$ids.')'; if (isset($master['Constrain'])) $query .= ' AND '.$master['Constrain'];