Index: trunk/core/kernel/db/dbitem.php =================================================================== diff -u -r5340 -r6093 --- trunk/core/kernel/db/dbitem.php (.../dbitem.php) (revision 5340) +++ trunk/core/kernel/db/dbitem.php (.../dbitem.php) (revision 6093) @@ -229,7 +229,12 @@ $ret = ''; foreach($keys_hash as $field => $value) { - $ret .= '(`'.$this->TableName.'`.'.$field.' = '.$this->Conn->qstr($value).') AND '; + if (!preg_match('/\./', $field)) { + $ret .= '(`'.$this->TableName.'`.'.$field.' = '.$this->Conn->qstr($value).') AND '; + } + else { + $ret .= '('.$field.' = '.$this->Conn->qstr($value).') AND '; + } } return preg_replace('/(.*) AND $/', '\\1', $ret); @@ -771,11 +776,18 @@ $this->SetDBField($title_field, $new_name); } - function raiseEvent($name, $id=null) + function raiseEvent($name, $id = null, $additional_params = Array()) { if( !isset($id) ) $id = $this->GetID(); $event = new kEvent( Array('name'=>$name,'prefix'=>$this->Prefix,'special'=>$this->Special) ); $event->setEventParam('id', $id); + + if ($additional_params) { + foreach ($additional_params as $ap_name => $ap_value) { + $event->setEventParam($ap_name, $ap_value); + } + } + $this->Application->HandleEvent($event); return $event->status == erSUCCESS ? true : false; } @@ -909,7 +921,16 @@ foreach ($this->customFields as $custom_id => $custom_name) { $cdata->SetDBField($ml_formatter->LangFieldName('cust_'.$custom_id), $this->GetDBField('cust_'.$custom_name)); } - return $cdata->isLoaded() ? $cdata->Update() : $cdata->Create(); + + if ($cdata->isLoaded()) { + $ret = $cdata->Update(); + } + else { + $ret = $cdata->Create(); + if ($cdata->mode == 't') $cdata->setTempID(); + } + + return $ret; } }