From 935f8f0595d734537aa0af212cda88ff7936521d Mon Sep 17 00:00:00 2001 From: Nico Bugl <n.bugl@adito.de> Date: Fri, 7 Jun 2019 09:04:40 +0200 Subject: [PATCH] =?UTF-8?q?=C3=84nderungen=20bzgl.=20Consumer=20und=20Proz?= =?UTF-8?q?esse?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- aliasDefinition/Data_alias/Data_alias.aod | 4 +-- entity/Context_entity/Context_entity.aod | 6 ++++ entity/Offer_entity/Offer_entity.aod | 34 +++++++++++++++---- entity/Offer_entity/conditionProcess.js | 2 +- .../entityfields/contact_id/valueProcess.js | 17 +++++++--- .../linkage/displayValueProcess.js | 17 ++++++++++ .../entityfields/linkage/mandatoryProcess.js | 7 ++++ .../entityfields/linkage/stateProcess.js | 17 ++++++++++ .../entityfields/linkage/valueProcess.js | 7 ++++ .../object_rowid/mandatoryProcess.js | 0 .../entityfields/object_rowid/stateProcess.js | 0 .../entityfields/object_rowid/titleProcess.js | 3 ++ .../entityfields/object_rowid/valueProcess.js | 2 +- .../children/contactid_param/valueProcess.js | 5 +++ .../recordcontainers/db/conditionProcess.js | 10 ++++-- .../Salesproject_entity.aod | 12 +++---- .../objectrowid_param/valueProcess.js | 1 - .../children/objecttype_param/valueProcess.js | 1 - .../_____LANGUAGE_de/_____LANGUAGE_de.aod | 12 ++++--- neonView/OfferEdit_view/OfferEdit_view.aod | 4 +-- 20 files changed, 130 insertions(+), 31 deletions(-) create mode 100644 entity/Offer_entity/entityfields/linkage/displayValueProcess.js create mode 100644 entity/Offer_entity/entityfields/linkage/mandatoryProcess.js create mode 100644 entity/Offer_entity/entityfields/linkage/stateProcess.js create mode 100644 entity/Offer_entity/entityfields/linkage/valueProcess.js delete mode 100644 entity/Offer_entity/entityfields/object_rowid/mandatoryProcess.js delete mode 100644 entity/Offer_entity/entityfields/object_rowid/stateProcess.js create mode 100644 entity/Offer_entity/entityfields/object_rowid/titleProcess.js create mode 100644 entity/Offer_entity/entityfields/salesprojects/children/contactid_param/valueProcess.js diff --git a/aliasDefinition/Data_alias/Data_alias.aod b/aliasDefinition/Data_alias/Data_alias.aod index 025687e3f99..dbca5419dce 100644 --- a/aliasDefinition/Data_alias/Data_alias.aod +++ b/aliasDefinition/Data_alias/Data_alias.aod @@ -9536,8 +9536,8 @@ <name>DECIDER</name> <dbName></dbName> <primaryKey v="false" /> - <columnType v="12" /> - <size v="36" /> + <columnType v="16" /> + <size v="1" /> <scale v="0" /> <notNull v="false" /> <isUnique v="false" /> diff --git a/entity/Context_entity/Context_entity.aod b/entity/Context_entity/Context_entity.aod index 90c638545b2..c1134c2e5f7 100644 --- a/entity/Context_entity/Context_entity.aod +++ b/entity/Context_entity/Context_entity.aod @@ -59,6 +59,12 @@ <fieldName>Contexts</fieldName> <isConsumer v="false" /> </entityDependency> + <entityDependency> + <name>420468aa-c237-4e29-a24f-8851e56343b9</name> + <entityName>Offer_entity</entityName> + <fieldName>Contexts</fieldName> + <isConsumer v="false" /> + </entityDependency> </dependencies> <children> <entityParameter> diff --git a/entity/Offer_entity/Offer_entity.aod b/entity/Offer_entity/Offer_entity.aod index f590f09647a..9f62d333ece 100644 --- a/entity/Offer_entity/Offer_entity.aod +++ b/entity/Offer_entity/Offer_entity.aod @@ -4,9 +4,6 @@ <majorModelMode>DISTRIBUTED</majorModelMode> <documentation>%aditoprj%/entity/Offer_entity/documentation.adoc</documentation> <title>Offer</title> - <siblings> - <element>Offeritem_entity</element> - </siblings> <afterUiInit>%aditoprj%/entity/Offer_entity/afterUiInit.js</afterUiInit> <iconId>VAADIN:CART</iconId> <recordContainer>db</recordContainer> @@ -651,9 +648,8 @@ <name>OBJECT_ROWID</name> <consumer>Objects</consumer> <linkedContextProcess>%aditoprj%/entity/Offer_entity/entityfields/object_rowid/linkedContextProcess.js</linkedContextProcess> - <mandatoryProcess>%aditoprj%/entity/Offer_entity/entityfields/object_rowid/mandatoryProcess.js</mandatoryProcess> <state>AUTO</state> - <stateProcess>%aditoprj%/entity/Offer_entity/entityfields/object_rowid/stateProcess.js</stateProcess> + <titleProcess>%aditoprj%/entity/Offer_entity/entityfields/object_rowid/titleProcess.js</titleProcess> <valueProcess>%aditoprj%/entity/Offer_entity/entityfields/object_rowid/valueProcess.js</valueProcess> <displayValueProcess>%aditoprj%/entity/Offer_entity/entityfields/object_rowid/displayValueProcess.js</displayValueProcess> </entityField> @@ -675,6 +671,8 @@ <name>Contexts</name> <dependency> <name>dependency</name> + <entityName>Context_entity</entityName> + <fieldName>Context</fieldName> </dependency> </entityConsumer> <entityProvider> @@ -752,7 +750,8 @@ </entityParameter> <entityField> <name>chooseTEXHeader</name> - <consumer>DocumentTemplateTex</consumer> </entityField> + <consumer>DocumentTemplateTex</consumer> + </entityField> <entityConsumer> <name>DocumentTemplateTexHeader</name> <dependency> @@ -820,6 +819,29 @@ </entityParameter> </children> </entityConsumer> + <entityField> + <name>LINKAGE</name> + <title>Additional link</title> + <consumer>Salesprojects</consumer> + <mandatoryProcess>%aditoprj%/entity/Offer_entity/entityfields/linkage/mandatoryProcess.js</mandatoryProcess> + <stateProcess>%aditoprj%/entity/Offer_entity/entityfields/linkage/stateProcess.js</stateProcess> + <valueProcess>%aditoprj%/entity/Offer_entity/entityfields/linkage/valueProcess.js</valueProcess> + <displayValueProcess>%aditoprj%/entity/Offer_entity/entityfields/linkage/displayValueProcess.js</displayValueProcess> + </entityField> + <entityConsumer> + <name>Salesprojects</name> + <dependency> + <name>dependency</name> + <entityName>Salesproject_entity</entityName> + <fieldName>Salesprojects</fieldName> + </dependency> + <children> + <entityParameter> + <name>ContactId_param</name> + <valueProcess>%aditoprj%/entity/Offer_entity/entityfields/salesprojects/children/contactid_param/valueProcess.js</valueProcess> + </entityParameter> + </children> + </entityConsumer> </entityFields> <recordContainers> <dbRecordContainer> diff --git a/entity/Offer_entity/conditionProcess.js b/entity/Offer_entity/conditionProcess.js index 30a86e4e5f5..b14a501b815 100644 --- a/entity/Offer_entity/conditionProcess.js +++ b/entity/Offer_entity/conditionProcess.js @@ -3,7 +3,7 @@ import("system.result"); import("Sql_lib"); var cond = new SqlCondition(); -cond.andPrepareVars("OFFER.OBJECT_ROWID", "$param.SalesprojectId_param"); +cond.andPrepareVars("OFFER.OBJECT_ROWID", "$param.ObjectRowId_param"); //TODO: use a preparedCondition when available #1030812 #1034026 result.string(db.translateCondition(cond.build("1 = 1"))); \ No newline at end of file diff --git a/entity/Offer_entity/entityfields/contact_id/valueProcess.js b/entity/Offer_entity/entityfields/contact_id/valueProcess.js index de8555de92b..8e4cf1fcfcc 100644 --- a/entity/Offer_entity/entityfields/contact_id/valueProcess.js +++ b/entity/Offer_entity/entityfields/contact_id/valueProcess.js @@ -1,3 +1,4 @@ +import("system.logging"); import("system.neon"); import("system.db"); import("system.result"); @@ -6,6 +7,7 @@ import("Sql_lib"); if (vars.exists("$param.ContactId_param") && vars.get("$param.ContactId_param")) { + logging.log("$param.ContactId_param") var contactid = vars.get("$param.ContactId_param"); var relData = db.array(db.ROW, "select LANGUAGE from CONTACT where CONTACTID = '" + contactid + "'"); @@ -14,9 +16,16 @@ if (vars.exists("$param.ContactId_param") && vars.get("$param.ContactId_param")) result.string(vars.get("$param.ContactId_param")); } -else if (vars.exists("$param.SalesprojectId_param") && vars.get("$param.SalesprojectId_param")) +else if (vars.exists("$param.ObjectRowId_param") && vars.get("$param.ObjectRowId_param")) { - result.string(db.cell(SqlCondition.begin() - .andPrepareVars("SALESPROJECT.SALESPROJECTID", "$param.SalesprojectId_param") - .buildSql("select CONTACT_ID from SALESPROJECT", "1=2"))); + logging.log("$param.ObjectRowId_param") + logging.log("$param.ObjectType_param") + var objectType = vars.get("$param.ObjectType_param"); + switch (objectType){ + case "Salesproject": + result.string(db.cell(SqlCondition.begin() + .andPrepareVars("SALESPROJECT.SALESPROJECTID", "$param.ObjectRowId_param") + .buildSql("select CONTACT_ID from SALESPROJECT", "1=2"))); + break; + } } \ No newline at end of file diff --git a/entity/Offer_entity/entityfields/linkage/displayValueProcess.js b/entity/Offer_entity/entityfields/linkage/displayValueProcess.js new file mode 100644 index 00000000000..7599db7fc33 --- /dev/null +++ b/entity/Offer_entity/entityfields/linkage/displayValueProcess.js @@ -0,0 +1,17 @@ +import("Sql_lib"); +import("system.db"); +import("system.vars"); +import("system.result"); +import("Salesproject_lib"); + +if(vars.exists("$param.ObjectRowId_param") && vars.exists("$param.ObjectType_param") && vars.get("$param.ObjectRowId_param") && vars.get("$param.ObjectType_param")) + var objectType = vars.get("$param.ObjectType_param"); +switch (objectType){ + + case "Salesproject": + result.string(db.cell( SqlCondition.begin() + .andPrepare("SALESPROJECT.SALESPROJECTID", vars.get("$field.OBJECT_ROWID")) + .buildSql("select PROJECTTITLE from SALESPROJECT", "1=0"))); + break; + +} diff --git a/entity/Offer_entity/entityfields/linkage/mandatoryProcess.js b/entity/Offer_entity/entityfields/linkage/mandatoryProcess.js new file mode 100644 index 00000000000..4736fe4bfc8 --- /dev/null +++ b/entity/Offer_entity/entityfields/linkage/mandatoryProcess.js @@ -0,0 +1,7 @@ +import("system.vars"); +import("system.result"); +import("Contact_lib"); + +var type = ContactUtils.getContactType(vars.get("$field.CONTACT_ID"), vars.get("$field.CONTACT_PERSON_ID"), vars.get("$field.CONTACT_ORG_ID")); + +result.string(type != 2); diff --git a/entity/Offer_entity/entityfields/linkage/stateProcess.js b/entity/Offer_entity/entityfields/linkage/stateProcess.js new file mode 100644 index 00000000000..b2fa4696978 --- /dev/null +++ b/entity/Offer_entity/entityfields/linkage/stateProcess.js @@ -0,0 +1,17 @@ +import("system.neon"); +import("system.result"); +import("system.vars"); +import("Entity_lib"); + +switch (vars.get("$sys.recordstate")) +{ + case neon.OPERATINGSTATE_NEW: + //only EDITABLE if $field.CONTACT_ID is set + if(ProcessHandlingUtils.getOnValidationValue(vars.get("$field.CONTACT_ID"))) + result.object(neon.COMPONENTSTATE_EDITABLE); + else + result.object(neon.COMPONENTSTATE_READONLY); + break; + default: + result.object(neon.COMPONENTSTATE_READONLY); +} diff --git a/entity/Offer_entity/entityfields/linkage/valueProcess.js b/entity/Offer_entity/entityfields/linkage/valueProcess.js new file mode 100644 index 00000000000..37fd0bb1032 --- /dev/null +++ b/entity/Offer_entity/entityfields/linkage/valueProcess.js @@ -0,0 +1,7 @@ +import("system.result"); +import("system.vars"); + +if (vars.exists("$param.ObjectRowId_param")) +{ + result.string(vars.get("$param.ObjectRowId_param")); +} diff --git a/entity/Offer_entity/entityfields/object_rowid/mandatoryProcess.js b/entity/Offer_entity/entityfields/object_rowid/mandatoryProcess.js deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/entity/Offer_entity/entityfields/object_rowid/stateProcess.js b/entity/Offer_entity/entityfields/object_rowid/stateProcess.js deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/entity/Offer_entity/entityfields/object_rowid/titleProcess.js b/entity/Offer_entity/entityfields/object_rowid/titleProcess.js new file mode 100644 index 00000000000..1bb50e998dd --- /dev/null +++ b/entity/Offer_entity/entityfields/object_rowid/titleProcess.js @@ -0,0 +1,3 @@ +import("system.vars"); +import("system.result"); +result.string(vars.get("$field.OBJECT_TYPE")); \ No newline at end of file diff --git a/entity/Offer_entity/entityfields/object_rowid/valueProcess.js b/entity/Offer_entity/entityfields/object_rowid/valueProcess.js index 09d845d6f59..752a1b6b754 100644 --- a/entity/Offer_entity/entityfields/object_rowid/valueProcess.js +++ b/entity/Offer_entity/entityfields/object_rowid/valueProcess.js @@ -2,4 +2,4 @@ import("system.vars"); import("system.result"); if(vars.exists("$param.ObjectRowId_param") && vars.get("$param.ObjectRowId_param")) - result.string(vars.get("$param.ObjectRowId_param")); \ No newline at end of file + result.string(vars.get("$param.ObjectRowId_param")); diff --git a/entity/Offer_entity/entityfields/salesprojects/children/contactid_param/valueProcess.js b/entity/Offer_entity/entityfields/salesprojects/children/contactid_param/valueProcess.js new file mode 100644 index 00000000000..9232f51b2e0 --- /dev/null +++ b/entity/Offer_entity/entityfields/salesprojects/children/contactid_param/valueProcess.js @@ -0,0 +1,5 @@ +import("system.vars"); +import("system.result"); +import("Entity_lib"); + +result.string(ProcessHandlingUtils.getOnValidationValue(vars.get("$field.CONTACT_ORG_ID"))); diff --git a/entity/Offer_entity/recordcontainers/db/conditionProcess.js b/entity/Offer_entity/recordcontainers/db/conditionProcess.js index 4538e37b375..25a5d52c1d4 100644 --- a/entity/Offer_entity/recordcontainers/db/conditionProcess.js +++ b/entity/Offer_entity/recordcontainers/db/conditionProcess.js @@ -1,11 +1,15 @@ +import("system.vars"); import("system.db"); import("system.result"); import("Sql_lib"); var cond = new SqlCondition(); -cond.andPrepareVars("OFFER.OBJECT_ROWID", "$param.ObjectRowId_param"); -cond.andPrepareVars("OFFER.OBJECT_TYPE", "$param.ObjectType_param"); -cond.andPrepareVars("OFFER.CONTACT_ID", "$param.ContactId_param"); +if(vars.exists("$param.ContactId_param") && vars.get("$param.ContactId_param")) + cond.andPrepareVars("OFFER.CONTACT_ID", "$param.ContactId_param"); +else { + cond.andPrepareVars("OFFER.OBJECT_ROWID", "$param.ObjectRowId_param"); + cond.andPrepareVars("OFFER.OBJECT_TYPE", "$param.ObjectType_param"); +} //TODO: use a preparedCondition when available #1030812 #1034026 result.string(db.translateCondition(cond.build("1 = 1"))); \ No newline at end of file diff --git a/entity/Salesproject_entity/Salesproject_entity.aod b/entity/Salesproject_entity/Salesproject_entity.aod index a2c2f769da6..9f572ce9e54 100644 --- a/entity/Salesproject_entity/Salesproject_entity.aod +++ b/entity/Salesproject_entity/Salesproject_entity.aod @@ -327,9 +327,6 @@ <fieldName>Documents</fieldName> </dependency> <children> - <entityParameter> - <name>AssignmentName_param</name> - </entityParameter> <entityParameter> <name>AssignmentRowId_param</name> <valueProcess>%aditoprj%/entity/Salesproject_entity/entityfields/documents/children/assignmentrowid_param/valueProcess.js</valueProcess> @@ -349,9 +346,6 @@ <fieldName>MainDocuments</fieldName> </dependency> <children> - <entityParameter> - <name>AssignmentName_param</name> - </entityParameter> <entityParameter> <name>AssignmentRowId_param</name> <valueProcess>%aditoprj%/entity/Salesproject_entity/entityfields/maindocuments/children/assignmentrowid_param/valueProcess.js</valueProcess> @@ -468,6 +462,12 @@ <fieldName>Salesprojects</fieldName> <isConsumer v="false" /> </entityDependency> + <entityDependency> + <name>bdea1358-ebf2-4356-8df1-af3eb1e6338a</name> + <entityName>Offer_entity</entityName> + <fieldName>Salesprojects</fieldName> + <isConsumer v="false" /> + </entityDependency> </dependencies> <children> <entityParameter> diff --git a/entity/Salesproject_entity/entityfields/offers/children/objectrowid_param/valueProcess.js b/entity/Salesproject_entity/entityfields/offers/children/objectrowid_param/valueProcess.js index 0c198ef8c2f..6900f8723af 100644 --- a/entity/Salesproject_entity/entityfields/offers/children/objectrowid_param/valueProcess.js +++ b/entity/Salesproject_entity/entityfields/offers/children/objectrowid_param/valueProcess.js @@ -1,4 +1,3 @@ -import("system.logging"); import("system.vars"); import("system.result"); result.string(vars.get("$field.SALESPROJECTID")); \ No newline at end of file diff --git a/entity/Salesproject_entity/entityfields/offers/children/objecttype_param/valueProcess.js b/entity/Salesproject_entity/entityfields/offers/children/objecttype_param/valueProcess.js index d0156b4590f..c346bbcfecb 100644 --- a/entity/Salesproject_entity/entityfields/offers/children/objecttype_param/valueProcess.js +++ b/entity/Salesproject_entity/entityfields/offers/children/objecttype_param/valueProcess.js @@ -1,4 +1,3 @@ -import("system.logging"); import("Context_lib"); import("system.result"); result.string(ContextUtils.getCurrentContextId()); \ No newline at end of file diff --git a/language/_____LANGUAGE_de/_____LANGUAGE_de.aod b/language/_____LANGUAGE_de/_____LANGUAGE_de.aod index 2dc9599fb21..ec3daa390cc 100644 --- a/language/_____LANGUAGE_de/_____LANGUAGE_de.aod +++ b/language/_____LANGUAGE_de/_____LANGUAGE_de.aod @@ -318,6 +318,10 @@ <key>Office address</key> <value>Firmenadresse</value> </entry> + <entry> + <key>Additional link</key> + <value>Zusätzliche Verknüpfung</value> + </entry> <entry> <key>Contact</key> <value>Kontakt</value> @@ -4559,10 +4563,10 @@ <entry> <key>Kein Weitergeben von privaten Aufgaben möglich!</key> </entry> - <entry> - <key>Search for new Entries</key> - <value>Nach neuen Einträgen suchen</value> - </entry> + <entry> + <key>Search for new Entries</key> + <value>Nach neuen Einträgen suchen</value> + </entry> </keyValueMap> <font name="Dialog" style="0" size="11" /> </language> diff --git a/neonView/OfferEdit_view/OfferEdit_view.aod b/neonView/OfferEdit_view/OfferEdit_view.aod index ddc985c18e0..9e6b23e56b2 100644 --- a/neonView/OfferEdit_view/OfferEdit_view.aod +++ b/neonView/OfferEdit_view/OfferEdit_view.aod @@ -41,8 +41,8 @@ <entityField>LANGUAGE</entityField> </entityFieldLink> <entityFieldLink> - <name>ac6f81a2-5012-461a-bcf1-4534182b0973</name> - <entityField>SALESPROJECT_ID</entityField> + <name>eb4c5ca2-1e72-4e52-bfd1-505447ed231f</name> + <entityField>LINKAGE</entityField> </entityFieldLink> <entityFieldLink> <name>7a9b0943-eb06-4b44-a111-ed4e2749da6a</name> -- GitLab