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

jleroux 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 0c7a89e7c3 Fixed: Error with executeMRP service (OFBIZ-13122)
0c7a89e7c3 is described below

commit 0c7a89e7c36daf84ff56f1612374144ba831c03f
Author: Jacques Le Roux <jacques.le.r...@les7arts.com>
AuthorDate: Fri Jul 12 19:53:48 2024 +0200

    Fixed: Error with executeMRP service (OFBIZ-13122)
    
    Reverting OFBIZ-10395 commits was not enough because of the merge issues.
    Other things have changed since:
    *  createRequirementCustRequest, was created later
    *  Some service were migrated to groovy, eg checkCreateOrderRequirement
    *  etc.
    
    Actually only adding again in the RequirementServices.xml the old
    createRequirement simple-method, with its required requirementInterface
    interface, to replace the entity-auto createRequirement service was needed.
    
    For history sake: also deleteRequirement is no longer required, the new 
Groovy
    implementation deleteRequirementAndRelated does really the work. Same for 
the
    rest of the file below.
---
 .../minilang/requirement/RequirementServices.xml   | 39 ++++++++++++++++++++++
 .../order/servicedef/services_requirement.xml      | 28 ++++++++++------
 2 files changed, 57 insertions(+), 10 deletions(-)

diff --git a/applications/order/minilang/requirement/RequirementServices.xml 
b/applications/order/minilang/requirement/RequirementServices.xml
new file mode 100644
index 0000000000..4a85ad5961
--- /dev/null
+++ b/applications/order/minilang/requirement/RequirementServices.xml
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+
+<simple-methods xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+        xmlns="http://ofbiz.apache.org/Simple-Method"; 
xsi:schemaLocation="http://ofbiz.apache.org/Simple-Method 
http://ofbiz.apache.org/dtds/simple-methods.xsd";>
+    <simple-method method-name="createRequirement" short-description="Create a 
new requirement">
+        <make-value entity-name="Requirement" value-field="newEntity"/>
+        <sequenced-id sequence-name="Requirement" field="requirementId"/>
+        <set field="newEntity.requirementId" from-field="requirementId"/>
+        <set-nonpk-fields map="parameters" value-field="newEntity"/>
+        <if-empty field="parameters.statusId">
+            <set value="REQ_CREATED" field="newEntity.statusId"/>
+        </if-empty>
+        <now-timestamp field="nowTimestamp"/>
+        <set field="newEntity.createdDate" from-field="nowTimestamp"/>
+        <set field="newEntity.lastModifiedDate" from-field="nowTimestamp"/>
+        <set field="newEntity.createdByUserLogin" 
from-field="userLogin.userLoginId"/>
+        <set field="newEntity.lastModifiedByUserLogin" 
from-field="userLogin.userLoginId"/>
+        <create-value value-field="newEntity"/>
+        <field-to-result field="requirementId" result-name="requirementId"/>
+    </simple-method>
+</simple-methods>
diff --git a/applications/order/servicedef/services_requirement.xml 
b/applications/order/servicedef/services_requirement.xml
index 07ddbed252..58a100c5a9 100644
--- a/applications/order/servicedef/services_requirement.xml
+++ b/applications/order/servicedef/services_requirement.xml
@@ -24,13 +24,24 @@ under the License.
     <vendor>OFBiz</vendor>
     <version>1.0</version>
 
-    <service name="createRequirement" default-entity-name="Requirement" 
engine="entity-auto" invoke="create" auth="true">
+    <!-- Requirement Services -->
+    <service name="requirementInterface" engine="interface" location="" 
invoke="">
+        <description>Requirement Interface</description>
+        <auto-attributes mode="IN" entity-name="Requirement" include="nonpk" 
optional="true">
+            <exclude field-name="createdDate"/>
+            <exclude field-name="createdByUserLogin"/>
+            <exclude field-name="lastModifiedDate"/>
+            <exclude field-name="lastModifiedByUserLogin"/>
+        </auto-attributes>
+    </service>
+    <service name="createRequirement" engine="simple"
+            
location="component://order/minilang/requirement/RequirementServices.xml" 
invoke="createRequirement">
         <description>Create a new requirement</description>
-        <auto-attributes include="pk" mode="INOUT" optional="true"/>
-        <auto-attributes include="nonpk" mode="IN" optional="true"/>
-        <attribute name="custRequestId" mode="IN" type="String" 
optional="true"/>
-        <attribute name="custRequestItemSeqId" mode="IN" type="String" 
optional="true"/>
-        <override name="statusId" default-value="REQ_CREATED"/>
+        <implements service="requirementInterface"/>
+        <attribute name="requirementTypeId" type="String" mode="IN" 
optional="false"/>
+        <attribute name="custRequestId" type="String" mode="IN" 
optional="true"/>
+        <attribute name="custRequestItemSeqId" type="String" mode="IN" 
optional="true"/>
+        <attribute name="requirementId" type="String" mode="INOUT" 
optional="true"/>
     </service>
     <service name="updateRequirement" default-entity-name="Requirement" 
engine="entity-auto" invoke="update" auth="true">
         <description>Update an existing requirement</description>
@@ -38,10 +49,6 @@ under the License.
         <auto-attributes include="nonpk" mode="IN" optional="true"/>
         <attribute name="oldStatusId" type="String" mode="OUT" 
optional="true"/>
     </service>
-    <service name="deleteRequirement" engine="entity-auto" 
default-entity-name="Requirement" auth="true" invoke="delete">
-        <description>Delete a requirement</description>
-        <auto-attributes mode="IN" include="pk" optional="false"/>
-    </service>
     <service name="deleteRequirementAndRelated" engine="groovy"
             
location="component://order/src/main/groovy/org/apache/ofbiz/order/requirement/RequirementServicesScript.groovy"
 invoke="deleteRequirementAndRelated">
         <description>Delete a requirement after deleting related entity 
records.</description>
@@ -272,6 +279,7 @@ under the License.
         <description>Delete a RequirementTypeAttr record</description>
         <auto-attributes mode="IN" include="pk"/>
     </service>
+
     <!-- RequirementCustRequest services -->
     <service name="createRequirementCustRequest" 
default-entity-name="RequirementCustRequest" engine="entity-auto" 
invoke="create" auth="true">
         <description>Create a RequirementCustRequest record</description>

Reply via email to