Skip to content
Snippets Groups Projects
Commit 98b11cee authored by Sebastian Pongratz's avatar Sebastian Pongratz :ping_pong:
Browse files

[Projekt: xRM-ContactManagement][TicketNr.: 1083227][Firma: Bei Änderungen...

[Projekt: xRM-ContactManagement][TicketNr.: 1083227][Firma: Bei Änderungen werden die Standards für E-Mail und Telefon verworfen]
- Fixed bug.
parent 92e311b2
No related branches found
No related tags found
Loading
Showing
with 94 additions and 77 deletions
......@@ -355,6 +355,11 @@
<entityField>
<name>VALIDATION_RESULT</name>
</entityField>
<entityField>
<name>contentTitle</name>
<title>Address</title>
<valueProcess>%aditoprj%/entity/Address_entity/entityfields/contenttitle/valueProcess.js</valueProcess>
</entityField>
</entityFields>
<recordContainers>
<dbRecordContainer>
......
import("system.result");
import("system.vars");
result.string(vars.get("$field.#CONTENTTITLE") + ", " + vars.get("$field.COUNTRY"));
\ No newline at end of file
......@@ -85,6 +85,7 @@ Usually this is used for filtering COMMUNICATION-entries by a specified contact
</entityProvider>
<entityProvider>
<name>PhoneCommunications</name>
<lookupIdfield>COMMUNICATIONID</lookupIdfield>
<documentation>%aditoprj%/entity/Communication_entity/entityfields/phonecommunications/documentation.adoc</documentation>
<recordContainer>db</recordContainer>
<children>
......@@ -113,6 +114,7 @@ Usually this is used for filtering COMMUNICATION-entries by a specified contact
</entityProvider>
<entityProvider>
<name>EmailCommunications</name>
<lookupIdfield>COMMUNICATIONID</lookupIdfield>
<documentation>%aditoprj%/entity/Communication_entity/entityfields/emailcommunications/documentation.adoc</documentation>
<recordContainer>db</recordContainer>
<children>
......
import("system.result");
import("system.vars");
import("system.db");
import("system.result");
import("Sql_lib");
import("Keyword_lib");
import("Sql_lib");
var cond = newWhere()
.andIfSet("COMMUNICATION.OBJECT_ROWID", "$param.ObjectRowId_param")
......@@ -14,4 +14,5 @@ if (vars.getString("$param.CommMediumIds_param"))
var mediumIds = JSON.parse(vars.getString("$param.CommMediumIds_param"));
cond.andIfSet("COMMUNICATION.MEDIUM_ID", mediumIds, SqlBuilder.IN());
}
result.string(cond.toString());
\ No newline at end of file
......@@ -12,7 +12,8 @@ if (vars.get("$sys.viewmode") == neon.FRAME_VIEWMODE_DATASET)
var commRestrictionString = ContactUtils.getCommunicationRejectionSummary(vars.get("$field.CONTACTID"));
//has to be checked for exists because otherwise there will be a exception on the quickEntry_entity
var firstAddress = vars.exists("$field.Addresses.insertedRows") && vars.get("$field.Addresses.insertedRows") ? vars.get("$field.Addresses.insertedRows")[0] : null;
var firstAddress = vars.exists("$field.Addresses.insertedRows") && vars.get("$field.Addresses.insertedRows")
? vars.get("$field.Addresses.insertedRows")[0] : null;
var dataObject = DuplicateScannerUtils.getDataForDuplicateCheck(EntityUtils.getCurrentEntitytId(), {
CONTACTID: vars.get("$field.CONTACTID"),
......
import("system.vars");
import("system.neon");
neon.openContext("Organisation", "OrganisationEditDefaults_view", [vars.get("$sys.uid")], neon.OPERATINGSTATE_EDIT, null);
......@@ -2,4 +2,7 @@ import("system.vars");
import("Entity_lib");
// TODO: also there is currently no good way to do updates with fields not connected to the record container. Workaround: imagevariable and update in onDBUpdate Process #1030023
FieldChanges.setChange("$field.STANDARD_EMAIL_COMMUNICATION", vars.get("$local.value"));
\ No newline at end of file
if (vars.get("$field.STANDARD_EMAIL_COMMUNICATION") != vars.get("$local.value"))
{
FieldChanges.setChange("$field.STANDARD_EMAIL_COMMUNICATION", vars.get("$local.value"));
}
\ No newline at end of file
......@@ -2,4 +2,7 @@ import("system.vars");
import("Entity_lib");
// TODO: also there is currently no good way to do updates with fields not connected to the record container. Workaround: imagevariable and update in onDBUpdate Process #1030023
FieldChanges.setChange("$field.STANDARD_PHONE_COMMUNICATION", vars.get("$local.value"));
\ No newline at end of file
if (vars.get("$field.STANDARD_PHONE_COMMUNICATION") != vars.get("$local.value"))
{
FieldChanges.setChange("$field.STANDARD_PHONE_COMMUNICATION", vars.get("$local.value"));
}
\ No newline at end of file
import("Employee_lib");
import("Sql_lib");
import("system.vars");
import("Organisation_lib");
import("Communication_lib");
import("Sql_lib");
import("Entity_lib");
import("Workflow_lib");
import("Employee_lib");
import("Organisation_lib");
import("Communication_lib");
import("KeywordRegistry_basic");
import("DuplicateScanner_lib");
......@@ -13,24 +13,27 @@ DuplicateScannerUtils.updateHasDuplicateEntry(EntityUtils.getCurrentEntitytId())
// TODO: this is a workaround for missing possibility to react on changes of fields not connected to record Contqainer #1030023
var rowdata = vars.get("$local.rowdata");
var changedRows = vars.get("$local.changed");
var uid = rowdata["CONTACT.CONTACTID"];
var contactId = rowdata["CONTACT.CONTACTID"];
FieldChanges.assimilateChangeAndDispose("$field.STANDARD_EMAIL_COMMUNICATION", function(state, value){
CommUtil.setStandardMail(uid, value);
FieldChanges.assimilateChangeAndDispose("$field.STANDARD_EMAIL_COMMUNICATION", function(pState, pValue){
CommUtil.setStandardMail(contactId, pValue);
});
FieldChanges.assimilateChangeAndDispose("$field.STANDARD_PHONE_COMMUNICATION", function(state, value){
CommUtil.setStandardPhone(uid, value);
FieldChanges.assimilateChangeAndDispose("$field.STANDARD_PHONE_COMMUNICATION", function(pState, pValue){
CommUtil.setStandardPhone(contactId, pValue);
});
if (changedRows.indexOf("CONTACT.STATUS") > -1
&& rowdata["CONTACT.STATUS"] && rowdata["CONTACT.STATUS"] == $KeywordRegistry.contactStatus$inactive())
&& rowdata["CONTACT.STATUS"]
&& rowdata["CONTACT.STATUS"] == $KeywordRegistry.contactStatus$inactive())
{
var orgId = rowdata["ORGANISATION.ORGANISATIONID"];
newWhere("CONTACT.ORGANISATION_ID", orgId)
.and("CONTACT.PERSON_ID is not null")
.updateFields({"STATUS" : $KeywordRegistry.contactStatus$inactive()}, "CONTACT");
.updateFields({
"STATUS" : $KeywordRegistry.contactStatus$inactive()
}, "CONTACT");
}
WorkflowSignalSender.updated();
\ No newline at end of file
......@@ -399,6 +399,7 @@
<name>STANDARD_PHONE_COMMUNICATION</name>
<title>Phone</title>
<consumer>PhoneCommunications</consumer>
<displayValueProcess>%aditoprj%/entity/Person_entity/entityfields/standard_phone_communication/displayValueProcess.js</displayValueProcess>
<onValueChange>%aditoprj%/entity/Person_entity/entityfields/standard_phone_communication/onValueChange.js</onValueChange>
</entityField>
<entityConsumer>
......
......@@ -10,14 +10,18 @@ import("system.vars");
if (vars.get("$sys.viewmode") == neon.FRAME_VIEWMODE_DATASET)
{
var communications = null, email = null;
var commRestrictionString = ContactUtils.getCommunicationRejectionSummary(vars.get("$field.CONTACTID"));
var communications = vars.get("$field.Communications.insertedRows");
var email = communications.filter(function(object)
//has to be checked for exists because otherwise there will be a exception while triggering action openEditDefaultsView
if (vars.exists("$field.Communications.insertedRows") && !Utils.isNullOrEmpty(vars.get("$field.Communications.insertedRows")))
{
return object["MEDIUM_ID"] == $KeywordRegistry.communicationMedium$mail();
})[0];
communications = vars.get("$field.Communications.insertedRows");
email = communications.filter(function(object)
{
return object["MEDIUM_ID"] == $KeywordRegistry.communicationMedium$mail();
})[0];
}
var dataObject = DuplicateScannerUtils.getDataForDuplicateCheck(EntityUtils.getCurrentEntitytId(), {
PERSON_ID: vars.get("$field.PERSON_ID"),
......
import("system.vars");
import("system.neon");
neon.openContext("Person", "PersonEditDefaults_view", [vars.get("$field.CONTACTID")], neon.OPERATINGSTATE_EDIT, null);
\ No newline at end of file
import("system.logging");
import("system.vars");
import("Entity_lib");
// TODO: also there is currently no good way to do updates with fields not connected to the record container. Workaround: imagevariable and update in onDBUpdate Process #1030023
FieldChanges.setChange("$field.STANDARD_EMAIL_COMMUNICATION", vars.get("$local.value"));
\ No newline at end of file
if (vars.get("$field.STANDARD_EMAIL_COMMUNICATION") != vars.get("$local.value"))
{
FieldChanges.setChange("$field.STANDARD_EMAIL_COMMUNICATION", vars.get("$local.value"));
}
\ No newline at end of file
import("system.logging");
import("system.vars");
import("Entity_lib");
// TODO: also there is currently no good way to do updates with fields not connected to the record container. Workaround: imagevariable and update in onDBUpdate Process #1030023
FieldChanges.setChange("$field.STANDARD_PHONE_COMMUNICATION", vars.get("$local.value"));
\ No newline at end of file
if (vars.get("$field.STANDARD_PHONE_COMMUNICATION") != vars.get("$local.value"))
{
FieldChanges.setChange("$field.STANDARD_PHONE_COMMUNICATION", vars.get("$local.value"));
}
\ No newline at end of file
import("Sql_lib");
import("Workflow_lib");
import("DataPrivacy_lib");
import("system.logging");
import("KeywordRegistry_basic");
import("system.tools");
import("system.neon");
import("system.vars");
import("Sql_lib");
import("Person_lib");
import("Communication_lib");
import("Entity_lib");
import("Workflow_lib");
import("DataPrivacy_lib");
import("Communication_lib");
import("StandardObject_lib");
import("DuplicateScanner_lib");
......@@ -14,7 +16,12 @@ DuplicateScannerUtils.updateHasDuplicateEntry(EntityUtils.getCurrentEntitytId())
var localChanged = vars.get("$local.changed");
var orgChanged = false;
for (var i = 0; i < localChanged.length; i++) {
var commId = null;
var rowdata = vars.get("$local.rowdata");
var contactId = rowdata["CONTACT.CONTACTID"];
for (var i = 0; i < localChanged.length; i++)
{
if(localChanged[i] == "CONTACT.ORGANISATION_ID")
{
orgChanged = true;
......@@ -25,24 +32,25 @@ for (var i = 0; i < localChanged.length; i++) {
if(orgChanged)
{
var standardAddressId = new StandardObject("Address", null, "Person", vars.get("$field.PERSONID"))
.onPersonValueChange(vars.get("$field.ORGANISATION_ID"));
.onPersonValueChange(vars.get("$field.ORGANISATION_ID"));
newWhere("CONTACT.CONTACTID", vars.get("$field.CONTACTID")).updateData(true, "CONTACT", ["ADDRESS_ID"], null, [standardAddressId])
newWhere("CONTACT.CONTACTID", vars.get("$field.CONTACTID"))
.updateData(true, "CONTACT", ["ADDRESS_ID"], null, [standardAddressId])
}
var rowdata = vars.get("$local.rowdata");
// TODO: this is a workaround for missing possibility to react on changes of fields not connected to record Contqainer #1030023
var uid = rowdata["CONTACT.CONTACTID"];
FieldChanges.assimilateChangeAndDispose("$field.STANDARD_EMAIL_COMMUNICATION", function(state, value){
CommUtil.setStandardMail(uid, value);
});
FieldChanges.assimilateChangeAndDispose("$field.STANDARD_PHONE_COMMUNICATION", function(state, value){
CommUtil.setStandardPhone(uid, value);
FieldChanges.assimilateChangeAndDispose("$field.STANDARD_EMAIL_COMMUNICATION", function(pState, pValue){
CommUtil.setStandardMail(contactId, pValue);
});
FieldChanges.assimilateChangeAndDispose("$field.STANDARD_PHONE_COMMUNICATION", function(pState, pValue){
CommUtil.setStandardPhone(contactId, pValue);
});
new StandardObject("Address", rowdata["CONTACT.ADDRESS_ID"], "Person", uid)
.onPersonUpdate(rowdata["CONTACT.ORGANISATION_ID"]);
new StandardObject("Address", rowdata["CONTACT.ADDRESS_ID"], "Person", contactId)
.onPersonUpdate(rowdata["CONTACT.ORGANISATION_ID"]);
var updates = [];
......@@ -54,7 +62,7 @@ localChanged.forEach(function(fieldName)
case "PERSON.FIRSTNAME":
nameProp = tools.FIRSTNAME;
case "PERSON.LASTNAME":
var user = tools.getUserByAttribute(tools.CONTACTID, [uid], tools.PROFILE_FULL);
var user = tools.getUserByAttribute(tools.CONTACTID, [contactId], tools.PROFILE_FULL);
if (user)
{
user[tools.PARAMS][nameProp] = rowdata[fieldName];
......@@ -64,6 +72,6 @@ localChanged.forEach(function(fieldName)
}
})
DataPrivacyUtils.notifyNeedDataPrivacyUpdate(uid);
DataPrivacyUtils.notifyNeedDataPrivacyUpdate(contactId);
WorkflowSignalSender.updated();
\ No newline at end of file
......@@ -61,7 +61,7 @@ switch (tableName)
return newSelect("COMMUNICATION.OBJECT_ROWID")
.from("COMMUNICATION")
.where("COMMUNICATION.COMMUNICATIONID", id)
.where("COMMUNICATION.OBJECT_TYPE", "Contact")
.and("COMMUNICATION.OBJECT_TYPE", "Contact")
.arrayColumn();
});
break;
......
......@@ -21,40 +21,8 @@
<entityField>ADDR_TYPE</entityField>
</neonTableColumn>
<neonTableColumn>
<name>570039fc-c27a-4b06-a93e-16cc712a3d0c</name>
<entityField>ADDRESS</entityField>
</neonTableColumn>
<neonTableColumn>
<name>26ca52ce-91e7-4e76-a37e-6db28b967beb</name>
<entityField>BUILDINGNO</entityField>
</neonTableColumn>
<neonTableColumn>
<name>a54d6306-e9be-41db-9d1c-abeebe5ce77b</name>
<entityField>ZIP</entityField>
</neonTableColumn>
<neonTableColumn>
<name>6a07479c-b4d3-4946-993e-e6ce7dd825ba</name>
<entityField>CITY</entityField>
</neonTableColumn>
<neonTableColumn>
<name>e6d9ced9-eea3-4cdf-9751-74c8f206282f</name>
<entityField>COUNTRY</entityField>
</neonTableColumn>
<neonTableColumn>
<name>820b6ffc-7e56-4982-8f39-4443b0ada876</name>
<entityField>STATE</entityField>
</neonTableColumn>
<neonTableColumn>
<name>9651a718-ab01-4c97-8da0-6e7133f26466</name>
<entityField>REGION</entityField>
</neonTableColumn>
<neonTableColumn>
<name>9a5b1c97-c2b5-4f3a-b845-7cf56c0cb4eb</name>
<entityField>ADDRESSADDITION</entityField>
</neonTableColumn>
<neonTableColumn>
<name>24f73ac8-ac90-4beb-83fe-bdaa2d0806b6</name>
<entityField>ADDRIDENTIFIER</entityField>
<name>dbe3adfa-a299-423d-a006-336fb24556ae</name>
<entityField>contentTitle</entityField>
</neonTableColumn>
</columns>
</tableViewTemplate>
......
......@@ -199,17 +199,21 @@ FieldChanges.STATE_DELETED = function (){
*/
FieldChanges.assimilateChangeAndDispose = function (pFieldName, pAssimilatorFn)
{
var res = null;
var allChanges = FieldChanges._getStorage();
if (allChanges[pFieldName] == undefined)
{
return null;
}
var res = null;
if (allChanges[pFieldName].state != FieldChanges.STATE_NO_CHANGE())
{
res = pAssimilatorFn.call(this, allChanges[pFieldName].state, vars.get(pFieldName));
allChanges[pFieldName].state = FieldChanges.STATE_NO_CHANGE();
FieldChanges._setStorage(allChanges);
}
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