Fixed: Unable to delete Group Order(OFBIZ-11773)
At We converted deleteProductGroupOrder service from XML to Groovy, which generates this issue.
Reimplemented full groovy service to remove releated records.
@@ -760,25 +760,14 @@ def updateProductGroupOrder() {
*/
def deleteProductGroupOrder() {
GenericValue productGroupOrder = from("ProductGroupOrder").where(parameters).queryOne()
- if (!productGroupOrder) {
- return error("ProductGroupOrder not found with id ${parameters.groupOrderId}")
- }
- delegator.removeByCondition("OrderItemGroupOrder", groupOrderId: parameters.groupOrderId)
productGroupOrder.remove()
+ productGroupOrder.removeRelated("OrderItemGroupOrder")
GenericValue jobSandbox = from("JobSandbox").where(jobId: productGroupOrder.jobId).queryOne()
- if (!jobSandbox) {
- return error("JobSandbox not found with id ${productGroupOrder.jobId}")
- }
- delegator.removeByCondition("JobSandbox", runtimeDataId: jobSandbox.runtimeDataId)
+ if (jobSandbox) {
jobSandbox.remove()
-
- GenericValue runtimeData = from("RuntimeData").where(runtimeDataId: jobSandbox.runtimeDataId).queryOne()
- if (!runtimeData) {
- return error("RuntimeData not found with id: ${jobSandbox.runtimeDataId}")
+ jobSandbox.removeRelated("RuntimeData")
}
- runtimeData.remove()
-
return success()
}
