cob-cli 2.6.0 → 2.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -29,11 +29,17 @@ def updateUser(auditFields,instanceFields) {
|
|
|
29
29
|
def userm = actionPacks.get("userm");
|
|
30
30
|
def updates = [:]
|
|
31
31
|
auditFields.each { auditField ->
|
|
32
|
-
if( auditField.op == "creator" && msg.action == "update") return
|
|
32
|
+
if( auditField.op == "creator" && msg.action == "update" && msg.value(auditField.name) != null) return
|
|
33
33
|
if( auditField.args == "usermRef") {
|
|
34
34
|
updates << [(auditField.name) : userm.getUser(msg.user).data._links.self]
|
|
35
|
-
|
|
35
|
+
|
|
36
|
+
} else if( auditField.args == "username") {
|
|
36
37
|
updates << [(auditField.name) : msg.user]
|
|
38
|
+
|
|
39
|
+
} else if( auditField.args == "time") {
|
|
40
|
+
if(msg.action == 'add' && Math.abs(msg.value(auditField.name, Long.class)?:0 - msg._timestamp_) < 30000) return // Ignore changes less then 30s
|
|
41
|
+
if(msg.action == 'update' && !msg.diff) return // Only continues if there is at least one change
|
|
42
|
+
updates << [(auditField.name) : "" + msg._timestamp_]
|
|
37
43
|
}
|
|
38
44
|
}
|
|
39
45
|
return updates
|
|
@@ -63,7 +69,7 @@ def getAuditFields(definitionName) {
|
|
|
63
69
|
// Finalmente obtém a lista de campos que é necessário calcular
|
|
64
70
|
def auditFields = [];
|
|
65
71
|
fields.each { fieldId,field ->
|
|
66
|
-
def matcher = field.description =~ /[$]audit\.(creator|updater)\.(username|usermRef)/
|
|
72
|
+
def matcher = field.description =~ /[$]audit\.(creator|updater)\.(username|usermRef|time)/
|
|
67
73
|
if(matcher) {
|
|
68
74
|
def op = matcher[0][1]
|
|
69
75
|
def arg = matcher[0][2]
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
cob.custom.customize.push(function (core, utils, ui) {
|
|
3
3
|
core.customizeAllInstances((instance, presenter) =>
|
|
4
4
|
{
|
|
5
|
-
let userFPs = presenter.findFieldPs( fp => /[$]audit\.(creator|updater)\.(username|usermRef)/.exec(fp.field.fieldDefinition.description
|
|
5
|
+
let userFPs = presenter.findFieldPs( fp => /[$]audit\.(creator|updater)\.(username|usermRef|time)/.exec(fp.field.fieldDefinition.description) )
|
|
6
6
|
userFPs.forEach( fp => {
|
|
7
7
|
fp.disable()
|
|
8
8
|
if(!instance.isNew() || presenter.isGroupEdit()) return //Only update if it's on create interface (updates will only be changed by the backend)
|
|
@@ -12,6 +12,9 @@ cob.custom.customize.push(function (core, utils, ui) {
|
|
|
12
12
|
if(/[$]audit\.(creator|updater)\.usermRef/.exec(fp.field.fieldDefinition.description)) {
|
|
13
13
|
fp.setValue(core.getCurrentLoggedInUserUri())
|
|
14
14
|
}
|
|
15
|
+
if(/[$]audit\.(creator|updater)\.time/.exec(fp.field.fieldDefinition.description)) {
|
|
16
|
+
fp.setValue(Date.now())
|
|
17
|
+
}
|
|
15
18
|
})
|
|
16
19
|
})
|
|
17
20
|
});
|
|
@@ -17,7 +17,7 @@ function calc_automation(instance, presenter) {
|
|
|
17
17
|
//=========================================================
|
|
18
18
|
function getAllCalculationsFields() {
|
|
19
19
|
return presenter
|
|
20
|
-
.findFieldPs( fp => fp.field.fieldDefinition.description
|
|
20
|
+
.findFieldPs( fp => /[$]calc\.(.*)/.exec(fp.field.fieldDefinition.description) )
|
|
21
21
|
.map( calculationFp => {
|
|
22
22
|
calculationFp.disable()
|
|
23
23
|
return {
|