You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by ja...@apache.org on 2008/06/18 16:29:16 UTC

svn commit: r669188 - in /ofbiz/trunk/applications: order/entitydef/ order/script/org/ofbiz/order/order/ order/servicedef/ order/webapp/ordermgr/WEB-INF/actions/return/ order/webapp/ordermgr/return/ order/widget/ordermgr/ product/config/ product/script...

Author: jacopoc
Date: Wed Jun 18 07:29:16 2008
New Revision: 669188

URL: http://svn.apache.org/viewvc?rev=669188&view=rev
Log:
Several fixes and enhancements to the return process: now a return shipment is automatically created when the return is approved, and when the return is completed an invoice is also created. Added new entity to associate a return item with a shipment.
Several small enhancements to the ui to link returns with shipments and inventory receipts.
Still, a lot of works needs to be done in this area (e.g. manual creation of return shipments, improve the ui, verify the code that creates the invoice for the return, verify the code that apply payments to invoices etc...)

Added:
    ofbiz/trunk/applications/order/webapp/ordermgr/return/returnLinks.ftl   (with props)
Modified:
    ofbiz/trunk/applications/order/entitydef/entitygroup.xml
    ofbiz/trunk/applications/order/entitydef/entitymodel.xml
    ofbiz/trunk/applications/order/script/org/ofbiz/order/order/OrderReturnServices.xml
    ofbiz/trunk/applications/order/servicedef/secas.xml
    ofbiz/trunk/applications/order/servicedef/services_return.xml
    ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/return/returnItems.bsh
    ofbiz/trunk/applications/order/webapp/ordermgr/return/returnHeader.ftl
    ofbiz/trunk/applications/order/webapp/ordermgr/return/returnItems.ftl
    ofbiz/trunk/applications/order/widget/ordermgr/OrderReturnScreens.xml
    ofbiz/trunk/applications/product/config/ProductUiLabels.xml
    ofbiz/trunk/applications/product/script/org/ofbiz/shipment/shipment/ShipmentServices.xml
    ofbiz/trunk/applications/product/servicedef/services_shipment.xml
    ofbiz/trunk/applications/product/webapp/facility/returns/receiveReturn.ftl

Modified: ofbiz/trunk/applications/order/entitydef/entitygroup.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/entitydef/entitygroup.xml?rev=669188&r1=669187&r2=669188&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/entitydef/entitygroup.xml (original)
+++ ofbiz/trunk/applications/order/entitydef/entitygroup.xml Wed Jun 18 07:29:16 2008
@@ -177,6 +177,7 @@
     <entity-group group="org.ofbiz" entity="ReturnStatus" />
     <entity-group group="org.ofbiz" entity="ReturnType" />            
     <entity-group group="org.ofbiz" entity="ReturnItemBilling" />
+    <entity-group group="org.ofbiz" entity="ReturnItemShipment" />
 
     <!-- ========================================================= -->
     <!-- org.ofbiz.order.shoppingcart -->

Modified: ofbiz/trunk/applications/order/entitydef/entitymodel.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/entitydef/entitymodel.xml?rev=669188&r1=669187&r2=669188&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/entitydef/entitymodel.xml (original)
+++ ofbiz/trunk/applications/order/entitydef/entitymodel.xml Wed Jun 18 07:29:16 2008
@@ -2529,6 +2529,33 @@
         <key-map field-name="shipmentReceiptId" rel-field-name="receiptId"/>
       </relation>
     </entity>
+    <entity entity-name="ReturnItemShipment"
+            package-name="org.ofbiz.order.return"
+            title="Return Item And Shipment Association Entity">
+      <field name="returnId" type="id-ne"></field>
+      <field name="returnItemSeqId" type="id-ne"></field>
+      <field name="shipmentId" type="id-ne"></field>
+      <field name="shipmentItemSeqId" type="id-ne"></field>
+      <field name="quantity" type="floating-point"></field>
+      <prim-key field="returnId"/>
+      <prim-key field="returnItemSeqId"/>
+      <prim-key field="shipmentId"/>
+      <prim-key field="shipmentItemSeqId"/>
+      <relation type="one" fk-name="RIT_SHPMT_RHDR" rel-entity-name="ReturnHeader">
+        <key-map field-name="returnId"/>
+      </relation>
+      <relation type="one" fk-name="RIT_SHPMT_RITM" rel-entity-name="ReturnItem">
+        <key-map field-name="returnId"/>
+        <key-map field-name="returnItemSeqId"/>
+      </relation>
+      <relation type="one" fk-name="RIT_SHPMT_SHPMT" rel-entity-name="Shipment">
+        <key-map field-name="shipmentId"/>
+      </relation>
+      <relation type="one" fk-name="RIT_SHPMT_SHPITM" rel-entity-name="ShipmentItem">
+        <key-map field-name="shipmentId"/>
+        <key-map field-name="shipmentItemSeqId"/>
+      </relation>
+    </entity>
 
   <!-- ========================================================= -->
   <!-- org.ofbiz.order.shoppingcart -->

