diff --git a/entity/VisitPlanEmployeeWeek_entity/VisitPlanEmployeeWeek_entity.aod b/entity/VisitPlanEmployeeWeek_entity/VisitPlanEmployeeWeek_entity.aod index 63130c5f63deebc3bc36702245a2755785fe4a50..ef198c6a746700f3c3b7f5614ed93309d1ada2e7 100644 --- a/entity/VisitPlanEmployeeWeek_entity/VisitPlanEmployeeWeek_entity.aod +++ b/entity/VisitPlanEmployeeWeek_entity/VisitPlanEmployeeWeek_entity.aod @@ -27,6 +27,7 @@ <title>Week</title> <dropDownProcess>%aditoprj%/entity/VisitPlanEmployeeWeek_entity/entityfields/week/dropDownProcess.js</dropDownProcess> <valueProcess>%aditoprj%/entity/VisitPlanEmployeeWeek_entity/entityfields/week/valueProcess.js</valueProcess> + <onValidation>%aditoprj%/entity/VisitPlanEmployeeWeek_entity/entityfields/week/onValidation.js</onValidation> </entityField> <entityField> <name>INFO</name> diff --git a/entity/VisitPlanEmployeeWeek_entity/entityfields/week/onValidation.js b/entity/VisitPlanEmployeeWeek_entity/entityfields/week/onValidation.js new file mode 100644 index 0000000000000000000000000000000000000000..cff756f7130fcb535a1c273f06ab92ea235f96ec --- /dev/null +++ b/entity/VisitPlanEmployeeWeek_entity/entityfields/week/onValidation.js @@ -0,0 +1,22 @@ +import("system.result"); +import("Sql_lib"); +import("Employee_lib"); +import("system.logging"); +import("system.datetime"); +import("system.vars"); +import("system.eMath"); + + +var year = eMath.absInt(vars.get("$field.YEAR")); +var week = vars.get("$local.value"); +var user = EmployeeUtils.getCurrentContactId(); + +var weekEntry = newSelect("VISITPLANEMPLOYEEWEEKID") + .from("VISITPLANEMPLOYEEWEEK") + .where("VISITPLANEMPLOYEEWEEK.VISITPLAN_YEAR", year) + .and("VISITPLANEMPLOYEEWEEK.VISITPLAN_WEEK", week) + .and("VISITPLANEMPLOYEEWEEK.CONTACT_ID", user) + .cell(); + +if(weekEntry) + result.string("Weekplan already exists!"); \ No newline at end of file diff --git a/entity/VisitRecommendation_entity/VisitRecommendation_entity.aod b/entity/VisitRecommendation_entity/VisitRecommendation_entity.aod index caeb768e66aea08e0a2f80054c24135f32939b22..1751833285fbca00981d53839c8e2a81dc88d907 100644 --- a/entity/VisitRecommendation_entity/VisitRecommendation_entity.aod +++ b/entity/VisitRecommendation_entity/VisitRecommendation_entity.aod @@ -32,8 +32,8 @@ <groupable v="false" /> <linkedContext>Organisation</linkedContext> <mandatory v="true" /> - <stateProcess>%aditoprj%/entity/VisitRecommendation_entity/entityfields/contact_id/stateProcess.js</stateProcess> <valueProcess>%aditoprj%/entity/VisitRecommendation_entity/entityfields/contact_id/valueProcess.js</valueProcess> + <displayValueProcess>%aditoprj%/entity/VisitRecommendation_entity/entityfields/contact_id/displayValueProcess.js</displayValueProcess> </entityField> <entityField> <name>UID</name> @@ -167,8 +167,8 @@ <description></description> <consumer>PersonConsumer</consumer> <groupable v="true" /> - <stateProcess>%aditoprj%/entity/VisitRecommendation_entity/entityfields/contact_person_id/stateProcess.js</stateProcess> <valueProcess>%aditoprj%/entity/VisitRecommendation_entity/entityfields/contact_person_id/valueProcess.js</valueProcess> + <displayValueProcess>%aditoprj%/entity/VisitRecommendation_entity/entityfields/contact_person_id/displayValueProcess.js</displayValueProcess> </entityField> <entityProvider> <name>#PROVIDER_AGGREGATES</name> @@ -198,6 +198,8 @@ <consumer>Employees</consumer> <groupable v="true" /> <mandatory v="true" /> + <valueProcess>%aditoprj%/entity/VisitRecommendation_entity/entityfields/responsible/valueProcess.js</valueProcess> + <displayValueProcess>%aditoprj%/entity/VisitRecommendation_entity/entityfields/responsible/displayValueProcess.js</displayValueProcess> </entityField> <entityConsumer> <name>Employees</name> diff --git a/entity/VisitRecommendation_entity/entityfields/contact_id/displayValueProcess.js b/entity/VisitRecommendation_entity/entityfields/contact_id/displayValueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..e91b48435345a0dad841873c3199e8f9f1fd5ad6 --- /dev/null +++ b/entity/VisitRecommendation_entity/entityfields/contact_id/displayValueProcess.js @@ -0,0 +1,5 @@ +import("system.vars"); +import("Contact_lib"); +import("system.result"); + +result.string(ContactUtils.getFullTitleByContactId(vars.get("$field.CONTACT_ID"))); \ No newline at end of file diff --git a/entity/VisitRecommendation_entity/entityfields/contact_id/stateProcess.js b/entity/VisitRecommendation_entity/entityfields/contact_id/stateProcess.js deleted file mode 100644 index 7092871f22eb86bcc0c5ddba5f8fdd55542ed005..0000000000000000000000000000000000000000 --- a/entity/VisitRecommendation_entity/entityfields/contact_id/stateProcess.js +++ /dev/null @@ -1,7 +0,0 @@ -import("system.logging"); -import("system.neon"); -import("system.result"); -import("system.vars"); - -if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && vars.get("$param.ContactId_param") && vars.exists("$param.ContactId_param")) - result.string(neon.COMPONENTSTATE_INVISIBLE) \ No newline at end of file diff --git a/entity/VisitRecommendation_entity/entityfields/contact_person_id/displayValueProcess.js b/entity/VisitRecommendation_entity/entityfields/contact_person_id/displayValueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..2b20cde46f73e3abf1d2d2a1fdf5d9380639900b --- /dev/null +++ b/entity/VisitRecommendation_entity/entityfields/contact_person_id/displayValueProcess.js @@ -0,0 +1,5 @@ +import("system.vars"); +import("Contact_lib"); +import("system.result"); + +result.string(ContactUtils.getFullTitleByContactId(vars.get("$field.CONTACT_PERSON_ID"))); \ No newline at end of file diff --git a/entity/VisitRecommendation_entity/entityfields/contact_person_id/stateProcess.js b/entity/VisitRecommendation_entity/entityfields/contact_person_id/stateProcess.js deleted file mode 100644 index 07f9475d01670aa8652b4ccf7cc1ca12117385b3..0000000000000000000000000000000000000000 --- a/entity/VisitRecommendation_entity/entityfields/contact_person_id/stateProcess.js +++ /dev/null @@ -1,7 +0,0 @@ -import("system.logging"); -import("system.neon"); -import("system.result"); -import("system.vars"); - -if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && vars.get("$param.ContactIdPerson_param") && vars.exists("$param.ContactIdPerson_param")) - result.string(neon.COMPONENTSTATE_INVISIBLE) \ No newline at end of file diff --git a/entity/VisitRecommendation_entity/entityfields/due_date/valueProcess.js b/entity/VisitRecommendation_entity/entityfields/due_date/valueProcess.js index 82886507c617614ead1114576e1393b38406f191..eac3244b03ab8d8c5e9a0dc0ecaa40ce213e6061 100644 --- a/entity/VisitRecommendation_entity/entityfields/due_date/valueProcess.js +++ b/entity/VisitRecommendation_entity/entityfields/due_date/valueProcess.js @@ -1,27 +1,42 @@ -//import("Sql_lib"); -//import("Employee_lib"); -//import("system.neon"); -//import("system.vars"); -//import("system.result"); -// -// -//if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && vars.get("$this.value") == null) -//{ -// var contactidResp = vars.get("$field.RESPONSIBLE") -// var maturity = newSelect("ATTRIBUTE_NAME") -// .from("AB_ATTRIBUTERELATION") -// .join("AB_ATTRIBUTE", "AB_ATTRIBUTEID = ID_VALUE") -// .where("AB_ATTRIBUTE_ID", "e8770b60-160c-466e-af57-4f90bd6e02d7") -// .and("OBJECT_ROWID", contactidResp); -// -// var due_date = new Date(); -// switch(maturity) -// { -// case "2 Weeks": -// due_date.setDate(d.getDate() + 14); -// break; -// case "" -// } -// -// result.string(); -//} \ No newline at end of file +import("system.datetime"); +import("system.logging"); +import("Sql_lib"); +import("Employee_lib"); +import("system.neon"); +import("system.vars"); +import("system.result"); + + +if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && vars.get("$this.value") == null) +{ + var contactidResp = vars.get("$field.RESPONSIBLE") + var maturity = newSelect("AB_ATTRIBUTE.ATTRIBUTE_NAME") + .from("AB_ATTRIBUTERELATION") + .join("AB_ATTRIBUTE", "AB_ATTRIBUTE.AB_ATTRIBUTEID = AB_ATTRIBUTERELATION.ID_VALUE") + .where("AB_ATTRIBUTERELATION.AB_ATTRIBUTE_ID", "e8770b60-160c-466e-af57-4f90bd6e02d7") + .and("AB_ATTRIBUTERELATION.OBJECT_ROWID", contactidResp) + .cell(); + + var due_date = new Date(); +//d.setDate(d.getDate() + 50); + switch(maturity) + { + case "2 Weeks": + due_date =due_date.setDate(due_date.getDate() + 14); + logging.log("2"); + break; + case "1 Month": + due_date = due_date.setMonth(due_date.getMonth() + 1); + logging.log("1") + break; + case "6 Months": + due_date = due_date.setMonth(due_date.getMonth() + 6); + logging.log("6") + break; + case "12 Months": + due_date = due_date.setMonth(due_date.getMonth() + 12); + logging.log("12") + break; + } + result.string(due_date); +} \ No newline at end of file diff --git a/entity/VisitRecommendation_entity/entityfields/responsible/displayValueProcess.js b/entity/VisitRecommendation_entity/entityfields/responsible/displayValueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..46777a8ba61d19bf3a9f8b3dfe737b8bc15744dc --- /dev/null +++ b/entity/VisitRecommendation_entity/entityfields/responsible/displayValueProcess.js @@ -0,0 +1,6 @@ +import("system.vars"); +import("Contact_lib"); +import("system.result"); + + +result.string(ContactUtils.getFullTitleByContactId(vars.get("$field.RESPONSIBLE"), false)); \ No newline at end of file diff --git a/entity/VisitRecommendation_entity/entityfields/responsible/valueProcess.js b/entity/VisitRecommendation_entity/entityfields/responsible/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..1b25b343bc110c951c7da05d01eb360c5faee64b --- /dev/null +++ b/entity/VisitRecommendation_entity/entityfields/responsible/valueProcess.js @@ -0,0 +1,7 @@ +import("system.neon"); +import("system.vars"); +import("Employee_lib"); +import("system.result"); + +if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && (vars.get("$this.value") == null || vars.get("$this.value") == undefined)) + result.string(EmployeeUtils.getCurrentContactId()) \ No newline at end of file diff --git a/language/_____LANGUAGE_EXTRA/_____LANGUAGE_EXTRA.aod b/language/_____LANGUAGE_EXTRA/_____LANGUAGE_EXTRA.aod index e7857d64b6456a58bcf23319e44031255ed63a40..fe35570b1705441174996862489fe7aa2005598d 100644 --- a/language/_____LANGUAGE_EXTRA/_____LANGUAGE_EXTRA.aod +++ b/language/_____LANGUAGE_EXTRA/_____LANGUAGE_EXTRA.aod @@ -7296,6 +7296,12 @@ <entry> <key>2 Weeks</key> </entry> + <entry> + <key>Calendar week</key> + </entry> + <entry> + <key>Weekplan already exists!</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 6b96b2f3c12dd529e2d99c3bfe5333afa347f740..8c0dce1efc3f441ea0b0a0d5c0daf29e2a85390d 100644 --- a/language/_____LANGUAGE_de/_____LANGUAGE_de.aod +++ b/language/_____LANGUAGE_de/_____LANGUAGE_de.aod @@ -9509,6 +9509,10 @@ Bitte Datumseingabe prüfen</value> <key>Responsible Department</key> <value>zuständige Abteilung</value> </entry> + <entry> + <key>Weekplan already exists!</key> + <value>Wochenplan existiert bereits!</value> + </entry> <entry> <key>Shows the different conversion rates of the sales project phases</key> <value>zeigt die unterschiedlichen Umrechnungsraten der vertriebsprojektphasen</value> @@ -9668,15 +9672,19 @@ Bitte Datumseingabe prüfen</value> </entry> <entry> <key>12 Months</key> + <value>12 Monate</value> </entry> <entry> <key>6 Months</key> + <value>6 Monate</value> </entry> <entry> <key>1 Month</key> + <value>1 Monat</value> </entry> <entry> <key>2 Weeks</key> + <value>2 Wochen</value> </entry> </keyValueMap> <font name="Dialog" style="0" size="11" /> diff --git a/language/_____LANGUAGE_en/_____LANGUAGE_en.aod b/language/_____LANGUAGE_en/_____LANGUAGE_en.aod index 25a9a85803e2b148a5cac3ed2adabec761bf1e62..a5011c8bcd788076e058b54826907187a0de91e2 100644 --- a/language/_____LANGUAGE_en/_____LANGUAGE_en.aod +++ b/language/_____LANGUAGE_en/_____LANGUAGE_en.aod @@ -7377,6 +7377,12 @@ <entry> <key>2 Weeks</key> </entry> + <entry> + <key>Calendar week</key> + </entry> + <entry> + <key>Weekplan already exists!</key> + </entry> </keyValueMap> <font name="Dialog" style="0" size="11" /> </language>