You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by mo...@apache.org on 2009/05/26 10:52:15 UTC
svn commit: r778625 - in /ofbiz/trunk/applications/order:
src/org/ofbiz/order/shoppingcart/ShoppingCartEvents.java
webapp/ordermgr/requirement/RequirementForms.xml
Author: mor
Date: Tue May 26 08:52:14 2009
New Revision: 778625
URL: http://svn.apache.org/viewvc?rev=778625&view=rev
Log:
Optional input field where user can specify an orderId while creating a purchase order from Requirements.
Patch from Mridul Pathak and Bharat Soni, part of OFBIZ-2519 (https://issues.apache.org/jira/browse/OFBIZ-2519)
Modified:
ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartEvents.java
ofbiz/trunk/applications/order/webapp/ordermgr/requirement/RequirementForms.xml
Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartEvents.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartEvents.java?rev=778625&r1=778624&r2=778625&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartEvents.java (original)
+++ ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartEvents.java Tue May 26 08:52:14 2009
@@ -632,9 +632,26 @@
request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage(resource_error, "OrderCouldNotInitPurchaseOrder", locale));
return "error";
}
+ String orderId = request.getParameter("orderId_o_0");
+ // set the order id if supplied
+ if(UtilValidate.isNotEmpty(orderId)) {
+ GenericValue thisOrder = null;
+ try {
+ thisOrder = delegator.findOne("OrderHeader", UtilMisc.toMap("orderId", orderId), false);
+ } catch (GenericEntityException e) {
+ Debug.logError(e.getMessage(), module);
+ }
+ if (thisOrder == null) {
+ cart.setOrderId(orderId);
+ } else {
+ request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage(resource_error,"OrderIdAlreadyExistsPleaseChooseAnother", locale));
+ return "error";
+ }
+ }
cart.setBillToCustomerPartyId(billToCustomerPartyId);
cart.setBillFromVendorPartyId(supplierPartyId);
cart.setOrderPartyId(supplierPartyId);
+ cart.setOrderId(orderId);
String agreementId = request.getParameter("agreementId_o_0");
if (agreementId != null && agreementId.length() > 0) {
ShoppingCartHelper sch = new ShoppingCartHelper(delegator, dispatcher, cart);
Modified: ofbiz/trunk/applications/order/webapp/ordermgr/requirement/RequirementForms.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/requirement/RequirementForms.xml?rev=778625&r1=778624&r2=778625&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/webapp/ordermgr/requirement/RequirementForms.xml (original)
+++ ofbiz/trunk/applications/order/webapp/ordermgr/requirement/RequirementForms.xml Tue May 26 08:52:14 2009
@@ -325,6 +325,7 @@
</form>
<form name="ApprovedProductRequirements" type="multi" use-row-submit="true" target="quickPurchaseOrderEntry" title="" list-name="requirementsForSupplier"
paginate-target="RequirementsForSupplier" odd-row-style="alternate-row" default-table-style="basic-table hover-bar">
+ <field name="orderId" id-name="orderId"><hidden/></field>
<field name="billToCustomerPartyId"><hidden value="${parameters.billToCustomerPartyId}"/></field>
<field name="supplierPartyId"><hidden value="${parameters.partyId}"/></field>
<field name="requirementId" widget-style="buttontext">
@@ -358,8 +359,9 @@
</form>
<form name="ApprovedProductRequirementsSubmit" type="single"
header-row-style="header-row" default-table-style="basic-table">
+ <field name="orderId" id-name="orderId_o_0"><text/></field>
<field name="submitButton" title="${uiLabelMap.CommonEmptyHeader}" widget-style="buttontext">
- <hyperlink also-hidden="false" target-type="plain" description="${uiLabelMap.OrderInputQuickPurchaseOrder}" target="javascript:document.ApprovedProductRequirements.submit()"/>
+ <hyperlink also-hidden="false" target-type="plain" description="${uiLabelMap.OrderInputQuickPurchaseOrder}" target="javascript:document.ApprovedProductRequirements.orderId_o_0.value=document.ApprovedProductRequirementsSubmit.orderId_o_0.value;document.ApprovedProductRequirements.submit()"/>
</field>
</form>
<form name="ApprovedProductRequirementsSummary" type="single" default-map-name="quantityReport" target="ApprovedProductRequirements"