svn commit: r1858319 - /ofbiz/ofbiz-framework/trunk/applications/product/servicedef/services_feature.xml

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r1858319 - /ofbiz/ofbiz-framework/trunk/applications/product/servicedef/services_feature.xml

Swapnil M Mane
Author: swapnilmmane
Date: Sun Apr 28 11:54:42 2019
New Revision: 1858319

URL: http://svn.apache.org/viewvc?rev=1858319&view=rev
Log:
Fixed: createProductFeature service ignoring passed productFeatureId parameter
(OFBIZ-10958)

In the change, used override tag instead of attribute.
And set the optional true in INOUT mode for productFeatureId.
But since we are using entity-auto productFeatureId will be always available (either user provide it and if not passed by the user,  system will autogenerate it), thus it will be always OUT.

Additional Notes:

Here we can't make a changes mentioned below, because, for *optional* field's value, invokeCreate method (internally calling isIn and IsOut methods of ModelParam) of EntityAutoEngine.java consider the attribute (override) defined at last for parameters with the same name.

i.e. for below example,  optional value for productFeatureId for mode IN  will be false (but it is defined true)

{code}
<override name=productFeatureId type=String mode=IN optional=true/>
<override name=productFeatureId type=String mode=OUT optional=false/>
{code}

Due to this, isSinglePkIn (in invokeCreate method) field got false value, and the system will auto-generate the productFeatureId and ignore the user's input.

Similarly, we can't write in this way
{code}
<override name=productFeatureId type=String mode=OUT optional=false/>
<override name=productFeatureId type=String mode=IN optional=true/>
{code}

Because in this case, isSinglePkOut (in invokeCreate method) field got false value, and again the system will auto-generate the productFeatureId and ignore the user's input.

Thanks:  Ulrich Heidfeld for reporting the issue and providing the patch.

Modified:
    ofbiz/ofbiz-framework/trunk/applications/product/servicedef/services_feature.xml

Modified: ofbiz/ofbiz-framework/trunk/applications/product/servicedef/services_feature.xml
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/product/servicedef/services_feature.xml?rev=1858319&r1=1858318&r2=1858319&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/product/servicedef/services_feature.xml (original)
+++ ofbiz/ofbiz-framework/trunk/applications/product/servicedef/services_feature.xml Sun Apr 28 11:54:42 2019
@@ -43,7 +43,7 @@ under the License.
     <service name="createProductFeature" engine="entity-auto" invoke="create" default-entity-name="ProductFeature" auth="true">
         <description>Create a ProductFeature record</description>
         <auto-attributes include="all" mode="IN" optional="true"/>
-        <attribute name="productFeatureId" type="String" mode="OUT" optional="false"/>
+        <override name="productFeatureId" type="String" mode="INOUT" optional="true"/>
         <override name="productFeatureTypeId" mode="IN" optional="false"/>
         <override name="description" mode="IN" optional="false"/>
     </service>