protected function _doUpdate($inputRecord, $currentRecord) { parent::_doUpdate($inputRecord, $currentRecord); $postFields = $_POST; $elem_mapping = array(); foreach ($postFields as $elem_name => $value) { $elem = $this->dataPanel->get($elem_name); $fld_name = $elem->fieldName; if ($elem) { $elem_mapping[$fld_name] = $elem; } } $logDO = $this->getDataObj()->getRefObject($this->logDO); if (!$logDO) { return true; } $cond_column = $logDO->association['CondColumn']; $cond_value = $logDO->association['CondValue']; if ($cond_column) { $type = $cond_value; } $foreign_id = $currentRecord['Id']; $logRecord = array(); foreach ($inputRecord as $fldName => $fldVal) { $oldVal = $currentRecord[$fldName]; if ($oldVal == $fldVal) { continue; } $elem = $elem_mapping[$fldName]->xmlMeta; if (!$elem) { $elem = $this->dataPanel->getByField($fldName)->xmlMeta; } if ($elem['ATTRIBUTES']['CLASS'] != 'Hidden') { $logRecord[$fldName] = array('old' => $oldVal, 'new' => $fldVal, 'element' => $elem); } } $comment = Openbiz::$app->getClientProxy()->getFormInputs("fld_changelog_comment"); if (empty($logRecord) && empty($comment)) { return true; } $formMetaLite = array("name" => $this->objectName, "package" => $this->package, "message_file" => $this->messageFile); // save to comment do $dataRec = new DataRecord(null, $logDO); $dataRec['foreign_id'] = $foreign_id; $dataRec['type'] = $type; $dataRec['form'] = serialize($formMetaLite); $dataRec['data'] = serialize($logRecord); $dataRec['comment'] = $comment; try { $dataRec->save(); } catch (Openbiz\data\Exception $e) { $this->processDataException($e); return true; } $this->runEventLog(); return true; }