Author: jacopoc
Date: Fri Jul 30 05:37:28 2010
New Revision: 980655
URL: http://svn.apache.org/viewvc?rev=980655&view=rev
Log:
Added ability to create new shipment groups to an existing order. This also
fixes a bug mentioned in one of the comments to "OFBIZ-1809" (duplicated ship
groups were assigned to newly created items when they were not assigned to the
first ship group). Misc code formatting fixes that I did while wading thru the
code.
Modified:
ofbiz/trunk/applications/order/config/OrderUiLabels.xml
ofbiz/trunk/applications/order/script/org/ofbiz/order/order/OrderServices.xml
ofbiz/trunk/applications/order/servicedef/services.xml
ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java
ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/controller.xml
ofbiz/trunk/applications/order/webapp/ordermgr/entry/shipsettings.ftl
ofbiz/trunk/applications/order/webapp/ordermgr/order/ordershippinginfo.ftl
Modified: ofbiz/trunk/applications/order/config/OrderUiLabels.xml
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/config/OrderUiLabels.xml?rev=980655&r1=980654&r2=980655&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/config/OrderUiLabels.xml (original)
+++ ofbiz/trunk/applications/order/config/OrderUiLabels.xml Fri Jul 30 05:37:28
2010
@@ -2696,6 +2696,10 @@
<value xml:lang="pt_BR">Criar envio de devolução</value>
<value xml:lang="zh">å建éè´§è¿è¾</value>
</property>
+ <property key="OrderCreateShipGroup">
+ <value xml:lang="en">Create New Ship Group</value>
+ <value xml:lang="it">Creare Nuovo Gruppo di Spedizione</value>
+ </property>
<property key="OrderCreateShippingAddress">
<value xml:lang="de">Neue Versandadresse erstellen</value>
<value xml:lang="en">Create New Shipping Address</value>
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=980655&r1=980654&r2=980655&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 Jul 30 05:37:28 2010
@@ -762,6 +762,20 @@ under the License.
</simple-method>
<!-- OrderItemShipGroup -->
+ <simple-method method-name="createOrderItemShipGroup"
short-description="Create OrderItemShipGroup">
+ <check-permission permission="ORDERMGR" action="_CREATE">
+ <fail-property resource="OrderErrorUiLabels"
property="OrderSecurityErrorToRunCreateOrderItemShipGroup"/>
+ </check-permission>
+ <check-errors/>
+ <make-value value-field="newEntity" entity-name="OrderItemShipGroup"/>
+ <set-pk-fields map="parameters" value-field="newEntity"/>
+ <set-nonpk-fields map="parameters" value-field="newEntity"/>
+ <if-empty field="newEntity.shipGroupSeqId">
+ <make-next-seq-id value-field="newEntity"
seq-field-name="shipGroupSeqId"/> <!-- this finds the next sub-sequence ID -->
+ <field-to-result field="newEntity.shipGroupSeqId"
result-name="shipGroupSeqId"/>
+ </if-empty>
+ <create-value value-field="newEntity"/>
+ </simple-method>
<simple-method method-name="updateOrderItemShipGroup"
short-description="Update OrderItemShipGroup">
<check-permission permission="ORDERMGR" action="_UPDATE">
<fail-property resource="OrderErrorUiLabels"
property="OrderSecurityErrorToRunUpdateOrderItemShipGroup"/>
Modified: ofbiz/trunk/applications/order/servicedef/services.xml
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/servicedef/services.xml?rev=980655&r1=980654&r2=980655&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/servicedef/services.xml (original)
+++ ofbiz/trunk/applications/order/servicedef/services.xml Fri Jul 30 05:37:28
2010
@@ -670,6 +670,13 @@ under the License.
</service>
<!-- Order Shipping and Contacts -->
+ <service name="createOrderItemShipGroup"
default-entity-name="OrderItemShipGroup" engine="simple"
+
location="component://order/script/org/ofbiz/order/order/OrderServices.xml"
invoke="createOrderItemShipGroup" auth="true">
+ <description>Creates a new OrderItemShipGroup.</description>
+ <auto-attributes mode="IN" include="nonpk" optional="true"/>
+ <attribute name="orderId" type="String" mode="IN" optional="false"/>
+ <attribute name="shipGroupSeqId" type="String" mode="INOUT"
optional="true"/>
+ </service>
<service name="updateOrderItemShipGroup"
default-entity-name="OrderItemShipGroup" engine="simple"
location="component://order/script/org/ofbiz/order/order/OrderServices.xml"
invoke="updateOrderItemShipGroup" auth="true">
<description>Updates OrderItemShipGroup. The shipmentMethod field is
of the format ${shipmentmethodtype...@${carrierpartyid}</description>
Modified:
ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java?rev=980655&r1=980654&r2=980655&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java
(original)
+++ ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java
Fri Jul 30 05:37:28 2010
@@ -3365,6 +3365,7 @@ public class OrderServices {
// set the item in the selected ship group
item.setShipBeforeDate(itemDesiredDeliveryDate);
+ cart.clearItemShipInfo(item);
cart.setItemShipGroupQty(item, item.getQuantity(),
shipGroupIdx);
}
} catch (CartItemModifyException e) {
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=980655&r1=980654&r2=980655&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/controller.xml
(original)
+++ ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/controller.xml Fri
Jul 30 05:37:28 2010
@@ -1563,6 +1563,12 @@ under the License.
<response name="success" type="view" value="ListOrderHeaders"/>
<response name="error" type="view" value="ListOrderHeaders"/>
</request-map>
+ <request-map uri="createOrderItemShipGroup">
+ <security https="true" auth="true"/>
+ <event type="service" invoke="createOrderItemShipGroup"/>
+ <response name="success" type="view" value="orderview"/>
+ <response name="error" type="view" value="orderview"/>
+ </request-map>
<request-map uri="updateOrderItemShipGroup">
<security https="true" auth="true"/>
<event type="service" invoke="updateOrderItemShipGroup"/>
Modified: ofbiz/trunk/applications/order/webapp/ordermgr/entry/shipsettings.ftl
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/entry/shipsettings.ftl?rev=980655&r1=980654&r2=980655&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/webapp/ordermgr/entry/shipsettings.ftl
(original)
+++ ofbiz/trunk/applications/order/webapp/ordermgr/entry/shipsettings.ftl Fri
Jul 30 05:37:28 2010
@@ -30,7 +30,7 @@ under the License.
<table width='100%' border='0' cellspacing='0' cellpadding='0'
class="boxboutside">
<tr>
<td>
- <a href="<@ofbizUrl>setShipping?createNewShipGroup=Y</@ofbizUrl>"
class="buttontext">${uiLabelMap.CommonCreateNew}
${uiLabelMap.OrderShipGroup}</a>
+ <a href="<@ofbizUrl>setShipping?createNewShipGroup=Y</@ofbizUrl>"
class="buttontext">${uiLabelMap.OrderCreateShipGroup}</a>
<#list 1..cart.getShipGroupSize() as currIndex>
Modified:
ofbiz/trunk/applications/order/webapp/ordermgr/order/ordershippinginfo.ftl
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/order/ordershippinginfo.ftl?rev=980655&r1=980654&r2=980655&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/webapp/ordermgr/order/ordershippinginfo.ftl
(original)
+++ ofbiz/trunk/applications/order/webapp/ordermgr/order/ordershippinginfo.ftl
Fri Jul 30 05:37:28 2010
@@ -171,6 +171,12 @@ under the License.
<li><a
href="<@ofbizUrl>cancelOrderItem?${paramString}</@ofbizUrl>"
class="buttontext">${uiLabelMap.OrderCancelAllItems}</a></li>
-->
<li><a href="<@ofbizUrl>editOrderItems?${paramString}</@ofbizUrl>"
class="buttontext">${uiLabelMap.OrderEditItems}</a></li>
+ <li>
+ <form name="createOrderItemShipGroup" method="post"
action="<@ofbizUrl>createOrderItemShipGroup</@ofbizUrl>">
+ <input type="hidden" name="orderId" value="${orderId}"/>
+ </form>
+ <a href="javascript:document.createOrderItemShipGroup.submit()"
class="buttontext">${uiLabelMap.OrderCreateShipGroup}</a>
+ </li>
</#if>
<li><a
href="<@ofbizUrl>loadCartFromOrder?${paramString}&finalizeMode=init</@ofbizUrl>"
class="buttontext">${uiLabelMap.OrderCreateAsNewOrder}</a></li>
<#if orderHeader.statusId == "ORDER_COMPLETED">
@@ -203,7 +209,6 @@ under the License.
<input type="hidden" name="contactMechPurposeTypeId"
value="SHIPPING_LOCATION"/>
<input type="hidden" name="oldContactMechId"
value="${shipGroup.contactMechId?if_exists}"/>
<table class="basic-table" cellspacing='0'>
- <#if shipGroup.contactMechId?has_content>
<tr>
<td align="right" valign="top" width="15%">
<span
class="label"> ${uiLabelMap.OrderAddress}</span>
@@ -230,17 +235,15 @@ under the License.
</div>
</td>
</tr>
- </#if>
<#-- the setting of shipping method is only supported for
sales orders at this time -->
- <#if orderHeader.orderTypeId == "SALES_ORDER" &&
shipGroup.shipmentMethodTypeId?has_content>
+ <#if orderHeader.orderTypeId == "SALES_ORDER">
<tr>
<td align="right" valign="top" width="15%">
<span
class="label"> <b>${uiLabelMap.CommonMethod}</b></span>
</td>
<td width="5"> </td>
<td valign="top" width="80%">
- <#if shipGroup.carrierPartyId?has_content ||
shipmentMethodType?has_content>
<div>
<#if orderHeader?has_content &&
orderHeader.statusId != "ORDER_CANCELLED" && orderHeader.statusId !=
"ORDER_COMPLETED" && orderHeader.statusId != "ORDER_REJECTED">
<#-- passing the shipmentMethod value as the
combination of two fields value
@@ -248,7 +251,11 @@ under the License.
"@" symbol.
-->
<select name="shipmentMethod">
+ <#if
shipGroup.shipmentMethodTypeId?has_content>
<option
value="${shipgroup.shipmentmethodtype...@${shipgroup.carrierpartyid?if_exists}"><#if
shipGroup.carrierPartyId !=
"_NA_">${shipGroup.carrierPartyId?if_exists}</#if> ${shipmentMethodType.get("description",locale)?default("")}</option>
+ <#else>
+ <option value=""/>
+ </#if>
<#list productStoreShipmentMethList as
productStoreShipmentMethod>
<#assign shipmentMethodTypeAndParty =
productStoreShipmentMethod.shipmentMethodTypeId + "@" +
productStoreShipmentMethod.partyId>
<#if
productStoreShipmentMethod.partyId?has_content ||
productStoreShipmentMethod?has_content>
@@ -260,12 +267,11 @@ under the License.
<#if shipGroup.carrierPartyId != "_NA_">
${shipGroup.carrierPartyId?if_exists}
</#if>
-
${shipmentMethodType.get("description",locale)?default("")}
+
${shipmentMethodType?if_exists.get("description",locale)?default("")}
</#if>
</div>
- </#if>
</td>
- </tr>
+ </tr>
</#if>
<#if orderHeader?has_content && orderHeader.statusId !=
"ORDER_CANCELLED" && orderHeader.statusId != "ORDER_COMPLETED" &&
orderHeader.statusId != "ORDER_REJECTED">
<tr>
@@ -277,12 +283,12 @@ under the License.
</td>
</tr>
</#if>
- <#if !shipGroup.contactMechId?has_content &&
!shipGroup.shipmentMethodTypeId?has_content>
- <#assign noShipment = "true">
- <tr>
- <td colspan="3"
align="center">${uiLabelMap.OrderNotShipped}</td>
- </tr>
- </#if>
+ <#if !shipGroup.contactMechId?has_content &&
!shipGroup.shipmentMethodTypeId?has_content>
+ <#assign noShipment = "true">
+ <tr>
+ <td colspan="3"
align="center">${uiLabelMap.OrderNotShipped}</td>
+ </tr>
+ </#if>
</table>
</form>
<div id="newShippingAddressForm" class="popup" style="display: none;">