Modified: ofbiz/trunk/applications/order/script/org/ofbiz/order/order/OrderReturnServices.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/script/org/ofbiz/order/order/OrderReturnServices.xml?rev=669188&r1=669187&r2=669188&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/script/org/ofbiz/order/order/OrderReturnServices.xml (original)
+++ ofbiz/trunk/applications/order/script/org/ofbiz/order/order/OrderReturnServices.xml Wed Jun 18 07:29:16 2008
@@ -880,4 +880,13 @@
         <set field="inMap.returnTypeId" value="RTN_REPAIR_REPLACE"/>
         <call-service service-name="processReplacementReturn" in-map-name="inMap"/>
     </simple-method>
+
+    <simple-method method-name="createReturnItemShipment" short-description="Create a ReturnItemShipment">
+        <check-permission permission="ORDERMGR" action="_CREATE"><fail-property resource="OrderErrorUiLabels" property="OrderSecurityErrorToRunCreateReturnItemShipment"/></check-permission>
+        <check-errors/>
+        <make-value value-name="newEntity" entity-name="ReturnItemShipment"/>
+        <set-pk-fields map-name="parameters" value-name="newEntity"/>
+        <set-nonpk-fields map-name="parameters" value-name="newEntity"/>
+        <create-value value-name="newEntity"/>
+    </simple-method>
 </simple-methods>

Modified: ofbiz/trunk/applications/order/servicedef/secas.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/servicedef/secas.xml?rev=669188&r1=669187&r2=669188&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/servicedef/secas.xml (original)
+++ ofbiz/trunk/applications/order/servicedef/secas.xml Wed Jun 18 07:29:16 2008
@@ -177,6 +177,7 @@
     <eca service="updateReturnHeader" event="commit">
         <condition field-name="statusId" operator="equals" value="RETURN_ACCEPTED"/>
         <condition field-name="currentStatusId" operator="not-equals" value="RETURN_ACCEPTED"/>
+        <action service="createShipmentAndItemsForReturn" mode="sync"/>
         <action service="processCrossShipReplacementReturn" mode="sync"/>
         <action service="createTrackingCodeOrderReturns" mode="sync" run-as-user="system"/>
         <action service="sendReturnAcceptNotification" mode="async" persist="true"/>

Modified: ofbiz/trunk/applications/order/servicedef/services_return.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/servicedef/services_return.xml?rev=669188&r1=669187&r2=669188&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/servicedef/services_return.xml (original)
+++ ofbiz/trunk/applications/order/servicedef/services_return.xml Wed Jun 18 07:29:16 2008
@@ -288,4 +288,10 @@
         <attribute name="refundAmount" type="Double" mode="IN" optional="false"/>
         <attribute name="paymentId" type="String" mode="OUT" optional="false"/>
     </service>
+
+    <service name="createReturnItemShipment" engine="simple"
+            location="org/ofbiz/order/order/OrderReturnServices.xml" invoke="createReturnItemShipment">
+        <description>Create a new ReturnItemShipment</description>
+        <auto-attributes entity-name="ReturnItemShipment" include="all" mode="IN" optional="false"/>
+    </service>
 </services>

Modified: ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/return/returnItems.bsh
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/return/returnItems.bsh?rev=669188&r1=669187&r2=669188&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/return/returnItems.bsh (original)
+++ ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/return/returnItems.bsh Wed Jun 18 07:29:16 2008
@@ -19,6 +19,8 @@
  
 import org.ofbiz.base.util.*;
 import org.ofbiz.entity.*;
+import org.ofbiz.entity.condition.EntityCondition;
+import org.ofbiz.entity.util.EntityFindOptions;
 import org.ofbiz.order.order.OrderReadHelper;
 import java.math.BigDecimal;
 
