Fixes #3042 - Timeaccounting ignores tags in conditions.

This commit is contained in:
Rolf Schmidt 2020-11-06 10:49:32 +01:00 committed by Thorsten Eckel
parent f132225b2f
commit 053429bb79
3 changed files with 14 additions and 10 deletions

View file

@ -884,8 +884,10 @@ class App.TicketZoom extends App.Controller
return
# verify if time accounting is active for ticket
selector = ticket.clone()
selector.tags = @tags
time_accounting_selector = @Config.get('time_accounting_selector')
if !App.Ticket.selector(ticket, time_accounting_selector['condition'])
if !App.Ticket.selector(selector, time_accounting_selector['condition'])
@submitPost(e, ticket, macro)
return

View file

@ -120,7 +120,7 @@ class App.Ticket extends App.Model
# apply tag changes
if attributes[1] is 'tags'
tags = content.value.split(',')
tags = content.value.split(/\s*,\s*/)
for tag in tags
if content.operator is 'remove'
if params.callback && params.callback.tagRemove
@ -244,6 +244,9 @@ class App.Ticket extends App.Model
contains_regex = new RegExp(App.Utils.escapeRegExp(conditionValue.toString()), 'i')
# move value to array if it is not already
if objectName is 'ticket' && attributeName is 'tags'
conditionValue = conditionValue.split(/\s*,\s*/)
if !_.isArray(objectValue)
objectValue = [objectValue]
# move value to array if it is not already

View file

@ -457,7 +457,7 @@ window.onload = function() {
"condition": {
"ticket.tags": {
"operator": "contains all",
"value": ["tag a", "not existing"],
"value": "tag a, not existing",
},
}
};
@ -479,7 +479,7 @@ window.onload = function() {
"condition": {
"ticket.tags": {
"operator": "contains all not",
"value": ["tag a", "tag b"],
"value": "tag a, tag b",
},
}
};
@ -490,7 +490,7 @@ window.onload = function() {
"condition": {
"ticket.tags": {
"operator": "contains all not",
"value": ["tag a", "tag b", "tag c"],
"value": "tag a, tag b, tag c",
},
}
};
@ -501,7 +501,7 @@ window.onload = function() {
"condition": {
"ticket.tags": {
"operator": "contains all not",
"value": ["tag c", "tag d"],
"value": "tag c, tag d",
},
}
};
@ -516,7 +516,6 @@ window.onload = function() {
},
}
};
result = App.Ticket.selector(ticket, setting['condition']);
equal(result, true, result);
@ -524,7 +523,7 @@ window.onload = function() {
"condition": {
"ticket.tags": {
"operator": "contains one not",
"value": ["tag a", "tag b"],
"value": "tag a, tag b",
},
}
};
@ -535,7 +534,7 @@ window.onload = function() {
"condition": {
"ticket.tags": {
"operator": "contains one not",
"value": ["tag a", "tag c"],
"value": "tag a, tag c",
},
}
};
@ -546,7 +545,7 @@ window.onload = function() {
"condition": {
"ticket.tags": {
"operator": "contains one not",
"value": ["tag c"],
"value": "tag c",
},
}
};