diff --git a/entity/BulkMail_entity/recordcontainers/db/fromClauseProcess.js b/entity/BulkMail_entity/recordcontainers/db/fromClauseProcess.js index 1820a51b4973e9e143e89ef18739e26e3f5b276f..deca382a381a30c435a7c243e5e671756e5dcb26 100644 --- a/entity/BulkMail_entity/recordcontainers/db/fromClauseProcess.js +++ b/entity/BulkMail_entity/recordcontainers/db/fromClauseProcess.js @@ -5,4 +5,6 @@ var from = new SqlBuilder() .from("BULKMAIL") .leftJoin("DOCUMENTTEMPLATE", "BULKMAIL.DOCUMENTTEMPLATE_ID = DOCUMENTTEMPLATE.DOCUMENTTEMPLATEID") .leftJoin("MOSAICOTEMPLATE", "BULKMAIL.MOSAICOTEMPLATE_ID = MOSAICOTEMPLATE.MOSAICOTEMPLATEID") + .leftJoin("CONTACT", "CONTACT.CONTACTID = BULKMAIL.EMPLOYEE_CONTACT_ID") + .leftJoin("PERSON", "PERSON.PERSONID = CONTACT.PERSON_ID") result.string(from.toString()); \ No newline at end of file diff --git a/entity/BulkMail_entity/recordcontainers/db/recordfieldmappings/employee_contact_id.displayvalue/expression.js b/entity/BulkMail_entity/recordcontainers/db/recordfieldmappings/employee_contact_id.displayvalue/expression.js index 39b635bffd96afba9ecdbbc71bb7bf03167f6802..d75b9f3fc60b019618522690921bf25b06ea60a7 100644 --- a/entity/BulkMail_entity/recordcontainers/db/recordfieldmappings/employee_contact_id.displayvalue/expression.js +++ b/entity/BulkMail_entity/recordcontainers/db/recordfieldmappings/employee_contact_id.displayvalue/expression.js @@ -1,3 +1,4 @@ -import("Person_lib"); import("system.result"); -result.string(PersUtils.getResolvingDisplaySubSql("BULKMAIL.EMPLOYEE_CONTACT_ID")); \ No newline at end of file +import("Person_lib"); + +result.string(PersUtils.getDisplaySqlExpression()); \ No newline at end of file diff --git a/entity/CampaignParticipant_entity/CampaignParticipant_entity.aod b/entity/CampaignParticipant_entity/CampaignParticipant_entity.aod index 3ee2c224e92b748bc2e0513aba8700b1c5ffd06b..56099308c728313324d1b2b7d2fad60c7c578c77 100644 --- a/entity/CampaignParticipant_entity/CampaignParticipant_entity.aod +++ b/entity/CampaignParticipant_entity/CampaignParticipant_entity.aod @@ -364,7 +364,7 @@ </dbRecordFieldMapping> <dbRecordFieldMapping> <name>CAMPAIGNSTEP_ID.displayValue</name> - <expression>%aditoprj%/entity/CampaignParticipant_entity/recordcontainers/db/recordfieldmappings/campaignstep_id.displayvalue/expression.js</expression> + <recordfield>CAMPAIGNSTEP.NAME</recordfield> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>campaignStepCurrentParticipantCount.value</name> @@ -420,33 +420,40 @@ </recordFieldMappings> <linkInformation> <linkInformation> - <name>02d0ac80-2767-401c-bdc1-aac3e8abf0e4</name> + <name>0aa4dca9-2644-43e7-9390-ad54408f9c67</name> <tableName>CAMPAIGNPARTICIPANT</tableName> <primaryKey>CAMPAIGNPARTICIPANTID</primaryKey> <isUIDTable v="true" /> <readonly v="false" /> </linkInformation> <linkInformation> - <name>6c320211-601b-47bf-a562-003886666040</name> + <name>2e997cb8-b3a8-42fa-b94d-dd195bc3594e</name> <tableName>CONTACT</tableName> <primaryKey>CONTACTID</primaryKey> <isUIDTable v="false" /> <readonly v="true" /> </linkInformation> <linkInformation> - <name>e1719eb5-112c-4acd-8f72-58a688d5f058</name> + <name>18150da0-5225-4c4e-9efa-382a6f93b633</name> <tableName>PERSON</tableName> <primaryKey>PERSONID</primaryKey> <isUIDTable v="false" /> <readonly v="true" /> </linkInformation> <linkInformation> - <name>8be80af4-69ea-4a5d-b404-8a26c1f8d8da</name> + <name>41d08e24-65e5-4356-844b-b0aad6aedd08</name> <tableName>ORGANISATION</tableName> <primaryKey>ORGANISATIONID</primaryKey> <isUIDTable v="false" /> <readonly v="true" /> </linkInformation> + <linkInformation> + <name>71cbd9cf-5311-467f-bc5e-a50aeeb64692</name> + <tableName>CAMPAIGNSTEP</tableName> + <primaryKey>CAMPAIGNSTEPID</primaryKey> + <isUIDTable v="false" /> + <readonly v="true" /> + </linkInformation> </linkInformation> </dbRecordContainer> </recordContainers> diff --git a/entity/CampaignParticipant_entity/recordcontainers/db/fromClauseProcess.js b/entity/CampaignParticipant_entity/recordcontainers/db/fromClauseProcess.js index 8603fcea0476d3281eedbdcb42db6032e193ff12..1107205ac5289bfa59d29d0e00320ced8faade2d 100644 --- a/entity/CampaignParticipant_entity/recordcontainers/db/fromClauseProcess.js +++ b/entity/CampaignParticipant_entity/recordcontainers/db/fromClauseProcess.js @@ -1,5 +1,14 @@ +import("Sql_lib"); import("system.result"); -result.string("CAMPAIGNPARTICIPANT " - +" join CONTACT on CONTACTID = CONTACT_ID " - +" left join PERSON ON PERSONID = PERSON_ID " - +" join ORGANISATION on ORGANISATION_ID = ORGANISATIONiD"); \ No newline at end of file + +var from = new SqlBuilder() + .from("CAMPAIGNPARTICIPANT") + .leftJoin("CAMPAIGNSTEP", "CAMPAIGNPARTICIPANT.CAMPAIGNSTEP_ID = CAMPAIGNSTEP.CAMPAIGNSTEPID") + .leftJoin("CONTACT", "CONTACT.CONTACTID = CAMPAIGNPARTICIPANT.CONTACT_ID") + .leftJoin("PERSON", "PERSON.PERSONID = CONTACT.PERSON_ID") + .leftJoin("ORGANISATION", "CONTACT.ORGANISATION_ID = ORGANISATION.ORGANISATIONID") + .leftJoin("CONTACT", newWhere("ORGANISATION_CONTACT.ORGANISATION_ID = CONTACT.ORGANISATION_ID").and("ORGANISATION_CONTACT.PERSON_ID is null"), "ORGANISATION_CONTACT") + .leftJoin("CONTACT", "RESPONSIBLE_CONTACT.CONTACTID = CAMPAIGNPARTICIPANT.RESPONSIBLE_CONTACT_ID", "RESPONSIBLE_CONTACT") + .leftJoin("PERSON", "RESPONSIBLE_PERSON.PERSONID = RESPONSIBLE_CONTACT.PERSON_ID", "RESPONSIBLE_PERSON"); + +result.string(from.toString()); \ No newline at end of file diff --git a/entity/CampaignParticipant_entity/recordcontainers/db/recordfieldmappings/campaignstep_id.displayvalue/expression.js b/entity/CampaignParticipant_entity/recordcontainers/db/recordfieldmappings/campaignstep_id.displayvalue/expression.js deleted file mode 100644 index 840d4c2dc1202bd94f31491b84d05e76e55adf03..0000000000000000000000000000000000000000 --- a/entity/CampaignParticipant_entity/recordcontainers/db/recordfieldmappings/campaignstep_id.displayvalue/expression.js +++ /dev/null @@ -1,4 +0,0 @@ -import("system.result"); -import("Sql_lib"); - -result.string(newSelect("CAMPAIGNSTEP.NAME").from("CAMPAIGNSTEP").where("CAMPAIGNSTEP.CAMPAIGNSTEPID = CAMPAIGNPARTICIPANT.CAMPAIGNSTEP_ID").toString()); \ No newline at end of file diff --git a/entity/CampaignParticipant_entity/recordcontainers/db/recordfieldmappings/organisation_contact_id.value/expression.js b/entity/CampaignParticipant_entity/recordcontainers/db/recordfieldmappings/organisation_contact_id.value/expression.js index 93edad8b41dce7f2dbaab8c776c8054e9097c7a2..d7d68b94df7ad1c7cb3141043f708b028670d485 100644 --- a/entity/CampaignParticipant_entity/recordcontainers/db/recordfieldmappings/organisation_contact_id.value/expression.js +++ b/entity/CampaignParticipant_entity/recordcontainers/db/recordfieldmappings/organisation_contact_id.value/expression.js @@ -2,13 +2,4 @@ import("system.SQLTYPES"); import("Sql_lib"); import("system.result"); -result.string(SqlBuilder.caseWhen(newWhere(newSelect("COUNT(*)") - .from("CONTACT") - .where("CONTACT.CONTACTID = CAMPAIGNPARTICIPANT.CONTACT_ID") - .and("CONTACT.PERSON_ID is null"), "0", SqlBuilder.GREATER(), SQLTYPES.INTEGER)) - .then("CAMPAIGNPARTICIPANT.CONTACT_ID") - .elseValue(newSelect("c1.CONTACTID") - .from("CONTACT", "c1") - .join("CONTACT", "c1.ORGANISATION_ID = c2.ORGANISATION_ID", "c2") - .where("c2.CONTACTID = CAMPAIGNPARTICIPANT.CONTACT_ID") - .and("c1.PERSON_ID is null")).toString()) \ No newline at end of file +result.string("ORGANISATION_CONTACT.CONTACTID"); \ No newline at end of file diff --git a/entity/CampaignParticipant_entity/recordcontainers/db/recordfieldmappings/responsible_contact_id.displayvalue/expression.js b/entity/CampaignParticipant_entity/recordcontainers/db/recordfieldmappings/responsible_contact_id.displayvalue/expression.js index 29d2f306f74cbad80faada5dba266f0c819e76d3..d2ae9461d599f57afd7b372ffc124ee1ebe6cbb1 100644 --- a/entity/CampaignParticipant_entity/recordcontainers/db/recordfieldmappings/responsible_contact_id.displayvalue/expression.js +++ b/entity/CampaignParticipant_entity/recordcontainers/db/recordfieldmappings/responsible_contact_id.displayvalue/expression.js @@ -1,3 +1,14 @@ import("system.result"); import("Person_lib"); -result.string(PersUtils.getResolvingDisplaySubSql("CAMPAIGNPARTICIPANT.RESPONSIBLE_CONTACT_ID")); \ No newline at end of file +import("Sql_lib"); + +var contact = new Contact(); + contact.salutation = "RESPONSIBLE_PERSON.SALUTATION"; + contact.title = "RESPONSIBLE_PERSON.TITLE"; + contact.firstname= "RESPONSIBLE_PERSON.FIRSTNAME"; + contact.middlename = "RESPONSIBLE_PERSON.MIDDLENAME"; + contact.lastname = "RESPONSIBLE_PERSON.LASTNAME"; + contact.suffix = "RESPONSIBLE_PERSON.TITLESUFFIX"; + +var renderer = new ContactTitleRenderer(contact, ContactTitleRenderer.OPTIONS.NoOption); +result.string(renderer.asSql()); \ No newline at end of file diff --git a/entity/CampaignStep_entity/CampaignStep_entity.aod b/entity/CampaignStep_entity/CampaignStep_entity.aod index a38be8ee20843c49023799a79c176754162d6cd3..3d40d3531edc1d25041c2b33f962aaf35eef07d3 100644 --- a/entity/CampaignStep_entity/CampaignStep_entity.aod +++ b/entity/CampaignStep_entity/CampaignStep_entity.aod @@ -431,6 +431,7 @@ <dbRecordContainer> <name>db</name> <hasDependentRecords v="true" /> + <fromClauseProcess>%aditoprj%/entity/CampaignStep_entity/recordcontainers/db/fromClauseProcess.js</fromClauseProcess> <conditionProcess>%aditoprj%/entity/CampaignStep_entity/recordcontainers/db/conditionProcess.js</conditionProcess> <orderClauseProcess>%aditoprj%/entity/CampaignStep_entity/recordcontainers/db/orderClauseProcess.js</orderClauseProcess> <onDBInsert>%aditoprj%/entity/CampaignStep_entity/recordcontainers/db/onDBInsert.js</onDBInsert> diff --git a/entity/CampaignStep_entity/recordcontainers/db/fromClauseProcess.js b/entity/CampaignStep_entity/recordcontainers/db/fromClauseProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..a8097c1106f34b1b924bbab6474dbf66880bb458 --- /dev/null +++ b/entity/CampaignStep_entity/recordcontainers/db/fromClauseProcess.js @@ -0,0 +1,9 @@ +import("Sql_lib"); +import("system.result"); + +var from = new SqlBuilder() + .from("CAMPAIGNSTEP") + .leftJoin("CONTACT", "CONTACT.CONTACTID = CAMPAIGNSTEP.EMPLOYEE_CONTACT_ID") + .leftJoin("PERSON","PERSON.PERSONID = CONTACT.PERSON_ID"); + +result.string(from.toString()); \ No newline at end of file diff --git a/entity/CampaignStep_entity/recordcontainers/db/recordfieldmappings/employee_contact_id.displayvalue/expression.js b/entity/CampaignStep_entity/recordcontainers/db/recordfieldmappings/employee_contact_id.displayvalue/expression.js index 54ff36ce1d19a4fcaf358c6242271a93d788c915..d75b9f3fc60b019618522690921bf25b06ea60a7 100644 --- a/entity/CampaignStep_entity/recordcontainers/db/recordfieldmappings/employee_contact_id.displayvalue/expression.js +++ b/entity/CampaignStep_entity/recordcontainers/db/recordfieldmappings/employee_contact_id.displayvalue/expression.js @@ -1,3 +1,4 @@ import("system.result"); import("Person_lib"); -result.string(PersUtils.getResolvingDisplaySubSql("CAMPAIGNSTEP.EMPLOYEE_CONTACT_ID")); \ No newline at end of file + +result.string(PersUtils.getDisplaySqlExpression()); \ No newline at end of file diff --git a/entity/Campaign_entity/Campaign_entity.aod b/entity/Campaign_entity/Campaign_entity.aod index f2379d3a6494932a6dd60629f32c45c4a53c33f3..f35660d768204ecac37a730a700fc63dc880eab0 100644 --- a/entity/Campaign_entity/Campaign_entity.aod +++ b/entity/Campaign_entity/Campaign_entity.aod @@ -646,6 +646,7 @@ <recordContainers> <dbRecordContainer> <name>db</name> + <fromClauseProcess>%aditoprj%/entity/Campaign_entity/recordcontainers/db/fromClauseProcess.js</fromClauseProcess> <conditionProcess>%aditoprj%/entity/Campaign_entity/recordcontainers/db/conditionProcess.js</conditionProcess> <onDBInsert>%aditoprj%/entity/Campaign_entity/recordcontainers/db/onDBInsert.js</onDBInsert> <onDBUpdate>%aditoprj%/entity/Campaign_entity/recordcontainers/db/onDBUpdate.js</onDBUpdate> diff --git a/entity/Campaign_entity/recordcontainers/db/fromClauseProcess.js b/entity/Campaign_entity/recordcontainers/db/fromClauseProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..922e5eefe59453bb9e4a2d224a327380dc60aefe --- /dev/null +++ b/entity/Campaign_entity/recordcontainers/db/fromClauseProcess.js @@ -0,0 +1,9 @@ +import("Sql_lib"); +import("system.result"); + +var from = new SqlBuilder() + .from("CAMPAIGN") + .leftJoin("CONTACT", "CONTACT.CONTACTID = CAMPAIGN.EMPLOYEE_CONTACT_ID") + .leftJoin("PERSON","PERSON.PERSONID = CONTACT.PERSON_ID"); + +result.string(from.toString()); diff --git a/entity/Campaign_entity/recordcontainers/db/recordfieldmappings/employee_contact_id.displayvalue/expression.js b/entity/Campaign_entity/recordcontainers/db/recordfieldmappings/employee_contact_id.displayvalue/expression.js index f0023d115c5071a9e86a99a3f9624b169018f820..d75b9f3fc60b019618522690921bf25b06ea60a7 100644 --- a/entity/Campaign_entity/recordcontainers/db/recordfieldmappings/employee_contact_id.displayvalue/expression.js +++ b/entity/Campaign_entity/recordcontainers/db/recordfieldmappings/employee_contact_id.displayvalue/expression.js @@ -1,3 +1,4 @@ -import("Person_lib"); import("system.result"); -result.string(PersUtils.getResolvingDisplaySubSql("CAMPAIGN.EMPLOYEE_CONTACT_ID")); \ No newline at end of file +import("Person_lib"); + +result.string(PersUtils.getDisplaySqlExpression()); \ No newline at end of file diff --git a/entity/DistrictContact_entity/DistrictContact_entity.aod b/entity/DistrictContact_entity/DistrictContact_entity.aod index 1597cca452f76f38f5b308f646b9ec40d5e24aaa..11e4380a28d054d52500ba0906037657bcbeca4e 100644 --- a/entity/DistrictContact_entity/DistrictContact_entity.aod +++ b/entity/DistrictContact_entity/DistrictContact_entity.aod @@ -302,7 +302,7 @@ </dbRecordFieldMapping> <dbRecordFieldMapping> <name>DISTRICT_ID.displayValue</name> - <expression>%aditoprj%/entity/DistrictContact_entity/recordcontainers/db/recordfieldmappings/district_id.displayvalue/expression.js</expression> + <recordfield>DISTRICT.DISTRICT_NAME</recordfield> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>STATUS.displayValue</name> @@ -316,19 +316,26 @@ </recordFieldMappings> <linkInformation> <linkInformation> - <name>dc5cbebc-a947-4196-937a-f665ee80cc31</name> + <name>ec646e0f-7878-4daa-8aa8-80f197388e61</name> <tableName>DISTRICTCONTACT</tableName> <primaryKey>DISTRICTCONTACTID</primaryKey> <isUIDTable v="true" /> <readonly v="false" /> </linkInformation> <linkInformation> - <name>058abbb3-d92f-4fe1-b326-1320cfee90df</name> + <name>22e4d702-ca6d-4265-938c-dfeb47641882</name> <tableName>CONTACT</tableName> <primaryKey>CONTACTID</primaryKey> <isUIDTable v="false" /> <readonly v="true" /> </linkInformation> + <linkInformation> + <name>80c7d8c6-cdbd-4cc2-af78-c9045ea86347</name> + <tableName>DISTRICT</tableName> + <primaryKey>DISTRICTID</primaryKey> + <isUIDTable v="false" /> + <readonly v="true" /> + </linkInformation> </linkInformation> <filterExtensions> <filterExtension> diff --git a/entity/DistrictContact_entity/recordcontainers/db/fromClauseProcess.js b/entity/DistrictContact_entity/recordcontainers/db/fromClauseProcess.js index 19a916d7f0b23cd1c832567ee33ea1d3c592f01f..25161eb4b1780da1c9e57755ffaeb8247f69bcb7 100644 --- a/entity/DistrictContact_entity/recordcontainers/db/fromClauseProcess.js +++ b/entity/DistrictContact_entity/recordcontainers/db/fromClauseProcess.js @@ -1,5 +1,9 @@ +import("Sql_lib"); import("system.result"); -var res = "DISTRICTCONTACT \n\ - left join CONTACT on (CONTACT.CONTACTID = DISTRICTCONTACT.CONTACT_ID)"; -result.string(res); \ No newline at end of file +var from = new SqlBuilder() + .from("DISTRICTCONTACT") + .leftJoin("CONTACT", "CONTACT.CONTACTID = DISTRICTCONTACT.CONTACT_ID") + .leftJoin("DISTRICT", "DISTRICT.DISTRICTID = DISTRICTCONTACT.DISTRICT_ID"); + +result.string(from.toString()); \ No newline at end of file diff --git a/entity/DistrictContact_entity/recordcontainers/db/recordfieldmappings/district_id.displayvalue/expression.js b/entity/DistrictContact_entity/recordcontainers/db/recordfieldmappings/district_id.displayvalue/expression.js deleted file mode 100644 index 2b6b2fc2b784294d32c6ea947086bf1e62d5d9c3..0000000000000000000000000000000000000000 --- a/entity/DistrictContact_entity/recordcontainers/db/recordfieldmappings/district_id.displayvalue/expression.js +++ /dev/null @@ -1,7 +0,0 @@ -import("system.result"); -import("Sql_lib"); - -result.string(newSelect("DISTRICT.DISTRICT_NAME") - .from("DISTRICT") - .where("DISTRICT.DISTRICTID = DISTRICTCONTACT.DISTRICT_ID") - .toString()); \ No newline at end of file diff --git a/entity/Task_entity/recordcontainers/db/fromClauseProcess.js b/entity/Task_entity/recordcontainers/db/fromClauseProcess.js index 83589697b4bbd94fe3b7f66a86f3fb0d1e5c5e9d..5125a05a3ba6051befaa7904cfab7cf547ec0e32 100644 --- a/entity/Task_entity/recordcontainers/db/fromClauseProcess.js +++ b/entity/Task_entity/recordcontainers/db/fromClauseProcess.js @@ -7,7 +7,8 @@ let from = new SqlBuilder().from("TASK") if ((vars.exists("$param.AdditionalRowID_param") && vars.get("$param.AdditionalRowID_param") && vars.exists("$param.AdditionalObjectID_param") && vars.get("$param.AdditionalObjectID_param")) || vars.exists("$param.RowId_param") && vars.get("$param.RowId_param") && vars.exists("$param.ObjectId_param") && vars.get("$param.ObjectId_param")) { - from.join("TASKLINK", newWhere("TASK.TASKID = TASKLINK.TASK_ID")); + from.leftJoin("TASKLINK", newWhere("TASK.TASKID = TASKLINK.TASK_ID")); } - +from.leftJoin("CONTACT", newWhere("TASK.REQUESTOR_CONTACT_ID = CONTACT.CONTACTID")) + .leftJoin("PERSON", newWhere("CONTACT.PERSON_ID = PERSON.PERSONID")) result.string(from.toString()); \ No newline at end of file diff --git a/entity/Task_entity/recordcontainers/db/recordfieldmappings/requestor_contact_id.displayvalue/expression.js b/entity/Task_entity/recordcontainers/db/recordfieldmappings/requestor_contact_id.displayvalue/expression.js index 0454543183a4bccd7f12af16b488300c30d1c026..b373cf79a6cb0cdddda310e124f66ca0b1335af7 100644 --- a/entity/Task_entity/recordcontainers/db/recordfieldmappings/requestor_contact_id.displayvalue/expression.js +++ b/entity/Task_entity/recordcontainers/db/recordfieldmappings/requestor_contact_id.displayvalue/expression.js @@ -2,7 +2,4 @@ import("system.result"); import("Person_lib"); import("Contact_lib"); -//TODO: try to find a better solution for this -> #TITLE-mechanic when available -var subSql = PersUtils.getResolvingDisplaySubSql("TASK.REQUESTOR_CONTACT_ID"); - -result.string(subSql); +result.string(PersUtils.getDisplaySqlExpression());