本文整理汇总了PHP中SugarBean::getAuditEnabledFieldDefinitions方法的典型用法代码示例。如果您正苦于以下问题:PHP SugarBean::getAuditEnabledFieldDefinitions方法的具体用法?PHP SugarBean::getAuditEnabledFieldDefinitions怎么用?PHP SugarBean::getAuditEnabledFieldDefinitions使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SugarBean
的用法示例。
在下文中一共展示了SugarBean::getAuditEnabledFieldDefinitions方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getAuditDataChanges
/**
* Uses the audit enabled fields array to find fields whose value has changed.
* The before and after values are stored in the bean.
* Uses $bean->fetched_row && $bean->fetched_rel_row to compare
*
* @param SugarBean $bean Sugarbean instance that was changed
* @return array
*/
public function getAuditDataChanges(SugarBean $bean)
{
$audit_fields = $bean->getAuditEnabledFieldDefinitions();
return $this->getDataChanges($bean, array_keys($audit_fields));
}
示例2: getDataChanges
/**
* Uses the audit enabled fields array to find fields whose value has changed.
* The before and after values are stored in the bean.
*
* @param object $bean Sugarbean instance
* @return array
*/
public function getDataChanges(SugarBean &$bean)
{
$changed_values = array();
$audit_fields = $bean->getAuditEnabledFieldDefinitions();
if (is_array($audit_fields) and count($audit_fields) > 0) {
foreach ($audit_fields as $field => $properties) {
if (!empty($bean->fetched_row) && array_key_exists($field, $bean->fetched_row)) {
if (isset($properties['type'])) {
$field_type = $properties['type'];
} else {
if (isset($properties['dbType'])) {
$field_type = $properties['dbType'];
} else {
if (isset($properties['data_type'])) {
$field_type = $properties['data_type'];
} else {
$field_type = $properties['dbtype'];
}
}
}
// Bug # 44624 - check for currency type and cast to float
// this ensures proper matching for change log
if (strcmp($field_type, "currency") == 0) {
$before_value = (double) $bean->fetched_row[$field];
$after_value = (double) $bean->{$field};
} else {
$before_value = $bean->fetched_row[$field];
$after_value = $bean->{$field};
}
//Because of bug #25078(sqlserver haven't 'date' type, trim extra "00:00:00" when insert into *_cstm table). so when we read the audit datetime field from sqlserver, we have to replace the extra "00:00:00" again.
if (!empty($field_type) && $field_type == 'date') {
$before_value = from_db_convert($before_value, $field_type);
}
//if the type and values match, do nothing.
if (!($this->_emptyValue($before_value, $field_type) && $this->_emptyValue($after_value, $field_type))) {
if (trim($before_value) !== trim($after_value)) {
// Bug #42475: Don't directly compare numeric values, instead do the subtract and see if the comparison comes out to be "close enough", it is necessary for floating point numbers.
if (!($this->_isTypeNumber($field_type) && abs(trim($before_value) + 0 - (trim($after_value) + 0)) < 0.001)) {
if (!($this->_isTypeBoolean($field_type) && $this->_getBooleanValue($before_value) == $this->_getBooleanValue($after_value))) {
$changed_values[$field] = array('field_name' => $field, 'data_type' => $field_type, 'before' => $before_value, 'after' => $after_value);
}
}
}
}
}
}
}
return $changed_values;
}
示例3: getDataChanges
/**
* Uses the audit enabled fields array to find fields whose value has changed.
* The before and after values are stored in the bean.
*
* @param object $bean Sugarbean instance
* @return array
*/
public function getDataChanges(SugarBean &$bean)
{
$changed_values = array();
$audit_fields = $bean->getAuditEnabledFieldDefinitions();
if (is_array($audit_fields) and count($audit_fields) > 0) {
foreach ($audit_fields as $field => $properties) {
if (!empty($bean->fetched_row) && array_key_exists($field, $bean->fetched_row)) {
$before_value = $bean->fetched_row[$field];
$after_value = $bean->{$field};
if (isset($properties['type'])) {
$field_type = $properties['type'];
} else {
if (isset($properties['dbType'])) {
$field_type = $properties['dbType'];
} else {
if (isset($properties['data_type'])) {
$field_type = $properties['data_type'];
} else {
$field_type = $properties['dbtype'];
}
}
}
//if the type and values match, do nothing.
if (!(emptyValue($before_value, $field_type) && emptyValue($after_value, $field_type))) {
if (trim($before_value) !== trim($after_value)) {
if (!(isTypeNumber($field_type) && trim($before_value) + 0 == trim($after_value) + 0)) {
if (!(isTypeBoolean($field_type) && getBooleanValue($before_value) == getBooleanValue($after_value))) {
$changed_values[$field] = array('field_name' => $field, 'data_type' => $field_type, 'before' => $before_value, 'after' => $after_value);
}
}
}
}
}
}
}
return $changed_values;
}
示例4: getDataChanges
/**
* Uses the audit enabled fields array to find fields whose value has changed.
* The before and after values are stored in the bean.
*
* @param object $bean Sugarbean instance
* @return array
*/
public function getDataChanges(SugarBean &$bean)
{
$changed_values = array();
$audit_fields = $bean->getAuditEnabledFieldDefinitions();
if (is_array($audit_fields) and count($audit_fields) > 0) {
foreach ($audit_fields as $field => $properties) {
if (!empty($bean->fetched_row) && array_key_exists($field, $bean->fetched_row)) {
$before_value = $bean->fetched_row[$field];
$after_value = $bean->{$field};
if (isset($properties['type'])) {
$field_type = $properties['type'];
} else {
if (isset($properties['dbType'])) {
$field_type = $properties['dbType'];
} else {
if (isset($properties['data_type'])) {
$field_type = $properties['data_type'];
} else {
$field_type = $properties['dbtype'];
}
}
}
//Because of bug #25078(sqlserver haven't 'date' type, trim extra "00:00:00" when insert into *_cstm table). so when we read the audit datetime field from sqlserver, we have to replace the extra "00:00:00" again.
if (!empty($field_type) && $field_type == 'date') {
$before_value = from_db_convert($before_value, $field_type);
}
//if the type and values match, do nothing.
if (!($this->_emptyValue($before_value, $field_type) && $this->_emptyValue($after_value, $field_type))) {
if (trim($before_value) !== trim($after_value)) {
if (!($this->_isTypeNumber($field_type) && trim($before_value) + 0 == trim($after_value) + 0)) {
if (!($this->_isTypeBoolean($field_type) && $this->_getBooleanValue($before_value) == $this->_getBooleanValue($after_value))) {
$changed_values[$field] = array('field_name' => $field, 'data_type' => $field_type, 'before' => $before_value, 'after' => $after_value);
}
}
}
}
}
}
}
return $changed_values;
}
示例5: getDataChanges
/**
* Uses the audit enabled fields array to find fields whose value has changed.
* The before and after values are stored in the bean.
* Uses $bean->fetched_row to compare
*
* @param SugarBean $bean Sugarbean instance that was changed
* @return array
*/
public function getDataChanges(SugarBean &$bean)
{
$changed_values = array();
$audit_fields = $bean->getAuditEnabledFieldDefinitions();
if (is_array($audit_fields) and count($audit_fields) > 0) {
foreach ($audit_fields as $field => $properties) {
if (!empty($bean->fetched_row) && array_key_exists($field, $bean->fetched_row)) {
$before_value = $bean->fetched_row[$field];
$after_value = $bean->{$field};
if (isset($properties['type'])) {
$field_type = $properties['type'];
} else {
if (isset($properties['dbType'])) {
$field_type = $properties['dbType'];
} else {
if (isset($properties['data_type'])) {
$field_type = $properties['data_type'];
} else {
$field_type = $properties['dbtype'];
}
}
}
//Because of bug #25078(sqlserver haven't 'date' type, trim extra "00:00:00" when insert into *_cstm table).
// so when we read the audit datetime field from sqlserver, we have to replace the extra "00:00:00" again.
if (!empty($field_type) && $field_type == 'date') {
$before_value = $this->fromConvert($before_value, $field_type);
}
//if the type and values match, do nothing.
if (!($this->_emptyValue($before_value, $field_type) && $this->_emptyValue($after_value, $field_type))) {
if (trim($before_value) !== trim($after_value)) {
// Bug #42475: Don't directly compare numeric values, instead do the subtract and see if the comparison comes out to be "close enough", it is necessary for floating point numbers.
// Manual merge of fix 95727f2eed44852f1b6bce9a9eccbe065fe6249f from DBHelper
// This fix also fixes Bug #44624 in a more generic way and therefore eliminates the need for fix 0a55125b281c4bee87eb347709af462715f33d2d in DBHelper
if (!($this->isNumericType($field_type) && abs(2 * (trim($before_value) + 0 - (trim($after_value) + 0)) / (trim($before_value) + 0 + (trim($after_value) + 0))) < 1.0E-10)) {
// Smaller than 10E-10
if (!($this->isBooleanType($field_type) && $this->_getBooleanValue($before_value) == $this->_getBooleanValue($after_value))) {
$changed_values[$field] = array('field_name' => $field, 'data_type' => $field_type, 'before' => $before_value, 'after' => $after_value);
}
}
}
}
}
}
}
return $changed_values;
}