@@ -83,3 +85,9 @@
 
 partyOrders = delegator.findByAnd("OrderHeaderAndRoles", UtilMisc.toMap("roleTypeId", "PLACING_CUSTOMER", "partyId", returnHeader.getString("fromPartyId")), UtilMisc.toList("orderId"));
 context.put("partyOrders", partyOrders);
+
+// get the list of return shipments associated to the return
+EntityFindOptions findOptions = new EntityFindOptions();
+findOptions.setDistinct(true);
+List returnShipmentIds = delegator.findList("ReturnItemShipment", EntityCondition.makeCondition("returnId", returnId), UtilMisc.toSet("shipmentId"), null, findOptions, true);
+context.put("returnShipmentIds", returnShipmentIds);

Modified: ofbiz/trunk/applications/order/webapp/ordermgr/return/returnHeader.ftl
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/return/returnHeader.ftl?rev=669188&r1=669187&r2=669188&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/webapp/ordermgr/return/returnHeader.ftl (original)
+++ ofbiz/trunk/applications/order/webapp/ordermgr/return/returnHeader.ftl Wed Jun 18 07:29:16 2008
@@ -16,29 +16,6 @@
 specific language governing permissions and limitations
 under the License.
 -->
-<#assign selected = tabButtonItem?default("void")>
-
-<#if returnHeader?exists>
-<div class="button-bar tab-bar">
-    <ul>
-        <li<#if selected="OrderReturnHeader"> class="selected"</#if>><a href="<@o...@ofbizUrl>">${uiLabelMap.OrderReturnHeader}</a></li>
-        <li<#if selected="OrderReturnItems"> class="selected"</#if>><a href="<@ofbizUrl>returnItems?returnId=${returnId?if_exists}<#if requestParameters.orderId?exists>&orderId=${requestParameters.orderId}</#...@ofbizUrl>">${uiLabelMap.OrderReturnItems}</a></li>
-    </ul>
-    <br/>
-</div>
-<div>
-    <a href="<@o...@ofbizUrl>" class="buttontext">PDF</a>
-    <#if returnHeader?has_content && returnHeader.destinationFacilityId?has_content && returnHeader.statusId == "RETURN_ACCEPTED">
-      <a href="/facility/control/ReceiveReturn?facilityId=${returnHeader.destinationFacilityId}&returnId=${returnHeader.returnId?if_exists}${externalKeyParam}" class="buttontext">${uiLabelMap.OrderReceiveReturn}</a>
-    </#if>
-</div>
-<#else>
-  <h1>${uiLabelMap.OrderCreateNewReturn}</h1>
-  <#if requestParameters.returnId?has_content>
-    <h2>${uiLabelMap.OrderNoReturnFoundWithId} : ${requestParameters.returnId}</h2>
-  </#if>
-  <br/>
-</#if>
 
 <div class="screenlet">
     <div class="screenlet-title-bar">
@@ -179,7 +156,7 @@
                   </#if>
                 </select>
               <#else>
-                <input type='text' size='20' name='paymentMethodId'>
+                <input type='text' size='20' name='paymentMethodId' value="${returnHeader?if_exists.paymentMethodId?if_exists}"/>
               </#if>
               <#if (returnHeader.fromPartyId)?has_content>
                 <a href="/partymgr/control/editcreditcard?partyId=${returnHeader.fromPartyId}${externalKeyParam}" target="partymgr" class="smallSubmit">${uiLabelMap.AccountingCreateNewCreditCard}</a>

Modified: ofbiz/trunk/applications/order/webapp/ordermgr/return/returnItems.ftl
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/return/returnItems.ftl?rev=669188&r1=669187&r2=669188&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/webapp/ordermgr/return/returnItems.ftl (original)
+++ ofbiz/trunk/applications/order/webapp/ordermgr/return/returnItems.ftl Wed Jun 18 07:29:16 2008
@@ -65,21 +65,13 @@
     </tr>    
 </#macro>
 
-<#assign selected = tabButtonItem?default("void")>
 
-<div class="button-bar tab-bar">
-    <ul>
-        <li<#if selected="OrderReturnHeader"> class="selected"</#if>><a href="<@o...@ofbizUrl>">${uiLabelMap.OrderReturnHeader}</a></li>
-        <li<#if selected="OrderReturnItems"> class="selected"</#if>><a href="<@o...@ofbizUrl>">${uiLabelMap.OrderReturnItems}</a></li>
-    </ul>
-    <br/>
-</div>
-<div>
-    <a href="<@o...@ofbizUrl>" class="buttontext">PDF</a>
     <#if returnHeader?has_content && returnHeader.destinationFacilityId?has_content && returnHeader.statusId == "RETURN_ACCEPTED">
