Fixed issue #1513 - TimeAccounting ticket condition prevents submit of Zoom.
This commit is contained in:
parent
7599e8e17a
commit
d3062592ea
2 changed files with 203 additions and 37 deletions
|
@ -200,6 +200,26 @@ class App.Ticket extends App.Model
|
||||||
result = true if objectValue.toString().match(contains_regex)
|
result = true if objectValue.toString().match(contains_regex)
|
||||||
else if condition.operator == 'contains not'
|
else if condition.operator == 'contains not'
|
||||||
result = true if !objectValue.toString().match(contains_regex)
|
result = true if !objectValue.toString().match(contains_regex)
|
||||||
|
else if condition.operator == 'contains all'
|
||||||
|
result = true
|
||||||
|
for loopConditionValue in conditionValue
|
||||||
|
if !_.contains(objectValue, loopConditionValue)
|
||||||
|
result = false
|
||||||
|
else if condition.operator == 'contains one'
|
||||||
|
result = false
|
||||||
|
for loopConditionValue in conditionValue
|
||||||
|
if _.contains(objectValue, loopConditionValue)
|
||||||
|
result = true
|
||||||
|
else if condition.operator == 'contains all not'
|
||||||
|
result = true
|
||||||
|
for loopObjectValue in objectValue
|
||||||
|
if _.contains(conditionValue, loopObjectValue)
|
||||||
|
result = false
|
||||||
|
else if condition.operator == 'contains one not'
|
||||||
|
result = false
|
||||||
|
for loopObjectValue in objectValue
|
||||||
|
if !_.contains(conditionValue, loopObjectValue)
|
||||||
|
result = true
|
||||||
else if condition.operator == 'is'
|
else if condition.operator == 'is'
|
||||||
result = true if objectValue.toString().trim().toLowerCase() is loopConditionValue.toString().trim().toLowerCase()
|
result = true if objectValue.toString().trim().toLowerCase() is loopConditionValue.toString().trim().toLowerCase()
|
||||||
else if condition.operator == 'is not'
|
else if condition.operator == 'is not'
|
||||||
|
|
|
@ -130,6 +130,7 @@ window.onload = function() {
|
||||||
"vip": false,
|
"vip": false,
|
||||||
"id": 434
|
"id": 434
|
||||||
},
|
},
|
||||||
|
"tags": ["tag a", "tag b"],
|
||||||
"escalation_at": "2017-02-09T09:16:56.192Z",
|
"escalation_at": "2017-02-09T09:16:56.192Z",
|
||||||
"last_contact_agent_at": "2017-02-09T09:16:56.192Z",
|
"last_contact_agent_at": "2017-02-09T09:16:56.192Z",
|
||||||
"last_contact_agent_at": "2017-02-09T09:16:56.192Z",
|
"last_contact_agent_at": "2017-02-09T09:16:56.192Z",
|
||||||
|
@ -414,6 +415,144 @@ window.onload = function() {
|
||||||
equal(result, true, result);
|
equal(result, true, result);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
var testPreConditionTags = function (key, ticket) {
|
||||||
|
App.Session.set(sessionData);
|
||||||
|
|
||||||
|
setting = {
|
||||||
|
"condition": {
|
||||||
|
"ticket.tags": {
|
||||||
|
"operator": "contains one",
|
||||||
|
"value": "tag a",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
};
|
||||||
|
result = App.Ticket.selector(ticket, setting['condition']);
|
||||||
|
equal(result, true, result);
|
||||||
|
|
||||||
|
setting = {
|
||||||
|
"condition": {
|
||||||
|
"ticket.tags": {
|
||||||
|
"operator": "contains one",
|
||||||
|
"value": "tag aa",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
};
|
||||||
|
result = App.Ticket.selector(ticket, setting['condition']);
|
||||||
|
equal(result, false, result);
|
||||||
|
|
||||||
|
setting = {
|
||||||
|
"condition": {
|
||||||
|
"ticket.tags": {
|
||||||
|
"operator": "contains all",
|
||||||
|
"value": "tag a",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
};
|
||||||
|
result = App.Ticket.selector(ticket, setting['condition']);
|
||||||
|
equal(result, true, result);
|
||||||
|
|
||||||
|
setting = {
|
||||||
|
"condition": {
|
||||||
|
"ticket.tags": {
|
||||||
|
"operator": "contains all",
|
||||||
|
"value": ["tag a", "not existing"],
|
||||||
|
},
|
||||||
|
}
|
||||||
|
};
|
||||||
|
result = App.Ticket.selector(ticket, setting['condition']);
|
||||||
|
equal(result, false, result);
|
||||||
|
|
||||||
|
setting = {
|
||||||
|
"condition": {
|
||||||
|
"ticket.tags": {
|
||||||
|
"operator": "contains all not",
|
||||||
|
"value": "tag a",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
};
|
||||||
|
result = App.Ticket.selector(ticket, setting['condition']);
|
||||||
|
equal(result, false, result);
|
||||||
|
|
||||||
|
setting = {
|
||||||
|
"condition": {
|
||||||
|
"ticket.tags": {
|
||||||
|
"operator": "contains all not",
|
||||||
|
"value": ["tag a", "tag b"],
|
||||||
|
},
|
||||||
|
}
|
||||||
|
};
|
||||||
|
result = App.Ticket.selector(ticket, setting['condition']);
|
||||||
|
equal(result, false, result);
|
||||||
|
|
||||||
|
setting = {
|
||||||
|
"condition": {
|
||||||
|
"ticket.tags": {
|
||||||
|
"operator": "contains all not",
|
||||||
|
"value": ["tag a", "tag b", "tag c"],
|
||||||
|
},
|
||||||
|
}
|
||||||
|
};
|
||||||
|
result = App.Ticket.selector(ticket, setting['condition']);
|
||||||
|
equal(result, false, result);
|
||||||
|
|
||||||
|
setting = {
|
||||||
|
"condition": {
|
||||||
|
"ticket.tags": {
|
||||||
|
"operator": "contains all not",
|
||||||
|
"value": ["tag c", "tag d"],
|
||||||
|
},
|
||||||
|
}
|
||||||
|
};
|
||||||
|
result = App.Ticket.selector(ticket, setting['condition']);
|
||||||
|
equal(result, true, result);
|
||||||
|
|
||||||
|
setting = {
|
||||||
|
"condition": {
|
||||||
|
"ticket.tags": {
|
||||||
|
"operator": "contains one not",
|
||||||
|
"value": "tag a",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
result = App.Ticket.selector(ticket, setting['condition']);
|
||||||
|
equal(result, true, result);
|
||||||
|
|
||||||
|
setting = {
|
||||||
|
"condition": {
|
||||||
|
"ticket.tags": {
|
||||||
|
"operator": "contains one not",
|
||||||
|
"value": ["tag a", "tag b"],
|
||||||
|
},
|
||||||
|
}
|
||||||
|
};
|
||||||
|
result = App.Ticket.selector(ticket, setting['condition']);
|
||||||
|
equal(result, false, result);
|
||||||
|
|
||||||
|
setting = {
|
||||||
|
"condition": {
|
||||||
|
"ticket.tags": {
|
||||||
|
"operator": "contains one not",
|
||||||
|
"value": ["tag a", "tag c"],
|
||||||
|
},
|
||||||
|
}
|
||||||
|
};
|
||||||
|
result = App.Ticket.selector(ticket, setting['condition']);
|
||||||
|
equal(result, true, result);
|
||||||
|
|
||||||
|
setting = {
|
||||||
|
"condition": {
|
||||||
|
"ticket.tags": {
|
||||||
|
"operator": "contains one not",
|
||||||
|
"value": ["tag c"],
|
||||||
|
},
|
||||||
|
}
|
||||||
|
};
|
||||||
|
result = App.Ticket.selector(ticket, setting['condition']);
|
||||||
|
equal(result, true, result);
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
var testTime = function (key, value, ticket) {
|
var testTime = function (key, value, ticket) {
|
||||||
valueDate = new Date(value);
|
valueDate = new Date(value);
|
||||||
compareDate = new Date( valueDate.setHours( valueDate.getHours() - 1 ) ).toISOString();
|
compareDate = new Date( valueDate.setHours( valueDate.getHours() - 1 ) ).toISOString();
|
||||||
|
@ -778,6 +917,13 @@ window.onload = function() {
|
||||||
testPreConditionUser('ticket.updated_by_id', '6', ticket, sessionData);
|
testPreConditionUser('ticket.updated_by_id', '6', ticket, sessionData);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test("ticket tags", function() {
|
||||||
|
ticket = new App.Ticket();
|
||||||
|
ticket.load(ticketData);
|
||||||
|
|
||||||
|
testPreConditionTags('ticket.tags', ticket);
|
||||||
|
});
|
||||||
|
|
||||||
test("article from", function() {
|
test("article from", function() {
|
||||||
ticket = new App.Ticket();
|
ticket = new App.Ticket();
|
||||||
ticket.load(ticketData);
|
ticket.load(ticketData);
|
||||||
|
|
Loading…
Reference in a new issue