Author: jleroux
Date: Fri Sep 25 04:34:57 2009 New Revision: 818715 URL: http://svn.apache.org/viewvc?rev=818715&view=rev Log: A patch from Prateek Jain "Make ATP/QOH button in purchase order independent of productStore" (https://issues.apache.org/jira/browse/OFBIZ-2967) - OFBIZ-2967 When we click on ATP/'Qoh button in purchase order for a particular order item it gives error that facility id is not present.Ideally in case of purchase order it should not be dependent on productStore. Modified: ofbiz/trunk/applications/order/script/org/ofbiz/order/order/OrderServices.xml ofbiz/trunk/applications/order/servicedef/services.xml ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/controller.xml ofbiz/trunk/applications/order/webapp/ordermgr/entry/cart/showcart.ftl Modified: ofbiz/trunk/applications/order/script/org/ofbiz/order/order/OrderServices.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/script/org/ofbiz/order/order/OrderServices.xml?rev=818715&r1=818714&r2=818715&view=diff ============================================================================== --- ofbiz/trunk/applications/order/script/org/ofbiz/order/order/OrderServices.xml (original) +++ ofbiz/trunk/applications/order/script/org/ofbiz/order/order/OrderServices.xml Fri Sep 25 04:34:57 2009 @@ -1351,4 +1351,22 @@ </else> </if-compare-field> </simple-method> + <simple-method method-name="productAvailabalityByFacility" short-description="Calculate ATP and Qoh According For each facility"> + <set field="facilityMap.ownerPartyId" from-field="parameters.ownerPartyId"/> + <find-by-and map="facilityMap" list="facilityList" entity-name="Facility"/> + <iterate entry="facility" list="facilityList"> + <set field="getInventoryAvailableByFacilityMap.facilityId" from-field="facility.facilityId"/> + <set field="getInventoryAvailableByFacilityMap.productId" from-field="parameters.productId"/> + <call-service service-name="getInventoryAvailableByFacility" in-map-name="getInventoryAvailableByFacilityMap"> + <result-to-field result-name="quantityOnHandTotal"/> + <result-to-field result-name="availableToPromiseTotal"/> + </call-service> + <set field="availabalityMap.facilityId" from-field="facility.facilityId"/> + <set field="availabalityMap.quantityOnHandTotal" from-field="quantityOnHandTotal"/> + <set field="availabalityMap.availableToPromiseTotal" from-field="availableToPromiseTotal"/> + <field-to-list field="availabalityMap" list="availabalityList"/> + <clear-field field="availabalityMap"/> + </iterate> + <field-to-result field="availabalityList"/> + </simple-method> </simple-methods> Modified: ofbiz/trunk/applications/order/servicedef/services.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/servicedef/services.xml?rev=818715&r1=818714&r2=818715&view=diff ============================================================================== --- ofbiz/trunk/applications/order/servicedef/services.xml (original) +++ ofbiz/trunk/applications/order/servicedef/services.xml Fri Sep 25 04:34:57 2009 @@ -1034,4 +1034,13 @@ </description> <attribute name="orderId" mode="IN" type="String" optional="false"/> </service> + <service name="productAvailabalityByFacility" engine="simple" location="component://order/script/org/ofbiz/order/order/OrderServices.xml" + invoke="productAvailabalityByFacility" auth="true"> + <description> + Calculate ATP and QOH According For each facility + </description> + <attribute name="productId" type="String" mode="IN" optional="false"/> + <attribute name="ownerPartyId" type="String" mode="IN" optional="true"/> + <attribute name="availabalityList" type="List" mode="OUT"/> + </service> </services> \ No newline at end of file Modified: ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/controller.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/controller.xml?rev=818715&r1=818714&r2=818715&view=diff ============================================================================== --- ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/controller.xml (original) +++ ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/controller.xml Fri Sep 25 04:34:57 2009 @@ -1650,6 +1650,12 @@ </request-map> <request-map uri="LookupContent"><security auth="true" https="true"/><response name="success" type="view" value="LookupContent"/></request-map> + <request-map uri="productAvailabalityByFacility"> + <security https="true" auth="true"/> + <event type="service" invoke="productAvailabalityByFacility"/> + <response name="success" type="view" value="showcart"/> + <response name="error" type="view" value="showcart"/> + </request-map> <!-- These are just examples of reports developed using JasperReport and not really useful reports. In order to run them you'll have to follow the notes in the Modified: ofbiz/trunk/applications/order/webapp/ordermgr/entry/cart/showcart.ftl URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/entry/cart/showcart.ftl?rev=818715&r1=818714&r2=818715&view=diff ============================================================================== --- ofbiz/trunk/applications/order/webapp/ordermgr/entry/cart/showcart.ftl (original) +++ ofbiz/trunk/applications/order/webapp/ordermgr/entry/cart/showcart.ftl Fri Sep 25 04:34:57 2009 @@ -23,28 +23,52 @@ document.qohAtpForm.submit(); } </script> - +<#if shoppingCart.getOrderType() == "PURCHASE_ORDER"> + <#assign target="productAvailabalityByFacility"> +<#else> + <#assign target="getProductInventoryAvailable"> +</#if> <div class="screenlet"> <div class="screenlet-body"> - <div> - <#if quantityOnHandTotal?exists && availableToPromiseTotal?exists && (productId)?exists> - <ul> - <li> - <label>${uiLabelMap.ProductQuantityOnHand}</label>: ${quantityOnHandTotal} - </li> - <li> - <label>${uiLabelMap.ProductAvailableToPromise}</label>: ${availableToPromiseTotal} - </li> - </ul> + <#if shoppingCart.getOrderType() == "SALES_ORDER"> + <div> + <#if quantityOnHandTotal?exists && availableToPromiseTotal?exists && (productId)?exists> + <ul> + <li> + <label>${uiLabelMap.ProductQuantityOnHand}</label>: ${quantityOnHandTotal} + </li> + <li> + <label>${uiLabelMap.ProductAvailableToPromise}</label>: ${availableToPromiseTotal} + </li> + </ul> + </#if> + </div> + <#else> + <#if parameters.availabalityList?has_content> + <table> + <tr> + <td>${uiLabelMap.Facility}</td> + <td>${uiLabelMap.ProductQuantityOnHand}</td> + <td>${uiLabelMap.ProductAvailableToPromise}</td> + </tr> + <#list parameters.availabalityList as availabality> + <tr> + <td>${availabality.facilityId}</td> + <td>${availabality.quantityOnHandTotal}</td> + <td>${availabality.availableToPromiseTotal}</td> + </tr> + </#list> + </table> </#if> - </div> + </#if> <table border="0" cellspacing="0" cellpadding="0"> <tr> <td> - <form name="qohAtpForm" method="post" action="<@ofbizUrl>getProductInventoryAvailable</@ofbizUrl>"> + <form name="qohAtpForm" method="post" action="<@ofbizUrl>${target}</@ofbizUrl>"> <fieldset> <input type="hidden" name="facilityId" value="${facilityId?if_exists}"/> <input type="hidden" name="productId"/> + <input type="hidden" id="ownerPartyId" name="ownerPartyId" value="${shoppingCart.getBillToCustomerPartyId()?if_exists}" /> </fieldset> </form> <form method="post" action="<@ofbizUrl>additem</@ofbizUrl>" name="quickaddform" style="margin: 0;"> |
Free forum by Nabble | Edit this page |