diff --git a/entity/CampaignAddParticipants_entity/CampaignAddParticipants_entity.aod b/entity/CampaignAddParticipants_entity/CampaignAddParticipants_entity.aod index 5d48a5105c946129a349e4f8e459bb9faa547c19..71c8af2723ad8ee5c8cee8a99fe9cc4740d47e51 100644 --- a/entity/CampaignAddParticipants_entity/CampaignAddParticipants_entity.aod +++ b/entity/CampaignAddParticipants_entity/CampaignAddParticipants_entity.aod @@ -38,7 +38,7 @@ <valueProcess>%aditoprj%/entity/CampaignAddParticipants_entity/entityfields/campaignparticipantmessage/valueProcess.js</valueProcess> </entityField> <entityParameter> - <name>campaignParticipants_param</name> + <name>campaignParticipantsRowIds_param</name> <expose v="true" /> <description>PARAMETER</description> </entityParameter> @@ -115,6 +115,14 @@ <name>isUpdate</name> <valueProcess>%aditoprj%/entity/CampaignAddParticipants_entity/entityfields/isupdate/valueProcess.js</valueProcess> </entityField> + <entityParameter> + <name>campaignParticipantsCondition_param</name> + <expose v="true" /> + </entityParameter> + <entityParameter> + <name>dataSourceTableName_param</name> + <expose v="true" /> + </entityParameter> </entityFields> <recordContainers> <jDitoRecordContainer> diff --git a/entity/CampaignAddParticipants_entity/entityfields/campaignparticipantmessage/valueProcess.js b/entity/CampaignAddParticipants_entity/entityfields/campaignparticipantmessage/valueProcess.js index 93144d421b59f8981e8f61e400ac6dc8b1937d85..e26b93f07ea4d621a85dbcf66f85ebdfdf0622a3 100644 --- a/entity/CampaignAddParticipants_entity/entityfields/campaignparticipantmessage/valueProcess.js +++ b/entity/CampaignAddParticipants_entity/entityfields/campaignparticipantmessage/valueProcess.js @@ -1,8 +1,12 @@ +import("system.logging"); import("system.result"); import("system.translate"); import("system.vars"); -var campaignParticipantsAmount = JSON.parse(vars.getString("$param.campaignParticipants_param")).length; -var informationText = translate.text("participants will be added to the selected campaign step"); +//logging.log(" -> " + JSON.stringify(vars.getString("$param.campaignParticipantsRowIds_param"))); +//var test = vars.getString("$param.campaignParticipantsRowIds_param"); +//var campaignParticipantsAmount = JSON.parse(vars.getString("$param.campaignParticipantsRowIds_param")).length; +//var informationText = translate.text("participants will be added to the selected campaign step"); -result.string(campaignParticipantsAmount + " " + informationText); \ No newline at end of file +//result.string(campaignParticipantsAmount + " " + informationText); +result.string("Message"); \ No newline at end of file diff --git a/entity/CampaignAddParticipants_entity/recordcontainers/jdito/onInsert.js b/entity/CampaignAddParticipants_entity/recordcontainers/jdito/onInsert.js index 323f5b11c4f2cef69ff6967f0617919aabfccc2b..77fdca8e84c742f4039226c4ac4fd9964a6f4923 100644 --- a/entity/CampaignAddParticipants_entity/recordcontainers/jdito/onInsert.js +++ b/entity/CampaignAddParticipants_entity/recordcontainers/jdito/onInsert.js @@ -1,74 +1,96 @@ +import("system.logging"); import("system.vars"); import("system.db"); import("system.util"); import("Campaign_lib"); +var cols = []; + +var participantRowIds = JSON.parse(vars.getString("$param.campaignParticipantsRowIds_param")); +var participantCondition = JSON.parse(vars.getString("$param.campaignParticipantsCondition_param")); +var conditionSourceTableName = vars.getString("$param.dataSourceTableName_param"); + var campaignId = vars.getString("$field.CAMPAIGN_ID"); var newCampaignStepId = vars.getString("$field.CAMPAIGNSTEP_ID"); -var participants = JSON.parse(vars.getString("$param.campaignParticipants_param")); - var isUpdate = vars.get("$field.isUpdate"); -var colNamesCampaignParticipantLog = CampaignUtils.getParticipantLogInsertColumnNames(); -var cols = []; +var colNamesCampaignParticipantLog = CampaignUtils.getParticipantLogInsertColumnNames(); -if(isUpdate == "true") +if(participantRowIds.length > 0) { - cols = [ "CAMPAIGNSTEP_ID", - "USER_EDIT", - "DATE_EDIT" - ]; + _handleRowIds(participantRowIds); } else { - cols = [ "CAMPAIGNPARTICIPANTID" - ,"CONTACT_ID" - ,"CAMPAIGN_ID" - ,"CAMPAIGNSTEP_ID" - ,"USER_NEW" - ,"DATE_NEW" - ]; + _handleCondition(participantCondition, conditionSourceTableName) +} + +function _handleCondition(pCondition, pSourceTableName) +{ + //( UPPER( PERSON.SALUTATION ) = UPPER( 'Frau' ) } -var statementArray = []; -var logArray = []; -for (participant in participants) +function _handleRowIds(pParticipantRowIds) { - var campaignParticipantLogId = util.getNewUUID(); if(isUpdate == "true") { - let updatedValues = [newCampaignStepId, - vars.get("$sys.user"), - vars.get("$sys.date")]; - - let condition = "CAMPAIGNPARTICIPANTID = '" + participants[participant] + "'"; - let valsCampaignParticipantLog = new Array(participants[participant], campaignId, newCampaignStepId, campaignParticipantLogId, vars.get("$sys.user"), vars.get("$sys.date")); - - statementArray.push(["CAMPAIGNPARTICIPANT", cols, null, updatedValues, condition]); - logArray.push(["CAMPAIGNPARTICIPANTLOG", colNamesCampaignParticipantLog, null, valsCampaignParticipantLog]); + cols = [ "CAMPAIGNSTEP_ID", + "USER_EDIT", + "DATE_EDIT" + ]; } else { - let campaignParticipantId = util.getNewUUID(); - - var valsCampaignParticipant = [ campaignParticipantId - , participants[participant] - , campaignId - , newCampaignStepId - , vars.get("$sys.user") - , vars.get("$sys.date") + cols = [ "CAMPAIGNPARTICIPANTID" + ,"CONTACT_ID" + ,"CAMPAIGN_ID" + ,"CAMPAIGNSTEP_ID" + ,"USER_NEW" + ,"DATE_NEW" ]; + } - let valsCampaignParticipantLog = new Array(campaignParticipantId, campaignId, newCampaignStepId, campaignParticipantLogId, vars.get("$sys.user"), vars.get("$sys.date")); + let statementArray = []; + let logArray = []; + for (participant in pParticipantRowIds) + { + let campaignParticipantLogId = util.getNewUUID(); + if(isUpdate == "true") + { + let updatedValues = [newCampaignStepId, + vars.get("$sys.user"), + vars.get("$sys.date")]; + + let condition = "CAMPAIGNPARTICIPANTID = '" + pParticipantRowIds[participant] + "'"; + let valsCampaignParticipantLog = new Array(pParticipantRowIds[participant], campaignId, newCampaignStepId, campaignParticipantLogId, vars.get("$sys.user"), vars.get("$sys.date")); + + statementArray.push(["CAMPAIGNPARTICIPANT", cols, null, updatedValues, condition]); + logArray.push(["CAMPAIGNPARTICIPANTLOG", colNamesCampaignParticipantLog, null, valsCampaignParticipantLog]); + } + else + { + let campaignParticipantId = util.getNewUUID(); + + let valsCampaignParticipant = [ campaignParticipantId + , pParticipantRowIds[participant] + , campaignId + , newCampaignStepId + , vars.get("$sys.user") + , vars.get("$sys.date") + ]; + + let valsCampaignParticipantLog = new Array(campaignParticipantId, campaignId, newCampaignStepId, campaignParticipantLogId, vars.get("$sys.user"), vars.get("$sys.date")); - statementArray.push(["CAMPAIGNPARTICIPANT", cols, null, valsCampaignParticipant]); - logArray.push(["CAMPAIGNPARTICIPANTLOG", colNamesCampaignParticipantLog, null, valsCampaignParticipantLog]); + statementArray.push(["CAMPAIGNPARTICIPANT", cols, null, valsCampaignParticipant]); + } } + + if(isUpdate == "true") + db.updates(statementArray) + else + db.inserts(statementArray); + + if(logArray.length > 0) + db.inserts(logArray); } -if(isUpdate == "true") - db.updates(statementArray) -else - db.inserts(statementArray); - -db.inserts(logArray); \ No newline at end of file diff --git a/entity/CampaignParticipant_entity/entityfields/filterviewactiongroup/children/setsteptoparticipantselection/onActionProcess.js b/entity/CampaignParticipant_entity/entityfields/filterviewactiongroup/children/setsteptoparticipantselection/onActionProcess.js index 990e188be561f4bb2b8ea73b668b16b25a65e5ab..1b2aa9e9bbce53eed7c943f579572496c3d0e454 100644 --- a/entity/CampaignParticipant_entity/entityfields/filterviewactiongroup/children/setsteptoparticipantselection/onActionProcess.js +++ b/entity/CampaignParticipant_entity/entityfields/filterviewactiongroup/children/setsteptoparticipantselection/onActionProcess.js @@ -2,7 +2,10 @@ import("system.vars"); import("system.neon"); import("Campaign_lib"); -if(vars.exists("$sys.selection")) //selektierte IDs als Array + +var sysSelection = vars.getString("$sys.selection"); + +if(sysSelection.length > 0) //selektierte IDs als Array { CampaignUtils.openSetCampaignStepView(vars.getString("$sys.selection"), vars.get("$field.CAMPAIGN_ID"), vars.get("$field.CAMPAIGNSTEP_ID")); } \ No newline at end of file diff --git a/entity/Organisation_entity/entityfields/campaignactiongroup/children/addtocampaignfromtable/onActionProcess.js b/entity/Organisation_entity/entityfields/campaignactiongroup/children/addtocampaignfromtable/onActionProcess.js index 0fbec19d1da86b1b492606a5cc430e756e5d1313..8ae8d45bb07577457f0511bdb492322be2b7cd6a 100644 --- a/entity/Organisation_entity/entityfields/campaignactiongroup/children/addtocampaignfromtable/onActionProcess.js +++ b/entity/Organisation_entity/entityfields/campaignactiongroup/children/addtocampaignfromtable/onActionProcess.js @@ -2,7 +2,14 @@ import("system.vars"); import("system.neon"); import("Campaign_lib"); -if(vars.exists("$sys.selection")) //selektierte IDs als Array +var sysSelection = vars.getString("sys.selection"); + +if(sysSelection.length > 0) //selektierte IDs als Array +{ + CampaignUtils.addParticipantsByRowIds(sysSelection, "ORGANISATION"); +} +else { - CampaignUtils.addParticipants(vars.getString("$sys.selection")); + let sysFilter = vars.get("$sys.filter");//todo change name + CampaignUtils.addParticipantsByCondition(sysFilter.condition, "ORGANISATION"); } \ No newline at end of file diff --git a/entity/Person_entity/entityfields/campaignactiongroup/children/addtocampaignfromtable/onActionProcess.js b/entity/Person_entity/entityfields/campaignactiongroup/children/addtocampaignfromtable/onActionProcess.js index 93d8123c03681bebbed47b99243cc230a6543b95..7be2f554b74e0286efb82bc177ce1dcc1e84fb39 100644 --- a/entity/Person_entity/entityfields/campaignactiongroup/children/addtocampaignfromtable/onActionProcess.js +++ b/entity/Person_entity/entityfields/campaignactiongroup/children/addtocampaignfromtable/onActionProcess.js @@ -2,7 +2,20 @@ import("system.vars"); import("system.neon"); import("Campaign_lib"); -if(vars.exists("$sys.selection")) //selektierte IDs als Array +/* + * If there's a selection only those are ought to be added. + * Otherwise the filter gets checked, if a filter has beed set, the condition + * is used to determine the objects to be added. + * If no selection has been set, all objects will be added. + */ +var sysSelection = vars.getString("$sys.selection"); + +if(sysSelection.length > 0) //selektierte IDs als Array +{ + CampaignUtils.addParticipantsByRowIds(sysSelection, "PERSON"); +} +else { - CampaignUtils.addParticipants(vars.getString("$sys.selection")); + let sysFilter = vars.get("$sys.filter");//todo change name + CampaignUtils.addParticipantsByCondition(sysFilter.condition, "PERSON"); } \ No newline at end of file diff --git a/language/_____LANGUAGE_EXTRA/_____LANGUAGE_EXTRA.aod b/language/_____LANGUAGE_EXTRA/_____LANGUAGE_EXTRA.aod index 2cff05e9f26a57fb1c8bb670acb5a00ac7ec9c08..d1af6a77d29e496d8267650ce113f85294200d8e 100644 --- a/language/_____LANGUAGE_EXTRA/_____LANGUAGE_EXTRA.aod +++ b/language/_____LANGUAGE_EXTRA/_____LANGUAGE_EXTRA.aod @@ -3702,6 +3702,9 @@ <entry> <key>Do you really want to delete this recurring appointment?</key> </entry> + <entry> + <key>Start date</key> + </entry> </keyValueMap> <font name="Dialog" style="0" size="11" /> <sqlModels> diff --git a/language/_____LANGUAGE_de/_____LANGUAGE_de.aod b/language/_____LANGUAGE_de/_____LANGUAGE_de.aod index ce566a5eaf3a1528782b458472c808b72297834e..78f95e3469c3d2c551b8eeed0238b6061a8276d2 100644 --- a/language/_____LANGUAGE_de/_____LANGUAGE_de.aod +++ b/language/_____LANGUAGE_de/_____LANGUAGE_de.aod @@ -4523,6 +4523,7 @@ </entry> <entry> <key>New step</key> + <value>Neue Stufe</value> </entry> <entry> <key>Runtime</key> diff --git a/language/_____LANGUAGE_en/_____LANGUAGE_en.aod b/language/_____LANGUAGE_en/_____LANGUAGE_en.aod index b3908e18a50c3eb581e324ed9e45c867b6f39a0c..ab510d02a2497320f7d050c019f5ba2c6fcfe0fd 100644 --- a/language/_____LANGUAGE_en/_____LANGUAGE_en.aod +++ b/language/_____LANGUAGE_en/_____LANGUAGE_en.aod @@ -3751,6 +3751,9 @@ <entry> <key>Do you really want to delete this recurring appointment?</key> </entry> + <entry> + <key>Start date</key> + </entry> </keyValueMap> <font name="Dialog" style="0" size="11" /> </language> diff --git a/neonContext/CampaignStep/CampaignStep.aod b/neonContext/CampaignStep/CampaignStep.aod index 5ffbe5f7e726d650db7f95313d0863759485cdbe..6a03138ca81cbc2312f24bd130d593d1ec71d13c 100644 --- a/neonContext/CampaignStep/CampaignStep.aod +++ b/neonContext/CampaignStep/CampaignStep.aod @@ -3,7 +3,6 @@ <name>CampaignStep</name> <title>Campaign Step</title> <majorModelMode>DISTRIBUTED</majorModelMode> - <mainview>CampaignStepMain_view</mainview> <filterview>CampaignStepFilter_view</filterview> <editview>CampaignStepEdit_view</editview> <preview>CampaignStepPreview_view</preview> diff --git a/process/Campaign_lib/process.js b/process/Campaign_lib/process.js index bf72837d510bb4fb8ada0a5359e0745c352d7ea4..c1a90cd8d8c568add584458071fcc08cf80ce829 100644 --- a/process/Campaign_lib/process.js +++ b/process/Campaign_lib/process.js @@ -30,11 +30,22 @@ CampaignUtils.addParticipant = function(pContactId) * * @param {String} pRowIds req ContactIds */ -CampaignUtils.addParticipants = function(pRowIds) +CampaignUtils.addParticipantsByRowIds = function(pRowIds, pSourceTableName) { - _CampaignUtils._openAddParticipantContext("CampaignAddParticipants", pRowIds, "campaignParticipants_param", "CampaignAddParticipantsEdit_view"); + _CampaignUtils._openAddParticipantContext("CampaignAddParticipants", pRowIds, + "campaignParticipantsRowIds_param", "CampaignAddParticipantsEdit_view", pSourceTableName); } +/** + * Add many Contacts (Person or Organistaion) to a Campaign + * + * @param {String} pRowIds req ContactIds + */ +CampaignUtils.addParticipantsByCondition = function(pCondition, pSourceTableName) +{ + _CampaignUtils._openAddParticipantContext("CampaignAddParticipants", pCondition, + "campaignParticipantsCondition_param", "CampaignAddParticipantsEdit_view", pSourceTableName); +} /** * todo @@ -149,8 +160,7 @@ CampaignUtils.getParticipantLogInsertColumnNames = function() CampaignUtils.openSetCampaignStepView = function(pParticipantIds, pCampaignId, pCampaignStepId) { var params = {}; - - params["campaignParticipants_param"] = pParticipantIds; + params["campaignParticipantsRowIds_param"] = pParticipantIds; params["currentCampaignId_param"] = pCampaignId; params["currentCampaignStepId_param"] = pCampaignStepId; params["isUpdate_param"] = true; @@ -311,15 +321,16 @@ function _CampaignUtils() {} * @param {String} pView req targeting view * */ -_CampaignUtils._openAddParticipantContext = function(pContext, pRowIds, pEntityParam, pView) +_CampaignUtils._openAddParticipantContext = function(pContext, pTargetDataExpression, pDataExpressionParameterName, pView, pSourceTableName) { var params = {}; - if (pRowIds) + if (pTargetDataExpression) { - params[pEntityParam] = pRowIds; + params[pDataExpressionParameterName] = pTargetDataExpression; } params["isUpdate_param"] = false; + params["dataSourceTableName_param"] = pSourceTableName; neon.openContext(pContext, null, null, neon.OPERATINGSTATE_NEW, params); }