Index: branches/RC/core/kernel/db/db_event_handler.php =================================================================== diff -u -N -r11724 -r11742 --- branches/RC/core/kernel/db/db_event_handler.php (.../db_event_handler.php) (revision 11724) +++ branches/RC/core/kernel/db/db_event_handler.php (.../db_event_handler.php) (revision 11742) @@ -210,13 +210,13 @@ // 1. get id from post (used in admin) $ret = $this->Application->GetVar($event->getPrefixSpecial(true).'_id'); - if ($ret) { + if (($ret !== false) && ($ret != '')) { return $ret; } // 2. get id from env (used in front) $ret = $this->Application->GetVar($event->getPrefixSpecial().'_id'); - if ($ret) { + if (($ret !== false) && ($ret != '')) { return $ret; } @@ -232,6 +232,7 @@ $this->StoreSelectedIDs($event); return $this->Application->GetVar($event->getPrefixSpecial(true).'_id'); // StoreSelectedIDs sets this variable } + return $ret; } @@ -1180,7 +1181,14 @@ $object->Clear(0); $this->Application->SetVar($event->Prefix_Special.'_SaveEvent', 'OnCreate'); - $table_info = $object->getLinkedInfo(); + if ($event->getEventParam('top_prefix') != $event->Prefix) { + // this is subitem prefix, so use main item special + $table_info = $object->getLinkedInfo( $this->getMainSpecial($event) ); + } + else { + $table_info = $object->getLinkedInfo(); + } + $object->SetDBField($table_info['ForeignKey'], $table_info['ParentId']); $event->redirect = false; @@ -1254,10 +1262,16 @@ */ function setTempWindowID(&$event) { - $mode = $this->Application->GetVar($event->Prefix.'_mode'); - if ($mode == 't') { - $wid = $this->Application->GetVar('m_wid'); - $this->Application->SetVar($event->Prefix.'_mode', 't'.$wid); + $prefixes = Array ($event->Prefix, $event->getPrefixSpecial(true)); + + foreach ($prefixes as $prefix) { + $mode = $this->Application->GetVar($prefix . '_mode'); + + if ($mode == 't') { + $wid = $this->Application->GetVar('m_wid'); + $this->Application->SetVar(str_replace('_', '.', $prefix) . '_mode', 't' . $wid); + break; + } } }