Index: trunk/core/kernel/utility/temp_handler.php =================================================================== diff -u -r2797 -r2799 --- trunk/core/kernel/utility/temp_handler.php (.../temp_handler.php) (revision 2797) +++ trunk/core/kernel/utility/temp_handler.php (.../temp_handler.php) (revision 2799) @@ -135,6 +135,7 @@ 'TableName' => $this->Application->getUnitOption($prefix,'TableName'), 'IdField' => $this->Application->getUnitOption($prefix,'IDField'), 'ForeignKey' => $this->Application->getUnitOption($prefix,'ForeignKey'), + 'ParentPrefix' => $this->Application->getUnitOption($prefix, 'ParentPrefix'), 'ParentTableKey' => $this->Application->getUnitOption($prefix,'ParentTableKey'), 'Prefix' => $prefix, 'AutoClone' => $this->Application->getUnitOption($prefix,'AutoClone'), @@ -163,7 +164,7 @@ $tables['SubTables'][] = $tmp; } - function CloneItems($prefix, $special, $ids, $master=null, $foreign_key=null, $parent_prefix=null) + function CloneItems($prefix, $special, $ids, $master=null, $foreign_key=null) { if (!isset($master)) $master = $this->Tables; if( strpos($prefix,'.') !== false ) list($prefix,$special) = explode('.', $prefix, 2); @@ -194,7 +195,7 @@ $object->NameCopy($master, $foreign_key); if (isset($foreign_key)) { - $master_foreign_key_field = is_array($master['ForeignKey']) ? $master['ForeignKey'][$parent_prefix] : $master['ForeignKey']; + $master_foreign_key_field = is_array($master['ForeignKey']) ? $master['ForeignKey'][ $master['ParentPrefix'] ] : $master['ForeignKey']; $object->SetDBField($master_foreign_key_field, $foreign_key); } @@ -240,7 +241,7 @@ $parent_key = $object->GetDBField($parent_key_field); - $this->CloneItems($sub_table['Prefix'], '', $sub_ids, $sub_table, $parent_key, $master['Prefix']); + $this->CloneItems($sub_table['Prefix'], '', $sub_ids, $sub_table, $parent_key); } } }