-      <a href="/facility/control/ReceiveReturn?facilityId=${returnHeader.destinationFacilityId}&returnId=${returnHeader.returnId?if_exists}${externalKeyParam}" class="buttontext">${uiLabelMap.OrderReturnReceive}</a>
+      <#list returnShipmentIds as returnShipmentId>
+        <a href="/facility/control/ViewShipment?shipmentId=${returnShipmentId.shipmentId}${externalKeyParam}" class="buttontext">${uiLabelMap.ProductShipmentId} ${returnShipmentId.shipmentId}</a>
+        <a href="/facility/control/ReceiveReturn?facilityId=${returnHeader.destinationFacilityId}&returnId=${returnHeader.returnId?if_exists}&shipmentId=${returnShipmentId.shipmentId}${externalKeyParam}" class="buttontext">${uiLabelMap.OrderReceiveReturn}</a>
+      </#list>
     </#if>
-</div>
 
 <div class="screenlet">
     <div class="screenlet-title-bar">
@@ -143,6 +135,7 @@
               <#assign returnReason = item.getRelatedOne("ReturnReason")?if_exists>
               <#assign returnType = item.getRelatedOne("ReturnType")?if_exists>
               <#assign status = item.getRelatedOne("InventoryStatusItem")?if_exists>
+              <#assign shipmentReceipts = item.getRelated("ShipmentReceipt")?if_exists>
               <#if (item.get("returnQuantity")?exists && item.get("returnPrice")?exists)>
                  <#assign returnTotal = returnTotal + item.get("returnQuantity") * item.get("returnPrice") >
                  <#assign returnItemSubTotal = item.get("returnQuantity") * item.get("returnPrice") >
@@ -175,7 +168,12 @@
                     <#else>
                         <input name="returnQuantity_o_${rowCount}" value="${item.returnQuantity}" type="text" size="8" align="right">
                     </#if>
-                    <#if item.receivedQuantity?exists> (${item.receivedQuantity} received)</#if>
+                    <#if item.receivedQuantity?exists>
+                    <br/>Received: ${item.receivedQuantity}
+                        <#list shipmentReceipts?if_exists as shipmentReceipt>
+                            <br/>Qty: ${shipmentReceipt.quantityAccepted}, ${shipmentReceipt.datetimeReceived}, <a href="/facility/control/EditInventoryItem?inventoryItemId=${shipmentReceipt.inventoryItemId}" class="buttontext">${shipmentReceipt.inventoryItemId}</a>
+                        </#list>
+                    </#if>
                     </div></td>
                 <td><div>
                     <#if readOnly>

Added: ofbiz/trunk/applications/order/webapp/ordermgr/return/returnLinks.ftl
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/return/returnLinks.ftl?rev=669188&view=auto
==============================================================================
--- ofbiz/trunk/applications/order/webapp/ordermgr/return/returnLinks.ftl (added)
+++ ofbiz/trunk/applications/order/webapp/ordermgr/return/returnLinks.ftl Wed Jun 18 07:29:16 2008
@@ -0,0 +1,38 @@
+<#--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+<#assign selected = tabButtonItem?default("void")>
+<#if requestParameters.orderId?exists>&orderId=${requestParameters.orderId}</#if>
+<#if returnHeader?exists>
+<div class="button-bar tab-bar">
+    <ul>
+        <li<#if selected="OrderReturnHeader"> class="selected"</#if>><a href="<@o...@ofbizUrl>">${uiLabelMap.OrderReturnHeader}</a></li>
+        <li<#if selected="OrderReturnItems"> class="selected"</#if>><a href="<@o...@ofbizUrl>">${uiLabelMap.OrderReturnItems}</a></li>
+    </ul>
+    <br/>
+</div>
+<div>
+    <a href="<@o...@ofbizUrl>" class="buttontext">PDF</a>
+</div>
+<#else>
+  <h1>${uiLabelMap.OrderCreateNewReturn}</h1>
+  <#if requestParameters.returnId?has_content>
+    <h2>${uiLabelMap.OrderNoReturnFoundWithId} : ${requestParameters.returnId}</h2>
+  </#if>
+  <br/>
+</#if>

