svn commit: r1368889 - in /ofbiz/trunk/applications: order/entitydef/entitymodel.xml product/script/org/ofbiz/product/product/ProductServices.xml product/script/org/ofbiz/product/test/GroupOrderTest.xml

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

svn commit: r1368889 - in /ofbiz/trunk/applications: order/entitydef/entitymodel.xml product/script/org/ofbiz/product/product/ProductServices.xml product/script/org/ofbiz/product/test/GroupOrderTest.xml

hansbak-2
Author: hansbak
Date: Fri Aug  3 11:14:03 2012
New Revision: 1368889

URL: http://svn.apache.org/viewvc?rev=1368889&view=rev
Log:
fix the grouporder tests

Modified:
    ofbiz/trunk/applications/order/entitydef/entitymodel.xml
    ofbiz/trunk/applications/product/script/org/ofbiz/product/product/ProductServices.xml
    ofbiz/trunk/applications/product/script/org/ofbiz/product/test/GroupOrderTest.xml

Modified: ofbiz/trunk/applications/order/entitydef/entitymodel.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/entitydef/entitymodel.xml?rev=1368889&r1=1368888&r2=1368889&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/entitydef/entitymodel.xml (original)
+++ ofbiz/trunk/applications/order/entitydef/entitymodel.xml Fri Aug  3 11:14:03 2012
@@ -782,7 +782,7 @@ under the License.
         <key-map field-name="orderId"/>
         <key-map field-name="orderItemSeqId"/>
       </relation>
-      <relation type="one" fk-name="OIGO_PRD_GROUP_ORDER" rel-entity-name="ProductGroupOrder">
+      <relation type="one" fk-name="OIGO_GROUP_ORDER" rel-entity-name="ProductGroupOrder">
         <key-map field-name="groupOrderId"/>
       </relation>
     </entity>

Modified: ofbiz/trunk/applications/product/script/org/ofbiz/product/product/ProductServices.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/script/org/ofbiz/product/product/ProductServices.xml?rev=1368889&r1=1368888&r2=1368889&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/script/org/ofbiz/product/product/ProductServices.xml (original)
+++ ofbiz/trunk/applications/product/script/org/ofbiz/product/product/ProductServices.xml Fri Aug  3 11:14:03 2012
@@ -1199,21 +1199,23 @@ under the License.
                     <field-map field-name="groupOrderId" from-field="orderItemGroupOrder.groupOrderId"/>
                 </entity-one>
                 <if-not-empty field="productGroupOrder">
-                    <if-compare field="orderItem.statusId" operator="equals" value="ITEM_CANCELLED">
-                        <if-not-empty field="orderItem.cancelQuantity">
-                            <set field="cancelQuantity" from-field="orderItem.cancelQuantity"/>
-                        <else>
-                            <set field="cancelQuantity" from-field="orderItem.quantity"/>
-                        </else>
-                        </if-not-empty>
-                        <calculate field="productGroupOrder.soldOrderQty">
-                            <calcop field="productGroupOrder.soldOrderQty" operator="subtract">
-                                <calcop field="cancelQuantity" operator="get"/>
-                            </calcop>
-                        </calculate>
+                    <if-compare field="productGroupOrder.statusId" operator="equals" value="GO_CREATED">
+                        <if-compare field="orderItem.statusId" operator="equals" value="ITEM_CANCELLED">
+                            <if-not-empty field="orderItem.cancelQuantity">
+                                <set field="cancelQuantity" from-field="orderItem.cancelQuantity"/>
+                            <else>
+                                <set field="cancelQuantity" from-field="orderItem.quantity"/>
+                            </else>
+                            </if-not-empty>
+                            <calculate field="productGroupOrder.soldOrderQty">
+                                <calcop field="productGroupOrder.soldOrderQty" operator="subtract">
+                                    <calcop field="cancelQuantity" operator="get"/>
+                                </calcop>
+                            </calculate>
+                        </if-compare>
+                        <store-value value-field="productGroupOrder"/>
+                        <remove-value value-field="orderItemGroupOrder"/>
                     </if-compare>
-                    <store-value value-field="productGroupOrder"/>
-                    <remove-value value-field="orderItemGroupOrder"/>
                 </if-not-empty>
             </if-not-empty>
         </iterate>
@@ -1231,6 +1233,10 @@ under the License.
             </else>
             </if-compare>
             
+            <set field="updateProductGroupOrderMap.groupOrderId" from-field="productGroupOrder.groupOrderId"/>
+            <set field="updateProductGroupOrderMap.statusId" from-field="groupOrderStatusId"/>
+            <call-service service-name="updateProductGroupOrder" in-map-name="updateProductGroupOrderMap"/>
+            
             <entity-and entity-name="OrderItemGroupOrder" list="orderItemGroupOrders">
                 <field-map field-name="groupOrderId" from-field="productGroupOrder.groupOrderId"/>
             </entity-and>
@@ -1240,10 +1246,6 @@ under the License.
                 <set field="changeOrderItemStatusMap.statusId" from-field="newItemStatusId"/>
                 <call-service service-name="changeOrderItemStatus" in-map-name="changeOrderItemStatusMap"/>
             </iterate>
-            
-            <set field="updateProductGroupOrderMap.groupOrderId" from-field="productGroupOrder.groupOrderId"/>
-            <set field="updateProductGroupOrderMap.statusId" from-field="groupOrderStatusId"/>
-            <call-service service-name="updateProductGroupOrder" in-map-name="updateProductGroupOrderMap"/>
         </if-not-empty>
     </simple-method>
     

