Author: deepak
Date: Thu May 26 11:54:55 2016 New Revision: 1745592 URL: http://svn.apache.org/viewvc?rev=1745592&view=rev Log: (OFBIZ-7079) Applied modified patch from jira ticket. ======================================= Extend Product entity and add serialized field ======================================= Thanks Avnindra for your patch. Modified: ofbiz/trunk/applications/datamodel/entitydef/product-entitymodel.xml ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductWorker.java ofbiz/trunk/applications/product/template/inventory/ReceiveInventory.ftl ofbiz/trunk/applications/product/template/returns/ReceiveReturn.ftl ofbiz/trunk/applications/product/widget/catalog/ProductForms.xml Modified: ofbiz/trunk/applications/datamodel/entitydef/product-entitymodel.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/datamodel/entitydef/product-entitymodel.xml?rev=1745592&r1=1745591&r2=1745592&view=diff ============================================================================== --- ofbiz/trunk/applications/datamodel/entitydef/product-entitymodel.xml (original) +++ ofbiz/trunk/applications/datamodel/entitydef/product-entitymodel.xml Thu May 26 11:54:55 2016 @@ -2724,6 +2724,7 @@ under the License. <field name="originalImageUrl" type="url"></field> <field name="detailScreen" type="long-varchar"></field> <field name="inventoryMessage" type="description"></field> + <field name="inventoryItemTypeId" type="id"></field> <field name="requireInventory" type="indicator"></field> <field name="quantityUomId" type="id"></field> <field name="quantityIncluded" type="fixed-point"><description>If you have a six-pack of 12oz soda cans you would have quantityIncluded=12, quantityUomId=oz, piecesIncluded=6.</description></field> @@ -2831,6 +2832,10 @@ under the License. <relation type="one" fk-name="PROD_SHBX_TYPE" title="Default" rel-entity-name="ShipmentBoxType"> <key-map field-name="defaultShipmentBoxTypeId" rel-field-name="shipmentBoxTypeId"/> </relation> + <relation type="one" fk-name="INV_ITEM_TYPE" rel-entity-name="InventoryItemType"> + <key-map field-name="inventoryItemTypeId" rel-field-name="inventoryItemTypeId"/> + </relation> + </entity> <entity entity-name="ProductAssoc" package-name="org.ofbiz.product.product" Modified: ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductWorker.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductWorker.java?rev=1745592&r1=1745591&r2=1745592&view=diff ============================================================================== --- ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductWorker.java (original) +++ ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductWorker.java Thu May 26 11:54:55 2016 @@ -131,6 +131,17 @@ public class ProductWorker { } return false; } + public static boolean isSerialized (Delegator delegator, String productId) { + try { + GenericValue product = EntityQuery.use(delegator).from("Product").where("productId", productId).cache().queryOne(); + if (UtilValidate.isNotEmpty(product)) { + return "SERIALIZED_INV_ITEM".equals(product.getString("inventoryItemTypeId")); + } + } catch (GenericEntityException e) { + Debug.logWarning(e.getMessage(), module); + } + return false; + } public static boolean taxApplies(GenericValue product) { String errMsg = ""; Modified: ofbiz/trunk/applications/product/template/inventory/ReceiveInventory.ftl URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/template/inventory/ReceiveInventory.ftl?rev=1745592&r1=1745591&r2=1745592&view=diff ============================================================================== --- ofbiz/trunk/applications/product/template/inventory/ReceiveInventory.ftl (original) +++ ofbiz/trunk/applications/product/template/inventory/ReceiveInventory.ftl Thu May 26 11:54:55 2016 @@ -137,6 +137,11 @@ under the License. <td width="6%" align="right" nowrap="nowrap" class="label">${uiLabelMap.ProductInventoryItemType}</td> <td width="6%"> </td> <td width="74%"> + <#if product.inventoryItemTypeId?has_content> + <input name="inventoryItemTypeId" type="hidden" value="${product.inventoryItemTypeId}" /> + <#assign inventoryItemType = product.getRelatedOne("InventoryItemType", true)! /> + ${inventoryItemType.description!} + <#else> <select name="inventoryItemTypeId" size="1"> <#list inventoryItemTypes as nextInventoryItemType> <option value="${nextInventoryItemType.inventoryItemTypeId}" @@ -146,8 +151,20 @@ under the License. >${nextInventoryItemType.get("description",locale)?default(nextInventoryItemType.inventoryItemTypeId)}</option> </#list> </select> + </#if> </td> </tr> + <#assign isSeriazed = Static["org.ofbiz.product.product.ProductWorker"].isSerialized(delegator, product.productId)!/> + <#if isSeriazed?has_content> + <tr> + <td width="14%"> </td> + <td width="6%" align="right" nowrap="nowrap" class="label">${uiLabelMap.ProductSerialNumber}</td> + <td width="6%"> </td> + <td width="74%"> + <input type="text" name="serialNumber" value="${parameters.serialNumber!}" /> + </td> + </tr> + </#if> <tr> <td colspan="4"> </td> </tr> @@ -437,6 +454,11 @@ under the License. <tr> <td width="45%"> ${uiLabelMap.ProductInventoryItemType} : + <#if product.inventoryItemTypeId?has_content> + <input name="inventoryItemTypeId_o_${rowCount}" type="hidden" value="${product.inventoryItemTypeId}" /> + <#assign inventoryItemType = product.getRelatedOne("InventoryItemType", true)! /> + ${inventoryItemType.description!} + <#else> <select name="inventoryItemTypeId_o_${rowCount}" size="1"> <#list inventoryItemTypes as nextInventoryItemType> <option value="${nextInventoryItemType.inventoryItemTypeId}" @@ -446,6 +468,7 @@ under the License. >${nextInventoryItemType.get("description",locale)?default(nextInventoryItemType.inventoryItemTypeId)}</option> </#list> </select> + </#if> </td> <td align="right">${uiLabelMap.ProductRejectionReason} :</td> <td align="right"> @@ -461,13 +484,19 @@ under the License. <input type="text" name="quantityRejected_o_${rowCount}" value="0" size="6"/> </td> <tr> - <td> </td> + <td width="45%"> + <#assign isSeriazed = Static["org.ofbiz.product.product.ProductWorker"].isSerialized(delegator, product.productId)!/> + <#if isSeriazed?has_content> + ${uiLabelMap.ProductSerialNumber} : + <input type="text" name="serialNumber_o_${rowCount}" value="" /> + </#if> + </td> <#if !product.lotIdFilledIn?has_content || product.lotIdFilledIn != "Forbidden"> <td align="right">${uiLabelMap.ProductLotId}</td> <td align="right"> <input type="text" name="lotId_o_${rowCount}" size="20" /> </td> - <#else /> + <#else> <td align="right"> </td> <td align="right"> </td> </#if> Modified: ofbiz/trunk/applications/product/template/returns/ReceiveReturn.ftl URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/template/returns/ReceiveReturn.ftl?rev=1745592&r1=1745591&r2=1745592&view=diff ============================================================================== --- ofbiz/trunk/applications/product/template/returns/ReceiveReturn.ftl (original) +++ ofbiz/trunk/applications/product/template/returns/ReceiveReturn.ftl Thu May 26 11:54:55 2016 @@ -167,7 +167,12 @@ under the License. </tr> <tr> <td width='10%'> - <select name="inventoryItemTypeId_o_${rowCount}" size="1" id="inventoryItemTypeId_o_${rowCount}" onchange="javascript:setInventoryItemStatus(this,${rowCount});"> + <#if product.inventoryItemTypeId?has_content> + <input name="inventoryItemTypeId_o_${rowCount}" type="hidden" value="${product.inventoryItemTypeId}" /> + <#assign inventoryItemType = product.getRelatedOne("InventoryItemType", true)! /> + ${inventoryItemType.description!} + <#else> + <select name="inventoryItemTypeId_o_${rowCount}" size="1" id="inventoryItemTypeId_o_${rowCount}" onchange="javascript:setInventoryItemStatus(this,${rowCount});"> <#list inventoryItemTypes as nextInventoryItemType> <option value='${nextInventoryItemType.inventoryItemTypeId}' <#if (facility.defaultInventoryItemTypeId?has_content) && (nextInventoryItemType.inventoryItemTypeId == facility.defaultInventoryItemTypeId)> @@ -175,7 +180,8 @@ under the License. </#if> >${nextInventoryItemType.get("description",locale)?default(nextInventoryItemType.inventoryItemTypeId)}</option> </#list> - </select> + </select> + </#if> </td> <td width="35%"> <span class="label">${uiLabelMap.ProductInitialInventoryItemStatus}:</span> Modified: ofbiz/trunk/applications/product/widget/catalog/ProductForms.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/widget/catalog/ProductForms.xml?rev=1745592&r1=1745591&r2=1745592&view=diff ============================================================================== --- ofbiz/trunk/applications/product/widget/catalog/ProductForms.xml (original) +++ ofbiz/trunk/applications/product/widget/catalog/ProductForms.xml Thu May 26 11:54:55 2016 @@ -122,6 +122,11 @@ under the License. <drop-down allow-empty="true"><option key="Y" description="${uiLabelMap.CommonY}"/><option key="N" description="${uiLabelMap.CommonN}"/></drop-down> </field> <field name="inventoryMessage" title="${uiLabelMap.ProductInventoryMessage}"><text size="20" maxlength="255"/></field> + <field name="inventoryItemTypeId" title="${uiLabelMap.ProductInventoryItemTypeId}"> + <drop-down allow-empty="true"> + <entity-options entity-name="InventoryItemType" key-field-name="inventoryItemTypeId"/> + </drop-down> + </field> <field name="lotIdFilledIn" title="${uiLabelMap.ProductLotId}"> <drop-down allow-empty="false"> @@ -296,6 +301,7 @@ under the License. <field-group title="${uiLabelMap.CommonInventory}" collapsible="true" initially-collapsed="true"> <sort-field name="salesDiscWhenNotAvail"/> <sort-field name="requirementMethodEnumId"/> + <sort-field name="inventoryItemTypeId"/> <sort-field name="requireInventory"/> <sort-field name="inventoryMessage"/> <sort-field name="lotIdFilledIn"/> |
Free forum by Nabble | Edit this page |