Propchange: ofbiz/trunk/applications/order/webapp/ordermgr/return/returnLinks.ftl
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ofbiz/trunk/applications/order/webapp/ordermgr/return/returnLinks.ftl
------------------------------------------------------------------------------
    svn:keywords = Date Rev Author URL Id

Propchange: ofbiz/trunk/applications/order/webapp/ordermgr/return/returnLinks.ftl
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: ofbiz/trunk/applications/order/widget/ordermgr/OrderReturnScreens.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/widget/ordermgr/OrderReturnScreens.xml?rev=669188&r1=669187&r2=669188&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/widget/ordermgr/OrderReturnScreens.xml (original)
+++ ofbiz/trunk/applications/order/widget/ordermgr/OrderReturnScreens.xml Wed Jun 18 07:29:16 2008
@@ -25,6 +25,11 @@
                     <decorator-section name="body">
                         <section>
                             <widgets>
+                                <platform-specific>
+                                    <html>
+                                        <html-template location="component://order/webapp/ordermgr/return/returnLinks.ftl"/>
+                                    </html>
+                                </platform-specific>
                                 <decorator-section-include name="body"/>
                             </widgets>
                         </section>

Modified: ofbiz/trunk/applications/product/config/ProductUiLabels.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/config/ProductUiLabels.xml?rev=669188&r1=669187&r2=669188&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/config/ProductUiLabels.xml (original)
+++ ofbiz/trunk/applications/product/config/ProductUiLabels.xml Wed Jun 18 07:29:16 2008
@@ -10219,7 +10219,7 @@
         <value xml:lang="en">Initial Inventory Item Status</value>
         <value xml:lang="es">Estado inicial de Artículos de Inventario</value>
         <value xml:lang="fr">Statut initial de la ligne de stock</value>
-        <value xml:lang="it">Stato Iniziale Riga Inventorio</value>
+        <value xml:lang="it">Stato Iniziale Riga Inventario</value>
         <value xml:lang="ro">Stat Initial Linie Inventar</value>
         <value xml:lang="ru">Начальный статус ТМЦ</value>
         <value xml:lang="th">สถานะรายการสินค้าคงเหลือเบื้องต้น

Modified: ofbiz/trunk/applications/product/script/org/ofbiz/shipment/shipment/ShipmentServices.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/script/org/ofbiz/shipment/shipment/ShipmentServices.xml?rev=669188&r1=669187&r2=669188&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/script/org/ofbiz/shipment/shipment/ShipmentServices.xml (original)
+++ ofbiz/trunk/applications/product/script/org/ofbiz/shipment/shipment/ShipmentServices.xml Wed Jun 18 07:29:16 2008
@@ -279,6 +279,38 @@
         <field-to-result field-name="shipmentId"/>
     </simple-method>
 
+    <simple-method method-name="createShipmentAndItemsForReturn" short-description="Create Shipment and ShipmentItems based on ReturnHeader and ReturnItems">
+        <set-service-fields service-name="createShipmentForReturn" map-name="parameters" to-map-name="shipmentCtx"/>
+        <call-service service-name="createShipmentForReturn" in-map-name="shipmentCtx">
+            <result-to-field result-name="shipmentId"/>
+        </call-service>
+        <check-errors/>
+        <log level="info" message="Created new shipment ${shipmentId}"/>
+
+        <entity-condition entity-name="ReturnItem" list-name="returnItems">
+            <condition-expr field-name="returnId" operator="equals" env-name="parameters.returnId"/>
+        </entity-condition>
+        <iterate entry-name="returnItem" list-name="returnItems">
+            <clear-field field-name="shipItemCtx"/>
+            <set from-field="shipmentId" field="shipItemCtx.shipmentId"/>
+            <set from-field="returnItem.productId" field="shipItemCtx.productId"/>
+            <set from-field="returnItem.returnQuantity" field="shipItemCtx.quantity"/>
+            <log level="info" message="calling create shipment item with ${shipItemCtx}"/>
+            <call-service service-name="createShipmentItem" in-map-name="shipItemCtx">
+                <result-to-field result-name="shipmentItemSeqId"/>
+            </call-service>
+            <clear-field field-name="shipItemCtx"/>
+            <set from-field="shipmentId" field="shipItemCtx.shipmentId"/>
+            <set from-field="shipmentItemSeqId" field="shipItemCtx.shipmentItemSeqId"/>
+            <set from-field="returnItem.returnId" field="shipItemCtx.returnId"/>
+            <set from-field="returnItem.returnItemSeqId" field="shipItemCtx.returnItemSeqId"/>
+            <set from-field="returnItem.returnQuantity" field="shipItemCtx.quantity"/>
+            <call-service service-name="createReturnItemShipment" in-map-name="shipItemCtx"/>
+        </iterate>
+        
+        <field-to-result field-name="shipmentId"/>
+    </simple-method>
+
     <simple-method method-name="setShipmentSettingsFromPrimaryOrder" short-description="Set Shipment Settings From Primary Order">
         <check-permission permission="FACILITY" action="_CREATE">
             <fail-message message="Security Error: to run setShipmentSettingsFromPrimaryOrder you must have the FACILITY_CREATE or FACILITY_ADMIN permission"/>

