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/07/01 17:33:44 UTC

svn commit: r673106 - in /ofbiz/trunk/applications/order: webapp/ordermgr/WEB-INF/actions/return/returnHeader.bsh webapp/ordermgr/return/ReturnForms.xml widget/ordermgr/OrderReturnScreens.xml

Author: jacopoc
Date: Tue Jul  1 08:33:44 2008
New Revision: 673106

URL: http://svn.apache.org/viewvc?rev=673106&view=rev
Log:
Converted ftl form to the widget; enhanced the "Edit Return Header" form so that it can be used for supplier returns.

Modified:
    ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/return/returnHeader.bsh
    ofbiz/trunk/applications/order/webapp/ordermgr/return/ReturnForms.xml
    ofbiz/trunk/applications/order/widget/ordermgr/OrderReturnScreens.xml

Modified: ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/return/returnHeader.bsh
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/return/returnHeader.bsh?rev=673106&r1=673105&r2=673106&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/return/returnHeader.bsh (original)
+++ ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/return/returnHeader.bsh Tue Jul  1 08:33:44 2008
@@ -28,55 +28,15 @@
 returnId = parameters.get("returnId");
     
 returnHeader = null;
-addressEditable = true;
-postalAddressFrom = null;
 if (returnId != null) {
     returnHeader = delegator.findByPrimaryKey("ReturnHeader", UtilMisc.toMap("returnId", returnId));
     if (returnHeader != null) {   
         partyId = returnHeader.getString("fromPartyId"); 
         toPartyId = parameters.get("toPartyId");
-        currentStatus = returnHeader.getRelatedOne("StatusItem");
-        context.put("currentStatus", currentStatus);
-        // user can change fromAddress as long as the ReturnHeader hasn't been accepted( returnStatus==Requested )
-        addressEditable = "RETURN_REQUESTED".equals(currentStatus.get("statusId"));
-        postalAddressFrom = returnHeader.getRelatedOne("PostalAddress");            
-        currentAccount = returnHeader.getRelatedOne("BillingAccount");
-        context.put("currentAccount", currentAccount);
-        currentPaymentMethod = returnHeader.getRelatedOne("PaymentMethod");
-        if (currentPaymentMethod != null) {
-            currentCreditCard = currentPaymentMethod.getRelatedOne("CreditCard");
-            if (currentCreditCard != null) {
-                context.put("currentCreditCard", currentCreditCard);
-            } else {
-                currentEftAccount = currentPaymentMethod.getRelatedOne("EftAccount");
-                context.put("currentEftAccount", currentEftAccount);
-            }
-        }
-        context.put("currentPaymentMethod", currentPaymentMethod);
-        currentFacility = returnHeader.getRelatedOne("Facility");
-        context.put("currentFacility", currentFacility);     
-        context.put("entryDate", returnHeader.getTimestamp("entryDate"));
-        context.put("needsInventoryReceive", returnHeader.getString("needsInventoryReceive"));        
     }
 }
 context.put("returnHeader", returnHeader);
 context.put("returnId", returnId);
-context.put("addressEditable", addressEditable);
-currencyUom = null;
-
-if (returnHeader != null) {
-    context.put("returnInfo", returnHeader);
-    currencyUom = returnHeader.get("currencyUomId");
-} else {
-    context.put("returnInfo", parameters);
-    currencyUom = UtilProperties.getPropertyValue("general.properties", "currency.uom.id.default", "USD");
-}
-
-// default currency
-if (currencyUom != null) {
-    defaultCurrency = delegator.findByPrimaryKey("Uom", UtilMisc.toMap("uomId", currencyUom));
-    context.put("defaultCurrency", defaultCurrency);
-}
 
 // billing account info
 billingAccountList = null;
@@ -87,25 +47,14 @@
 context.put("billingAccountList", billingAccountList);
 
 // payment method info
+List creditCardList = null;
+List eftAccountList = null;
 if (partyId != null) {
-    List creditCardList = EntityUtil.filterByDate(delegator.findByAnd("PaymentMethodAndCreditCard", UtilMisc.toMap("partyId", partyId)));
-    if (UtilValidate.isNotEmpty(creditCardList)) {
-        context.put("creditCardList", creditCardList);
-    }
-    List eftAccountList = EntityUtil.filterByDate(delegator.findByAnd("PaymentMethodAndEftAccount", UtilMisc.toMap("partyId", partyId)));
-    if (UtilValidate.isNotEmpty(eftAccountList)) {
-        context.put("eftAccountList", eftAccountList);
-    }
-}
-
-facilityList = delegator.findList("Facility", null, null, UtilMisc.toList("facilityName"), null, false);
-context.put("facilityList", facilityList);
-
-currentStatus = returnHeader != null ? returnHeader.getString("statusId") : null;
-if (currentStatus != null) {
-    returnStatus = delegator.findByAnd("StatusValidChangeToDetail", UtilMisc.toMap("statusId", currentStatus), UtilMisc.toList("sequenceId"));
-    context.put("returnStatus", returnStatus);
+    creditCardList = EntityUtil.filterByDate(delegator.findByAnd("PaymentMethodAndCreditCard", UtilMisc.toMap("partyId", partyId)));
+    eftAccountList = EntityUtil.filterByDate(delegator.findByAnd("PaymentMethodAndEftAccount", UtilMisc.toMap("partyId", partyId)));
 }
+context.put("creditCardList", creditCardList);
+context.put("eftAccountList", eftAccountList);
 
 orderRole = null;
 orderHeader = null;
@@ -121,7 +70,6 @@
 // from address
 addresses = ContactMechWorker.getPartyPostalAddresses(request, partyId, "_NA_");
 context.put("addresses", addresses);
-context.put("postalAddressFrom", postalAddressFrom); 
 
 if (returnHeader != null) {
     postalAddressTo = null;
@@ -141,7 +89,3 @@
     }
     context.put("postalAddressTo", postalAddressTo);
 }
-
-// get a list of all currencies
-currencies = delegator.findByAndCache("Uom", UtilMisc.toMap("uomTypeId", "CURRENCY_MEASURE"), UtilMisc.toList("description"));
-context.put("currencies", currencies);

Modified: ofbiz/trunk/applications/order/webapp/ordermgr/return/ReturnForms.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/return/ReturnForms.xml?rev=673106&r1=673105&r2=673106&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/webapp/ordermgr/return/ReturnForms.xml (original)
+++ ofbiz/trunk/applications/order/webapp/ordermgr/return/ReturnForms.xml Tue Jul  1 08:33:44 2008
@@ -20,37 +20,87 @@
 
 <forms xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
         xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/widget-form.xsd">
-    <form name="EditReturn" type="single" target="updateReturnHeader" 
+    <form name="EditReturn" type="single" target="updateReturn" default-map-name="returnHeader"
         header-row-style="header-row" default-table-style="basic-table">
-        <alt-target use-when="returnHeader==null" target="createReturnHeader"/>
+        <alt-target use-when="returnHeader==null" target="createReturn"/>
         <auto-fields-service service-name="updateReturnHeader"/>
+        <actions>
+            <entity-one entity-name="StatusItem" value-name="currentStatus" auto-field-map="false">
+                <field-map field-name="statusId" env-name="returnHeader.statusId"/>
+            </entity-one>
+        </actions>
         <field use-when="returnHeader!=null" name="returnId" tooltip="This cannot be changed without re-creating the Return."><display/></field>
         <field use-when="returnHeader==null&amp;&amp;returnId!=null" name="returnId" tooltip="Could not find Return with ID [${returnId}]"><text size="20" maxlength="20"/></field>
         <field use-when="returnHeader==null&amp;&amp;returnId==null" name="returnId"><ignored/></field>
-        
-        <field position="1" name="entryDate"/>
-        <field name="statusId">
+        <field name="currentStatusId" entry-name="statusId"><hidden/></field>
+        <field name="returnHeaderTypeId">
+            <drop-down allow-empty="false">
+                <entity-options entity-name="ReturnHeaderType" description="${description}"/>
+            </drop-down>
+        </field>
+        <field name="statusId" use-when="returnHeader==null">
             <drop-down>
                 <entity-options entity-name="StatusItem" description="${description}">
                     <entity-constraint name="statusTypeId" value="ORDER_RETURN_STTS"/>
                     <entity-order-by field-name="sequenceId"/>
                 </entity-options>
+                <list-options key-name="statusIdTo" list-name="returnStatus" description="${transitionName}"/>
             </drop-down>
         </field>
+        <field name="statusId" use-when="returnHeader!=null">
+            <drop-down current-description="${currentStatus.description}">
+                <entity-options entity-name="StatusValidChangeToDetail" key-field-name="statusIdTo" description="${transitionName} (${description})">
+                    <entity-constraint name="statusId" env-name="returnHeader.statusId"/>
+                    <entity-order-by field-name="sequenceId"/>
+                </entity-options>
+            </drop-down>
+        </field>
+        <field name="currencyUomId" use-when="returnHeader==null">
+            <drop-down no-current-selected-key="${defaultCurrencyUomId}">
+                <entity-options key-field-name="uomId" description="${abbreviation} - ${description}" entity-name="Uom">
+                    <entity-constraint name="uomTypeId" operator="equals" value="CURRENCY_MEASURE"/>
+                    <entity-order-by field-name="abbreviation"/>
+                </entity-options>
+            </drop-down>
+        </field>
+        <field name="currencyUomId" use-when="returnHeader!=null">
+            <display-entity entity-name="Uom" key-field-name="uomId" description="${abbreviation} - ${description}"/>
+        </field>
         <field name="destinationFacilityId">
-            <radio no-current-selected-key="">
-                <option key="" description="No Facility Specified"/>
+            <drop-down allow-empty="true">
                 <entity-options entity-name="Facility" key-field-name="facilityId" description="${facilityName}">
                     <entity-order-by field-name="facilityName"/>
                 </entity-options>
-            </radio>
+            </drop-down>
+        </field>
+        <field name="fromPartyId"><lookup target-form-name="LookupPartyName"/></field>
+        <field name="toPartyId"><lookup target-form-name="LookupPartyName"/></field>
+        <field name="originContactMechId" use-when="returnHeader!=null">
+            <display-entity entity-name="PostalAddress" key-field-name="contactMechId" description="${toName} ${attnName} ${address1} ${address2} ${city} ${stateProvinceGeoId} ${postalCode} ${countryGeoId}"/>
+        </field>
+        <field name="originContactMechId" use-when="returnHeader!=null&amp;&amp;&quot;RETURN_REQUESTED&quot;.equals(returnHeader.getString(&quot;statusId&quot;))">
+            <drop-down allow-empty="true">
+                <list-options key-name="postalAddress.contactMechId" list-name="addresses" description="${postalAddress.toName} ${postalAddress.attnName} ${postalAddress.address1} ${postalAddress.address2} ${postalAddress.city} ${postalAddress.stateProvinceGeoId} ${postalAddress.postalCode} ${postalAddress.countryGeoId}"/>
+            </drop-down>
+        </field>
+        <field name="billingAccountId" use-when="billingAccountList!=null&amp;&amp;billingAccountList.size()&gt;0">
+            <drop-down allow-empty="true">
+                <list-options key-name="billingAccountId" list-name="billingAccountList" description="${billingAccountId}: ${description}"/>
+            </drop-down>
+        </field>
+        <field name="paymentMethodId" use-when="creditCardList!=null&amp;&amp;creditCardList.size()&gt;0">
+            <drop-down allow-empty="true">
+                <list-options key-name="paymentMethodId" list-name="creditCardList" list-entry-name="creditCardPm" description="${bsh:org.ofbiz.party.contact.ContactHelper.formatCreditCard(creditCardPm.getRelatedOne(&quot;CreditCard&quot;))}"/>
+            </drop-down>
+        </field>
+        <field name="newCreditCard" widget-style="buttontext" use-when="returnHeader!=null&amp;&amp;returnHeader.getString(&quot;fromPartyId&quot;)!=null">
+            <hyperlink also-hidden="false" target="/partymgr/control/editcreditcard?partyId=${returnHeader.fromPartyId}${externalKeyParam}" target-window="partymgr" description="${uiLabelMap.AccountingCreateNewCreditCard}" target-type="inter-app"/>
         </field>
         <field name="needsInventoryReceive" tooltip="If this is Y then the return will be automatically Completed when it is Accepted, skipping the Received status and process.">
             <drop-down no-current-selected-key="N"><option key="N"/><option key="Y"/></drop-down>
         </field>
-        
-        <field service-name="updateReturnHeader" name="fromPartyId"/>
-        <field name="submitButton" title="${uiLabelMap.CommonUpdate}" widget-style="smallSubmit"><submit button-type="button"/></field>
+        <field name="createdBy"><display/></field>
+        <field name="submitButton" title="${uiLabelMap.CommonSubmit}" widget-style="smallSubmit"><submit button-type="button"/></field>
     </form>
     
     <form name="ReturnItems" type="multi" list-name="orderItems" target="createReturnItem" 

Modified: ofbiz/trunk/applications/order/widget/ordermgr/OrderReturnScreens.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/widget/ordermgr/OrderReturnScreens.xml?rev=673106&r1=673105&r2=673106&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/widget/ordermgr/OrderReturnScreens.xml (original)
+++ ofbiz/trunk/applications/order/widget/ordermgr/OrderReturnScreens.xml Tue Jul  1 08:33:44 2008
@@ -47,7 +47,7 @@
                 <set field="viewSize" from-field="parameters.VIEW_SIZE" type="Integer" default-value="20"/>
             </actions>
             <widgets>
-                <decorator-screen name="CommonOrderReturnDecorator">
+                <decorator-screen name="main-decorator" location="${parameters.mainDecoratorLocation}">
                     <decorator-section name="body">
                         <container style="screenlet">
                             <container style="screenlet-title-bar">
@@ -111,6 +111,7 @@
                 <set field="titleProperty" value="PageTitleReturnHeader"/>
                 <set field="headerItem" value="return"/>
                 <set field="tabButtonItem" value="OrderReturnHeader"/>                
+                <property-to-field field="defaultCurrencyUomId" resource="general" property="currency.uom.id.default" default="USD"/>
                 <script location="component://order/webapp/ordermgr/WEB-INF/actions/return/returnHeader.bsh"/>
             </actions>
             <widgets>
@@ -118,11 +119,7 @@
                     <decorator-section name="body">
                         <section>
                             <widgets>
-                                <platform-specific>
-                                    <html>
-                                        <html-template location="component://order/webapp/ordermgr/return/returnHeader.ftl"/>
-                                    </html>
-                                </platform-specific>
+                                <include-form name="EditReturn" location="component://order/webapp/ordermgr/return/ReturnForms.xml"/>
                             </widgets>
                         </section>                
                     </decorator-section>