Index: branches/5.3.x/core/kernel/utility/temp_handler.php =================================================================== diff -u -N -r15677 -r15698 --- branches/5.3.x/core/kernel/utility/temp_handler.php (.../temp_handler.php) (revision 15677) +++ branches/5.3.x/core/kernel/utility/temp_handler.php (.../temp_handler.php) (revision 15698) @@ -1,6 +1,6 @@ TableIdCounter = 0; $this->WindowID = $this->Application->GetVar('m_wid'); - $this->TableIdCounter = 0; + $config = $this->Application->getUnitConfig($prefix); + $tables = Array( - 'TableName' => $this->Application->getUnitOption($prefix, 'TableName'), - 'IdField' => $this->Application->getUnitOption($prefix, 'IDField'), + 'TableName' => $config->getTableName(), + 'IdField' => $config->getIDField(), 'IDs' => $ids, 'Prefix' => $prefix, 'TableId' => $this->TableIdCounter++, ); - /*$parent_prefix = $this->Application->getUnitOption($prefix, 'ParentPrefix'); - if ($parent_prefix) { - $tables['ForeignKey'] = $this->Application->getUnitOption($prefix, 'ForeignKey'); + /*$config = $this->Application->getUnitConfig($prefix); + $parent_prefix = $config->getParentPrefix(); + + if ( $parent_prefix ) { + $tables['ForeignKey'] = $config->getForeignKey(); $tables['ParentPrefix'] = $parent_prefix; - $tables['ParentTableKey'] = $this->Application->getUnitOption($prefix, 'ParentTableKey'); + $tables['ParentTableKey'] = $config->getParentTableKey(); }*/ $this->FinalRefs[ $tables['TableName'] ] = $tables['TableId']; // don't forget to add main table to FinalRefs too - $sub_items = $this->Application->getUnitOption($prefix, 'SubItems', Array ()); - /* @var $sub_items Array */ + $sub_items = $this->Application->getUnitConfig($prefix)->getSubItems(Array ()); if ( is_array($sub_items) ) { foreach ($sub_items as $prefix) { @@ -230,28 +233,30 @@ return ; } + $config = $this->Application->getUnitConfig($prefix); + $tmp = Array( - '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'), + 'TableName' => $config->getTableName(), + 'IdField' => $config->getIDField(), + 'ForeignKey' => $config->getForeignKey(), + 'ParentPrefix' => $config->getParentPrefix(), + 'ParentTableKey' => $config->getParentTableKey(), 'Prefix' => $prefix, - 'AutoClone' => $this->Application->getUnitOption($prefix,'AutoClone'), - 'AutoDelete' => $this->Application->getUnitOption($prefix,'AutoDelete'), + 'AutoClone' => $config->getAutoClone(), + 'AutoDelete' => $config->getAutoDelete(), 'TableId' => $this->TableIdCounter++, ); $this->FinalRefs[ $tmp['TableName'] ] = $tmp['TableId']; - $constrain = $this->Application->getUnitOption($prefix, 'Constrain'); + $constrain = $config->getConstrain(); + if ( $constrain ) { $tmp['Constrain'] = $constrain; $this->FinalRefs[ $tmp['TableName'] . $tmp['Constrain'] ] = $tmp['TableId']; } - $sub_items = $this->Application->getUnitOption($prefix, 'SubItems', Array ()); - /* @var $sub_items Array */ + $sub_items = $config->getSubItems(Array ()); if ( is_array($sub_items) ) { foreach ($sub_items as $prefix) { @@ -771,12 +776,12 @@ if (array_key_exists('DependentFields', $rec)) { // these are fields from table of $rec['Prefix'] table! // when one of dependent fields goes into idfield of it's parent item, that was changed - $parent_table_key = $this->Application->getUnitOption($rec['Prefix'], 'ParentTableKey'); - $parent_table_key = is_array($parent_table_key) ? $parent_table_key[$prefix] : $parent_table_key; + $config = $this->Application->getUnitConfig($rec['Prefix']); + $parent_table_key = $config->getParentTableKey($prefix); + if ($parent_table_key == $master['IdField']) { - $foreign_key = $this->Application->getUnitOption($rec['Prefix'], 'ForeignKey'); - $foreign_key = is_array($foreign_key) ? $foreign_key[$prefix] : $foreign_key; + $foreign_key = $config->getForeignKey($prefix); $changes[$key]['DependentFields'][$foreign_key] = $live_id; } @@ -861,7 +866,7 @@ $event_key = $prefix . ($special ? '.' : '') . $special . ':' . $name; $event = new kEvent($event_key); $event->MasterEvent = $this->parentEvent; - + if ( isset($foreign_key) ) { $event->setEventParam('foreign_key', $foreign_key); } @@ -905,7 +910,8 @@ function PrepareEdit() { $this->DoCopyLiveToTemp($this->Tables, $this->Tables['IDs']); - if ($this->Application->getUnitOption($this->Tables['Prefix'],'CheckSimulatniousEdit')) { + + if ($this->Application->getUnitConfig($this->Tables['Prefix'])->getCheckSimulatniousEdit()) { $this->CheckSimultaniousEdit(); } }