|
Author: apatel
Date: Wed Dec 1 03:11:44 2010 New Revision: 1040865 URL: http://svn.apache.org/viewvc?rev=1040865&view=rev Log: Simplified code in EditShipment screen. Its real simple screen but had some really complex code. Ftl was not needed. Removed: ofbiz/trunk/applications/product/webapp/facility/shipment/EditShipment.ftl Modified: ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/shipment/EditShipment.groovy ofbiz/trunk/applications/product/widget/facility/ShipmentForms.xml ofbiz/trunk/applications/product/widget/facility/ShipmentScreens.xml Modified: ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/shipment/EditShipment.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/shipment/EditShipment.groovy?rev=1040865&r1=1040864&r2=1040865&view=diff ============================================================================== --- ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/shipment/EditShipment.groovy (original) +++ ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/shipment/EditShipment.groovy Wed Dec 1 03:11:44 2010 @@ -20,10 +20,7 @@ import org.ofbiz.entity.condition.* import org.ofbiz.widget.html.HtmlFormWrapper -shipmentId = request.getParameter("shipmentId"); -if (!shipmentId) { - shipmentId = request.getAttribute("shipmentId"); -} +shipmentId = parameters.shipmentId; shipment = delegator.findOne("Shipment", [shipmentId : shipmentId], false); // orderHeader is needed here to determine type of order and hence types of shipment status @@ -34,26 +31,15 @@ if (!shipment) { } orderHeader = delegator.findOne("OrderHeader", [orderId : primaryOrderId], false); -HtmlFormWrapper editShipmentWrapper = new HtmlFormWrapper("component://product/widget/facility//ShipmentForms.xml", "EditShipment", request, response); -editShipmentWrapper.putInContext("shipmentId", shipmentId); -editShipmentWrapper.putInContext("shipment", shipment); -editShipmentWrapper.putInContext("productStoreId", null); // seems to be needed not exist != null - -if (!shipment) { - editShipmentWrapper.setUseRequestParameters(true); -} - // the kind of StatusItem to use is based on the type of order +statusItemTypeId = "SHIPMENT_STATUS"; if (orderHeader && "PURCHASE_ORDER".equals(orderHeader.orderTypeId)) { - statusItemType = "PURCH_SHIP_STATUS"; -} else { - statusItemType = "SHIPMENT_STATUS"; + statusItemTypeId = "PURCH_SHIP_STATUS"; } -editShipmentWrapper.putInContext("statusItemType", statusItemType); +context.statusItemTypeId = statusItemTypeId; context.shipmentId = shipmentId; context.shipment = shipment; -context.editShipmentWrapper = editShipmentWrapper; if (shipment) { currentStatus = shipment.getRelatedOne("StatusItem"); @@ -61,24 +47,9 @@ if (shipment) { destinationPostalAddress = shipment.getRelatedOne("DestinationPostalAddress"); originTelecomNumber = shipment.getRelatedOne("OriginTelecomNumber"); destinationTelecomNumber = shipment.getRelatedOne("DestinationTelecomNumber"); - toPerson = shipment.getRelatedOne("ToPerson"); - toPartyGroup = shipment.getRelatedOne("ToPartyGroup"); - fromPerson = shipment.getRelatedOne("FromPerson"); - fromPartyGroup = shipment.getRelatedOne("FromPartyGroup"); - primaryOrderId = shipment.getString("primaryOrderId"); - - editShipmentWrapper.putInContext("currentStatus", currentStatus); - editShipmentWrapper.putInContext("originPostalAddress", originPostalAddress); - editShipmentWrapper.putInContext("destinationPostalAddress", destinationPostalAddress); - editShipmentWrapper.putInContext("originTelecomNumber", originTelecomNumber); - editShipmentWrapper.putInContext("destinationTelecomNumber", destinationTelecomNumber); - editShipmentWrapper.putInContext("toPerson", toPerson); - editShipmentWrapper.putInContext("toPartyGroup", toPartyGroup); - editShipmentWrapper.putInContext("fromPerson", fromPerson); - editShipmentWrapper.putInContext("fromPartyGroup", fromPartyGroup); - editShipmentWrapper.putInContext("orderHeader", orderHeader); + if (orderHeader) { - editShipmentWrapper.putInContext("productStoreId", orderHeader.get("productStoreId")); + context.productStoreId = orderHeader.productStoreId; } context.currentStatus = currentStatus; @@ -86,14 +57,5 @@ if (shipment) { context.destinationPostalAddress = destinationPostalAddress; context.originTelecomNumber = originTelecomNumber; context.destinationTelecomNumber = destinationTelecomNumber; - context.toPerson = toPerson; - context.toPartyGroup = toPartyGroup; - context.fromPerson = fromPerson; - context.fromPartyGroup = fromPartyGroup; - - if (primaryOrderId) { - ord = delegator.findOne("OrderHeader", [orderId : primaryOrderId], false); - pfc = delegator.findList("ProductStoreFacility", null, null, null, null, false); - fac = delegator.findList("ProductStoreFacilityByOrder", EntityCondition.makeCondition([orderId : primaryOrderId]), null, null, null, false); - } + } Modified: ofbiz/trunk/applications/product/widget/facility/ShipmentForms.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/widget/facility/ShipmentForms.xml?rev=1040865&r1=1040864&r2=1040865&view=diff ============================================================================== --- ofbiz/trunk/applications/product/widget/facility/ShipmentForms.xml (original) +++ ofbiz/trunk/applications/product/widget/facility/ShipmentForms.xml Wed Dec 1 03:11:44 2010 @@ -38,7 +38,7 @@ under the License. <field use-when="shipment==null" name="statusId" title="${uiLabelMap.ProductStatusId}"> <drop-down allow-empty="false" current="first-in-list"> <entity-options entity-name="StatusItem" description="${description}"> - <entity-constraint name="statusTypeId" value="${statusItemType}"/> + <entity-constraint name="statusTypeId" value="${statusItemTypeId}"/> <entity-order-by field-name="sequenceId"/> </entity-options> </drop-down> @@ -116,9 +116,8 @@ under the License. <field name="destinationTelecomNumberId" title="${uiLabelMap.ProductDestinationPhoneNumberId}" tooltip="${destinationTelecomNumber.countryCode} ${destinationTelecomNumber.areaCode} ${destinationTelecomNumber.contactNumber}"> </field> - - <field name="partyIdTo" title="${uiLabelMap.ProductToParty}" tooltip="${toPerson.firstName} ${toPerson.middleName} ${toPerson.lastName} ${toPartyGroup.groupName}"/> - <field name="partyIdFrom" title="${uiLabelMap.ProductFromParty}" tooltip="${fromPerson.firstName} ${fromPerson.middleName} ${fromPerson.lastName} ${fromPartyGroup.groupName}"/> + <field name="partyIdTo" title="${uiLabelMap.ProductToParty}"><lookup target-form-name="LookupPartyName"/></field> + <field name="partyIdFrom" title="${uiLabelMap.ProductFromParty}"><lookup target-form-name="LookupPartyName"/></field> <field name="additionalShippingCharge" title="${uiLabelMap.ProductAdditionalShippingCharge}"><text/></field> Modified: ofbiz/trunk/applications/product/widget/facility/ShipmentScreens.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/widget/facility/ShipmentScreens.xml?rev=1040865&r1=1040864&r2=1040865&view=diff ============================================================================== --- ofbiz/trunk/applications/product/widget/facility/ShipmentScreens.xml (original) +++ ofbiz/trunk/applications/product/widget/facility/ShipmentScreens.xml Wed Dec 1 03:11:44 2010 @@ -187,9 +187,7 @@ under the License. <widgets> <decorator-screen name="CommonShipmentDecorator"> <decorator-section name="body"> - <platform-specific> - <html><html-template location="component://product/webapp/facility/shipment/EditShipment.ftl"/></html> - </platform-specific> + <include-form name="EditShipment" location="component://product/widget/facility/ShipmentForms.xml"/> </decorator-section> </decorator-screen> </widgets> |
| Free forum by Nabble | Edit this page |
