Skip to content
Snippets Groups Projects
Commit a88fce4f authored by Johannes Hörmann's avatar Johannes Hörmann
Browse files

Task Status verhalten angepasst 1039416

parent 05d29195
No related branches found
No related tags found
No related merge requests found
Showing
with 1315 additions and 1166 deletions
......@@ -19,6 +19,12 @@
<column name="CONTAINER" value="TaskType"/>
<column name="TYPE" value="CHAR_VALUE"/>
</insert>
<insert tableName="AB_KEYWORD_ATTRIBUTE">
<column name="AB_KEYWORD_ATTRIBUTEID" value="729a41d1-0463-480d-bf7b-0eb6c2e96f37"/>
<column name="NAME" value="defaultStatus"/>
<column name="CONTAINER" value="TaskType"/>
<column name="TYPE" value="CHAR_VALUE"/>
</insert>
<insert tableName="AB_KEYWORD_ATTRIBUTE">
<column name="AB_KEYWORD_ATTRIBUTEID" value="9ac96671-b519-488b-bbad-6dea3e5baafd"/>
<column name="NAME" value="showCode"/>
......@@ -38,6 +44,12 @@
<column name="AB_KEYWORD_ATTRIBUTE_ID" value="9ac96671-b519-488b-bbad-6dea3e5baafd"/>
<column name="BOOL_VALUE" valueNumeric="0"/>
</insert>
<insert tableName="AB_KEYWORD_ATTRIBUTERELATION">
<column name="AB_KEYWORD_ATTRIBUTERELATIONID" value="169edc60-5bad-45eb-b938-46a47b10a0a3"/>
<column name="AB_KEYWORD_ENTRY_ID" value="9e30365b-a9a6-4b57-ae6b-140c9e5a4eb4"/>
<column name="AB_KEYWORD_ATTRIBUTE_ID" value="729a41d1-0463-480d-bf7b-0eb6c2e96f37"/>
<column name="CHAR_VALUE" value="21bc4d20-1a87-4247-8f7c-8d3a09631850"/>
</insert>
<insert tableName="AB_KEYWORD_ENTRY">
<column name="AB_KEYWORD_ENTRYID" value="2ef84e0e-988a-44b4-9d14-3461555d2f18"/>
......@@ -60,6 +72,12 @@
<column name="AB_KEYWORD_ATTRIBUTE_ID" value="af6a0af9-0102-426b-a1f7-c8abfea79793"/>
<column name="CHAR_VALUE" value="[&quot;ff8b1caf-cf30-4edb-b5ca-a9a219ba8399&quot;]"/>
</insert>
<insert tableName="AB_KEYWORD_ATTRIBUTERELATION">
<column name="AB_KEYWORD_ATTRIBUTERELATIONID" value="4cabba92-fa98-42c8-aabb-8bff718c1502"/>
<column name="AB_KEYWORD_ENTRY_ID" value="2ef84e0e-988a-44b4-9d14-3461555d2f18"/>
<column name="AB_KEYWORD_ATTRIBUTE_ID" value="729a41d1-0463-480d-bf7b-0eb6c2e96f37"/>
<column name="CHAR_VALUE" value="21bc4d20-1a87-4247-8f7c-8d3a09631850"/>
</insert>
<insert tableName="AB_KEYWORD_ENTRY">
<column name="AB_KEYWORD_ENTRYID" value="9d326a2a-923c-41de-adb9-b0f86417e7c2"/>
......@@ -82,5 +100,11 @@
<column name="AB_KEYWORD_ATTRIBUTE_ID" value="af6a0af9-0102-426b-a1f7-c8abfea79793"/>
<column name="CHAR_VALUE" value="[&quot;01d761e0-802a-46d0-827f-b6ca5d9a2148&quot;]"/>
</insert>
<insert tableName="AB_KEYWORD_ATTRIBUTERELATION">
<column name="AB_KEYWORD_ATTRIBUTERELATIONID" value="b7d946e4-3644-4f97-96cb-f2331fc3aa1e"/>
<column name="AB_KEYWORD_ENTRY_ID" value="9d326a2a-923c-41de-adb9-b0f86417e7c2"/>
<column name="AB_KEYWORD_ATTRIBUTE_ID" value="729a41d1-0463-480d-bf7b-0eb6c2e96f37"/>
<column name="CHAR_VALUE" value="21bc4d20-1a87-4247-8f7c-8d3a09631850"/>
</insert>
</changeSet>
</databaseChangeLog>
\ No newline at end of file
This diff is collapsed.
Can be filled with a JSON array containing all allowed keyIds
["id1", "id2", ...]
\ No newline at end of file
......@@ -13,5 +13,8 @@ if (vars.get("$param.OnlyActives_param") == "true")
if (vars.exists("$param.ExcludedKeyIdsSubquery_param") && vars.get("$param.ExcludedKeyIdsSubquery_param"))
cond.and("AB_KEYWORD_ENTRY.KEYID not in (" + vars.get("$param.ExcludedKeyIdsSubquery_param") + ")");
if (vars.exists("$param.WhitelistIds_param") && vars.getString("$param.WhitelistIds_param"))
cond.andIn("AB_KEYWORD_ENTRY.KEYID", JSON.parse(vars.getString("$param.WhitelistIds_param")));
var condStr = db.translateCondition(cond.build("1 = 1"));
result.string(condStr);
\ No newline at end of file
This diff is collapsed.
import("KeywordRegistry_basic");
import("system.vars");
import("ActivityTask_lib");
import("system.result");
result.string(TaskUtils.getTypeStatusKeyword(vars.get("$field.TYPE")));
\ No newline at end of file
result.string($KeywordRegistry.taskStatus());
\ No newline at end of file
import("system.vars");
import("system.result");
import("ActivityTask_lib");
result.object(TaskUtils.getAvailableStatus(vars.get("$field.TYPE")));
\ No newline at end of file
......@@ -3,4 +3,4 @@ import("ActivityTask_lib");
import("KeywordRegistry_basic");
import("system.result");
result.string(TaskUtils.getStatusIcon(vars.getString("$field.TYPE"), vars.getString("$field.STATUS")));
\ No newline at end of file
result.string(TaskUtils.getStatusIcon(vars.getString("$field.STATUS")));
\ No newline at end of file
import("ActivityTask_lib");
import("KeywordRegistry_basic");
import("system.vars");
import("system.result");
import("Keyword_lib");
result.string(KeywordUtils.getViewValue(TaskUtils.getTypeStatusKeyword(vars.get("$field.TYPE")), vars.get("$field.STATUS")));
\ No newline at end of file
result.string(KeywordUtils.getViewValue($KeywordRegistry.taskStatus(), vars.get("$field.STATUS")));
\ No newline at end of file
......@@ -6,15 +6,8 @@ import("system.vars");
import("KeywordRegistry_basic");
import("Keyword_lib");
if(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW)
if(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && !vars.get("$this.value"))
{
var states = KeywordUtils.getEntryNamesAndIdsByContainer(TaskUtils.getTypeStatusKeyword(vars.get("$field.TYPE")))
if (states.length > 0)
{
result.string(states[0][0]);
}
else
{
result.string("");
}
var defaultState = TaskUtils.getDefaultStatus(vars.get("$field.TYPE"));
result.string(defaultState);
}
\ No newline at end of file
......@@ -129,9 +129,14 @@ TaskUtils.getTypeAttributes = function(pType)
return JSON.parse(KeywordUtils.getAttributeRelation(pType, $KeywordRegistry.taskType(), "attributes", "[]"));
}
TaskUtils.getTypeStatusKeyword = function(pType)
TaskUtils.getAvailableStatus = function(pType)
{
return KeywordUtils.getAttributeRelation(pType, $KeywordRegistry.taskType(), "status", $KeywordRegistry.taskStatus());
return JSON.parse(KeywordUtils.getAttributeRelation(pType, $KeywordRegistry.taskType(), "availableStatus", ""));
}
TaskUtils.getDefaultStatus = function(pType)
{
return KeywordUtils.getAttributeRelation(pType, $KeywordRegistry.taskType(), "defaultStatus", "");
}
TaskUtils.getShowCode = function(pType)
......@@ -139,10 +144,9 @@ TaskUtils.getShowCode = function(pType)
return KeywordUtils.getAttributeRelation(pType, $KeywordRegistry.taskType(), "showCode", true);
}
TaskUtils.getStatusIcon = function(pType, pStatus)
TaskUtils.getStatusIcon = function(pStatus)
{
var status = TaskUtils.getTypeStatusKeyword(pType)
return KeywordUtils.getAttributeRelation(pStatus, status, "icon", "NEON:STATUS_NOT_STARTED");
return KeywordUtils.getAttributeRelation(pStatus, $KeywordRegistry.taskStatus(), "icon", "NEON:STATUS_NOT_STARTED");
}
/**
......
......@@ -115,8 +115,13 @@ SqlCondition.prototype.or = function(cond) {
* @return {SqlCondition} current SqlCondition-object
*/
SqlCondition.prototype.andAttachPrepared = function(preparedObj) {
this.preparedValues = this.preparedValues.concat(preparedObj[1]);
return this.and(preparedObj[0]);
if (preparedObj)
{
this.preparedValues = this.preparedValues.concat(preparedObj[1]);
return this.and(preparedObj[0]);
}
return this;
}
/**
......@@ -125,8 +130,13 @@ SqlCondition.prototype.andAttachPrepared = function(preparedObj) {
* @return {SqlCondition} current SqlCondition-object
*/
SqlCondition.prototype.orAttachPrepared = function(preparedObj) {
this.preparedValues.push(preparedObj[1]);
return this.or(preparedObj[0]);
if (preparedObj)
{
this.preparedValues = this.preparedValues.concat(preparedObj[1]);
return this.or(preparedObj[0]);
}
return this;
}
/**
......@@ -289,6 +299,74 @@ SqlCondition.prototype.orPrepareVars = function(field, variable, cond, fieldType
return this;
}
/**
* creates a IN-statement out of a field and an array of values.
* Be carefull with a big number of values. This may have a bad performance.
*
* @param {String | String[]} field the database field as "tablename.columnname"; e.g. "ORGANISATION.NAME" or as array with column-alias: ["ORGANISATION", "NAME", "myorgAlias"]
* @param {String[]} values the value that shall be set into the prepared statement
* @param {Numeric | Boolean} [fieldType] SQL-column-type; if the fieldType is not given it's loaded automatically;
* The loaded type is cached if no type is given. So it is also safe to use this in a loop.
* e.g.
* for (...) {
* cond.andPrepare("SALESPROJECT_CLASSIFICATION.TYPE", entry, "# <> ?")
* }
* @param {Boolean} [not = undefined] if true, add not before in
* @return {SqlCondition} current SqlCondition-object
*/
SqlCondition.prototype.andIn = function(field, values, fieldType, not) {
return this.andAttachPrepared(this._in(field, values, fieldType, not));
}
/**
* creates a IN-statement out of a field and an array of values.
* Be carefull with a big number of values. This may have a bad performance.
*
* @param {String | String[]} field the database field as "tablename.columnname"; e.g. "ORGANISATION.NAME" or as array with column-alias: ["ORGANISATION", "NAME", "myorgAlias"]
* @param {String[]} values the value that shall be set into the prepared statement
* @param {Numeric | Boolean} [fieldType] SQL-column-type; if the fieldType is not given it's loaded automatically;
* The loaded type is cached if no type is given. So it is also safe to use this in a loop.
* e.g.
* for (...) {
* cond.andPrepare("SALESPROJECT_CLASSIFICATION.TYPE", entry, "# <> ?")
* }
* @param {Boolean} [not = undefined] if true, add not before in
* @return {SqlCondition} current SqlCondition-object
*/
SqlCondition.prototype.orIn = function(field, values, fieldType, not) {
return this.orAttachPrepared(this._in(field, values, fieldType, not));
}
/**
* creates a IN-statement out of a field and an array of values.
* Be carefull with a big number of values. This may have a bad performance.
*
* @param {String | String[]} field the database field as "tablename.columnname"; e.g. "ORGANISATION.NAME" or as array with column-alias: ["ORGANISATION", "NAME", "myorgAlias"]
* @param {String[]} values the value that shall be set into the prepared statement
* @param {Numeric | Boolean} [fieldType] SQL-column-type; if the fieldType is not given it's loaded automatically;
* The loaded type is cached if no type is given. So it is also safe to use this in a loop.
* e.g.
* for (...) {
* cond.andPrepare("SALESPROJECT_CLASSIFICATION.TYPE", entry, "# <> ?")
* }
* @param {Boolean} [not = undefined] if true, add not before in
* @return {SqlCondition} current SqlCondition-object
*/
SqlCondition.prototype._in = function(field, values, fieldType, not) {
if (values.length > 0)
{
if (fieldType == undefined)
fieldType = SqlUtils.getSingleColumnType(field, undefined, this.alias);
preparedStatement = SqlUtils.getSqlInStatement(field, values, undefined, true, fieldType);
if (not)
preparedStatement[0] = " not " + preparedStatement[0];
return preparedStatement;
}
return null;
}
/**
* ready to use string; does not contain a where keyword at the beginning
* @param {String} [alternativeCond=""] condition that is returned when nothing has been appended.
......@@ -1314,17 +1392,29 @@ SqlUtils.getSystemAlias = function()
* @param {String} pFieldname req name of the field with table alias
* z.B ORGREL.CONTACTID
* @param {String[]|String[][]} pData req Data as ID Array
* @param {String} pQuoteSymbol opt symbol for quoting values,
* @param {String} [pQuoteSymbol=""] symbol for quoting values,
* Strings i.e.: ' default is no symbol
* @param {Boolean} [pAsPrepared=undefined] true if result should be returned as prepared condition
* @param {Boolean} [pPreparedDbType=undefined] if pAsPrepared is true, this param has to be filld with the correct db type
*
* @return {String} SQL condition: where VALS in (1,2,3)
* @return {String|Array} SQL condition: where VALS in (1,2,3) OR as prepared Statement if pAsPrepared is true ["VALS in (1,2,3)", [...]
*/
SqlUtils.getSqlInStatement = function(pFieldname, pData, pQuoteSymbol) {
SqlUtils.getSqlInStatement = function(pFieldname, pData, pQuoteSymbol, pAsPrepared, pPreparedDbType) {
if (pData.length == 0)
return " 1 = 2 ";
var res = "";
var qs = pQuoteSymbol || "";
var preparedValues;
if (pAsPrepared)
{
preparedValues = [];
if (!pPreparedDbType)
{
throw new Error(translate.text("SqlUtils.getSqlInStatement: if pAsPrepared is true, pPreparedDbType has to be filld with the correct db type"));
}
}
var MAX_COUNT = 1000;
//pData.length -1 um für den Fall, dass MAX_COUNT == pData.length ist trotzdem nur einen Aufruf
......@@ -1334,17 +1424,36 @@ SqlUtils.getSqlInStatement = function(pFieldname, pData, pQuoteSymbol) {
for (var i = 0; i <= count; i++)
{
if (i > 0)
res += "or ";
res += pFieldname + " in (" + qs + pData.slice(i * MAX_COUNT, i * MAX_COUNT + MAX_COUNT)
.join(qs + ", " + qs) + qs + ") ";
res += " or ";
if (pAsPrepared)
{
res += pFieldname + " in (";
var subData = pData.slice(i * MAX_COUNT, i * MAX_COUNT + MAX_COUNT);
subData.forEach(function(pVal, pIndex) {
res += "?";
preparedValues.push([pVal, pPreparedDbType])
if (pIndex != subData.length-1)
res += ", ";
});
res += ")"
}
else
{
res += pFieldname + " in (" + qs + pData.slice(i * MAX_COUNT, i * MAX_COUNT + MAX_COUNT)
.join(qs + ", " + qs) + qs + ") ";
}
}
//wenn mehrere Zeilen mit "or" verknüpft wurden nochmal klammern
if (count > 0)
res = "(" + res + ")";
return res;
if (pAsPrepared)
return [res, preparedValues];
else
return res;
}
/**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment