audited change

This commit is contained in:
yuri
2015-05-07 11:22:52 +03:00
parent 9182aeef99
commit 201beca8fa
7 changed files with 32 additions and 17 deletions
@@ -11,12 +11,14 @@
"view": "Fields.EnumStyled",
"style": {
"Held": "success"
}
},
"audited": true
},
"dateStart": {
"type": "datetime",
"required": true,
"default": "javascript: return this.dateTime.getNow(15);"
"default": "javascript: return this.dateTime.getNow(15);",
"audited": true
},
"dateEnd": {
"type": "datetime",
@@ -17,7 +17,8 @@
"Closed": "success",
"Duplicate": "danger",
"Rejected": "danger"
}
},
"audited": true
},
"priority": {
"type": "enum",
@@ -31,7 +31,8 @@
"Converted": "success",
"Recycled": "danger",
"Dead": "danger"
}
},
"audited": true
},
"source": {
"type": "enum",
@@ -11,12 +11,14 @@
"view": "Fields.EnumStyled",
"style": {
"Held": "success"
}
},
"audited": true
},
"dateStart": {
"type": "datetime",
"required": true,
"default": "javascript: return this.dateTime.getNow(15);"
"default": "javascript: return this.dateTime.getNow(15);",
"audited": true
},
"dateEnd": {
"type": "datetime",
@@ -43,7 +43,8 @@
"type": "enum",
"options": ["Prospecting", "Qualification", "Needs Analysis", "Value Proposition", "Id. Decision Makers", "Perception Analysis", "Proposal/Price Quote", "Negotiation/Review", "Closed Won", "Closed Lost"],
"view": "Crm:Opportunity.Fields.Stage",
"default": "Prospecting"
"default": "Prospecting",
"audited": true
},
"probability": {
"type": "int",
@@ -11,12 +11,14 @@
"style": {
"Completed": "success"
},
"default": "Not Started"
"default": "Not Started",
"audited": true
},
"priority": {
"type": "enum",
"options": ["Low", "Normal", "High", "Urgent"],
"default": "Normal"
"default": "Normal",
"audited": true
},
"dateStart": {
"type": "datetime",
@@ -26,7 +28,8 @@
"dateEnd": {
"type": "datetime",
"after": "dateStart",
"view": "Crm:Task.Fields.DateEnd"
"view": "Crm:Task.Fields.DateEnd",
"audited": true
},
"dateStartDate": {
"type": "date",
+12 -7
View File
@@ -678,14 +678,20 @@ class Stream extends \Espo\Core\Services\Base
protected function getAuditedFields(Entity $entity)
{
$entityName = $entity->getEntityName();
$entityType = $entity->getEntityType();
if (!array_key_exists($entityName, $this->auditedFieldsCache)) {
$fields = $this->getMetadata()->get('entityDefs.' . $entityName . '.fields');
$statusFields = $this->getStatusFields();
if (!array_key_exists($entityType, $this->auditedFieldsCache)) {
$fields = $this->getMetadata()->get('entityDefs.' . $entityType . '.fields');
$auditedFields = array();
foreach ($fields as $field => $d) {
if (!empty($d['audited'])) {
$attributes = array();
if (!empty($statusFields[$entityType]) && $statusFields[$entityType] === $field) {
continue;
}
$attributes = [];
$fieldsDefs = $this->getMetadata()->get('fields.' . $d['type']);
if (empty($fieldsDefs['actualFields'])) {
@@ -703,10 +709,10 @@ class Stream extends \Espo\Core\Services\Base
$auditedFields[$field] = $attributes;
}
}
$this->auditedFieldsCache[$entityName] = $auditedFields;
$this->auditedFieldsCache[$entityType] = $auditedFields;
}
return $this->auditedFieldsCache[$entityName];
return $this->auditedFieldsCache[$entityType];
}
public function handleAudited($entity)
@@ -721,7 +727,6 @@ class Stream extends \Espo\Core\Services\Base
$updated = false;
foreach ($attrs as $attr) {
if ($entity->get($attr) != $entity->getFetched($attr)) {
$updated = true;
}
}