Author: mrisaliti
Date: Sat Feb 23 08:43:44 2008 New Revision: 630472 URL: http://svn.apache.org/viewvc?rev=630472&view=rev Log: Create a new service to storeQuote in a single transaction like storeOrder (Issue OFBIZ-1657). New parameters to permit to store also the others Quote entities, and passed the selectAmount field to the calculateProductPrice. Modified: ofbiz/trunk/applications/order/script/org/ofbiz/order/quote/QuoteServices.xml ofbiz/trunk/applications/order/servicedef/services_quote.xml ofbiz/trunk/applications/order/src/org/ofbiz/order/quote/QuoteServices.java Modified: ofbiz/trunk/applications/order/script/org/ofbiz/order/quote/QuoteServices.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/script/org/ofbiz/order/quote/QuoteServices.xml?rev=630472&r1=630471&r2=630472&view=diff ============================================================================== --- ofbiz/trunk/applications/order/script/org/ofbiz/order/quote/QuoteServices.xml (original) +++ ofbiz/trunk/applications/order/script/org/ofbiz/order/quote/QuoteServices.xml Sat Feb 23 08:43:44 2008 @@ -301,7 +301,10 @@ <if-not-empty field-name="parameters.productId"> <entity-one entity-name="Product" value-name="product"/> <set from-field="product" field="calculateProductPriceMap.product"/> - <set from-field="parameters.quantity" field="calculateProductPriceMap.quantity"/> + <set from-field="parameters.quantity" field="calculateProductPriceMap.quantity"/> + <if-not-empty field-name="parameters.selectedAmount"> + <set from-field="parameters.selectedAmount" field="calculateProductPriceMap.amount"/> + </if-not-empty> <call-service service-name="calculateProductPrice" in-map-name="calculateProductPriceMap"> <result-to-field result-name="price" field-name="newEntity.quoteUnitPrice"/> </call-service> Modified: ofbiz/trunk/applications/order/servicedef/services_quote.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/servicedef/services_quote.xml?rev=630472&r1=630471&r2=630472&view=diff ============================================================================== --- ofbiz/trunk/applications/order/servicedef/services_quote.xml (original) +++ ofbiz/trunk/applications/order/servicedef/services_quote.xml Sat Feb 23 08:43:44 2008 @@ -230,6 +230,12 @@ <auto-attributes include="nonpk" mode="IN" optional="true"/> <attribute name="quoteItems" type="List" mode="IN" optional="true"/> <attribute name="quoteAttributes" type="List" mode="IN" optional="true"/> + <attribute name="quoteCoefficients" type="List" mode="IN" optional="true"/> + <attribute name="quoteRoles" type="List" mode="IN" optional="true"/> + <attribute name="quoteTerms" type="List" mode="IN" optional="true"/> + <attribute name="quoteTermAttributes" type="List" mode="IN" optional="true"/> + <attribute name="quoteWorkEfforts" type="List" mode="IN" optional="true"/> + <attribute name="quoteAdjustments" type="List" mode="IN" optional="true"/> <attribute name="quoteId" type="String" mode="OUT" optional="false"/> </service> <service name="sendQuoteEmailForCreation" engine="simple" require-new-transaction="true" Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/quote/QuoteServices.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/quote/QuoteServices.java?rev=630472&r1=630471&r2=630472&view=diff ============================================================================== --- ofbiz/trunk/applications/order/src/org/ofbiz/order/quote/QuoteServices.java (original) +++ ofbiz/trunk/applications/order/src/org/ofbiz/order/quote/QuoteServices.java Sat Feb 23 08:43:44 2008 @@ -146,7 +146,12 @@ String description = (String) context.get("description"); List quoteItems = (List) context.get("quoteItems"); List quoteAttributes = (List) context.get("quoteAttributes"); - + List quoteCoefficients = (List) context.get("quoteCoefficients"); + List quoteRoles = (List) context.get("quoteRoles"); + List quoteTerms = (List) context.get("quoteTerms"); + List quoteTermAttributes = (List) context.get("quoteTermAttributes"); + List quoteWorkEfforts = (List) context.get("quoteWorkEfforts"); + List quoteAdjustments = (List) context.get("quoteAdjustments"); Map result = FastMap.newInstance(); @@ -197,6 +202,61 @@ dispatcher.runSync("createQuoteAttribute", quoteAttrIn); } } + + // create Quote Coefficients + if (UtilValidate.isNotEmpty(quoteCoefficients)) { + Iterator quoteCoefficientIt = quoteCoefficients.iterator(); + while (quoteCoefficientIt.hasNext()) { + GenericValue quoteCoefficient = (GenericValue)quoteCoefficientIt.next(); + quoteCoefficient.set("quoteId", quoteId); + Map quoteCoefficientIn = quoteCoefficient.getAllFields(); + quoteCoefficientIn.put("userLogin", userLogin); + + dispatcher.runSync("createQuoteCoefficient", quoteCoefficientIn); + } + } + + // create Quote Roles + if (UtilValidate.isNotEmpty(quoteRoles)) { + Iterator quoteRoleIt = quoteRoles.iterator(); + while (quoteRoleIt.hasNext()) { + GenericValue quoteRole = (GenericValue)quoteRoleIt.next(); + quoteRole.set("quoteId", quoteId); + Map quoteRoleIn = quoteRole.getAllFields(); + quoteRoleIn.put("userLogin", userLogin); + + dispatcher.runSync("createQuoteRole", quoteRoleIn); + } + } + + // create Quote WorkEfforts + if (UtilValidate.isNotEmpty(quoteWorkEfforts)) { + Iterator quoteWorkEffortIt = quoteWorkEfforts.iterator(); + while (quoteWorkEffortIt.hasNext()) { + GenericValue quoteWorkEffort = (GenericValue)quoteWorkEffortIt.next(); + quoteWorkEffort.set("quoteId", quoteId); + Map quoteWorkEffortIn = quoteWorkEffort.getAllFields(); + quoteWorkEffortIn.put("userLogin", userLogin); + + dispatcher.runSync("createQuoteWorkEffort", quoteWorkEffortIn); + } + } + + // create Quote Adjustments + if (UtilValidate.isNotEmpty(quoteAdjustments)) { + Iterator quoteAdjustmentIt = quoteAdjustments.iterator(); + while (quoteAdjustmentIt.hasNext()) { + GenericValue quoteAdjustment = (GenericValue)quoteAdjustmentIt.next(); + quoteAdjustment.set("quoteId", quoteId); + Map quoteAdjustmentIn = quoteAdjustment.getAllFields(); + quoteAdjustmentIn.put("userLogin", userLogin); + + dispatcher.runSync("createQuoteAdjustment", quoteAdjustmentIn); + } + } + + //TODO create Quote Terms still to be implemented the base service createQuoteTerm + //TODO create Quote Term Attributes still to be implemented the base service createQuoteTermAttribute } else { return ServiceUtil.returnFailure("Could not storing Quote"); } |
Free forum by Nabble | Edit this page |