Modified: ofbiz/trunk/applications/product/script/org/ofbiz/product/test/GroupOrderTest.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/script/org/ofbiz/product/test/GroupOrderTest.xml?rev=1368889&r1=1368888&r2=1368889&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/script/org/ofbiz/product/test/GroupOrderTest.xml (original)
+++ ofbiz/trunk/applications/product/script/org/ofbiz/product/test/GroupOrderTest.xml Fri Aug  3 11:14:03 2012
@@ -126,23 +126,20 @@ under the License.
         </assert>
         <!-- Step 4 -->
         <set field="checkProductGroupOrderExpiredMap.userLogin" from-field="systemUserLogin"/>
-        <set field="checkProductGroupOrderExpiredMap.groupOrderId" from-field="productGroupOrder.groupOrderId"/>
+        <set field="checkProductGroupOrderExpiredMap.groupOrderId" from-field="groupOrderId"/>
         <call-service service-name="checkProductGroupOrderExpired" in-map-name="checkProductGroupOrderExpiredMap"/>
         <!-- Step 5 -->
-        <entity-condition entity-name="OrderHeader" list="orderHeaders">
-            <condition-expr field-name="orderTypeId" value="SALES_ORDER"/>
-            <order-by field-name="-orderDate"/>
-        </entity-condition>
-        <first-from-list entry="orderHeader" list="orderHeaders"/>
-        <entity-and entity-name="OrderItem" list="orderItems">
-            <field-map field-name="orderId" from-field="orderHeader.orderId"/>
-            <field-map field-name="productId" value="GZ-1000"/>
+        <entity-and entity-name="OrderItemGroupOrder" list="orderItemGroupOrders">
+            <field-map field-name="groupOrderId" from-field="groupOrderId"/>
         </entity-and>
-        <first-from-list entry="orderItem" list="orderItems"/>
+        <first-from-list entry="orderItemGroupOrder" list="orderItemGroupOrders"/>
+        <entity-one entity-name="OrderItem" value-field="orderItem">
+            <field-map field-name="orderId" from-field="orderItemGroupOrder.orderId"/>
+            <field-map field-name="orderItemSeqId" from-field="orderItemGroupOrder.orderItemSeqId"/>
+        </entity-one>
         <assert>
             <if-compare field="orderItem.statusId" operator="equals" value="ITEM_APPROVED"/>
         </assert>
-        
         <check-errors/>
     </simple-method>
 
@@ -165,9 +162,10 @@ under the License.
             <field-map field-name="userLoginId" value="system"/>
         </entity-one>
         <set field="createProductGroupOrderMap.userLogin" from-field="systemUserLogin"/>
-        <set field="createProductGroupOrderMap.productId" value="GZ-1000"/>
+        <set field="createProductGroupOrderMap.productId" value="GZ-1001"/>
         <set field="createProductGroupOrderMap.fromDate" from-field="nowTimestamp"/>
         <set field="createProductGroupOrderMap.thruDate" from-field="thruDate"/>
+        <set field="createProductGroupOrderMap.statusId" value="GO_CREATED"/>
         <set field="createProductGroupOrderMap.reqOrderQty" value="2" type="BigDecimal"/>
         <set field="createProductGroupOrderMap.soldOrderQty" value="0" type="BigDecimal"/>
         <call-service service-name="createProductGroupOrder" in-map-name="createProductGroupOrderMap">
@@ -204,7 +202,7 @@ under the License.
         </call-class-method>
         <log level="info" message="===== >>> Event : setOrderCurrencyAgreementShipDates, Response : ${result}"/>
         <call-bsh><![CDATA[
-            request.setParameter("add_product_id", "GZ-1000");
+            request.setParameter("add_product_id", "GZ-1001");
         ]]></call-bsh>
         <call-class-method method-name="addToCart" class-name="org.ofbiz.order.shoppingcart.ShoppingCartEvents" ret-field="result">
             <field field="request" type="javax.servlet.http.HttpServletRequest"/>
@@ -250,23 +248,20 @@ under the License.
         </assert>
         <!-- Step 4 -->
         <set field="checkProductGroupOrderExpiredMap.userLogin" from-field="systemUserLogin"/>
-        <set field="checkProductGroupOrderExpiredMap.groupOrderId" from-field="productGroupOrder.groupOrderId"/>
+        <set field="checkProductGroupOrderExpiredMap.groupOrderId" from-field="groupOrderId"/>
         <call-service service-name="checkProductGroupOrderExpired" in-map-name="checkProductGroupOrderExpiredMap"/>
         <!-- Step 5 -->
-        <entity-condition entity-name="OrderHeader" list="orderHeaders">
-            <condition-expr field-name="orderTypeId" value="SALES_ORDER"/>
-            <order-by field-name="-orderDate"/>
-        </entity-condition>
-        <first-from-list entry="orderHeader" list="orderHeaders"/>
-        <entity-and entity-name="OrderItem" list="orderItems">
-            <field-map field-name="orderId" from-field="orderHeader.orderId"/>
-            <field-map field-name="productId" value="GZ-1000"/>
+        <entity-and entity-name="OrderItemGroupOrder" list="orderItemGroupOrders">
+            <field-map field-name="groupOrderId" from-field="groupOrderId"/>
         </entity-and>
-        <first-from-list entry="orderItem" list="orderItems"/>
+        <first-from-list entry="orderItemGroupOrder" list="orderItemGroupOrders"/>
+        <entity-one entity-name="OrderItem" value-field="orderItem">
+            <field-map field-name="orderId" from-field="orderItemGroupOrder.orderId"/>
+            <field-map field-name="orderItemSeqId" from-field="orderItemGroupOrder.orderItemSeqId"/>
+        </entity-one>
         <assert>
             <if-compare field="orderItem.statusId" operator="equals" value="ITEM_CANCELLED"/>
         </assert>
-        
         <check-errors/>
     </simple-method>
 </simple-methods>