svn commit: r439356 - in /incubator/ofbiz/trunk/applications/order: data/OrderTypeData.xml script/org/ofbiz/order/quote/QuoteServices.xml src/org/ofbiz/order/shoppingcart/ShoppingCartServices.java

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

svn commit: r439356 - in /incubator/ofbiz/trunk/applications/order: data/OrderTypeData.xml script/org/ofbiz/order/quote/QuoteServices.xml src/org/ofbiz/order/shoppingcart/ShoppingCartServices.java

jacopoc
Author: jacopoc
Date: Fri Sep  1 08:45:47 2006
New Revision: 439356

URL: http://svn.apache.org/viewvc?rev=439356&view=rev
Log:
Applied patch from Rodrigo Aguinaga (OFBIZ-173) to implement some basic features to allow the creation of purchase requests and quotes, that can be transformed to purchase orders.
I did some changes to contributed code for QuoteServices.xml because there were some formatting issues and one error in the minilang syntax.

Modified:
    incubator/ofbiz/trunk/applications/order/data/OrderTypeData.xml
    incubator/ofbiz/trunk/applications/order/script/org/ofbiz/order/quote/QuoteServices.xml
    incubator/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartServices.java

Modified: incubator/ofbiz/trunk/applications/order/data/OrderTypeData.xml
URL: http://svn.apache.org/viewvc/incubator/ofbiz/trunk/applications/order/data/OrderTypeData.xml?rev=439356&r1=439355&r2=439356&view=diff
==============================================================================
--- incubator/ofbiz/trunk/applications/order/data/OrderTypeData.xml (original)
+++ incubator/ofbiz/trunk/applications/order/data/OrderTypeData.xml Fri Sep  1 08:45:47 2006
@@ -24,6 +24,7 @@
     <CustRequestType custRequestTypeId="RF_PROPOSAL" description="Request For Proposal" hasTable="N" parentTypeId=""/>
     <CustRequestType custRequestTypeId="RF_QUOTE" description="Request For Quote" hasTable="N" parentTypeId=""/>
     <CustRequestType custRequestTypeId="RF_SUPPORT" description="Request For Support" hasTable="N" parentTypeId=""/>
+    <CustRequestType custRequestTypeId="RF_PUR_QUOTE" description="Request For Purchase Quote" hasTable="N" parentTypeId=""/>
 
     <CustRequestResolution custRequestResolutionId="FIXED" custRequestTypeId="RF_BUGFIX" description="Fixed"/>
     <CustRequestResolution custRequestResolutionId="WORKS" custRequestTypeId="RF_BUGFIX" description="Works For Me"/>
@@ -74,6 +75,7 @@
     <QuoteType description="Other" hasTable="N" parentTypeId="" quoteTypeId="OTHER_QUOTE"/>
     <QuoteType description="Product" hasTable="N" parentTypeId="" quoteTypeId="PRODUCT_QUOTE"/>
     <QuoteType description="Proposal" hasTable="N" parentTypeId="" quoteTypeId="PROPOSAL"/>
+    <QuoteType description="Product Purchase" hasTable="N" parentTypeId="" quoteTypeId="PURCHASE_QUOTE"/>
 
     <RequirementType description="Customer Requirement" hasTable="N" parentTypeId="" requirementTypeId="CUSTOMER_REQUIREMENT"/>
     <RequirementType description="Internal Requirement" hasTable="N" parentTypeId="" requirementTypeId="INTERNAL_REQUIREMENT"/>

Modified: incubator/ofbiz/trunk/applications/order/script/org/ofbiz/order/quote/QuoteServices.xml
URL: http://svn.apache.org/viewvc/incubator/ofbiz/trunk/applications/order/script/org/ofbiz/order/quote/QuoteServices.xml?rev=439356&r1=439355&r2=439356&view=diff
==============================================================================
--- incubator/ofbiz/trunk/applications/order/script/org/ofbiz/order/quote/QuoteServices.xml (original)
+++ incubator/ofbiz/trunk/applications/order/script/org/ofbiz/order/quote/QuoteServices.xml Fri Sep  1 08:45:47 2006
@@ -725,11 +725,19 @@
             <fail-property resource="OrderErrorUiLabels" property="OrderSecurityErrorToRunCreateQuoteFromCustRequest"/>
         </check-permission>
         <check-errors/>
-
         <entity-one entity-name="CustRequest" value-name="custRequest" auto-field-map="true"/>
-        <if-compare field-name="custRequest.custRequestTypeId" operator="not-equals" value="RF_QUOTE">
-            <add-error><fail-message message="ERROR: CustRequest [${custRequest.custRequestId}] is not a request for quote."/></add-error>
-        </if-compare>
+        <!-- error if request type not equals to RF_QUOTE or RF_PUR_QUOTE -->
+        <if>
+            <condition>
+                <and>
+                    <if-compare field-name="custRequest.custRequestTypeId" operator="not-equals" value="RF_QUOTE"/>
+                    <if-compare field-name="custRequest.custRequestTypeId" operator="not-equals" value="RF_PUR_QUOTE"/>
+                </and>
+            </condition>
+            <then>
+                <add-error><fail-message message="ERROR: CustRequest [${custRequest.custRequestId}] is not a request for quote."/></add-error>
+            </then>
+        </if>
         <check-errors/>
 
         <set field="createQuoteInMap.partyId" from-field="custRequest.fromPartyId"/>
@@ -739,10 +747,17 @@
         <set field="createQuoteInMap.currencyUomId" from-field="custRequest.maximumAmountUomId"/>
         <set field="createQuoteInMap.statusId" value="QUO_CREATED"/>
         <set field="createQuoteInMap.quoteTypeId" from-field="parameters.quoteTypeId"/>
+        <!-- set the quoteType (product or purchase) -->
         <if-empty field-name="createQuoteInMap.quoteTypeId">
-            <set field="createQuoteInMap.quoteTypeId" value="PRODUCT_QUOTE"/>
+            <if-compare field-name="custRequest.custRequestTypeId" operator="equals" value="RF_QUOTE">
+                <set field="createQuoteInMap.quoteTypeId" value="PRODUCT_QUOTE"/>
+            <else>
+                <set field="createQuoteInMap.quoteTypeId" value="PURCHASE_QUOTE"/>
+            </else>
+            </if-compare>
         </if-empty>
-        <call-service service-name="createQuote" in-map-name="createQuoteInMap">
+        
+         <call-service service-name="createQuote" in-map-name="createQuoteInMap">
             <result-to-field result-name="quoteId" field-name="quoteId"/>
         </call-service>
         <check-errors/>

Modified: incubator/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartServices.java
URL: http://svn.apache.org/viewvc/incubator/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartServices.java?rev=439356&r1=439355&r2=439356&view=diff
==============================================================================
--- incubator/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartServices.java (original)
+++ incubator/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartServices.java Fri Sep  1 08:45:47 2006
@@ -399,7 +399,10 @@
 
         // create the cart
         ShoppingCart cart = new ShoppingCart(delegator, productStoreId, locale, currency);
-
+        // set shopping cart type
+        if (quote.getString("quoteTypeId").equals("PURCHASE_QUOTE")){
+         cart.setOrderType("PURCHASE_ORDER");
+        }
         try {
             cart.setUserLogin(userLogin, dispatcher);
         } catch (CartItemModifyException e) {