diff --git a/entity/Salesproject_entity/entityfields/checklistentryvalues/children/objectrowid_param/valueProcess.js b/entity/Salesproject_entity/entityfields/checklistentryvalues/children/objectrowid_param/valueProcess.js index 35c86fce60207e00936f99096038f1ee1f4519e9..c8150fdcd5f99b0b53138d178fa6986b2385efc9 100644 --- a/entity/Salesproject_entity/entityfields/checklistentryvalues/children/objectrowid_param/valueProcess.js +++ b/entity/Salesproject_entity/entityfields/checklistentryvalues/children/objectrowid_param/valueProcess.js @@ -1,5 +1,4 @@ import("system.result"); import("system.vars"); - result.string(vars.get("$field.SALESPROJECTID")); \ No newline at end of file diff --git a/entity/Salesproject_entity/recordcontainers/db/onDBUpdate.js b/entity/Salesproject_entity/recordcontainers/db/onDBUpdate.js index 98e485c0fb60aafa9e3cf2e6abad127399eb2898..61aa43cba4691fadddc0a7dd5a6f6789b966cefd 100644 --- a/entity/Salesproject_entity/recordcontainers/db/onDBUpdate.js +++ b/entity/Salesproject_entity/recordcontainers/db/onDBUpdate.js @@ -90,7 +90,7 @@ vars.get("$local.changed").forEach(function(fieldName) { , "progress": $KeywordRegistry.taskProgress$0() , "status": $KeywordRegistry.taskStatus$assigned() , "protectionlevel": "0" - }, [["Salesproject", vars.getString("$local.uid")]]); + , "attendees": [contactId]}, [["Salesproject", vars.getString("$local.uid")]]); // ask if forecast should be cleared. Else reset to old value. diff --git a/language/_____LANGUAGE_de/_____LANGUAGE_de.aod b/language/_____LANGUAGE_de/_____LANGUAGE_de.aod index 4f7959ac78444da822da9dae881afca4b70eee00..7133dd9f28d68ba2fb43e3ed44295e3ada6886bc 100644 --- a/language/_____LANGUAGE_de/_____LANGUAGE_de.aod +++ b/language/_____LANGUAGE_de/_____LANGUAGE_de.aod @@ -145,6 +145,10 @@ <key>Open Visitrecommendation</key> <value>Offener Besuchsvorschlag</value> </entry> + <entry> + <key>Sales project responsibility set</key> + <value>Vertriebsprojekt Verantwortlichen gesetzt</value> + </entry> <entry> <key>Number of openers</key> <value>Anzahl Openers</value> diff --git a/process/ActivityTask_lib/process.js b/process/ActivityTask_lib/process.js index 722d202ca01ad29224b88d4917f703b5b0a03065..70137006164da591b43ccd20a98b57c9423e16e6 100644 --- a/process/ActivityTask_lib/process.js +++ b/process/ActivityTask_lib/process.js @@ -885,6 +885,7 @@ TaskUtils.createNewTaskSilent = function(pDataPreset, pTaskLinks, pDbAlias) var taskId = dataPreset.taskId || util.getNewUUID(); var startDate = dataPreset.startDate || datetime.date(); var marturityDate = dataPreset.marturityDate || marturityDate; + var attendees = dataPreset.attendees || []; var fieldValues = { "TASKID": taskId @@ -917,7 +918,7 @@ TaskUtils.createNewTaskSilent = function(pDataPreset, pTaskLinks, pDbAlias) if (pTaskLinks) { - for (var i = 0, l = pTaskLinks.length; i < l; i++) + for (let i = 0, l = pTaskLinks.length; i < l; i++) { insertStatements.push(new SqlBuilder().buildInsertStatement({"TASKLINKID": util.getNewUUID() , "TASK_ID": taskId @@ -925,6 +926,12 @@ TaskUtils.createNewTaskSilent = function(pDataPreset, pTaskLinks, pDbAlias) , "OBJECT_ROWID": pTaskLinks[i][1]}, "TASKLINK")); } } + for (let i = 0; i < attendees.length; i++) + { + insertStatements.push(new SqlBuilder().buildInsertStatement({"TASKATTENDEESID": util.getNewUUID() + , "TASK_ID": taskId + , "CONTACT_ID": attendees[i]}, "TASKATTENDEES")); + } db.execute(insertStatements, dbAlias); diff --git a/process/ChecklistEntryRegistry_basic/process.js b/process/ChecklistEntryRegistry_basic/process.js index 9cf5b604d5998002168c130b47dd9295d237a2be..14505ec30942126b83ff8b217a53971025fcddf9 100644 --- a/process/ChecklistEntryRegistry_basic/process.js +++ b/process/ChecklistEntryRegistry_basic/process.js @@ -168,7 +168,7 @@ $ChecklistEntryRegistry.salesprojectVolume = function(){ verifierFn: function(pSalesprojectId){ var spRows = $ChecklistEntryRegistry._getRows(pSalesprojectId, "Salesproject_entity", ["VOLUME"], null, "NoPhaseRequirementLoading"); - if(spRows[0]["VOLUME"] && spRows[0]["VOLUME"] != "") + if(spRows && spRows[0] && spRows[0]["VOLUME"] && spRows[0]["VOLUME"] != "") { return true; } @@ -189,7 +189,7 @@ $ChecklistEntryRegistry.salesprojectProjStart = function(){ verifierFn: function(pSalesprojectId){ var spRows = $ChecklistEntryRegistry._getRows(pSalesprojectId, "Salesproject_entity", ["STARTDATE"], null, "NoPhaseRequirementLoading"); - if(spRows[0]["STARTDATE"] && spRows[0]["STARTDATE"] != "") + if(spRows && spRows[0] && spRows[0]["STARTDATE"] && spRows[0]["STARTDATE"] != "") { return true; } @@ -406,7 +406,7 @@ $ChecklistEntryRegistry.salesprojectStatusWon = function(){ verifierFn: function(pSalesprojectId){ var spRows = $ChecklistEntryRegistry._getRows(pSalesprojectId, "Salesproject_entity", ["STATUS"], null, "NoPhaseRequirementLoading"); - if(spRows[0]["STATUS"] && (spRows[0]["STATUS"] == $KeywordRegistry.salesprojectState$partialOrder() || + if(spRows && spRows[0] && spRows[0]["STATUS"] && (spRows[0]["STATUS"] == $KeywordRegistry.salesprojectState$partialOrder() || spRows[0]["STATUS"] == $KeywordRegistry.salesprojectState$order())) { return true; @@ -452,21 +452,28 @@ $ChecklistEntryRegistry.salesprojectRoleProjectteam = function(){ title: translate.text("Project team"), verifierFn: function(pSalesprojectId){ var spRows = $ChecklistEntryRegistry._getRows(pSalesprojectId, "Salesproject_entity", ["SALESPROJECTID", "MST_TEAM_ID", "PROJECTCODE"], null, "NoPhaseRequirementLoading"); - var memberRows = $ChecklistEntryRegistry._getRows(null, "Member_entity", ["MEMBERROLE"], [["EnableMSTeams_param", spRows[0]["MST_TEAM_ID"]], - ["ObjectRowId_param", spRows[0]["SALESPROJECTID"]]], "WithDistrictResponsibles"); - var roles = ["MEMROLEINITIATOR", "MEMROLEDECISIONMAKER", "MEMROLEADVISE", "MEMROLEUSER", "MEMROLEEXSALEMANAG"]; - var halfLength = Math.floor(roles.length / 2); - - for (let i = 0; i < memberRows.length; i++) + if(spRows && spRows.length > 0) { - var role = memberRows[i]["MEMBERROLE"]; - var index = roles.indexOf(role); - if (index !== -1) + var memberRows = $ChecklistEntryRegistry._getRows(null, "Member_entity", ["MEMBERROLE"], [["EnableMSTeams_param", spRows[0]["MST_TEAM_ID"]], + ["ObjectRowId_param", spRows[0]["SALESPROJECTID"]]], "WithDistrictResponsibles"); + var roles = ["MEMROLEINITIATOR", "MEMROLEDECISIONMAKER", "MEMROLEADVISE", "MEMROLEUSER", "MEMROLEEXSALEMANAG"]; + var halfLength = Math.floor(roles.length / 2); + + for (let i = 0; i < memberRows.length; i++) { - roles.splice(index, 1); + var role = memberRows[i]["MEMBERROLE"]; + var index = roles.indexOf(role); + if (index !== -1) + { + roles.splice(index, 1); + } } + return roles.length <= halfLength; + } + else + { + return false; } - return roles.length <= halfLength; } }; } @@ -667,12 +674,13 @@ $ChecklistEntryRegistry.filter = function(){ */ $ChecklistEntryRegistry.salesprojectResponsible = function(){ return{ - title: translate.text("Sales project responibility set"), + context: ["Salesproject"], + title: translate.text("Sales project responsibility set"), verifierFn: function(pSalesprojectId){ var memberRows = $ChecklistEntryRegistry._getRows(null, "Member_entity", ["RESPONSIBLE"], [["EnableMSTeams_param", ""], ["ObjectRowId_param", pSalesprojectId]], "WithDistrictResponsibles"); - memberRows.some(function (row) { return row["RESPONSIBLE"] == 1; }); + return memberRows.some(function (row) { return Utils.toBoolean(row["RESPONSIBLE"]); }); } }; } \ No newline at end of file