Author: mor
Date: Fri Jul 3 12:32:47 2009
New Revision: 790886
URL: http://svn.apache.org/viewvc?rev=790886&view=rev
Log:
Shipping Instructions on order detail page can now be added (if the user does
not enter any instructions while doing a checkout) as well as can be edited.
Applied patch from Akash Jain, part of OFBIZ-2687
(https://issues.apache.org/jira/browse/OFBIZ-2687)
Modified:
ofbiz/trunk/applications/order/config/OrderUiLabels.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/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=790886&r1=790885&r2=790886&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/config/OrderUiLabels.xml (original)
+++ ofbiz/trunk/applications/order/config/OrderUiLabels.xml Fri Jul 3 12:32:47
2009
@@ -9064,6 +9064,9 @@
<value
xml:lang="th">รายà¸à¸²à¸£à¸ªà¸±à¹à¸à¸à¸·à¹à¸à¸à¸µà¹à¹à¸¡à¹à¹à¸à¹à¸à¸à¸à¸à¸§à¸±à¸</value>
<value xml:lang="zh">æ¬è®¢å䏿¯ç¤¼å</value>
</property>
+ <property key="OrderThisOrderDoesNotHaveShippingInstructions">
+ <value xml:lang="en">This order does not have shipping
instructions</value>
+ </property>
<property key="OrderThisOrderGift">
<value xml:lang="de">Dieser Auftrag ist ein GESCHENK</value>
<value xml:lang="en">This order is a gift</value>
Modified: ofbiz/trunk/applications/order/servicedef/services.xml
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/servicedef/services.xml?rev=790886&r1=790885&r2=790886&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/servicedef/services.xml (original)
+++ ofbiz/trunk/applications/order/servicedef/services.xml Fri Jul 3 12:32:47
2009
@@ -988,4 +988,12 @@
<attribute name="shipmentId" type="String" mode="IN" optional="false"/>
<attribute name="shipmentRouteSegmentId" type="String" mode="IN"
optional="false"/>
</service>
+
+ <service name="setShippingInstructions" engine="java" auth="true"
+ location="org.ofbiz.order.order.OrderServices"
invoke="setShippingInstructions">
+ <description>Set the shipping instructions for an order</description>
+ <attribute name="orderId" type="String" mode="IN" optional="false"/>
+ <attribute name="shipGroupSeqId" type="String" mode="IN"
optional="false"/>
+ <attribute name="shippingInstructions" type="String" mode="IN"
optional="true"/>
+ </service>
</services>
\ No newline at end of file
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=790886&r1=790885&r2=790886&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 3 12:32:47 2009
@@ -5228,4 +5228,18 @@
return ServiceUtil.returnSuccess("runSubscriptionAutoReorders
finished, " + count + " subscription extended.");
}
-}
+ public static Map setShippingInstructions(DispatchContext dctx, Map
context) {
+ GenericDelegator delegator = dctx.getDelegator();
+ String orderId = (String) context.get("orderId");
+ String shipGroupSeqId = (String) context.get("shipGroupSeqId");
+ String shippingInstructions = (String)
context.get("shippingInstructions");
+ try {
+ GenericValue orderItemShipGroup =
EntityUtil.getFirst(delegator.findByAnd("OrderItemShipGroup",
UtilMisc.toMap("orderId", orderId,"shipGroupSeqId",shipGroupSeqId)));
+ orderItemShipGroup.set("shippingInstructions",
shippingInstructions);
+ orderItemShipGroup.store();
+ } catch (GenericEntityException e) {
+ Debug.logError(e, module);
+ }
+ return ServiceUtil.returnSuccess();
+ }
+}
\ 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=790886&r1=790885&r2=790886&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 3 12:32:47 2009
@@ -292,6 +292,12 @@
<security https="true" auth="true"/>
<response name="success" type="view" value="viewimage"/>
</request-map>
+ <request-map uri="setShippingInstructions">
+ <security https="true" auth="true"/>
+ <event type="service" invoke="setShippingInstructions"/>
+ <response name="success" type="view" value="orderview"/>
+ <response name="error" type="view" value="orderview"/>
+ </request-map>
<!-- Order Note Requests -->
<request-map uri="createnewnote">
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=790886&r1=790885&r2=790886&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/webapp/ordermgr/order/ordershippinginfo.ftl
(original)
+++ ofbiz/trunk/applications/order/webapp/ordermgr/order/ordershippinginfo.ftl
Fri Jul 3 12:32:47 2009
@@ -16,6 +16,24 @@
specific language governing permissions and limitations
under the License.
-->
+
+<script language="JavaScript" type="text/javascript">
+ function editInstruction() {
+ $('shippingInstructions').style.display="block";
+ $('saveInstruction').style.display="inline";
+ $('editInstruction').style.display="none";
+ $('instruction').style.display="none";
+ }
+ function addInstruction() {
+ $('shippingInstructions').style.display="block";
+ $('saveInstruction').style.display="inline";
+ $('addInstruction').style.display="none";
+ }
+ function saveInstruction() {
+ document.updateShippingInstructionsForm.submit();
+ }
+</script>
+
<#if (security.hasEntityPermission("ORDERMGR", "_UPDATE", session) ||
security.hasRolePermission("ORDERMGR", "_UPDATE", "", "", session)) &&
orderHeader.salesChannelEnumId != "POS_SALES_CHANNEL">
<div class="screenlet">
<div class="screenlet-title-bar">
@@ -383,18 +401,45 @@
</td>
</tr>
</#if>
- <#if shipGroup.shippingInstructions?has_content>
- <tr><td colspan="3"><hr/></td></tr>
- <tr>
- <td align="right" valign="top" width="15%">
- <span class="label"> ${uiLabelMap.OrderInstructions}</span>
- </td>
- <td width="5"> </td>
- <td valign="top" width="80%">
- <div>${shipGroup.shippingInstructions}</div>
- </td>
- </tr>
- </#if>
+
+ <tr><td colspan="7"><hr class="sepbar"></td></tr>
+ <tr>
+ <td align="right" valign="top" width="15%">
+ <span class="label"> ${uiLabelMap.OrderInstructions}</span>
+ </td>
+ <td width="5"> </td>
+ <td align="left" valign="top" width="80%">
+ <#if (!orderHeader.statusId.equals("ORDER_COMPLETED")) &&
!(orderHeader.statusId.equals("ORDER_REJECTED")) &&
!(orderHeader.statusId.equals("ORDER_CANCELLED"))>
+ <form name="updateShippingInstructionsForm" method="post"
action="<@ofbizUrl>setShippingInstructions</@ofbizUrl>">
+ <input type="hidden" name="orderId"
value="${orderHeader.orderId}"/>
+ <input type="hidden" name="shipGroupSeqId"
value="${shipGroup.shipGroupSeqId}"/>
+ <#if shipGroup.shippingInstructions?has_content>
+ <table>
+ <tr>
+ <td id="instruction">
+ <label>${shipGroup.shippingInstructions}</label>
+ </td>
+ <td>
+ <a href="javascript:editInstruction();"
class="buttontext" id="editInstruction">${uiLabelMap.CommonEdit}</a>
+ </td>
+ </tr>
+ </table>
+ <#else>
+ <a href="javascript:addInstruction();" class="buttontext"
id="addInstruction">${uiLabelMap.CommonAdd}</a>
+ </#if>
+ <a href="javascript:saveInstruction();" class="buttontext"
id="saveInstruction" style="display:none">${uiLabelMap.CommonSave}</a>
+ <textarea name="shippingInstructions"
id="shippingInstructions"
style="display:none">${shipGroup.shippingInstructions?if_exists}</textarea>
+ </form>
+ <#else>
+ <#if shipGroup.shippingInstructions?has_content>
+ <span>${shipGroup.shippingInstructions}</span>
+ <#else>
+
<span>${uiLabelMap.OrderThisOrderDoesNotHaveShippingInstructions}</span>
+ </#if>
+ </#if>
+ </td>
+ </tr>
+
<#if shipGroup.isGift?has_content && noShipment?default("false") !=
"true">
<tr><td colspan="3"><hr/></td></tr>
<tr>