Index: dbitem.php =================================================================== --- dbitem.php (revision 13134) +++ dbitem.php (working copy) @@ -408,6 +408,34 @@ } /** + * Loads object from hash (not db) + * + * @param Array $fields_hash + * @param string $id_field + */ + function LoadFromHash($fields_hash, $id_field = null) + { + if (!isset($id_field)) { + $id_field = $this->IDField; + } + + $this->Clear(); + $id = $fields_hash[$id_field]; + + if ( !$this->raiseEvent('OnBeforeItemLoad', $id) ) { + return false; + } + + $this->FieldValues = array_merge_recursive2($this->FieldValues, $fields_hash); + $this->OriginalFieldValues = $this->FieldValues; + + $this->setID($id); + $this->raiseEvent('OnAfterItemLoad', $id); + + $this->Loaded = true; + } + + /** * Builds select sql, SELECT ... FROM parts only * * @access public