svn commit: r1747000 - in /ofbiz/trunk/applications/product: src/org/ofbiz/product/product/ProductContentWrapper.java widget/catalog/ProductForms.xml

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

svn commit: r1747000 - in /ofbiz/trunk/applications/product: src/org/ofbiz/product/product/ProductContentWrapper.java widget/catalog/ProductForms.xml

Arun Patidar-4
Author: arunpatidar
Date: Mon Jun  6 13:50:35 2016
New Revision: 1747000

URL: http://svn.apache.org/viewvc?rev=1747000&view=rev
Log:
[OFBIZ-7139] Applied patch from Jira issue
=============================================
As per the discussion over user list (subject: Product Name), user should be able to add product name in product creation process.
On Catalog >> Products >> New Product section, user won't see any input field to add product name. Same applies to Edit product screen.
Add field on the create and edit form.
Check for the support in the services used, if not then add support for it.
=============================================
Thanks Rishi for reporting and providing patch for the issue.

Modified:
    ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductContentWrapper.java
    ofbiz/trunk/applications/product/widget/catalog/ProductForms.xml

Modified: ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductContentWrapper.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductContentWrapper.java?rev=1747000&r1=1746999&r2=1747000&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductContentWrapper.java (original)
+++ ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductContentWrapper.java Mon Jun  6 13:50:35 2016
@@ -160,6 +160,23 @@ public class ProductContentWrapper imple
             throw new GeneralRuntimeException("Unable to find a delegator to use!");
         }
 
+        List<GenericValue> productContentList = EntityQuery.use(delegator).from("ProductContent").where("productId", productId, "productContentTypeId", productContentTypeId).orderBy("-fromDate").cache(cache).filterByDate().queryList();
+        if (UtilValidate.isEmpty(productContentList) && ("Y".equals(product.getString("isVariant")))) {
+            GenericValue parent = ProductWorker.getParentProduct(productId, delegator);
+            if (UtilValidate.isNotEmpty(parent)) {
+                productContentList = EntityQuery.use(delegator).from("ProductContent").where("productId", parent.get("productId"), "productContentTypeId", productContentTypeId).orderBy("-fromDate").cache(cache).filterByDate().queryList();
+            }
+        }
+        GenericValue productContent = EntityUtil.getFirst(productContentList);
+        if (productContent != null) {
+            // when rendering the product content, always include the Product and ProductContent records that this comes from
+            Map<String, Object> inContext = new HashMap<String, Object>();
+            inContext.put("product", product);
+            inContext.put("productContent", productContent);
+            ContentWorker.renderContentAsText(dispatcher, delegator, productContent.getString("contentId"), outWriter, inContext, locale, mimeTypeId, partyId, roleTypeId, cache);
+            return;
+        }
+
         String candidateFieldName = ModelUtil.dbNameToVarName(productContentTypeId);
         ModelEntity productModel = delegator.getModelEntity("Product");
         if (product == null) {
@@ -188,20 +205,5 @@ public class ProductContentWrapper imple
                 }
         }
 
-        List<GenericValue> productContentList = EntityQuery.use(delegator).from("ProductContent").where("productId", productId, "productContentTypeId", productContentTypeId).orderBy("-fromDate").cache(cache).filterByDate().queryList();
-        if (UtilValidate.isEmpty(productContentList) && ("Y".equals(product.getString("isVariant")))) {
-            GenericValue parent = ProductWorker.getParentProduct(productId, delegator);
-            if (UtilValidate.isNotEmpty(parent)) {
-                productContentList = EntityQuery.use(delegator).from("ProductContent").where("productId", parent.get("productId"), "productContentTypeId", productContentTypeId).orderBy("-fromDate").cache(cache).filterByDate().queryList();
-            }
-        }
-        GenericValue productContent = EntityUtil.getFirst(productContentList);
-        if (productContent != null) {
-            // when rendering the product content, always include the Product and ProductContent records that this comes from
-            Map<String, Object> inContext = new HashMap<String, Object>();
-            inContext.put("product", product);
-            inContext.put("productContent", productContent);
-            ContentWorker.renderContentAsText(dispatcher, delegator, productContent.getString("contentId"), outWriter, inContext, locale, mimeTypeId, partyId, roleTypeId, cache);
-        }
     }
 }

Modified: ofbiz/trunk/applications/product/widget/catalog/ProductForms.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/widget/catalog/ProductForms.xml?rev=1747000&r1=1746999&r2=1747000&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/widget/catalog/ProductForms.xml (original)
+++ ofbiz/trunk/applications/product/widget/catalog/ProductForms.xml Mon Jun  6 13:50:35 2016
@@ -98,6 +98,7 @@ under the License.
 
         <field position="1" name="internalName" title="${uiLabelMap.ProductInternalName}" required-field="true"><text size="30" maxlength="255"/></field>
         <field position="2" name="brandName" title="${uiLabelMap.ProductBrandName}" ><text size="30" maxlength="60"/></field>
+        <field name="productName" title="${uiLabelMap.ProductProductName}"><text size="30" maxlength="255"/></field>
         <field name="manufacturerPartyId" title="${uiLabelMap.ProductOemPartyId}" ><text size="20" maxlength="20"/></field>
         <field name="comments" title="${uiLabelMap.CommonComments}"><text size="60" maxlength="250"/></field>
 
@@ -299,6 +300,7 @@ under the License.
             <field-group title="${uiLabelMap.ProductWordingAndComment}" collapsible="true">
                 <sort-field name="internalName"/>
                 <sort-field name="brandName"/>
+                <sort-field name="productName"/>
                 <sort-field name="manufacturerPartyId"/>
                 <sort-field name="comments"/>
             </field-group>