Skip to content
Snippets Groups Projects
Commit 9d26fd3f authored by Benjamin Ulrich's avatar Benjamin Ulrich :speech_balloon:
Browse files

[Projekt: Entwicklung - Neon][TicketNr.: 1059714][neon.open*** können und...

[Projekt: Entwicklung - Neon][TicketNr.: 1059714][neon.open*** können und dürfen nicht in store-Prozessen(insert, update, delete) des RecordContainers verwendet werden]
Serialletter - add recipients
parent 5b8d4dd7
No related branches found
No related tags found
No related merge requests found
Showing
with 78 additions and 37 deletions
......@@ -3,7 +3,7 @@
<name>SerialLetterAddRecipients_entity</name>
<majorModelMode>DISTRIBUTED</majorModelMode>
<documentation>%aditoprj%/entity/SerialLetterAddRecipients_entity/documentation.adoc</documentation>
<recordContainer>jdito</recordContainer>
<recordContainer>datalessRecordContainer</recordContainer>
<entityFields>
<entityProvider>
<name>#PROVIDER</name>
......@@ -13,17 +13,21 @@
<title>Serial letter</title>
<consumer>SerialLetters</consumer>
<mandatory v="true" />
<state>EDITABLE</state>
<displayValueProcess>%aditoprj%/entity/SerialLetterAddRecipients_entity/entityfields/serialletter_id/displayValueProcess.js</displayValueProcess>
</entityField>
<entityField>
<name>UID</name>
<state>EDITABLE</state>
</entityField>
<entityField>
<name>recipientContactIds</name>
<state>EDITABLE</state>
<valueProcess>%aditoprj%/entity/SerialLetterAddRecipients_entity/entityfields/recipientcontactids/valueProcess.js</valueProcess>
</entityField>
<entityField>
<name>recipientCountMessage</name>
<state>EDITABLE</state>
<valueProcess>%aditoprj%/entity/SerialLetterAddRecipients_entity/entityfields/recipientcountmessage/valueProcess.js</valueProcess>
</entityField>
<entityParameter>
......@@ -38,18 +42,23 @@
<fieldName>#PROVIDER</fieldName>
</dependency>
</entityConsumer>
<entityActionField>
<name>addParticipants</name>
<title>Add Recipients</title>
<onActionProcess>%aditoprj%/entity/SerialLetterAddRecipients_entity/entityfields/addparticipants/onActionProcess.js</onActionProcess>
<iconId>VAADIN:ENVELOPES</iconId>
<stateProcess>%aditoprj%/entity/SerialLetterAddRecipients_entity/entityfields/addparticipants/stateProcess.js</stateProcess>
</entityActionField>
<entityField>
<name>recipientcount</name>
<state>EDITABLE</state>
<valueProcess>%aditoprj%/entity/SerialLetterAddRecipients_entity/entityfields/recipientcount/valueProcess.js</valueProcess>
</entityField>
</entityFields>
<recordContainers>
<jDitoRecordContainer>
<name>jdito</name>
<jDitoRecordAlias>Data_alias</jDitoRecordAlias>
<contentProcess>%aditoprj%/entity/SerialLetterAddRecipients_entity/recordcontainers/jdito/contentProcess.js</contentProcess>
<onInsert>%aditoprj%/entity/SerialLetterAddRecipients_entity/recordcontainers/jdito/onInsert.js</onInsert>
<recordFieldMappings>
<jDitoRecordFieldMapping>
<name>UID.value</name>
</jDitoRecordFieldMapping>
</recordFieldMappings>
</jDitoRecordContainer>
<datalessRecordContainer>
<name>datalessRecordContainer</name>
<alias>Data_alias</alias>
</datalessRecordContainer>
</recordContainers>
</entity>
import("system.neon");
import("system.result");
import("system.vars");
var count = vars.getString("$field.recipientcount");
if (count == "0" || !count || vars.get("$sys.validationerrors"))
result.string(neon.COMPONENTSTATE_DISABLED);
else
result.string(neon.COMPONENTSTATE_EDITABLE);
\ No newline at end of file
......@@ -8,15 +8,13 @@ import("Sql_lib");
import("system.vars");
var contactIds = JSON.parse(vars.getString("$param.ContactIds_param"));
var serialLetterId = vars.get("$field.SERIALLETTER_ID")
contactIds = newSelect("CONTACTID")
.from("CONTACT")
.where("CONTACT.CONTACTID", contactIds, SqlBuilder.IN())
.and(null, newSelect("LETTERRECIPIENTID")
.from("LETTERRECIPIENT")
.where("LETTERRECIPIENT.CONTACT_ID = CONTACT.CONTACTID")
.and("LETTERRECIPIENT.SERIALLETTER_ID", "$field.SERIALLETTER_ID"), SqlBuilder.NOT_EXISTS()) //only add contacts that aren't already recipients
.and(ContactUtils.getCommRestrictionCondition($KeywordRegistry.communicationMediumCampaign$letter(), true)) //check if there's a commrestriction
.array(db.COLUMN)
var res;
if (serialLetterId)
res = JSON.stringify(BulkMailUtils.filterNewRecipients(serialLetterId, contactIds));
else
res = null;
result.string(res);
result.string(JSON.stringify(contactIds));
import("system.result");
import("system.vars");
var res = "";
if (vars.get("$field.recipientContactIds"))
{
res = JSON.parse(vars.getString("$field.recipientContactIds")).length;
}
result.string(res);
......@@ -2,8 +2,13 @@ import("system.translate");
import("system.result");
import("system.vars");
if (vars.get("$field.SERIALLETTER_ID"))
var count = vars.getString("$field.recipientcount")
var res = "";
if (count && !vars.get("$sys.validationerrors"))
{
var count = JSON.parse(vars.getString("$field.recipientContactIds")).length;
result.string(translate.withArguments("%0 new recipients will be added to the serial letter.", [String(count)]));
}
\ No newline at end of file
if (count == "0")
res = translate.text("No new recipients found that can be added to the serial letter.");
else
res = translate.withArguments("%0 new recipients will be added to the serial letter.", [count]);
}
result.string(res);
\ No newline at end of file
import("system.result");
import("system.vars");
//TODO: This dummy implementation shouldn't be nescessary here. Remove this process eventually. #1051003
var rows = [];
if (vars.get("$local.idvalues"))
rows = vars.get("$local.idvalues").map(function (id) {return [id];});
result.object(rows);
\ No newline at end of file
......@@ -6827,6 +6827,9 @@
<entry>
<key>export using the selected template</key>
</entry>
<entry>
<key>No new recipients found that can be added to the serial letter.</key>
</entry>
</keyValueMap>
<font name="Dialog" style="0" size="11" />
<sqlModels>
......
......@@ -8748,6 +8748,10 @@ Bitte Datumseingabe prüfen</value>
<key>export using the selected template</key>
<value>Mit der ausgewählten Vorlage Exportieren</value>
</entry>
<entry>
<key>No new recipients found that can be added to the serial letter.</key>
<value>Keine neuen Empfänger, die zum Serienbrief werden können, gefunden.</value>
</entry>
</keyValueMap>
<font name="Dialog" style="0" size="11" />
</language>
......@@ -6893,6 +6893,9 @@
<entry>
<key>export using the selected template</key>
</entry>
<entry>
<key>No new recipients found that can be added to the serial letter.</key>
</entry>
</keyValueMap>
<font name="Dialog" style="0" size="11" />
</language>
......@@ -3,7 +3,7 @@
<name>SerialLetterAddRecipientsEdit_view</name>
<majorModelMode>DISTRIBUTED</majorModelMode>
<size>SMALL</size>
<isOverlay v="true" />
<isOverlay v="false" />
<overlayOrientation>PORTRAIT</overlayOrientation>
<layout>
<noneLayout>
......@@ -14,7 +14,9 @@
<genericViewTemplate>
<name>Generic</name>
<editMode v="true" />
<hideEmptyFields v="false" />
<entityField>#ENTITY</entityField>
<informationField>recipientCountMessage</informationField>
<fields>
<entityFieldLink>
<name>c289afee-ed44-48d7-8f2a-50c1bffb886e</name>
......@@ -33,5 +35,12 @@
</entityFieldLink>
</fields>
</genericViewTemplate>
<actionsViewTemplate>
<name>ContinueActions</name>
<actions>
<element>addParticipants</element>
</actions>
<entityField>#ENTITY</entityField>
</actionsViewTemplate>
</children>
</neonView>
......@@ -431,7 +431,7 @@ SerialLetterUtils.openAddRecipientView = function (pContactIds)
var params = {
"ContactIds_param" : pContactIds
};
neon.openContext("SerialLetterAddRecipients", "SerialLetterAddRecipientsEdit_view", null, neon.OPERATINGSTATE_NEW, params);
neon.openContext("SerialLetterAddRecipients", "SerialLetterAddRecipientsEdit_view", null, neon.OPERATINGSTATE_VIEW, params);
}
/**
......
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