diff --git a/entity/Order_entity/Order_entity.aod b/entity/Order_entity/Order_entity.aod index 37243fe0fc679f208fe3ce2d5c23b8e8d7193fdb..9bf430570e1b8a7671a6f1a0f09a851d2f1c0b6f 100644 --- a/entity/Order_entity/Order_entity.aod +++ b/entity/Order_entity/Order_entity.aod @@ -4,7 +4,6 @@ <majorModelMode>DISTRIBUTED</majorModelMode> <documentation>%aditoprj%/entity/Order_entity/documentation.adoc</documentation> <title>Receipt</title> - <grantUpdateProcess>%aditoprj%/entity/Order_entity/grantUpdateProcess.js</grantUpdateProcess> <grantDeleteProcess>%aditoprj%/entity/Order_entity/grantDeleteProcess.js</grantDeleteProcess> <contentTitleProcess>%aditoprj%/entity/Order_entity/contentTitleProcess.js</contentTitleProcess> <afterUiInit>%aditoprj%/entity/Order_entity/afterUiInit.js</afterUiInit> @@ -40,7 +39,7 @@ </entityField> <entityField> <name>SALESORDERDATE</name> - <title>Creation date</title> + <title>Order date</title> <contentType>DATE</contentType> <resolution>DAY</resolution> <outputFormat>dd.MM.yyyy</outputFormat> diff --git a/entity/Order_entity/entityfields/header/valueProcess.js b/entity/Order_entity/entityfields/header/valueProcess.js index 7defd5651e4772bedd18ba5ddeca431ff3e982a3..fb36eb5bfbdbe6121591b5778ec4dabf850e29eb 100644 --- a/entity/Order_entity/entityfields/header/valueProcess.js +++ b/entity/Order_entity/entityfields/header/valueProcess.js @@ -1,4 +1,3 @@ -import("system.logging"); import("system.result"); import("system.vars"); import("system.neon"); @@ -17,6 +16,5 @@ else if(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW) if (vars.get("$field.ChosenTexHeader") != "") { var binaryId = db.cell("select ID from ASYS_BINARIES where ROW_ID = '" + vars.get("$field.ChosenTexHeader") + "'", "_____SYSTEMALIAS"); - logging.log(binaryId); result.string(util.decodeBase64String(db.getBinaryContent(binaryId, "_____SYSTEMALIAS"))); } \ No newline at end of file diff --git a/entity/Order_entity/grantUpdateProcess.js b/entity/Order_entity/grantUpdateProcess.js deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/entity/Orderitem_entity/entityfields/orderstatus/valueProcess.js b/entity/Orderitem_entity/entityfields/orderstatus/valueProcess.js index 215e3b7dc3213011d9ca8db8d19a232950143af9..69668f662d6ced1cb23839941945ebf37939eaaa 100644 --- a/entity/Orderitem_entity/entityfields/orderstatus/valueProcess.js +++ b/entity/Orderitem_entity/entityfields/orderstatus/valueProcess.js @@ -4,7 +4,7 @@ import("system.logging"); import("system.result"); import("Sql_lib"); -var orderNo=vars.get("$field.SALESORDER_ID") +var orderNo=vars.get("$param.OrderId_param"); var status = db.array(db.ROW, SqlCondition.begin() .andPrepare("SALESORDER.SALESORDERID", orderNo) diff --git a/entity/Orderitem_entity/grantCreateProcess.js b/entity/Orderitem_entity/grantCreateProcess.js index 052e2d2bc2bca628c4958bfd6501978ceaa9b30c..3111426941eb795f73843948d42f1d85d0b51945 100644 --- a/entity/Orderitem_entity/grantCreateProcess.js +++ b/entity/Orderitem_entity/grantCreateProcess.js @@ -1,5 +1,20 @@ +import("Sql_lib"); +import("system.db"); import("system.vars"); import("system.result"); import("Order_lib"); +var itemcount = db.cell(SqlCondition.begin() + .andPrepareVars("SALESORDERITEM.SALESORDER_ID", "$field.SALESORDER_ID") + .buildSql("select count(*) from SALESORDERITEM", "1=2")); + +if (itemcount == "0" && vars.get("$field.OrderStatus") == "1" ) { + result.string(false); +} + +else if (itemcount == "0" && vars.get("$field.OrderStatus") == "0"){ + result.string(true); +} + +else result.string(OrderUtils.isEditable(vars.get("$field.OrderStatus"))); \ No newline at end of file diff --git a/entity/Orderitem_entity/grantDeleteProcess.js b/entity/Orderitem_entity/grantDeleteProcess.js index 052e2d2bc2bca628c4958bfd6501978ceaa9b30c..a1d172b731764b0ab83a31d79a3fbf430f742eb4 100644 --- a/entity/Orderitem_entity/grantDeleteProcess.js +++ b/entity/Orderitem_entity/grantDeleteProcess.js @@ -2,4 +2,4 @@ import("system.vars"); import("system.result"); import("Order_lib"); -result.string(OrderUtils.isEditable(vars.get("$field.OrderStatus"))); \ No newline at end of file +result.string(OrderUtils.isDeletable(vars.get("$field.OrderStatus"))); \ No newline at end of file diff --git a/entity/Orderitem_entity/grantUpdateProcess.js b/entity/Orderitem_entity/grantUpdateProcess.js index 052e2d2bc2bca628c4958bfd6501978ceaa9b30c..3111426941eb795f73843948d42f1d85d0b51945 100644 --- a/entity/Orderitem_entity/grantUpdateProcess.js +++ b/entity/Orderitem_entity/grantUpdateProcess.js @@ -1,5 +1,20 @@ +import("Sql_lib"); +import("system.db"); import("system.vars"); import("system.result"); import("Order_lib"); +var itemcount = db.cell(SqlCondition.begin() + .andPrepareVars("SALESORDERITEM.SALESORDER_ID", "$field.SALESORDER_ID") + .buildSql("select count(*) from SALESORDERITEM", "1=2")); + +if (itemcount == "0" && vars.get("$field.OrderStatus") == "1" ) { + result.string(false); +} + +else if (itemcount == "0" && vars.get("$field.OrderStatus") == "0"){ + result.string(true); +} + +else result.string(OrderUtils.isEditable(vars.get("$field.OrderStatus"))); \ No newline at end of file diff --git a/neonView/OrderFilter_view/OrderFilter_view.aod b/neonView/OrderFilter_view/OrderFilter_view.aod index 01b607f1c0a7c2dc0ae2d14c8b859bea71577ff2..98f6a4b089df7378599d8952c612182ab15238c0 100644 --- a/neonView/OrderFilter_view/OrderFilter_view.aod +++ b/neonView/OrderFilter_view/OrderFilter_view.aod @@ -62,6 +62,10 @@ <name>71f23753-601d-49fa-810d-daa02a1323d8</name> <entityField>IMAGE</entityField> </neonTableColumn> + <neonTableColumn> + <name>443c8480-5676-43a3-9617-f86dae39c960</name> + <entityField>SALESORDERDATE</entityField> + </neonTableColumn> <neonTableColumn> <name>dba5604f-cc1b-4083-8115-7bbe1ba07bf4</name> <entityField>ORDERTYPE</entityField> @@ -81,8 +85,12 @@ <entityField>CONTACT_PERSON_ID</entityField> </neonTableColumn> <neonTableColumn> - <name>443c8480-5676-43a3-9617-f86dae39c960</name> - <entityField>SALESORDERDATE</entityField> + <name>513826d9-7bb3-4cdd-b26a-f3c3976a6063</name> + <entityField>ORDERSTATUS</entityField> + </neonTableColumn> + <neonTableColumn> + <name>f0b61831-07b1-41dc-bac6-0e27252f6b74</name> + <entityField>CANCELLATION</entityField> </neonTableColumn> <neonTableColumn> <name>6f55da1e-281c-44ba-ab97-729b75516c32</name> diff --git a/process/Order_lib/process.js b/process/Order_lib/process.js index 1d18ece0b1ff2f89d9f354e51b9f370c5d9bc9a7..243108028a7861e16d987a2841accafb14aea86c 100644 --- a/process/Order_lib/process.js +++ b/process/Order_lib/process.js @@ -1,3 +1,4 @@ +import("system.logging"); import("Context_lib"); import("KeywordRegistry_basic"); import("Neon_lib"); @@ -56,8 +57,10 @@ OrderUtils.validateOrderNumber = function(orderNumber) { OrderUtils.getOrderNumberValidationFailString = function() { return translate.text("The order number already exists!"); } - + + OrderUtils.isEditable = function(status) { + // TODO: Administrator darf immer ändern, warten auf neue Berechtigungslogik? // Order should be editable if order state not equals "Sent"