diff --git a/entity/Offeritem_entity/Offeritem_entity.aod b/entity/Offeritem_entity/Offeritem_entity.aod index 468d323d76c33bf46f45fb7c3bea9bddab852228..11fa6807168d590f9d7c5db1b894b0d63e4e0860 100644 --- a/entity/Offeritem_entity/Offeritem_entity.aod +++ b/entity/Offeritem_entity/Offeritem_entity.aod @@ -10,7 +10,6 @@ <grantCreateProcess>%aditoprj%/entity/Offeritem_entity/grantCreateProcess.js</grantCreateProcess> <grantUpdateProcess>%aditoprj%/entity/Offeritem_entity/grantUpdateProcess.js</grantUpdateProcess> <grantDeleteProcess>%aditoprj%/entity/Offeritem_entity/grantDeleteProcess.js</grantDeleteProcess> - <afterSave>%aditoprj%/entity/Offeritem_entity/afterSave.js</afterSave> <titlePlural>Offeritems</titlePlural> <recordContainer>db</recordContainer> <entityFields> @@ -19,7 +18,6 @@ </entityProvider> <entityField> <name>ASSIGNEDTO</name> - <valueProcess>%aditoprj%/entity/Offeritem_entity/entityfields/assignedto/valueProcess.js</valueProcess> </entityField> <entityField> <name>DISCOUNT</name> @@ -267,12 +265,6 @@ <entityActionGroup> <name>group</name> <children> - <entityActionField> - <name>insertSubnode</name> - <title>Insert subnode</title> - <onActionProcess>%aditoprj%/entity/Offeritem_entity/entityfields/group/children/insertsubnode/onActionProcess.js</onActionProcess> - <stateProcess>%aditoprj%/entity/Offeritem_entity/entityfields/group/children/insertsubnode/stateProcess.js</stateProcess> - </entityActionField> <entityActionField> <name>moveUp</name> <onActionProcess>%aditoprj%/entity/Offeritem_entity/entityfields/group/children/moveup/onActionProcess.js</onActionProcess> @@ -304,10 +296,6 @@ <state>READONLY</state> <valueProcess>%aditoprj%/entity/Offeritem_entity/entityfields/currency/valueProcess.js</valueProcess> </entityField> - <entityParameter> - <name>AssignedTo_param</name> - <expose v="true" /> - </entityParameter> <entityField> <name>OFFER_CODE</name> <title>Offer number</title> diff --git a/entity/Offeritem_entity/afterSave.js b/entity/Offeritem_entity/afterSave.js deleted file mode 100644 index 7c2d55dd966eddba21d0bbc81d5202578886f64f..0000000000000000000000000000000000000000 --- a/entity/Offeritem_entity/afterSave.js +++ /dev/null @@ -1,10 +0,0 @@ -import("system.neon"); -import("system.vars"); -import("Offer_lib"); - -if(vars.get("$local.recordstate") == neon.OPERATINGSTATE_NEW) -{ - var oiUtils = new OfferItemUtils(vars.get("$field.OFFER_ID")); - oiUtils.reOrgItems(); - neon.refreshAll(); -} diff --git a/entity/Offeritem_entity/entityfields/assignedto/valueProcess.js b/entity/Offeritem_entity/entityfields/assignedto/valueProcess.js deleted file mode 100644 index bbde8dea6b2ea6dce3e1284e78334a24623fb1ba..0000000000000000000000000000000000000000 --- a/entity/Offeritem_entity/entityfields/assignedto/valueProcess.js +++ /dev/null @@ -1,5 +0,0 @@ -import("system.result"); -import("system.vars"); - -var assignedTo = vars.get("$param.AssignedTo_param"); -assignedTo && result.string(assignedTo); diff --git a/entity/Offeritem_entity/entityfields/group/children/insertsubnode/onActionProcess.js b/entity/Offeritem_entity/entityfields/group/children/insertsubnode/onActionProcess.js deleted file mode 100644 index 456e0cc7070a4c5318834277cf7e21d29054d6d1..0000000000000000000000000000000000000000 --- a/entity/Offeritem_entity/entityfields/group/children/insertsubnode/onActionProcess.js +++ /dev/null @@ -1,12 +0,0 @@ -import("system.neonFilter"); -import("system.neon"); -import("system.vars"); - -neon.openContextWithRecipe(vars.get("$sys.currentcontextname"), null, neonFilter.createEntityRecordsRecipeBuilder().parameters({ - ContactId_param: vars.get("$param.ContactId_param"), - OfferId_param: vars.get("$param.OfferId_param"), - ProductId_param: vars.get("$param.ProductId_param"), - Currency_param: vars.get("$param.Currency_param"), - Discount_param: vars.get("$param.Discount_param"), - AssignedTo_param: vars.get("$sys.uid") -}).toString(), neon.OPERATINGSTATE_NEW); diff --git a/entity/Offeritem_entity/entityfields/group/children/insertsubnode/stateProcess.js b/entity/Offeritem_entity/entityfields/group/children/insertsubnode/stateProcess.js deleted file mode 100644 index 5ba1e5ac67bc1f57c8df368230755af1bd132b29..0000000000000000000000000000000000000000 --- a/entity/Offeritem_entity/entityfields/group/children/insertsubnode/stateProcess.js +++ /dev/null @@ -1,11 +0,0 @@ -import("system.result"); -import("system.neon"); -import("system.vars"); -import("Offer_lib"); - -var res = neon.COMPONENTSTATE_DISABLED; -if(OfferUtils.isEditable(vars.get("$param.OfferStatus_param"))) -{ - res = neon.COMPONENTSTATE_EDITABLE; -} -result.string(res); diff --git a/entity/Offeritem_entity/grantDeleteProcess.js b/entity/Offeritem_entity/grantDeleteProcess.js index f23d205f0cd1ac600e41119d3532531960b0ee57..97dc6583f5a2a29fe03fc9342fdb814093bdbc97 100644 --- a/entity/Offeritem_entity/grantDeleteProcess.js +++ b/entity/Offeritem_entity/grantDeleteProcess.js @@ -1,5 +1,24 @@ -import("system.result"); +import("Sql_lib"); import("system.vars"); +import("system.result"); import("Offer_lib"); -result.object(OfferUtils.isDeletable(vars.get("$param.OfferStatus_param"))); +var canDelete = false; +if(OfferUtils.isDeletable(vars.get("$param.OfferStatus_param"))) +{ + var offerItemIds = vars.get("$sys.selection"); + + if(offerItemIds.length == 1 && offerItemIds[0] != null) + { + assignedTo = newSelect("OFFERITEM.ASSIGNEDTO") + .from("OFFERITEM") + .where("OFFERITEM.OFFERITEMID", offerItemIds[0]) + .orderBy("ITEMPOSITION desc") + .cell(); + if(assignedTo == "")//topItem + { + canDelete = true; + } + } +} +result.object(canDelete); \ No newline at end of file diff --git a/entity/Orderitem_entity/Orderitem_entity.aod b/entity/Orderitem_entity/Orderitem_entity.aod index dbdcda99143f4bb0b4db861f5cb61c3d057db778..d88495d1e76c565cfe288026f0688f41ad2c3fc6 100644 --- a/entity/Orderitem_entity/Orderitem_entity.aod +++ b/entity/Orderitem_entity/Orderitem_entity.aod @@ -10,7 +10,6 @@ <grantCreateProcess>%aditoprj%/entity/Orderitem_entity/grantCreateProcess.js</grantCreateProcess> <grantUpdateProcess>%aditoprj%/entity/Orderitem_entity/grantUpdateProcess.js</grantUpdateProcess> <grantDeleteProcess>%aditoprj%/entity/Orderitem_entity/grantDeleteProcess.js</grantDeleteProcess> - <afterSave>%aditoprj%/entity/Orderitem_entity/afterSave.js</afterSave> <titlePlural>Orderitems</titlePlural> <recordContainer>db</recordContainer> <entityFields> @@ -19,7 +18,6 @@ </entityProvider> <entityField> <name>ASSIGNEDTO</name> - <valueProcess>%aditoprj%/entity/Orderitem_entity/entityfields/assignedto/valueProcess.js</valueProcess> </entityField> <entityField> <name>DISCOUNT</name> @@ -245,12 +243,6 @@ <entityActionGroup> <name>group</name> <children> - <entityActionField> - <name>insertSubnode</name> - <title>Insert subnode</title> - <onActionProcess>%aditoprj%/entity/Orderitem_entity/entityfields/group/children/insertsubnode/onActionProcess.js</onActionProcess> - <stateProcess>%aditoprj%/entity/Orderitem_entity/entityfields/group/children/insertsubnode/stateProcess.js</stateProcess> - </entityActionField> <entityActionField> <name>moveUp</name> <onActionProcess>%aditoprj%/entity/Orderitem_entity/entityfields/group/children/moveup/onActionProcess.js</onActionProcess> @@ -287,10 +279,6 @@ <state>READONLY</state> <valueProcess>%aditoprj%/entity/Orderitem_entity/entityfields/currency/valueProcess.js</valueProcess> </entityField> - <entityParameter> - <name>AssignedTo_param</name> - <expose v="true" /> - </entityParameter> <entityField> <name>ORDER_CODE</name> <title>Receipt number</title> diff --git a/entity/Orderitem_entity/afterSave.js b/entity/Orderitem_entity/afterSave.js deleted file mode 100644 index 7526b591eca1914fe359f020220ef00400c153af..0000000000000000000000000000000000000000 --- a/entity/Orderitem_entity/afterSave.js +++ /dev/null @@ -1,10 +0,0 @@ -import("system.neon"); -import("system.vars"); -import("Order_lib"); - -if(vars.get("$local.recordstate") == neon.OPERATINGSTATE_NEW) -{ - var oiUtils = new OrderItemUtils(vars.get("$field.SALESORDER_ID")); - oiUtils.reOrgItems(); - neon.refreshAll(); -} diff --git a/entity/Orderitem_entity/entityfields/assignedto/valueProcess.js b/entity/Orderitem_entity/entityfields/assignedto/valueProcess.js deleted file mode 100644 index bbde8dea6b2ea6dce3e1284e78334a24623fb1ba..0000000000000000000000000000000000000000 --- a/entity/Orderitem_entity/entityfields/assignedto/valueProcess.js +++ /dev/null @@ -1,5 +0,0 @@ -import("system.result"); -import("system.vars"); - -var assignedTo = vars.get("$param.AssignedTo_param"); -assignedTo && result.string(assignedTo); diff --git a/entity/Orderitem_entity/entityfields/group/children/insertsubnode/onActionProcess.js b/entity/Orderitem_entity/entityfields/group/children/insertsubnode/onActionProcess.js deleted file mode 100644 index fa085e2b7cd98c641f1e5e6681ebcf7c6a57f462..0000000000000000000000000000000000000000 --- a/entity/Orderitem_entity/entityfields/group/children/insertsubnode/onActionProcess.js +++ /dev/null @@ -1,13 +0,0 @@ -import("system.neonFilter"); -import("system.logging"); -import("system.neon"); -import("system.vars"); - -neon.openContextWithRecipe(vars.get("$sys.currentcontextname"), null, neonFilter.createEntityRecordsRecipeBuilder().parameters({ - ContactId_param: vars.get("$param.ContactId_param"), - OrderId_param: vars.get("$param.OrderId_param"), - ProductId_param: vars.get("$param.ProductId_param"), - Currency_param: vars.get("$param.Currency_param"), - Discount_param: vars.get("$param.Discount_param"), - AssignedTo_param: vars.get("$sys.uid") -}).toString(), neon.OPERATINGSTATE_NEW); diff --git a/entity/Orderitem_entity/entityfields/group/children/insertsubnode/stateProcess.js b/entity/Orderitem_entity/entityfields/group/children/insertsubnode/stateProcess.js deleted file mode 100644 index ab4319e289d632c4168cccca2761b4bf7212a8e2..0000000000000000000000000000000000000000 --- a/entity/Orderitem_entity/entityfields/group/children/insertsubnode/stateProcess.js +++ /dev/null @@ -1,33 +0,0 @@ -import("system.result"); -import("system.neon"); -import("system.vars"); -import("system.db"); -import("Sql_lib"); -import("Order_lib"); - -var itemcount = newSelect("count(*)") - .from("SALESORDERITEM") - .whereIfSet("SALESORDERITEM.SALESORDER_ID", "$field.SALESORDER_ID") - .cell(true, "0"); - -var res; -if (vars.get("$field.OrderStatus") == undefined) -{ - res = neon.COMPONENTSTATE_DISABLED; -} -else if (itemcount == "0" && vars.get("$field.OrderStatus") == "1" ) -{ - res = neon.COMPONENTSTATE_DISABLED; -} -else if (itemcount == "0" && vars.get("$field.OrderStatus") == "0") -{ - res = neon.COMPONENTSTATE_EDITABLE; -} -else -{ - res = OrderUtils.isEditable(vars.get("$field.OrderStatus") - ? neon.COMPONENTSTATE_EDITABLE - : neon.COMPONENTSTATE_DISABLED - ); -} -result.string(res); diff --git a/entity/Orderitem_entity/grantDeleteProcess.js b/entity/Orderitem_entity/grantDeleteProcess.js index ec8d83f2d99ed83184ba76936bfc21468e95fbcd..56d26c9ab2c9703e5c0bcd19b25c826057e72802 100644 --- a/entity/Orderitem_entity/grantDeleteProcess.js +++ b/entity/Orderitem_entity/grantDeleteProcess.js @@ -1,5 +1,24 @@ -import("system.result"); -import("system.vars"); import("Order_lib"); +import("Sql_lib"); +import("system.vars"); +import("system.result"); -result.object(OrderUtils.isDeletable(vars.get("$param.OrderStatus_param"))); +var canDelete = false; +if(OrderUtils.isDeletable(vars.get("$param.OrderStatus_param"))) +{ + var orderItemIds = vars.get("$sys.selection"); + + if(orderItemIds.length == 1 && orderItemIds[0] != null) + { + assignedTo = newSelect("SALESORDERITEM.ASSIGNEDTO") + .from("SALESORDERITEM") + .where("SALESORDERITEM.SALESORDERITEMID", orderItemIds[0]) + .orderBy("ITEMPOSITION desc") + .cell(); + if(assignedTo == "")//topItem + { + canDelete = true; + } + } +} +result.object(canDelete); \ No newline at end of file diff --git a/language/_____LANGUAGE_de/_____LANGUAGE_de.aod b/language/_____LANGUAGE_de/_____LANGUAGE_de.aod index 61f4995c89dd358f041fe32fc005c827a41e5a49..6f6dbc6a5635870dcf32121f1c827b59fcc34e20 100644 --- a/language/_____LANGUAGE_de/_____LANGUAGE_de.aod +++ b/language/_____LANGUAGE_de/_____LANGUAGE_de.aod @@ -14659,10 +14659,6 @@ Bitte Datumseingabe prüfen</value> <key>Offers / Receipts</key> <value>Angebote / Belege</value> </entry> - <entry> - <key>Insert subnode</key> - <value>Unterposten einfügen</value> - </entry> <entry> <key>Calculate sum</key> <value>Summe berechnen</value> diff --git a/process/OfferOrder_lib/process.js b/process/OfferOrder_lib/process.js index 5ef98cc5d6fb90b4d6b994d079f80f8814c0b75e..7d890d2866c7f074a10c13b8506608fec261502d 100644 --- a/process/OfferOrder_lib/process.js +++ b/process/OfferOrder_lib/process.js @@ -467,16 +467,6 @@ ItemUtils.prototype.deletePartsList = function(itemId) { function _deleteNode(pItemId) { //delete Object property delete self.ItemTree[pItemId]; - - // delete id references - for(var currItemId in self.ItemTree) - { - var idsIdx = self.ItemTree[currItemId].ids.indexOf(pItemId); - if (idsIdx >= 0) - { - self.ItemTree[currItemId].ids.splice(idsIdx, 1); - } - } //delete id in global Array "ItemIds" var idx = self.ItemIds.indexOf(pItemId);