|
This comment isn't about this specific commit, but about the code it
modifies. The JobSandbox entity should not be manipulated outside of the Job Scheduler - it will cause erratic behavior. -Adrian On 8/3/2012 8:52 AM, [hidden email] wrote: > Author: hansbak > Date: Fri Aug 3 07:52:28 2012 > New Revision: 1368822 > > URL: http://svn.apache.org/viewvc?rev=1368822&view=rev > Log: > improve the groupbuying function by properly return sales numbers when cancelling an order. > > Modified: > ofbiz/trunk/applications/order/entitydef/entitymodel.xml > ofbiz/trunk/applications/order/servicedef/secas.xml > ofbiz/trunk/applications/order/servicedef/services.xml > ofbiz/trunk/applications/product/data/ProductTypeData.xml > ofbiz/trunk/applications/product/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 > ofbiz/trunk/applications/product/servicedef/services.xml > ofbiz/trunk/applications/product/widget/catalog/ProductForms.xml > > Modified: ofbiz/trunk/applications/order/entitydef/entitymodel.xml > URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/entitydef/entitymodel.xml?rev=1368822&r1=1368821&r2=1368822&view=diff > ============================================================================== > --- ofbiz/trunk/applications/order/entitydef/entitymodel.xml (original) > +++ ofbiz/trunk/applications/order/entitydef/entitymodel.xml Fri Aug 3 07:52:28 2012 > @@ -769,6 +769,23 @@ under the License. > <key-map field-name="parentGroupSeqId" rel-field-name="orderItemGroupSeqId"/> > </relation> > </entity> > + <entity entity-name="OrderItemGroupOrder" > + package-name="org.ofbiz.order.order" > + title="Order Item Group Order Entity"> > + <field name="orderId" type="id-ne"></field> > + <field name="orderItemSeqId" type="id-ne"></field> > + <field name="groupOrderId" type="id-ne"></field> > + <prim-key field="orderId"/> > + <prim-key field="orderItemSeqId"/> > + <prim-key field="groupOrderId"/> > + <relation type="one" fk-name="OIGO_ORDER_ITEM" rel-entity-name="OrderItem"> > + <key-map field-name="orderId"/> > + <key-map field-name="orderItemSeqId"/> > + </relation> > + <relation type="one" fk-name="OIGO_PRD_GROUP_ORDER" rel-entity-name="ProductGroupOrder"> > + <key-map field-name="groupOrderId"/> > + </relation> > + </entity> > <entity entity-name="OrderItemPriceInfo" > package-name="org.ofbiz.order.order" > never-cache="true" > > Modified: ofbiz/trunk/applications/order/servicedef/secas.xml > URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/servicedef/secas.xml?rev=1368822&r1=1368821&r2=1368822&view=diff > ============================================================================== > --- ofbiz/trunk/applications/order/servicedef/secas.xml (original) > +++ ofbiz/trunk/applications/order/servicedef/secas.xml Fri Aug 3 07:52:28 2012 > @@ -60,6 +60,7 @@ under the License. > <eca service="changeOrderItemStatus" event="commit"> > <condition field-name="statusId" operator="equals" value="ITEM_CANCELLED"/> > <action service="cancelOrderInventoryReservation" mode="sync"/> > + <action service="cancleOrderItemGroupOrder" mode="sync"/> > <action service="recalcShippingTotal" mode="sync"/> > <action service="recalcTaxTotal" mode="sync"/> > <action service="resetGrandTotal" mode="sync"/> > @@ -447,8 +448,4 @@ under the License. > <condition field-name="orderTypeId" operator="equals" value="SALES_ORDER"/> > <action service="checkOrderItemForProductGroupOrder" mode="sync"/> > </eca> > - <eca service="changeOrderStatus" event="commit"> > - <condition field-name="statusId" operator="equals" value="ORDER_CANCELLED"/> > - <action service="checkOrderItemForProductGroupOrder" mode="sync"/> > - </eca> > </service-eca> > > Modified: ofbiz/trunk/applications/order/servicedef/services.xml > URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/servicedef/services.xml?rev=1368822&r1=1368821&r2=1368822&view=diff > ============================================================================== > --- ofbiz/trunk/applications/order/servicedef/services.xml (original) > +++ ofbiz/trunk/applications/order/servicedef/services.xml Fri Aug 3 07:52:28 2012 > @@ -1142,4 +1142,10 @@ under the License. > <auto-attributes mode="IN" entity-name="OrderItemAttribute" include="pk" optional="false"/> > </service> > > + <!-- Order Item Group Order --> > + <service name="createOrderItemGroupOrder" engine="entity-auto" default-entity-name="OrderItemGroupOrder" invoke="create" auth="true"> > + <description>Create Order Item Group Order</description> > + <auto-attributes mode="IN" entity-name="OrderItemGroupOrder" include="pk" optional="false"/> > + </service> > + > </services> > > Modified: ofbiz/trunk/applications/product/data/ProductTypeData.xml > URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/data/ProductTypeData.xml?rev=1368822&r1=1368821&r2=1368822&view=diff > ============================================================================== > --- ofbiz/trunk/applications/product/data/ProductTypeData.xml (original) > +++ ofbiz/trunk/applications/product/data/ProductTypeData.xml Fri Aug 3 07:52:28 2012 > @@ -650,4 +650,10 @@ under the License. > <Enumeration description="Remove Logo" enumCode="REMOVE_LOGO" enumId="REMOVE_LOGO" sequenceId="02" enumTypeId="IMAGE_REJECT_REASON"/> > <Enumeration description="Other" enumCode="OTHER" enumId="OTHER" sequenceId="03" enumTypeId="IMAGE_REJECT_REASON"/> > > + <!-- Group Order --> > + <StatusType description="Group Order Status" hasTable="N" parentTypeId="" statusTypeId="GROUP_ORDER_STATUS"/> > + <StatusItem description="Created" sequenceId="01" statusCode="CREATED" statusId="GO_CREATED" statusTypeId="GROUP_ORDER_STATUS"/> > + <StatusItem description="Success" sequenceId="02" statusCode="SUCCESS" statusId="GO_SUCCESS" statusTypeId="GROUP_ORDER_STATUS"/> > + <StatusItem description="Cancelled" sequenceId="03" statusCode="CANCELLED" statusId="GO_CANCELLED" statusTypeId="GROUP_ORDER_STATUS"/> > + > </entity-engine-xml> > > Modified: ofbiz/trunk/applications/product/entitydef/entitymodel.xml > URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/entitydef/entitymodel.xml?rev=1368822&r1=1368821&r2=1368822&view=diff > ============================================================================== > --- ofbiz/trunk/applications/product/entitydef/entitymodel.xml (original) > +++ ofbiz/trunk/applications/product/entitydef/entitymodel.xml Fri Aug 3 07:52:28 2012 > @@ -4812,6 +4812,7 @@ under the License. > <field name="productId" type="id-ne"></field> > <field name="fromDate" type="date-time"></field> > <field name="thruDate" type="date-time"></field> > + <field name="statusId" type="id-ne"></field> > <field name="reqOrderQty" type="fixed-point"></field> > <field name="soldOrderQty" type="fixed-point"></field> > <field name="jobId" type="id-ne"></field> > @@ -4819,6 +4820,9 @@ under the License. > <relation type="one" fk-name="PROD_GROUP_ORDER" rel-entity-name="Product"> > <key-map field-name="productId"/> > </relation> > + <relation type="one" fk-name="GROUP_ORDER_STATUS" rel-entity-name="StatusItem"> > + <key-map field-name="statusId"/> > + </relation> > <relation type="one" fk-name="GROUP_ORDER_JOB" rel-entity-name="JobSandbox"> > <key-map field-name="jobId"/> > </relation> > > 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=1368822&r1=1368821&r2=1368822&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 07:52:28 2012 > @@ -1064,17 +1064,26 @@ under the License. > <entity-one entity-name="ProductGroupOrder" value-field="productGroupOrder"/> > <set-nonpk-fields value-field="productGroupOrder" map="parameters"/> > <store-value value-field="productGroupOrder"/> > - > - <entity-one entity-name="JobSandbox" value-field="jobSandbox"> > - <field-map field-name="jobId" from-field="productGroupOrder.jobId"/> > - </entity-one> > - <if-not-empty field="jobSandbox"> > - <set field="jobSandbox.runTime" from-field="parameters.thruDate"/> > - <store-value value-field="jobSandbox"/> > - </if-not-empty> > + > + <if-compare field="productGroupOrder.statusId" operator="equals" value="GO_CREATED"> > + <entity-one entity-name="JobSandbox" value-field="jobSandbox"> > + <field-map field-name="jobId" from-field="productGroupOrder.jobId"/> > + </entity-one> > + <if-not-empty field="jobSandbox"> > + <set field="jobSandbox.runTime" from-field="parameters.thruDate"/> > + <store-value value-field="jobSandbox"/> > + </if-not-empty> > + </if-compare> > </simple-method> > > <simple-method method-name="deleteProductGroupOrder" short-description="Delete ProductGroupOrder"> > + <entity-and entity-name="OrderItemGroupOrder" list="orderItemGroupOrders"> > + <field-map field-name="groupOrderId" from-field="parameters.groupOrderId"/> > + </entity-and> > + <iterate entry="orderItemGroupOrder" list="orderItemGroupOrders"> > + <remove-value value-field="orderItemGroupOrder"/> > + </iterate> > + > <entity-one entity-name="ProductGroupOrder" value-field="productGroupOrder"/> > <remove-value value-field="productGroupOrder"/> > > @@ -1114,7 +1123,7 @@ under the License. > <make-value entity-name="JobSandbox" value-field="jobSandbox"/> > <sequenced-id sequence-name="JobSandbox" field="jobSandbox.jobId"/> > <set field="jobId" from-field="jobSandbox.jobId"/> > - <set field="jobSandbox.jobName" value="Check Product GroupOrder Expired"/> > + <set field="jobSandbox.jobName" value="Check ProductGroupOrder Expired"/> > <set field="jobSandbox.runTime" from-field="parameters.thruDate"/> > <set field="jobSandbox.poolId" value="pool"/> > <set field="jobSandbox.statusId" value="SERVICE_PENDING"/> > @@ -1130,7 +1139,6 @@ under the License. > </simple-method> > > <simple-method method-name="checkOrderItemForProductGroupOrder" short-description="Check OrderItem For ProductGroupOrder"> > - <entity-one entity-name="OrderHeader" value-field="orderHeader"/> > <entity-and entity-name="OrderItem" list="orderItems"> > <field-map field-name="orderId" from-field="parameters.orderId"/> > </entity-and> > @@ -1151,92 +1159,94 @@ under the License. > <entity-and entity-name="ProductGroupOrder" list="productGroupOrders" filter-by-date="true"> > <field-map field-name="productId" from-field="productId"/> > </entity-and> > - <iterate entry="productGroupOrder" list="productGroupOrders"> > - <if-compare field="orderHeader.statusId" operator="equals" value="ORDER_CREATED"> > - <calculate field="productGroupOrder.soldOrderQty"> > - <calcop field="productGroupOrder.soldOrderQty" operator="add"> > - <calcop field="orderItem.quantity" operator="get"/> > - </calcop> > - </calculate> > - </if-compare> > - <if-compare field="orderHeader.statusId" operator="equals" value="ORDER_CANCELLED"> > - <calculate field="productGroupOrder.soldOrderQty"> > - <calcop field="productGroupOrder.soldOrderQty" operator="subtract"> > - <calcop field="orderItem.quantity" operator="get"/> > - </calcop> > - </calculate> > - </if-compare> > + <if-not-empty field="productGroupOrders"> > + <first-from-list entry="productGroupOrder" list="productGroupOrders"/> > + <calculate field="productGroupOrder.soldOrderQty"> > + <calcop field="productGroupOrder.soldOrderQty" operator="add"> > + <calcop field="orderItem.quantity" operator="get"/> > + </calcop> > + </calculate> > <store-value value-field="productGroupOrder"/> > - </iterate> > + > + <set field="createOrderItemGroupOrderMap.orderId" from-field="orderItem.orderId"/> > + <set field="createOrderItemGroupOrderMap.orderItemSeqId" from-field="orderItem.orderItemSeqId"/> > + <set field="createOrderItemGroupOrderMap.groupOrderId" from-field="productGroupOrder.groupOrderId"/> > + <call-service service-name="createOrderItemGroupOrder" in-map-name="createOrderItemGroupOrderMap"/> > + </if-not-empty> > </iterate> > </simple-method> > - > - <simple-method method-name="checkProductGroupOrderExpired" short-description="Check ProductGroupOrder Expired"> > - <entity-one entity-name="ProductGroupOrder" value-field="productGroupOrder"/> > - <if-compare field="productGroupOrder.soldOrderQty" operator="greater-equals" value="${productGroupOrder.reqOrderQty}"> > - <set field="newItemStatusId" value="ITEM_APPROVED"/> > - <else> > - <set field="newItemStatusId" value="ITEM_CANCELLED"/> > - </else> > - </if-compare> > - > - <entity-one entity-name="Product" value-field="product"> > - <field-map field-name="productId" from-field="productGroupOrder.productId"/> > - </entity-one> > - <if-compare field="product.isVirtual" operator="equals" value="Y"> > - <entity-and entity-name="ProductAssoc" list="variantProductAssocs" filter-by-date="true"> > - <field-map field-name="productId" from-field="productGroupOrder.productId"/> > - <field-map field-name="productAssocTypeId" value="PRODUCT_VARIANT"/> > + > + <simple-method method-name="cancleOrderItemGroupOrder" short-description="Cancle OrderItemGroupOrder"> > + <if-not-empty field="parameters.orderItemSeqId"> > + <entity-and entity-name="OrderItem" list="orderItems"> > + <field-map field-name="orderId" from-field="parameters.orderId"/> > + <field-map field-name="orderItemSeqId" from-field="parameters.orderItemSeqId" /> > </entity-and> > - <iterate entry="variantProductAssoc" list="variantProductAssocs"> > - <set field="findOrderItemMap.productId" from-field="variantProductAssoc.productIdTo"/> > - <set field="findOrderItemMap.newItemStatusId" from-field="newItemStatusId"/> > - <set field="findOrderItemMap.fromDate" from-field="productGroupOrder.fromDate"/> > - <set field="findOrderItemMap.thruDate" from-field="productGroupOrder.thruDate"/> > - <call-service service-name="findOrderItemForProductGroupOrder" in-map-name="findOrderItemMap"/> > - </iterate> > <else> > - <set field="findOrderItemMap.productId" from-field="productGroupOrder.productId"/> > - <set field="findOrderItemMap.newItemStatusId" from-field="newItemStatusId"/> > - <set field="findOrderItemMap.fromDate" from-field="productGroupOrder.fromDate"/> > - <set field="findOrderItemMap.thruDate" from-field="productGroupOrder.thruDate"/> > - <call-service service-name="findOrderItemForProductGroupOrder" in-map-name="findOrderItemMap"/> > + <entity-and entity-name="OrderItem" list="orderItems"> > + <field-map field-name="orderId" from-field="parameters.orderId"/> > + </entity-and> > </else> > - </if-compare> > - </simple-method> > - > - <simple-method method-name="findOrderItemForProductGroupOrder" short-description="Find OrderItem For ProductGroupOrder"> > - <entity-condition entity-name="OrderItem" list="orderItems"> > - <condition-list combine="and"> > - <condition-expr field-name="productId" operator="equals" from-field="parameters.productId"/> > - <condition-list combine="or"> > - <condition-expr field-name="statusId" operator="equals" value="ITEM_CREATED"/> > - <condition-expr field-name="statusId" operator="equals" value="ITEM_APPROVED"/> > - </condition-list> > - </condition-list> > - </entity-condition> > + </if-not-empty> > <iterate entry="orderItem" list="orderItems"> > - <entity-one value-field="orderHeader" entity-name="OrderHeader"> > + <entity-and entity-name="OrderItemGroupOrder" list="orderItemGroupOrders"> > <field-map field-name="orderId" from-field="orderItem.orderId"/> > - </entity-one> > - <if> > - <condition> > - <and> > - <if-compare field="orderHeader.orderTypeId" operator="equals" value="SALES_ORDER"/> > - <if-compare field="orderHeader.orderDate" operator="greater-equals" value="${parameters.fromDate}"/> > - <if-compare field="orderHeader.orderDate" operator="less" value="${parameters.thruDate}"/> > - </and> > - </condition> > - <then> > - <set field="changeOrderItemStatusMap.orderId" from-field="orderItem.orderId"/> > - <set field="changeOrderItemStatusMap.orderItemSeqId" from-field="orderItem.orderItemSeqId"/> > - <set field="changeOrderItemStatusMap.statusId" from-field="parameters.newItemStatusId"/> > - <call-service service-name="changeOrderItemStatus" in-map-name="changeOrderItemStatusMap"/> > - </then> > - </if> > + <field-map field-name="orderItemSeqId" from-field="orderItem.orderItemSeqId"/> > + </entity-and> > + <if-not-empty field="orderItemGroupOrders"> > + <first-from-list entry="orderItemGroupOrder" list="orderItemGroupOrders"/> > + <entity-one entity-name="ProductGroupOrder" value-field="productGroupOrder"> > + <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> > + <store-value value-field="productGroupOrder"/> > + <remove-value value-field="orderItemGroupOrder"/> > + </if-not-empty> > + </if-not-empty> > </iterate> > </simple-method> > > + <simple-method method-name="checkProductGroupOrderExpired" short-description="Check ProductGroupOrder Expired"> > + <entity-one entity-name="ProductGroupOrder" value-field="productGroupOrder"/> > + <if-not-empty field="productGroupOrder"> > + <if-compare field="productGroupOrder.soldOrderQty" operator="greater-equals" value="${productGroupOrder.reqOrderQty}"> > + <set field="newItemStatusId" value="ITEM_APPROVED"/> > + <set field="groupOrderStatusId" value="GO_SUCCESS"/> > + <else> > + <set field="newItemStatusId" value="ITEM_CANCELLED"/> > + <set field="groupOrderStatusId" value="GO_CANCELLED"/> > + </else> > + </if-compare> > + > + <entity-and entity-name="OrderItemGroupOrder" list="orderItemGroupOrders"> > + <field-map field-name="groupOrderId" from-field="productGroupOrder.groupOrderId"/> > + </entity-and> > + <iterate entry="orderItemGroupOrder" list="orderItemGroupOrders"> > + <set field="changeOrderItemStatusMap.orderId" from-field="orderItemGroupOrder.orderId"/> > + <set field="changeOrderItemStatusMap.orderItemSeqId" from-field="orderItemGroupOrder.orderItemSeqId"/> > + <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> > + > <simple-method method-name="setProductReviewStatus" short-description="change the product review Status"> > <set value="setProductReviewStatus" field="callingMethodName"/> > <set value="UPDATE" field="checkAction"/> > > 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=1368822&r1=1368821&r2=1368822&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 07:52:28 2012 > @@ -43,6 +43,7 @@ under the License. > <set field="createProductGroupOrderMap.productId" value="GZ-1000"/> > <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="1" type="BigDecimal"/> > <set field="createProductGroupOrderMap.soldOrderQty" value="0" type="BigDecimal"/> > <call-service service-name="createProductGroupOrder" in-map-name="createProductGroupOrderMap"> > > Modified: ofbiz/trunk/applications/product/servicedef/services.xml > URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/servicedef/services.xml?rev=1368822&r1=1368821&r2=1368822&view=diff > ============================================================================== > --- ofbiz/trunk/applications/product/servicedef/services.xml (original) > +++ ofbiz/trunk/applications/product/servicedef/services.xml Fri Aug 3 07:52:28 2012 > @@ -1685,21 +1685,15 @@ under the License. > <service name="createProductGroupOrder" default-entity-name="ProductGroupOrder" engine="simple" > location="component://product/script/org/ofbiz/product/product/ProductServices.xml" invoke="createProductGroupOrder" auth="true"> > <description>Create ProductGroupOrder</description> > - <attribute name="productId" mode="IN" type="String" optional="false"/> > - <attribute name="soldOrderQty" mode="IN" type="BigDecimal" optional="false"/> > - <attribute name="reqOrderQty" mode="IN" type="BigDecimal" optional="false"/> > - <attribute name="fromDate" mode="IN" type="Timestamp" optional="false"/> > - <attribute name="thruDate" mode="IN" type="Timestamp" optional="false"/> > - <attribute name="groupOrderId" mode="OUT" type="String" optional="true"/> > + <auto-attributes include="pk" mode="OUT" optional="false"/> > + <auto-attributes include="nonpk" mode="IN" optional="true"/> > </service> > > <service name="updateProductGroupOrder" default-entity-name="ProductGroupOrder" engine="simple" > location="component://product/script/org/ofbiz/product/product/ProductServices.xml" invoke="updateProductGroupOrder" auth="true"> > <description>Update ProductGroupOrder</description> > - <attribute name="groupOrderId" mode="IN" type="String" optional="false"/> > - <attribute name="reqOrderQty" mode="IN" type="BigDecimal" optional="false"/> > - <attribute name="fromDate" mode="IN" type="Timestamp" optional="false"/> > - <attribute name="thruDate" mode="IN" type="Timestamp" optional="false"/> > + <auto-attributes include="pk" mode="IN" optional="false"/> > + <auto-attributes include="nonpk" mode="IN" optional="true"/> > </service> > > <service name="deleteProductGroupOrder" default-entity-name="ProductGroupOrder" engine="simple" > @@ -1721,19 +1715,17 @@ under the License. > <attribute name="orderId" mode="IN" type="String" optional="false"/> > </service> > > + <service name="cancleOrderItemGroupOrder" engine="simple" > + location="component://product/script/org/ofbiz/product/product/ProductServices.xml" invoke="cancleOrderItemGroupOrder" auth="true"> > + <description>Cancle OrderItemGroupOrder</description> > + <attribute name="orderId" mode="IN" type="String" optional="false"/> > + <attribute name="orderItemSeqId" type="String" mode="IN" optional="true"/> > + </service> > + > <service name="checkProductGroupOrderExpired" engine="simple" > location="component://product/script/org/ofbiz/product/product/ProductServices.xml" invoke="checkProductGroupOrderExpired" auth="true"> > <description>Check ProductGroupOrder Expired</description> > <attribute name="groupOrderId" mode="IN" type="String" optional="false"/> > </service> > > - <service name="findOrderItemForProductGroupOrder" engine="simple" > - location="component://product/script/org/ofbiz/product/product/ProductServices.xml" invoke="findOrderItemForProductGroupOrder" auth="true"> > - <description>Find OrderItem For ProductGroupOrder</description> > - <attribute name="productId" mode="IN" type="String" optional="false"/> > - <attribute name="newItemStatusId" mode="IN" type="String" optional="false"/> > - <attribute name="fromDate" mode="IN" type="Timestamp" optional="false"/> > - <attribute name="thruDate" mode="IN" type="Timestamp" optional="false"/> > - </service> > - > </services> > > Modified: ofbiz/trunk/applications/product/widget/catalog/ProductForms.xml > URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/widget/catalog/ProductForms.xml?rev=1368822&r1=1368821&r2=1368822&view=diff > ============================================================================== > --- ofbiz/trunk/applications/product/widget/catalog/ProductForms.xml (original) > +++ ofbiz/trunk/applications/product/widget/catalog/ProductForms.xml Fri Aug 3 07:52:28 2012 > @@ -2166,6 +2166,7 @@ under the License. > <field name="soldOrderQty" title="${uiLabelMap.ProductSoldQuantity}"><display/></field> > <field name="fromDate" title="${uiLabelMap.ProductDealStartDate}"><display/></field> > <field name="thruDate" title="${uiLabelMap.ProductDealEndDate}"><display/></field> > + <field name="statusId" title="${uiLabelMap.CommonStatus}"><display-entity entity-name="StatusItem" key-field-name="statusId" description="${description}"/></field> > <field name="editLink" use-when="${groovy: return reqOrderQty.compareTo(soldOrderQty)!= 0;}&&${groovy: return thruDate.compareTo(org.ofbiz.base.util.UtilDateTime.nowTimestamp()) == 1}" title=" " widget-style="buttontext"> > <hyperlink target="EditProductGroupOrder" description="${uiLabelMap.CommonEdit}" also-hidden="false"> > <parameter param-name="productId"/> > @@ -2183,6 +2184,7 @@ under the License. > <form name="CreateProductGroupOrder" type="single" target="createProductGroupOrder" title="" > header-row-style="header-row" default-table-style="basic-table"> > <field name="productId"><hidden/></field> > + <field name="statusId"><hidden value="GO_CREATED"/></field> > <field name="soldOrderQty"><hidden value="0"/></field> > <field name="reqOrderQty" title="${uiLabelMap.ProductDealQuantity}*"><text/></field> > <field name="fromDate" title="${uiLabelMap.ProductDealStartDate}*"><date-time/></field> > @@ -2194,6 +2196,7 @@ under the License. > header-row-style="header-row" default-table-style="basic-table"> > <field name="groupOrderId"><hidden/></field> > <field name="productId"><hidden/></field> > + <field name="statusId"><hidden/></field> > <field name="reqOrderQty" title="${uiLabelMap.ProductDealQuantity}*"><text/></field> > <field name="fromDate" title="${uiLabelMap.ProductDealStartDate}*"><date-time/></field> > <field name="thruDate" title="${uiLabelMap.ProductDealEndDate}*"><date-time/></field> > > |
|
Administrator
|
Also, not a big deal, there are some typos
>> + <action service="cancleOrderItemGroupOrder" mode="sync"/> >> + <simple-method method-name="cancleOrderItemGroupOrder" short-description="Cancle OrderItemGroupOrder"> >> + <service name="cancleOrderItemGroupOrder" engine="simple" >> + location="component://product/script/org/ofbiz/product/product/ProductServices.xml" invoke="cancleOrderItemGroupOrder" >> auth="true"> >> + <description>Cancle OrderItemGroupOrder</description> Jacques From: "Adrian Crum" <[hidden email]> > This comment isn't about this specific commit, but about the code it modifies. The JobSandbox entity should not be manipulated > outside of the Job Scheduler - it will cause erratic behavior. > > -Adrian > > On 8/3/2012 8:52 AM, [hidden email] wrote: >> Author: hansbak >> Date: Fri Aug 3 07:52:28 2012 >> New Revision: 1368822 >> >> URL: http://svn.apache.org/viewvc?rev=1368822&view=rev >> Log: >> improve the groupbuying function by properly return sales numbers when cancelling an order. >> >> Modified: >> ofbiz/trunk/applications/order/entitydef/entitymodel.xml >> ofbiz/trunk/applications/order/servicedef/secas.xml >> ofbiz/trunk/applications/order/servicedef/services.xml >> ofbiz/trunk/applications/product/data/ProductTypeData.xml >> ofbiz/trunk/applications/product/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 >> ofbiz/trunk/applications/product/servicedef/services.xml >> ofbiz/trunk/applications/product/widget/catalog/ProductForms.xml >> >> Modified: ofbiz/trunk/applications/order/entitydef/entitymodel.xml >> URL: >> http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/entitydef/entitymodel.xml?rev=1368822&r1=1368821&r2=1368822&view=diff >> ============================================================================== >> --- ofbiz/trunk/applications/order/entitydef/entitymodel.xml (original) >> +++ ofbiz/trunk/applications/order/entitydef/entitymodel.xml Fri Aug 3 07:52:28 2012 >> @@ -769,6 +769,23 @@ under the License. >> <key-map field-name="parentGroupSeqId" rel-field-name="orderItemGroupSeqId"/> >> </relation> >> </entity> >> + <entity entity-name="OrderItemGroupOrder" >> + package-name="org.ofbiz.order.order" >> + title="Order Item Group Order Entity"> >> + <field name="orderId" type="id-ne"></field> >> + <field name="orderItemSeqId" type="id-ne"></field> >> + <field name="groupOrderId" type="id-ne"></field> >> + <prim-key field="orderId"/> >> + <prim-key field="orderItemSeqId"/> >> + <prim-key field="groupOrderId"/> >> + <relation type="one" fk-name="OIGO_ORDER_ITEM" rel-entity-name="OrderItem"> >> + <key-map field-name="orderId"/> >> + <key-map field-name="orderItemSeqId"/> >> + </relation> >> + <relation type="one" fk-name="OIGO_PRD_GROUP_ORDER" rel-entity-name="ProductGroupOrder"> >> + <key-map field-name="groupOrderId"/> >> + </relation> >> + </entity> >> <entity entity-name="OrderItemPriceInfo" >> package-name="org.ofbiz.order.order" >> never-cache="true" >> >> Modified: ofbiz/trunk/applications/order/servicedef/secas.xml >> URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/servicedef/secas.xml?rev=1368822&r1=1368821&r2=1368822&view=diff >> ============================================================================== >> --- ofbiz/trunk/applications/order/servicedef/secas.xml (original) >> +++ ofbiz/trunk/applications/order/servicedef/secas.xml Fri Aug 3 07:52:28 2012 >> @@ -60,6 +60,7 @@ under the License. >> <eca service="changeOrderItemStatus" event="commit"> >> <condition field-name="statusId" operator="equals" value="ITEM_CANCELLED"/> >> <action service="cancelOrderInventoryReservation" mode="sync"/> >> + <action service="cancleOrderItemGroupOrder" mode="sync"/> >> <action service="recalcShippingTotal" mode="sync"/> >> <action service="recalcTaxTotal" mode="sync"/> >> <action service="resetGrandTotal" mode="sync"/> >> @@ -447,8 +448,4 @@ under the License. >> <condition field-name="orderTypeId" operator="equals" value="SALES_ORDER"/> >> <action service="checkOrderItemForProductGroupOrder" mode="sync"/> >> </eca> >> - <eca service="changeOrderStatus" event="commit"> >> - <condition field-name="statusId" operator="equals" value="ORDER_CANCELLED"/> >> - <action service="checkOrderItemForProductGroupOrder" mode="sync"/> >> - </eca> >> </service-eca> >> >> Modified: ofbiz/trunk/applications/order/servicedef/services.xml >> URL: >> http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/servicedef/services.xml?rev=1368822&r1=1368821&r2=1368822&view=diff >> ============================================================================== >> --- ofbiz/trunk/applications/order/servicedef/services.xml (original) >> +++ ofbiz/trunk/applications/order/servicedef/services.xml Fri Aug 3 07:52:28 2012 >> @@ -1142,4 +1142,10 @@ under the License. >> <auto-attributes mode="IN" entity-name="OrderItemAttribute" include="pk" optional="false"/> >> </service> >> + <!-- Order Item Group Order --> >> + <service name="createOrderItemGroupOrder" engine="entity-auto" default-entity-name="OrderItemGroupOrder" invoke="create" >> auth="true"> >> + <description>Create Order Item Group Order</description> >> + <auto-attributes mode="IN" entity-name="OrderItemGroupOrder" include="pk" optional="false"/> >> + </service> >> + >> </services> >> >> Modified: ofbiz/trunk/applications/product/data/ProductTypeData.xml >> URL: >> http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/data/ProductTypeData.xml?rev=1368822&r1=1368821&r2=1368822&view=diff >> ============================================================================== >> --- ofbiz/trunk/applications/product/data/ProductTypeData.xml (original) >> +++ ofbiz/trunk/applications/product/data/ProductTypeData.xml Fri Aug 3 07:52:28 2012 >> @@ -650,4 +650,10 @@ under the License. >> <Enumeration description="Remove Logo" enumCode="REMOVE_LOGO" enumId="REMOVE_LOGO" sequenceId="02" >> enumTypeId="IMAGE_REJECT_REASON"/> >> <Enumeration description="Other" enumCode="OTHER" enumId="OTHER" sequenceId="03" enumTypeId="IMAGE_REJECT_REASON"/> >> + <!-- Group Order --> >> + <StatusType description="Group Order Status" hasTable="N" parentTypeId="" statusTypeId="GROUP_ORDER_STATUS"/> >> + <StatusItem description="Created" sequenceId="01" statusCode="CREATED" statusId="GO_CREATED" >> statusTypeId="GROUP_ORDER_STATUS"/> >> + <StatusItem description="Success" sequenceId="02" statusCode="SUCCESS" statusId="GO_SUCCESS" >> statusTypeId="GROUP_ORDER_STATUS"/> >> + <StatusItem description="Cancelled" sequenceId="03" statusCode="CANCELLED" statusId="GO_CANCELLED" >> statusTypeId="GROUP_ORDER_STATUS"/> >> + >> </entity-engine-xml> >> >> Modified: ofbiz/trunk/applications/product/entitydef/entitymodel.xml >> URL: >> http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/entitydef/entitymodel.xml?rev=1368822&r1=1368821&r2=1368822&view=diff >> ============================================================================== >> --- ofbiz/trunk/applications/product/entitydef/entitymodel.xml (original) >> +++ ofbiz/trunk/applications/product/entitydef/entitymodel.xml Fri Aug 3 07:52:28 2012 >> @@ -4812,6 +4812,7 @@ under the License. >> <field name="productId" type="id-ne"></field> >> <field name="fromDate" type="date-time"></field> >> <field name="thruDate" type="date-time"></field> >> + <field name="statusId" type="id-ne"></field> >> <field name="reqOrderQty" type="fixed-point"></field> >> <field name="soldOrderQty" type="fixed-point"></field> >> <field name="jobId" type="id-ne"></field> >> @@ -4819,6 +4820,9 @@ under the License. >> <relation type="one" fk-name="PROD_GROUP_ORDER" rel-entity-name="Product"> >> <key-map field-name="productId"/> >> </relation> >> + <relation type="one" fk-name="GROUP_ORDER_STATUS" rel-entity-name="StatusItem"> >> + <key-map field-name="statusId"/> >> + </relation> >> <relation type="one" fk-name="GROUP_ORDER_JOB" rel-entity-name="JobSandbox"> >> <key-map field-name="jobId"/> >> </relation> >> >> 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=1368822&r1=1368821&r2=1368822&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 07:52:28 2012 >> @@ -1064,17 +1064,26 @@ under the License. >> <entity-one entity-name="ProductGroupOrder" value-field="productGroupOrder"/> >> <set-nonpk-fields value-field="productGroupOrder" map="parameters"/> >> <store-value value-field="productGroupOrder"/> >> - >> - <entity-one entity-name="JobSandbox" value-field="jobSandbox"> >> - <field-map field-name="jobId" from-field="productGroupOrder.jobId"/> >> - </entity-one> >> - <if-not-empty field="jobSandbox"> >> - <set field="jobSandbox.runTime" from-field="parameters.thruDate"/> >> - <store-value value-field="jobSandbox"/> >> - </if-not-empty> >> + >> + <if-compare field="productGroupOrder.statusId" operator="equals" value="GO_CREATED"> >> + <entity-one entity-name="JobSandbox" value-field="jobSandbox"> >> + <field-map field-name="jobId" from-field="productGroupOrder.jobId"/> >> + </entity-one> >> + <if-not-empty field="jobSandbox"> >> + <set field="jobSandbox.runTime" from-field="parameters.thruDate"/> >> + <store-value value-field="jobSandbox"/> >> + </if-not-empty> >> + </if-compare> >> </simple-method> >> <simple-method method-name="deleteProductGroupOrder" short-description="Delete ProductGroupOrder"> >> + <entity-and entity-name="OrderItemGroupOrder" list="orderItemGroupOrders"> >> + <field-map field-name="groupOrderId" from-field="parameters.groupOrderId"/> >> + </entity-and> >> + <iterate entry="orderItemGroupOrder" list="orderItemGroupOrders"> >> + <remove-value value-field="orderItemGroupOrder"/> >> + </iterate> >> + >> <entity-one entity-name="ProductGroupOrder" value-field="productGroupOrder"/> >> <remove-value value-field="productGroupOrder"/> >> @@ -1114,7 +1123,7 @@ under the License. >> <make-value entity-name="JobSandbox" value-field="jobSandbox"/> >> <sequenced-id sequence-name="JobSandbox" field="jobSandbox.jobId"/> >> <set field="jobId" from-field="jobSandbox.jobId"/> >> - <set field="jobSandbox.jobName" value="Check Product GroupOrder Expired"/> >> + <set field="jobSandbox.jobName" value="Check ProductGroupOrder Expired"/> >> <set field="jobSandbox.runTime" from-field="parameters.thruDate"/> >> <set field="jobSandbox.poolId" value="pool"/> >> <set field="jobSandbox.statusId" value="SERVICE_PENDING"/> >> @@ -1130,7 +1139,6 @@ under the License. >> </simple-method> >> <simple-method method-name="checkOrderItemForProductGroupOrder" short-description="Check OrderItem For ProductGroupOrder"> >> - <entity-one entity-name="OrderHeader" value-field="orderHeader"/> >> <entity-and entity-name="OrderItem" list="orderItems"> >> <field-map field-name="orderId" from-field="parameters.orderId"/> >> </entity-and> >> @@ -1151,92 +1159,94 @@ under the License. >> <entity-and entity-name="ProductGroupOrder" list="productGroupOrders" filter-by-date="true"> >> <field-map field-name="productId" from-field="productId"/> >> </entity-and> >> - <iterate entry="productGroupOrder" list="productGroupOrders"> >> - <if-compare field="orderHeader.statusId" operator="equals" value="ORDER_CREATED"> >> - <calculate field="productGroupOrder.soldOrderQty"> >> - <calcop field="productGroupOrder.soldOrderQty" operator="add"> >> - <calcop field="orderItem.quantity" operator="get"/> >> - </calcop> >> - </calculate> >> - </if-compare> >> - <if-compare field="orderHeader.statusId" operator="equals" value="ORDER_CANCELLED"> >> - <calculate field="productGroupOrder.soldOrderQty"> >> - <calcop field="productGroupOrder.soldOrderQty" operator="subtract"> >> - <calcop field="orderItem.quantity" operator="get"/> >> - </calcop> >> - </calculate> >> - </if-compare> >> + <if-not-empty field="productGroupOrders"> >> + <first-from-list entry="productGroupOrder" list="productGroupOrders"/> >> + <calculate field="productGroupOrder.soldOrderQty"> >> + <calcop field="productGroupOrder.soldOrderQty" operator="add"> >> + <calcop field="orderItem.quantity" operator="get"/> >> + </calcop> >> + </calculate> >> <store-value value-field="productGroupOrder"/> >> - </iterate> >> + >> + <set field="createOrderItemGroupOrderMap.orderId" from-field="orderItem.orderId"/> >> + <set field="createOrderItemGroupOrderMap.orderItemSeqId" from-field="orderItem.orderItemSeqId"/> >> + <set field="createOrderItemGroupOrderMap.groupOrderId" from-field="productGroupOrder.groupOrderId"/> >> + <call-service service-name="createOrderItemGroupOrder" in-map-name="createOrderItemGroupOrderMap"/> >> + </if-not-empty> >> </iterate> >> </simple-method> >> - >> - <simple-method method-name="checkProductGroupOrderExpired" short-description="Check ProductGroupOrder Expired"> >> - <entity-one entity-name="ProductGroupOrder" value-field="productGroupOrder"/> >> - <if-compare field="productGroupOrder.soldOrderQty" operator="greater-equals" value="${productGroupOrder.reqOrderQty}"> >> - <set field="newItemStatusId" value="ITEM_APPROVED"/> >> - <else> >> - <set field="newItemStatusId" value="ITEM_CANCELLED"/> >> - </else> >> - </if-compare> >> - >> - <entity-one entity-name="Product" value-field="product"> >> - <field-map field-name="productId" from-field="productGroupOrder.productId"/> >> - </entity-one> >> - <if-compare field="product.isVirtual" operator="equals" value="Y"> >> - <entity-and entity-name="ProductAssoc" list="variantProductAssocs" filter-by-date="true"> >> - <field-map field-name="productId" from-field="productGroupOrder.productId"/> >> - <field-map field-name="productAssocTypeId" value="PRODUCT_VARIANT"/> >> + >> + <simple-method method-name="cancleOrderItemGroupOrder" short-description="Cancle OrderItemGroupOrder"> >> + <if-not-empty field="parameters.orderItemSeqId"> >> + <entity-and entity-name="OrderItem" list="orderItems"> >> + <field-map field-name="orderId" from-field="parameters.orderId"/> >> + <field-map field-name="orderItemSeqId" from-field="parameters.orderItemSeqId" /> >> </entity-and> >> - <iterate entry="variantProductAssoc" list="variantProductAssocs"> >> - <set field="findOrderItemMap.productId" from-field="variantProductAssoc.productIdTo"/> >> - <set field="findOrderItemMap.newItemStatusId" from-field="newItemStatusId"/> >> - <set field="findOrderItemMap.fromDate" from-field="productGroupOrder.fromDate"/> >> - <set field="findOrderItemMap.thruDate" from-field="productGroupOrder.thruDate"/> >> - <call-service service-name="findOrderItemForProductGroupOrder" in-map-name="findOrderItemMap"/> >> - </iterate> >> <else> >> - <set field="findOrderItemMap.productId" from-field="productGroupOrder.productId"/> >> - <set field="findOrderItemMap.newItemStatusId" from-field="newItemStatusId"/> >> - <set field="findOrderItemMap.fromDate" from-field="productGroupOrder.fromDate"/> >> - <set field="findOrderItemMap.thruDate" from-field="productGroupOrder.thruDate"/> >> - <call-service service-name="findOrderItemForProductGroupOrder" in-map-name="findOrderItemMap"/> >> + <entity-and entity-name="OrderItem" list="orderItems"> >> + <field-map field-name="orderId" from-field="parameters.orderId"/> >> + </entity-and> >> </else> >> - </if-compare> >> - </simple-method> >> - >> - <simple-method method-name="findOrderItemForProductGroupOrder" short-description="Find OrderItem For ProductGroupOrder"> >> - <entity-condition entity-name="OrderItem" list="orderItems"> >> - <condition-list combine="and"> >> - <condition-expr field-name="productId" operator="equals" from-field="parameters.productId"/> >> - <condition-list combine="or"> >> - <condition-expr field-name="statusId" operator="equals" value="ITEM_CREATED"/> >> - <condition-expr field-name="statusId" operator="equals" value="ITEM_APPROVED"/> >> - </condition-list> >> - </condition-list> >> - </entity-condition> >> + </if-not-empty> >> <iterate entry="orderItem" list="orderItems"> >> - <entity-one value-field="orderHeader" entity-name="OrderHeader"> >> + <entity-and entity-name="OrderItemGroupOrder" list="orderItemGroupOrders"> >> <field-map field-name="orderId" from-field="orderItem.orderId"/> >> - </entity-one> >> - <if> >> - <condition> >> - <and> >> - <if-compare field="orderHeader.orderTypeId" operator="equals" value="SALES_ORDER"/> >> - <if-compare field="orderHeader.orderDate" operator="greater-equals" value="${parameters.fromDate}"/> >> - <if-compare field="orderHeader.orderDate" operator="less" value="${parameters.thruDate}"/> >> - </and> >> - </condition> >> - <then> >> - <set field="changeOrderItemStatusMap.orderId" from-field="orderItem.orderId"/> >> - <set field="changeOrderItemStatusMap.orderItemSeqId" from-field="orderItem.orderItemSeqId"/> >> - <set field="changeOrderItemStatusMap.statusId" from-field="parameters.newItemStatusId"/> >> - <call-service service-name="changeOrderItemStatus" in-map-name="changeOrderItemStatusMap"/> >> - </then> >> - </if> >> + <field-map field-name="orderItemSeqId" from-field="orderItem.orderItemSeqId"/> >> + </entity-and> >> + <if-not-empty field="orderItemGroupOrders"> >> + <first-from-list entry="orderItemGroupOrder" list="orderItemGroupOrders"/> >> + <entity-one entity-name="ProductGroupOrder" value-field="productGroupOrder"> >> + <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> >> + <store-value value-field="productGroupOrder"/> >> + <remove-value value-field="orderItemGroupOrder"/> >> + </if-not-empty> >> + </if-not-empty> >> </iterate> >> </simple-method> >> + <simple-method method-name="checkProductGroupOrderExpired" short-description="Check ProductGroupOrder Expired"> >> + <entity-one entity-name="ProductGroupOrder" value-field="productGroupOrder"/> >> + <if-not-empty field="productGroupOrder"> >> + <if-compare field="productGroupOrder.soldOrderQty" operator="greater-equals" >> value="${productGroupOrder.reqOrderQty}"> >> + <set field="newItemStatusId" value="ITEM_APPROVED"/> >> + <set field="groupOrderStatusId" value="GO_SUCCESS"/> >> + <else> >> + <set field="newItemStatusId" value="ITEM_CANCELLED"/> >> + <set field="groupOrderStatusId" value="GO_CANCELLED"/> >> + </else> >> + </if-compare> >> + >> + <entity-and entity-name="OrderItemGroupOrder" list="orderItemGroupOrders"> >> + <field-map field-name="groupOrderId" from-field="productGroupOrder.groupOrderId"/> >> + </entity-and> >> + <iterate entry="orderItemGroupOrder" list="orderItemGroupOrders"> >> + <set field="changeOrderItemStatusMap.orderId" from-field="orderItemGroupOrder.orderId"/> >> + <set field="changeOrderItemStatusMap.orderItemSeqId" from-field="orderItemGroupOrder.orderItemSeqId"/> >> + <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> >> + >> <simple-method method-name="setProductReviewStatus" short-description="change the product review Status"> >> <set value="setProductReviewStatus" field="callingMethodName"/> >> <set value="UPDATE" field="checkAction"/> >> >> 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=1368822&r1=1368821&r2=1368822&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 07:52:28 2012 >> @@ -43,6 +43,7 @@ under the License. >> <set field="createProductGroupOrderMap.productId" value="GZ-1000"/> >> <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="1" type="BigDecimal"/> >> <set field="createProductGroupOrderMap.soldOrderQty" value="0" type="BigDecimal"/> >> <call-service service-name="createProductGroupOrder" in-map-name="createProductGroupOrderMap"> >> >> Modified: ofbiz/trunk/applications/product/servicedef/services.xml >> URL: >> http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/servicedef/services.xml?rev=1368822&r1=1368821&r2=1368822&view=diff >> ============================================================================== >> --- ofbiz/trunk/applications/product/servicedef/services.xml (original) >> +++ ofbiz/trunk/applications/product/servicedef/services.xml Fri Aug 3 07:52:28 2012 >> @@ -1685,21 +1685,15 @@ under the License. >> <service name="createProductGroupOrder" default-entity-name="ProductGroupOrder" engine="simple" >> location="component://product/script/org/ofbiz/product/product/ProductServices.xml" invoke="createProductGroupOrder" >> auth="true"> >> <description>Create ProductGroupOrder</description> >> - <attribute name="productId" mode="IN" type="String" optional="false"/> >> - <attribute name="soldOrderQty" mode="IN" type="BigDecimal" optional="false"/> >> - <attribute name="reqOrderQty" mode="IN" type="BigDecimal" optional="false"/> >> - <attribute name="fromDate" mode="IN" type="Timestamp" optional="false"/> >> - <attribute name="thruDate" mode="IN" type="Timestamp" optional="false"/> >> - <attribute name="groupOrderId" mode="OUT" type="String" optional="true"/> >> + <auto-attributes include="pk" mode="OUT" optional="false"/> >> + <auto-attributes include="nonpk" mode="IN" optional="true"/> >> </service> >> <service name="updateProductGroupOrder" default-entity-name="ProductGroupOrder" engine="simple" >> location="component://product/script/org/ofbiz/product/product/ProductServices.xml" invoke="updateProductGroupOrder" >> auth="true"> >> <description>Update ProductGroupOrder</description> >> - <attribute name="groupOrderId" mode="IN" type="String" optional="false"/> >> - <attribute name="reqOrderQty" mode="IN" type="BigDecimal" optional="false"/> >> - <attribute name="fromDate" mode="IN" type="Timestamp" optional="false"/> >> - <attribute name="thruDate" mode="IN" type="Timestamp" optional="false"/> >> + <auto-attributes include="pk" mode="IN" optional="false"/> >> + <auto-attributes include="nonpk" mode="IN" optional="true"/> >> </service> >> <service name="deleteProductGroupOrder" default-entity-name="ProductGroupOrder" engine="simple" >> @@ -1721,19 +1715,17 @@ under the License. >> <attribute name="orderId" mode="IN" type="String" optional="false"/> >> </service> >> + <service name="cancleOrderItemGroupOrder" engine="simple" >> + location="component://product/script/org/ofbiz/product/product/ProductServices.xml" invoke="cancleOrderItemGroupOrder" >> auth="true"> >> + <description>Cancle OrderItemGroupOrder</description> >> + <attribute name="orderId" mode="IN" type="String" optional="false"/> >> + <attribute name="orderItemSeqId" type="String" mode="IN" optional="true"/> >> + </service> >> + >> <service name="checkProductGroupOrderExpired" engine="simple" >> location="component://product/script/org/ofbiz/product/product/ProductServices.xml" >> invoke="checkProductGroupOrderExpired" auth="true"> >> <description>Check ProductGroupOrder Expired</description> >> <attribute name="groupOrderId" mode="IN" type="String" optional="false"/> >> </service> >> - <service name="findOrderItemForProductGroupOrder" engine="simple" >> - location="component://product/script/org/ofbiz/product/product/ProductServices.xml" >> invoke="findOrderItemForProductGroupOrder" auth="true"> >> - <description>Find OrderItem For ProductGroupOrder</description> >> - <attribute name="productId" mode="IN" type="String" optional="false"/> >> - <attribute name="newItemStatusId" mode="IN" type="String" optional="false"/> >> - <attribute name="fromDate" mode="IN" type="Timestamp" optional="false"/> >> - <attribute name="thruDate" mode="IN" type="Timestamp" optional="false"/> >> - </service> >> - >> </services> >> >> Modified: ofbiz/trunk/applications/product/widget/catalog/ProductForms.xml >> URL: >> http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/widget/catalog/ProductForms.xml?rev=1368822&r1=1368821&r2=1368822&view=diff >> ============================================================================== >> --- ofbiz/trunk/applications/product/widget/catalog/ProductForms.xml (original) >> +++ ofbiz/trunk/applications/product/widget/catalog/ProductForms.xml Fri Aug 3 07:52:28 2012 >> @@ -2166,6 +2166,7 @@ under the License. >> <field name="soldOrderQty" title="${uiLabelMap.ProductSoldQuantity}"><display/></field> >> <field name="fromDate" title="${uiLabelMap.ProductDealStartDate}"><display/></field> >> <field name="thruDate" title="${uiLabelMap.ProductDealEndDate}"><display/></field> >> + <field name="statusId" title="${uiLabelMap.CommonStatus}"><display-entity entity-name="StatusItem" >> key-field-name="statusId" description="${description}"/></field> >> <field name="editLink" use-when="${groovy: return reqOrderQty.compareTo(soldOrderQty)!= 0;}&&${groovy: return >> thruDate.compareTo(org.ofbiz.base.util.UtilDateTime.nowTimestamp()) == 1}" title=" " widget-style="buttontext"> >> <hyperlink target="EditProductGroupOrder" description="${uiLabelMap.CommonEdit}" also-hidden="false"> >> <parameter param-name="productId"/> >> @@ -2183,6 +2184,7 @@ under the License. >> <form name="CreateProductGroupOrder" type="single" target="createProductGroupOrder" title="" >> header-row-style="header-row" default-table-style="basic-table"> >> <field name="productId"><hidden/></field> >> + <field name="statusId"><hidden value="GO_CREATED"/></field> >> <field name="soldOrderQty"><hidden value="0"/></field> >> <field name="reqOrderQty" title="${uiLabelMap.ProductDealQuantity}*"><text/></field> >> <field name="fromDate" title="${uiLabelMap.ProductDealStartDate}*"><date-time/></field> >> @@ -2194,6 +2196,7 @@ under the License. >> header-row-style="header-row" default-table-style="basic-table"> >> <field name="groupOrderId"><hidden/></field> >> <field name="productId"><hidden/></field> >> + <field name="statusId"><hidden/></field> >> <field name="reqOrderQty" title="${uiLabelMap.ProductDealQuantity}*"><text/></field> >> <field name="fromDate" title="${uiLabelMap.ProductDealStartDate}*"><date-time/></field> >> <field name="thruDate" title="${uiLabelMap.ProductDealEndDate}*"><date-time/></field> >> >> > |
| Free forum by Nabble | Edit this page |