Modified: ofbiz/trunk/applications/product/servicedef/services_shipment.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/servicedef/services_shipment.xml?rev=669188&r1=669187&r2=669188&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/servicedef/services_shipment.xml (original)
+++ ofbiz/trunk/applications/product/servicedef/services_shipment.xml Wed Jun 18 07:29:16 2008
@@ -108,6 +108,15 @@
         <auto-attributes include="pk" mode="IN" optional="false"/>
         <attribute name="shipmentId" type="String" mode="OUT" optional="false"/>
     </service>
+    <service name="createShipmentAndItemsForReturn" default-entity-name="ReturnHeader" engine="simple"
+            location="org/ofbiz/shipment/shipment/ShipmentServices.xml" invoke="createShipmentAndItemsForReturn">
+        <description>Create a Return Shipment and ShipmentItems with information from ReturnHeader and ReturnItems</description>
+        <required-permissions join-type="AND">
+            <check-permission permission="FACILITY" action="_CREATE"/>
+        </required-permissions>
+        <auto-attributes include="pk" mode="IN" optional="false"/>
+        <attribute name="shipmentId" type="String" mode="OUT" optional="false"/>
+    </service>
     
     <service name="createShipment" default-entity-name="Shipment" engine="simple"
             location="org/ofbiz/shipment/shipment/ShipmentServices.xml" invoke="createShipment" auth="true">

Modified: ofbiz/trunk/applications/product/webapp/facility/returns/receiveReturn.ftl
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/webapp/facility/returns/receiveReturn.ftl?rev=669188&r1=669187&r2=669188&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/webapp/facility/returns/receiveReturn.ftl (original)
+++ ofbiz/trunk/applications/product/webapp/facility/returns/receiveReturn.ftl Wed Jun 18 07:29:16 2008
@@ -71,7 +71,10 @@
               <#else>
                 <tr>
                   <td>
-                    <h3>${uiLabelMap.ProductReceiveReturn} <a href="/ordermgr/control/returnMain?returnId=${returnHeader.returnId}${externalKeyParam?if_exists}" class="buttontext">#${returnHeader.returnId}</a></h3>
+                    <h3>
+                      ${uiLabelMap.ProductReceiveReturn} <a href="/ordermgr/control/returnMain?returnId=${returnHeader.returnId}${externalKeyParam?if_exists}" class="buttontext">#${returnHeader.returnId}</a>
+                      <#if parameters.shipmentId?has_content>${uiLabelMap.ProductShipmentId} <a href="<@o...@ofbizUrl>" class="buttontext">${parameters.shipmentId}</a></#if>
+                    </h3>
                   </td>
                   <td align="right">
                     ${uiLabelMap.ProductSelectAll}&nbsp;
@@ -86,6 +89,7 @@
                   <#assign orderItemType = (orderItem.getRelatedOne("OrderItemType"))?if_exists>
                   <input type="hidden" name="returnId_o_${rowCount}" value="${returnItem.returnId}">
                   <input type="hidden" name="returnItemSeqId_o_${rowCount}" value="${returnItem.returnItemSeqId}"> 
+                  <input type="hidden" name="shipmentId_o_${rowCount}" value="${parameters.shipmentId?if_exists}">
                   <input type="hidden" name="facilityId_o_${rowCount}" value="${requestParameters.facilityId?if_exists}">       
                   <input type="hidden" name="datetimeReceived_o_${rowCount}" value="${now}">
                   <input type="hidden" name="quantityRejected_o_${rowCount}" value="0">