This is an automated email from the ASF dual-hosted git repository.

pawan pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git


The following commit(s) were added to refs/heads/trunk by this push:
     new 52983af  Fixed: Unable to delete Group Order(OFBIZ-11773) (#172)
52983af is described below

commit 52983af7c74da685d3ae42db7e5924b8f2260ac6
Author: Pawan Verma <verma-pa...@users.noreply.github.com>
AuthorDate: Sat Jul 4 22:58:56 2020 +0530

    Fixed: Unable to delete Group Order(OFBIZ-11773) (#172)
    
    At 0da10ea897ae0b9fc9654c8faedc6f435ec21c26, We converted 
deleteProductGroupOrder service from XML to Groovy, which generates this issue.
    Reimplemented full groovy service to remove releated records.
---
 .../product/product/ProductServices.groovy            | 19 ++++---------------
 1 file changed, 4 insertions(+), 15 deletions(-)

diff --git 
a/applications/product/groovyScripts/product/product/ProductServices.groovy 
b/applications/product/groovyScripts/product/product/ProductServices.groovy
index 80c85d9..e5eae65 100644
--- a/applications/product/groovyScripts/product/product/ProductServices.groovy
+++ b/applications/product/groovyScripts/product/product/ProductServices.groovy
@@ -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)
-    jobSandbox.remove()
-
-    GenericValue runtimeData = from("RuntimeData").where(runtimeDataId: 
jobSandbox.runtimeDataId).queryOne()
-    if (!runtimeData) {
-        return error("RuntimeData not found with id: 
${jobSandbox.runtimeDataId}")
+    if (jobSandbox) {
+        jobSandbox.remove()
+        jobSandbox.removeRelated("RuntimeData")
     }
-    runtimeData.remove()
-
     return success()
 }
 

Reply via email to