| <?xml version="1.0" encoding="UTF-8"?> |
| <!-- |
| 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. |
| --> |
| |
| <simple-methods xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
| xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/simple-methods.xsd"> |
| |
| <!-- ================================================================ --> |
| <!-- Quote Services --> |
| <!-- ================================================================ --> |
| |
| <simple-method method-name="getNextQuoteId" short-description="Get Next quoteId"> |
| <!-- try to find PartyAcctgPreference for parameters.partyId, see if we need any special quote number sequencing --> |
| <entity-one entity-name="PartyAcctgPreference" value-field="partyAcctgPreference"/> |
| <log level="info" message="In getNextQuoteId partyId is [${parameters.partyId}], partyAcctgPreference: ${partyAcctgPreference}"/> |
| |
| <if-not-empty field="partyAcctgPreference"> |
| <get-related-one relation-name="QuoteCustomMethod" value-field="partyAcctgPreference" to-value-field="customMethod"/> |
| <else> |
| <property-to-field field="errorPartyPerf" resource="AccountingErrorUiLabels" property="AccountingPartyAcctgPreferenceNotDefine"/> |
| <log level="warning" message="errorPartyPerf" /> |
| </else> |
| |
| </if-not-empty> |
| |
| <if-not-empty field="customMethod"> |
| <set field="customMethodName" from-field="customMethod.customMethodName"/> |
| <else><!-- retreive service from deprecated enumeration --> |
| <if-compare operator="equals" value="QUOSQ_ENF_SEQ" field="partyAcctgPreference.oldQuoteSequenceEnumId"> |
| <set field="customMethodName" value="quoteSequence-enforced"/> |
| </if-compare> |
| </else> |
| </if-not-empty> |
| |
| <if-not-empty field="customMethod"> |
| <set-service-fields service-name="${customMethodName}" map="parameters" to-map="customMethodMap"/> |
| <set field="customMethodMap.partyId" from-field="parameters.partyId"/> |
| <set field="customMethodMap.partyAcctgPreference" from-field="partyAcctgPreference"/> |
| <call-service service-name="${customMethodName}" in-map-name="customMethodMap"> |
| <result-to-field result-name="quoteId" field="quoteIdTemp"/> |
| </call-service> |
| <else> |
| <!-- <log level="info" message="In getNextQuoteId sequence by Standard"/> --> |
| <!-- default to the default sequencing: QTESQ_STANDARD --> |
| <set from-field="parameters.quoteId" field="quoteIdTemp"/> |
| <if-empty field="quoteIdTemp"> |
| <sequenced-id sequence-name="Quote" field="quoteIdTemp"/> |
| <else> |
| <!-- check the provided ID --> |
| <check-id field="quoteIdTemp"/> |
| <check-errors/> |
| </else> |
| </if-empty> |
| </else> |
| </if-not-empty> |
| |
| <!-- use quoteIdTemp along with the quoteIdPrefix to create the real ID --> |
| <set field="quoteId" value="${partyAcctgPreference.quoteIdPrefix}${quoteIdTemp}"/> |
| <field-to-result field="quoteId" result-name="quoteId"/> |
| </simple-method> |
| |
| <simple-method method-name="quoteSequence-enforced" short-description="Enforced Sequence (no gaps, per organization)"> |
| <log level="info" message="In getNextQuoteId sequence enum Enforced"/> |
| <set field="partyAcctgPreference" from-field="parameters.partyAcctgPreference"/> |
| <!-- this is sequential sequencing, we can't skip a number, also it must be a unique sequence per partyIdFrom --> |
| |
| <if-not-empty field="partyAcctgPreference.lastQuoteNumber"> |
| <calculate field="partyAcctgPreference.lastQuoteNumber" type="Long"> |
| <calcop operator="add" field="partyAcctgPreference.lastQuoteNumber"/> |
| <number value="1"/> |
| </calculate> |
| <else> |
| <calculate field="partyAcctgPreference.lastQuoteNumber" type="Long"><number value="1"/></calculate> |
| </else> |
| </if-not-empty> |
| |
| <store-value value-field="partyAcctgPreference"/> |
| <set from-field="partyAcctgPreference.lastQuoteNumber" field="quoteId"/> |
| <field-to-result field="quoteId" result-name="quoteId"/> |
| </simple-method> |
| |
| <!-- create a new Quote --> |
| <simple-method method-name="createQuote" short-description="Create a Quote"> |
| <if> |
| <condition> |
| <and> |
| <not><if-empty field="parameters.partyId"/></not> |
| <not><if-compare-field field="parameters.partyId" to-field="userLogin.partyId" operator="equals"/></not> |
| <not><if-has-permission permission="ORDERMGR" action="_CREATE"/></not> |
| </and> |
| </condition> |
| <then> |
| <add-error> |
| <fail-property resource="OrderErrorUiLabels" property="OrderSecurityErrorToRunCreateQuote"/> |
| </add-error> |
| </then> |
| </if> |
| <check-errors/> |
| <!-- create new entity and create all the fields --> |
| <make-value value-field="newEntity" entity-name="Quote"/> |
| <set-nonpk-fields map="parameters" value-field="newEntity"/> |
| <if-empty field="newEntity.statusId"> |
| <set value="QUO_CREATED" field="newEntity.statusId"/> |
| </if-empty> |
| |
| <!-- create a non existing ID; if we have a productStoreId do it for the payToPartyId of that ProductStore according to PartyAcctgPreferences, otherwise get from standard sequence --> |
| <entity-one entity-name="ProductStore" value-field="productStore"/> |
| <if-not-empty field="productStore.payToPartyId"> |
| <set-service-fields service-name="getNextQuoteId" to-map="getNextQuoteIdContext" map="parameters"/> |
| <set field="getNextQuoteIdContext.partyId" from-field="productStore.payToPartyId"/> |
| <call-service service-name="getNextQuoteId" in-map-name="getNextQuoteIdContext"> |
| <result-to-field result-name="quoteId" field="newEntity.quoteId"/> |
| </call-service> |
| <else> |
| <sequenced-id sequence-name="Quote" field="newEntity.quoteId"/> |
| </else> |
| </if-not-empty> |
| <field-to-result field="newEntity.quoteId" result-name="quoteId"/> |
| |
| <!-- finally create the record (should not exist already)--> |
| <create-value value-field="newEntity"/> |
| |
| <!-- If the logged in partyId that is creating the quote is not equal to the partyId |
| then we associate it to the quote as the request taker. |
| This is not done if they are the same e.g. a logged in customer that is creating a quote for its |
| own sake. --> |
| <if-compare-field field="parameters.partyId" to-field="userLogin.partyId" operator="not-equals"> |
| <set from-field="newEntity.quoteId" field="takerMap.quoteId"/> |
| <set from-field="userLogin.partyId" field="takerMap.partyId"/> |
| <set value="REQ_TAKER" field="takerMap.roleTypeId"/> |
| <call-service service-name="createQuoteRole" in-map-name="takerMap"/> |
| </if-compare-field> |
| |
| <check-errors/> |
| </simple-method> |
| |
| <!-- update an existing Quote --> |
| <simple-method method-name="updateQuote" short-description="Update an existing Quote"> |
| <check-permission permission="ORDERMGR" action="_UPDATE"> |
| <fail-property resource="OrderErrorUiLabels" property="OrderSecurityErrorToRunUpdateQuote"/> |
| </check-permission> |
| <check-errors/> |
| <entity-one entity-name="Quote" value-field="quote" auto-field-map="true"/> |
| <check-errors/> |
| <if-empty field="parameters.statusId"> |
| <set field="parameters.statusId" from-field="quote.statusId"/> |
| </if-empty> |
| <if-compare-field field="quote.statusId" to-field="parameters.statusId" operator="not-equals"> |
| <!-- check if the status change is a valid change --> |
| <entity-and entity-name="StatusValidChange" list="validChange"> |
| <field-map field-name="statusId" from-field="quote.statusId"/> |
| <field-map field-name="statusIdTo" from-field="parameters.statusId"/> |
| </entity-and> |
| |
| <if-empty field="validChange"> |
| <add-error> |
| <fail-property resource="OrderErrorUiLabels" property="OrderQuoteStatusChangeIsNotValid"/> |
| </add-error> |
| <log level="error" message="The status change from ${quote.statusId} to ${parameters.statusId} is not a valid change"/> |
| <check-errors/> |
| </if-empty> |
| </if-compare-field> |
| <set-nonpk-fields map="parameters" value-field="quote"/> |
| <store-value value-field="quote"/> |
| <check-errors/> |
| </simple-method> |
| |
| <!-- copy an existing Quote --> |
| <simple-method method-name="copyQuote" short-description="Copy an existing Quote"> |
| <check-permission permission="ORDERMGR" action="_CREATE"> |
| <fail-property resource="OrderErrorUiLabels" property="OrderSecurityErrorToRunCopyQuote"/> |
| </check-permission> |
| <check-errors/> |
| <entity-one entity-name="Quote" value-field="quote" auto-field-map="true"/> |
| <check-errors/> |
| <set-service-fields service-name="createQuote" to-map="createQuoteInMap" map="quote"/> |
| <clear-field field="createQuoteInMap.statusId"/> |
| <call-service service-name="createQuote" in-map-name="createQuoteInMap"> |
| <result-to-field result-name="quoteId" field="quoteIdTo"/> |
| </call-service> |
| <field-to-result field="quoteIdTo" result-name="quoteId"/> |
| <if-compare field="parameters.copyQuoteItems" value="Y" operator="equals"> |
| <get-related value-field="quote" relation-name="QuoteItem" list="quoteItems"/> |
| <iterate list="quoteItems" entry="quoteItem"> |
| <clear-field field="createQuoteItemInMap"/> |
| <set-service-fields service-name="createQuoteItem" to-map="createQuoteItemInMap" map="quoteItem"/> |
| <set from-field="quoteIdTo" field="createQuoteItemInMap.quoteIdTo"/> |
| <set from-field="parameters.copyQuoteAdjustments" field="createQuoteItemInMap.copyQuoteAdjustments"/> |
| <call-service service-name="copyQuoteItem" in-map-name="createQuoteItemInMap"/> |
| </iterate> |
| </if-compare> |
| |
| <if-compare field="parameters.copyQuoteAdjustments" value="Y" operator="equals"> |
| <get-related value-field="quote" relation-name="QuoteAdjustment" list="quoteAdjustments"/> |
| <iterate list="quoteAdjustments" entry="quoteAdjustment"> |
| <if-empty field="quoteAdjustment.quoteItemSeqId"> |
| <clear-field field="createQuoteAdjustmentInMap"/> |
| <set-service-fields service-name="createQuoteAdjustment" to-map="createQuoteAdjustmentInMap" map="quoteAdjustment"/> |
| <set from-field="quoteIdTo" field="createQuoteAdjustmentInMap.quoteId"/> |
| <call-service service-name="createQuoteAdjustment" in-map-name="createQuoteAdjustmentInMap"/> |
| </if-empty> |
| </iterate> |
| </if-compare> |
| |
| <if-compare field="parameters.copyQuoteRoles" value="Y" operator="equals"> |
| <get-related value-field="quote" relation-name="QuoteRole" list="quoteRoles"/> |
| <iterate list="quoteRoles" entry="quoteRole"> |
| <if-compare field="quoteRole.roleTypeId" value="REQ_TAKER" operator="not-equals"> |
| <clear-field field="createQuoteRoleInMap"/> |
| <set-service-fields service-name="createQuoteRole" to-map="createQuoteRoleInMap" map="quoteRole"/> |
| <set from-field="quoteIdTo" field="createQuoteRoleInMap.quoteId"/> |
| <call-service service-name="createQuoteRole" in-map-name="createQuoteRoleInMap"/> |
| </if-compare> |
| </iterate> |
| </if-compare> |
| |
| <if-compare field="parameters.copyQuoteAttributes" value="Y" operator="equals"> |
| <get-related value-field="quote" relation-name="QuoteAttribute" list="quoteAttributes"/> |
| <iterate list="quoteAttributes" entry="quoteAttribute"> |
| <clear-field field="createQuoteAttributeInMap"/> |
| <set-service-fields service-name="createQuoteAttribute" to-map="createQuoteAttributeInMap" map="quoteAttribute"/> |
| <set from-field="quoteIdTo" field="createQuoteAttributeInMap.quoteId"/> |
| <call-service service-name="createQuoteAttribute" in-map-name="createQuoteAttributeInMap"/> |
| </iterate> |
| </if-compare> |
| |
| <if-compare field="parameters.copyQuoteCoefficients" value="Y" operator="equals"> |
| <get-related value-field="quote" relation-name="QuoteCoefficient" list="quoteCoefficients"/> |
| <iterate list="quoteCoefficients" entry="quoteCoefficient"> |
| <clear-field field="createQuoteCoefficientInMap"/> |
| <set-service-fields service-name="createQuoteCoefficient" to-map="createQuoteCoefficientInMap" map="quoteCoefficient"/> |
| <set from-field="quoteIdTo" field="createQuoteCoefficientInMap.quoteId"/> |
| <call-service service-name="createQuoteCoefficient" in-map-name="createQuoteCoefficientInMap"/> |
| </iterate> |
| </if-compare> |
| <if-compare field="parameters.copyQuoteTerms" value="Y" operator="equals"> |
| <get-related value-field="quote" relation-name="QuoteTerm" list="quoteTerms"/> |
| <iterate list="quoteTerms" entry="quoteTerm"> |
| <clear-field field="createQuoteTermInMap"/> |
| <set-service-fields service-name="createQuoteTerm" to-map="createQuoteTermInMap" map="quoteTerm"/> |
| <set from-field="quoteIdTo" field="createQuoteTermInMap.quoteId"/> |
| <call-service service-name="createQuoteTerm" in-map-name="createQuoteTermInMap"/> |
| </iterate> |
| </if-compare> |
| |
| <check-errors/> |
| </simple-method> |
| <simple-method method-name="checkUpdateQuoteStatus" short-description="Set the Quote status to ordered."> |
| <check-permission permission="ORDERMGR" action="_UPDATE"> |
| <fail-property resource="OrderErrorUiLabels" property="OrderSecurityErrorToRunCheckUpdateQuoteStatus"/> |
| </check-permission> |
| <check-errors/> |
| <entity-one entity-name="Quote" value-field="quote" auto-field-map="true"/> |
| <check-errors/> |
| <set field="quote.statusId" value="QUO_ORDERED"/> |
| <store-value value-field="quote"/> |
| <check-errors/> |
| </simple-method> |
| |
| <!-- create a new QuoteRole --> |
| <simple-method method-name="createQuoteRole" short-description="Create a QuoteRole"> |
| <check-permission permission="ORDERMGR" action="_CREATE"> |
| <fail-property resource="OrderErrorUiLabels" property="OrderErrorCreatePermissionError"/> |
| </check-permission> |
| <check-errors/> |
| <set from-field="parameters.partyId" field="lookupPKMap.partyId"/> |
| <set from-field="parameters.roleTypeId" field="lookupPKMap.roleTypeId"/> |
| <find-by-primary-key entity-name="PartyRole" map="lookupPKMap" value-field="partyRole"/> |
| <if-empty field="partyRole.partyId"> |
| <make-value value-field="partyRole" entity-name="PartyRole"/> |
| <set-pk-fields map="lookupPKMap" value-field="partyRole"/> |
| <create-value value-field="partyRole"/> |
| </if-empty> |
| <!-- create new entity and create all the fields --> |
| <make-value value-field="newEntity" entity-name="QuoteRole"/> |
| <set-pk-fields map="parameters" value-field="newEntity"/> |
| <create-value value-field="newEntity"/> |
| <check-errors/> |
| </simple-method> |
| |
| <!-- remove an existing QuoteRole --> |
| <simple-method method-name="removeQuoteRole" short-description="Remove an existing QuoteRole"> |
| <check-permission permission="ORDERMGR" action="_DELETE"> |
| <fail-property resource="OrderErrorUiLabels" property="OrderErrorDeletePermissionError"/> |
| </check-permission> |
| <check-errors/> |
| <entity-one entity-name="QuoteRole" value-field="quoteRole" auto-field-map="true"/> |
| <check-errors/> |
| <remove-value value-field="quoteRole"/> |
| <check-errors/> |
| </simple-method> |
| |
| <!-- create a new QuoteItem --> |
| <simple-method method-name="createQuoteItem" short-description="Create a QuoteItem"> |
| <entity-one entity-name="Quote" value-field="quote" auto-field-map="true"/> |
| <if> |
| <condition> |
| <and> |
| <not><if-empty field="quote.partyId"/></not> |
| <not><if-compare-field field="quote.partyId" to-field="userLogin.partyId" operator="equals"/></not> |
| <not><if-has-permission permission="ORDERMGR" action="_CREATE"/></not> |
| </and> |
| </condition> |
| <then> |
| <add-error> |
| <fail-property resource="OrderErrorUiLabels" property="OrderSecurityErrorToRunCreateQuoteItem"/> |
| </add-error> |
| </then> |
| </if> |
| |
| <check-errors/> |
| <!-- create new entity and create all the fields --> |
| <make-value value-field="newEntity" entity-name="QuoteItem"/> |
| <set-nonpk-fields map="parameters" value-field="newEntity"/> |
| |
| <set from-field="parameters.quoteId" field="newEntity.quoteId"/> |
| <set from-field="parameters.quoteItemSeqId" field="newEntity.quoteItemSeqId"/> |
| <if-empty field="newEntity.quoteItemSeqId"> |
| <!-- create a non existing ID --> |
| <make-next-seq-id value-field="newEntity" seq-field-name="quoteItemSeqId"/> |
| <set from-field="quoteItemSeqId" field="newEntity.quoteItemSeqId"/> |
| </if-empty> |
| <field-to-result field="newEntity.quoteId" result-name="quoteId"/> |
| <field-to-result field="newEntity.quoteItemSeqId" result-name="quoteItemSeqId"/> |
| |
| <!-- if there is no price and a productItem is supplied fill the price from the product record --> |
| <if-empty field="parameters.quoteUnitPrice"> |
| <if-not-empty field="parameters.productId"> |
| <entity-one entity-name="Product" value-field="product"/> |
| <if-compare operator="equals" value="Y" field="product.isVirtual"> |
| <add-error> |
| <fail-property resource="OrderErrorUiLabels" property="OrderCannotAddVirtualProductToQuote"/> |
| </add-error> |
| </if-compare> |
| <if> |
| <condition> |
| <and> |
| <if-compare operator="equals" value="AGGREGATED" field="product.productTypeId"></if-compare> |
| <not><if-empty field="parameters.configId"></if-empty></not> |
| </and> |
| </condition> |
| <then> |
| <call-class-method class-name="org.ofbiz.product.config.ProductConfigWorker" method-name="loadProductConfigWrapper" ret-field="configWrapper"> |
| <field field="delegator" type="org.ofbiz.entity.Delegator"/> |
| <field field="dispatcher" type="org.ofbiz.service.LocalDispatcher"/> |
| <field field="parameters.configId" type="java.lang.String"/> |
| <field field="parameters.productId" type="java.lang.String"/> |
| <field field="" type="java.lang.String"/> |
| <field field="" type="java.lang.String"/> |
| <field field="" type="java.lang.String"/> |
| <field field="" type="java.lang.String"/> |
| <field field="locale" type="java.util.Locale"/> |
| <field field="userLogin" type="org.ofbiz.entity.GenericValue"/> |
| </call-class-method> |
| <call-object-method method-name="getTotalPrice" obj-field="configWrapper" ret-field="totalPrice"></call-object-method> |
| <set field="newEntity.quoteUnitPrice" from-field="totalPrice"/> |
| </then> |
| <else> |
| <set from-field="product" field="calculateProductPriceMap.product"/> |
| <set from-field="parameters.quantity" field="calculateProductPriceMap.quantity"/> |
| <if-not-empty field="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="newEntity.quoteUnitPrice"/> |
| </call-service> |
| </else> |
| </if> |
| </if-not-empty> |
| </if-empty> |
| |
| <!-- finally create the record (should not exist already)--> |
| <create-value value-field="newEntity"/> |
| <check-errors/> |
| </simple-method> |
| |
| <!-- update an existing QuoteItem --> |
| <simple-method method-name="updateQuoteItem" short-description="Update an existing QuoteItem"> |
| <check-permission permission="ORDERMGR" action="_UPDATE"> |
| <fail-property resource="OrderErrorUiLabels" property="OrderSecurityErrorToRunUpdateQuoteItem"/> |
| </check-permission> |
| <check-errors/> |
| <entity-one entity-name="QuoteItem" value-field="quoteItem" auto-field-map="true"/> |
| <check-errors/> |
| <set-nonpk-fields map="parameters" value-field="quoteItem"/> |
| <store-value value-field="quoteItem"/> |
| <check-errors/> |
| </simple-method> |
| |
| <!-- remove an quoteItem --> |
| <simple-method method-name="removeQuoteItem" short-description="Remove a QuoteItem"> |
| <check-permission permission="ORDERMGR" action="_DELETE"> |
| <fail-property resource="OrderErrorUiLabels" property="OrderSecurityErrorToRunRemoveQuoteItem"/> |
| </check-permission> |
| <check-errors/> |
| <entity-and list="quoteTermList" entity-name="QuoteTerm"> |
| <field-map field-name="quoteId" from-field="parameters.quoteId"/> |
| <field-map field-name="quoteItemSeqId" from-field="parameters.quoteItemSeqId"/> |
| </entity-and> |
| <if-not-empty field="quoteTermList"> |
| <remove-list list="quoteTermList"/> |
| </if-not-empty> |
| <entity-one entity-name="QuoteItem" value-field="quoteItem" auto-field-map="true"/> |
| <remove-related value-field="quoteItem" relation-name="QuoteAdjustment"/> |
| <check-errors/> |
| <remove-value value-field="quoteItem"/> |
| </simple-method> |
| |
| <!-- copy an existing QuoteItem --> |
| <simple-method method-name="copyQuoteItem" short-description="Copy an existing QuoteItem"> |
| <check-permission permission="ORDERMGR" action="_CREATE"> |
| <fail-property resource="OrderErrorUiLabels" property="OrderSecurityErrorToRunCopyQuoteItem"/> |
| </check-permission> |
| <check-errors/> |
| <entity-one entity-name="QuoteItem" value-field="quoteItem" auto-field-map="true"/> |
| <check-errors/> |
| |
| <set-service-fields service-name="createQuoteItem" to-map="createQuoteItemInMap" map="quoteItem"/> |
| <set from-field="parameters.quoteIdTo" field="createQuoteItemInMap.quoteId"/> |
| <set from-field="parameters.quoteItemSeqId" field="createQuoteItemInMap.quoteItemSeqId"/> |
| <if-empty field="parameters.quoteIdTo"> |
| <if-empty field="parameters.quoteItemSeqIdTo"> |
| <clear-field field="createQuoteItemInMap.quoteItemSeqId"/> |
| </if-empty> |
| </if-empty> |
| |
| <call-service service-name="createQuoteItem" in-map-name="createQuoteItemInMap"> |
| <result-to-field result-name="quoteId" field="quoteIdTo"/> |
| <result-to-field result-name="quoteItemSeqId" field="quoteItemSeqId"/> |
| </call-service> |
| |
| <check-errors/> |
| |
| <if-compare field="parameters.copyQuoteAdjustments" value="Y" operator="equals"> |
| <get-related value-field="quoteItem" relation-name="QuoteAdjustment" list="quoteAdjustments"/> |
| <iterate list="quoteAdjustments" entry="quoteAdjustment"> |
| <clear-field field="createQuoteAdjustmentInMap"/> |
| <set-service-fields service-name="createQuoteAdjustment" to-map="createQuoteAdjustmentInMap" map="quoteAdjustment"/> |
| <set from-field="quoteIdTo" field="createQuoteAdjustmentInMap.quoteId"/> |
| <set from-field="quoteItemSeqId" field="createQuoteAdjustmentInMap.quoteItemSeqId"/> |
| <call-service service-name="createQuoteAdjustment" in-map-name="createQuoteAdjustmentInMap"/> |
| </iterate> |
| </if-compare> |
| |
| <check-errors/> |
| </simple-method> |
| |
| <!-- create a new QuoteAttribute --> |
| <simple-method method-name="createQuoteAttribute" short-description="Create a QuoteAttribute"> |
| <check-permission permission="ORDERMGR" action="_CREATE"> |
| <fail-property resource="OrderErrorUiLabels" property="OrderSecurityErrorToRunCreateQuoteAttribute"/> |
| </check-permission> |
| <check-errors/> |
| <!-- create new entity and create all the fields --> |
| <make-value value-field="newEntity" entity-name="QuoteAttribute"/> |
| <set-pk-fields map="parameters" value-field="newEntity"/> |
| <set-nonpk-fields map="parameters" value-field="newEntity"/> |
| <create-value value-field="newEntity"/> |
| <check-errors/> |
| </simple-method> |
| |
| <!-- update an existing QuoteAttribute --> |
| <simple-method method-name="updateQuoteAttribute" short-description="Update an existing QuoteAttribute"> |
| <check-permission permission="ORDERMGR" action="_UPDATE"> |
| <fail-property resource="OrderErrorUiLabels" property="OrderSecurityErrorToRunUpdateQuoteAttribute"/> |
| </check-permission> |
| <check-errors/> |
| <entity-one entity-name="QuoteAttribute" value-field="quoteAttribute" auto-field-map="true"/> |
| <check-errors/> |
| <set-nonpk-fields map="parameters" value-field="quoteAttribute"/> |
| <store-value value-field="quoteAttribute"/> |
| <check-errors/> |
| </simple-method> |
| |
| <!-- remove an existing QuoteAttribute --> |
| <simple-method method-name="removeQuoteAttribute" short-description="Remove an existing QuoteAttribute"> |
| <check-permission permission="ORDERMGR" action="_DELETE"> |
| <fail-property resource="OrderErrorUiLabels" property="OrderSecurityErrorToRunRemoveQuoteAttribute"/> |
| </check-permission> |
| <check-errors/> |
| <entity-one entity-name="QuoteAttribute" value-field="quoteAttribute" auto-field-map="true"/> |
| <check-errors/> |
| <remove-value value-field="quoteAttribute"/> |
| <check-errors/> |
| </simple-method> |
| |
| <!-- create a new QuoteCoefficient --> |
| <simple-method method-name="createQuoteCoefficient" short-description="Create a QuoteCoefficient"> |
| <check-permission permission="ORDERMGR" action="_CREATE"> |
| <fail-property resource="OrderErrorUiLabels" property="OrderSecurityErrorToRunCreateQuoteCoefficient"/> |
| </check-permission> |
| <check-errors/> |
| <!-- create new entity and create all the fields --> |
| <make-value value-field="newEntity" entity-name="QuoteCoefficient"/> |
| <set-pk-fields map="parameters" value-field="newEntity"/> |
| <set-nonpk-fields map="parameters" value-field="newEntity"/> |
| <create-value value-field="newEntity"/> |
| <check-errors/> |
| </simple-method> |
| |
| <!-- update an existing QuoteCoefficient --> |
| <simple-method method-name="updateQuoteCoefficient" short-description="Update an existing QuoteCoefficient"> |
| <check-permission permission="ORDERMGR" action="_UPDATE"> |
| <fail-property resource="OrderErrorUiLabels" property="OrderSecurityErrorToRunUpdateQuoteCoefficient"/> |
| </check-permission> |
| <check-errors/> |
| <entity-one entity-name="QuoteCoefficient" value-field="quoteCoefficient" auto-field-map="true"/> |
| <check-errors/> |
| <set-nonpk-fields map="parameters" value-field="quoteCoefficient"/> |
| <store-value value-field="quoteCoefficient"/> |
| <check-errors/> |
| </simple-method> |
| |
| <!-- remove an existing QuoteCoefficient --> |
| <simple-method method-name="removeQuoteCoefficient" short-description="Remove an existing QuoteCoefficient"> |
| <check-permission permission="ORDERMGR" action="_DELETE"> |
| <fail-property resource="OrderErrorUiLabels" property="OrderSecurityErrorToRunRemoveQuoteCoefficient"/> |
| </check-permission> |
| <check-errors/> |
| <entity-one entity-name="QuoteCoefficient" value-field="quoteCoefficient" auto-field-map="true"/> |
| <check-errors/> |
| <remove-value value-field="quoteCoefficient"/> |
| <check-errors/> |
| </simple-method> |
| |
| <!-- create a new Quote and QuoteItem for a given CustRequest --> |
| <simple-method method-name="createQuoteAndQuoteItemForRequest" short-description="Create a Quote"> |
| <check-permission permission="ORDERMGR" action="_CREATE"> |
| <fail-property resource="OrderErrorUiLabels" property="OrderSecurityErrorToRunCreateQuoteAndQuoteItemForRequest"/> |
| </check-permission> |
| <check-errors/> |
| <entity-one entity-name="CustRequest" value-field="custRequest" auto-field-map="true"/> |
| <entity-one entity-name="CustRequestItem" value-field="custRequestItem" auto-field-map="true"/> |
| |
| <if-empty field="custRequest"> |
| <add-error> |
| <fail-property resource="OrderErrorUiLabels" property="OrderErrorCustRequestWithIdDoesntExist"/> |
| </add-error> |
| </if-empty> |
| <check-errors/> |
| <!-- create new entity and create all the fields --> |
| <make-value value-field="newQuote" entity-name="Quote"/> |
| <make-value value-field="newQuoteItem" entity-name="QuoteItem"/> |
| <set-nonpk-fields map="parameters" value-field="newQuote"/> |
| <set-nonpk-fields map="parameters" value-field="newQuoteItem"/> |
| <if-empty field="newQuote.statusId"> |
| <set value="QUO_CREATED" field="newQuote.statusId"/> |
| </if-empty> |
| <set value="PROPOSAL" field="newQuote.quoteTypeId"/> |
| |
| <!-- create a non existing ID --> |
| <sequenced-id sequence-name="Quote" field="quoteId"/> |
| <set from-field="quoteId" field="newQuote.quoteId"/> |
| <set from-field="quoteId" field="newQuoteItem.quoteId"/> |
| <make-next-seq-id value-field="newQuoteItem" seq-field-name="quoteItemSeqId"/> |
| <field-to-result field="quoteId" result-name="quoteId"/> |
| <field-to-result field="newQuoteItem.quoteItemSeqId" result-name="quoteItemSeqId"/> |
| |
| <set from-field="custRequest.fromPartyId" field="newQuote.partyId"/> |
| <set from-field="custRequest.custRequestName" field="newQuote.quoteName"/> |
| <set from-field="custRequest.description" field="newQuote.description"/> |
| <set from-field="custRequest.maximumAmountUomId" field="newQuote.currencyUomId"/> |
| <set from-field="custRequest.productStoreId" field="newQuote.productStoreId"/> |
| <set from-field="custRequest.salesChannelEnumId" field="newQuote.salesChannelEnumId"/> |
| <set from-field="custRequestItem.story" field="newQuoteItem.comments"/> |
| <create-value value-field="newQuote"/> |
| <create-value value-field="newQuoteItem"/> |
| <!-- copy the roles from the request to the quote--> |
| <make-value value-field="lookupRequestRole" entity-name="CustRequestParty"/> |
| <set from-field="parameters.custRequestId" field="lookupRequestRole.custRequestId"/> |
| <find-by-and entity-name="CustRequestParty" map="lookupRequestRole" list="roles"/> |
| <iterate entry="role" list="roles"> |
| <clear-field field="cqrContext"/> |
| <set from-field="quoteId" field="cqrContext.quoteId"/> |
| <set from-field="role.partyId" field="cqrContext.partyId"/> |
| <set from-field="role.roleTypeId" field="cqrContext.roleTypeId"/> |
| <call-service service-name="createQuoteRole" in-map-name="cqrContext"></call-service> |
| </iterate> |
| <check-errors/> |
| </simple-method> |
| <simple-method method-name="autoUpdateQuotePrice" short-description="Auto update a QuoteItem price"> |
| <check-permission permission="ORDERMGR" action="_UPDATE"> |
| <fail-property resource="OrderErrorUiLabels" property="OrderSecurityErrorToRunAutoUpdateQuotePrice"/> |
| </check-permission> |
| <check-errors/> |
| <entity-one entity-name="QuoteItem" value-field="quoteItem" auto-field-map="true"/> |
| <check-errors/> |
| <if-not-empty field="parameters.manualQuoteUnitPrice"> |
| <set from-field="parameters.manualQuoteUnitPrice" field="quoteItem.quoteUnitPrice"/> |
| </if-not-empty> |
| <if-empty field="parameters.manualQuoteUnitPrice"> |
| <if-not-empty field="parameters.defaultQuoteUnitPrice"> |
| <set from-field="parameters.defaultQuoteUnitPrice" field="quoteItem.quoteUnitPrice"/> |
| </if-not-empty> |
| <!-- |
| <calculate field="quoteItem.quoteUnitPrice"> |
| <calcop operator="multiply"> |
| <calcop operator="get" field="parameters.averageCost"/> |
| <calcop operator="get" field="parameters.costToPriceMult"/> |
| </calcop> |
| </calculate> |
| --> |
| </if-empty> |
| <store-value value-field="quoteItem"/> |
| <check-errors/> |
| <field-to-request field="quoteItem.quoteId" request-name="quoteId"/> |
| </simple-method> |
| <simple-method method-name="autoCreateQuoteAdjustments" short-description="Auto create QuoteAdjustments"> |
| <check-permission permission="ORDERMGR" action="_CREATE"> |
| <fail-property resource="OrderErrorUiLabels" property="OrderSecurityErrorToRunAutoCreateQuoteAdjustments"/> |
| </check-permission> |
| <check-errors/> |
| <entity-one entity-name="Quote" value-field="quote" auto-field-map="true"/> |
| <!-- all existing promo quote items are removed --> |
| <get-related value-field="quote" relation-name="QuoteItem" list="quoteItems"/> |
| <iterate list="quoteItems" entry="quoteItem"> |
| <if-compare field="quoteItem.isPromo" value="Y" operator="equals"> |
| <clear-field field="removeQuoteItemInMap"/> |
| <set-service-fields service-name="removeQuoteItem" to-map="removeQuoteItemInMap" map="parameters"/> |
| <set from-field="quoteItem.quoteItemSeqId" field="removeQuoteItemInMap.quoteItemSeqId"/> |
| <call-service service-name="removeQuoteItem" in-map-name="removeQuoteItemInMap"/> |
| </if-compare> |
| </iterate> |
| <!-- all existing auto quote adjustments are removed --> |
| <get-related value-field="quote" relation-name="QuoteAdjustment" list="quoteAdjustments"/> |
| <iterate list="quoteAdjustments" entry="quoteAdjustment"> |
| <!-- make sure this is not a manual adjustments --> |
| <if-not-empty field="quoteAdjustment.productPromoId"> |
| <clear-field field="removeQuoteAdjustmentInMap"/> |
| <set-service-fields service-name="removeQuoteAdjustment" to-map="removeQuoteAdjustmentInMap" map="parameters"/> |
| <set from-field="quoteAdjustment.quoteAdjustmentId" field="removeQuoteAdjustmentInMap.quoteAdjustmentId"/> |
| <call-service service-name="removeQuoteAdjustment" in-map-name="removeQuoteAdjustmentInMap"/> |
| </if-not-empty> |
| </iterate> |
| <set-service-fields service-name="loadCartFromQuote" to-map="loadCartFromQuoteInMap" map="parameters"/> |
| <set value="false" field="loadCartFromQuoteInMap.applyQuoteAdjustments"/> |
| <call-service service-name="loadCartFromQuote" in-map-name="loadCartFromQuoteInMap"> |
| <result-to-field result-name="shoppingCart" field="cart"/> |
| </call-service> |
| |
| <call-object-method obj-field="cart" method-name="items" ret-field="items"/> |
| <iterate list="items" entry="item"> |
| <call-object-method obj-field="item" method-name="getOrderItemSeqId" ret-field="orderItemSeqId"/> |
| <if-empty field="orderItemSeqId"> |
| <!-- this is a new (promo) item --> |
| <!-- a new quote item is created --> |
| <clear-field field="createQuoteItemInMap"/> |
| <set-service-fields service-name="createQuoteItem" to-map="createQuoteItemInMap" map="parameters"/> |
| <call-object-method obj-field="item" method-name="getProductId" ret-field="createQuoteItemInMap.productId"/> |
| <call-object-method obj-field="item" method-name="getQuantity" ret-field="createQuoteItemInMap.quantity"/> |
| <set value="Y" field="createQuoteItemInMap.isPromo"/> |
| <call-service service-name="createQuoteItem" in-map-name="createQuoteItemInMap"> |
| <result-to-field result-name="quoteItemSeqId" field="quoteItemSeqId"/> |
| </call-service> |
| <!-- and the quoteItemSeqId is assigned to the shopping cart item (as orderItemSeqId) --> |
| <call-object-method obj-field="item" method-name="setOrderItemSeqId"> |
| <field field="quoteItemSeqId" type="String"/> |
| </call-object-method> |
| <call-object-method obj-field="item" method-name="getOrderItemSeqId" ret-field="newOrderItemSeqId"/> |
| </if-empty> |
| </iterate> |
| <!-- set the quoteUnitPrice from the item basePrice --> |
| <get-related value-field="quote" relation-name="QuoteItem" list="quoteItems"/> |
| <iterate list="quoteItems" entry="quoteItem"> |
| <if> |
| <condition> |
| <or> |
| <if-empty field="quoteItem.quoteUnitPrice"/> |
| <if-compare field="quoteItem.quoteUnitPrice" value="0" operator="equals" type="BigDecimal"/> |
| </or> |
| </condition> |
| <then> |
| <call-object-method obj-field="cart" method-name="findCartItem" ret-field="item"> |
| <field field="quoteItem.quoteItemSeqId" type="String"/> |
| </call-object-method> |
| <clear-field field="updateQuoteItemInMap"/> |
| <set from-field="quoteItem.quoteId" field="updateQuoteItemInMap.quoteId"/> |
| <set from-field="quoteItem.quoteItemSeqId" field="updateQuoteItemInMap.quoteItemSeqId"/> |
| <call-object-method obj-field="item" method-name="getBasePrice" ret-field="updateQuoteItemInMap.quoteUnitPrice"/> |
| <call-service service-name="updateQuoteItem" in-map-name="updateQuoteItemInMap"/> |
| </then> |
| </if> |
| </iterate> |
| |
| <call-object-method obj-field="cart" method-name="makeAllQuoteAdjustments" ret-field="adjustments"/> |
| |
| <iterate list="adjustments" entry="adjustment"> |
| <set from-field="parameters.quoteId" field="adjustment.quoteId"/> |
| <sequenced-id sequence-name="QuoteAdjustment" field="adjustment.quoteAdjustmentId"/> |
| <create-value value-field="adjustment"/> |
| </iterate> |
| </simple-method> |
| <simple-method method-name="createQuoteAdjustment" short-description="Create a QuoteAdjustment"> |
| <check-permission permission="ORDERMGR" action="_CREATE"> |
| <fail-property resource="OrderErrorUiLabels" property="OrderSecurityErrorToRunCreateQuoteAdjustment"/> |
| </check-permission> |
| <check-errors/> |
| |
| <make-value value-field="newEntity" entity-name="QuoteAdjustment"/> |
| <set-nonpk-fields map="parameters" value-field="newEntity"/> |
| |
| <sequenced-id sequence-name="QuoteAdjustment" field="quoteAdjustmentId"/> |
| <now-timestamp field="newEntity.createdDate"/> |
| <set from-field="quoteAdjustmentId" field="newEntity.quoteAdjustmentId"/> |
| <set from-field="userLogin.userLoginId" field="newEntity.createdByUserLogin"/> |
| <field-to-result field="quoteAdjustmentId" result-name="quoteAdjustmentId"/> |
| |
| <create-value value-field="newEntity"/> |
| </simple-method> |
| <simple-method method-name="removeQuoteAdjustment" short-description="Remove an existing QuoteAdjustment"> |
| <check-permission permission="ORDERMGR" action="_DELETE"> |
| <fail-property resource="OrderErrorUiLabels" property="OrderSecurityErrorToRunRemoveQuoteAdjustment"/> |
| </check-permission> |
| <check-errors/> |
| <entity-one entity-name="QuoteAdjustment" value-field="quoteAdjustment" auto-field-map="true"/> |
| <check-errors/> |
| <remove-value value-field="quoteAdjustment"/> |
| <check-errors/> |
| </simple-method> |
| <simple-method method-name="updateQuoteAdjustment" short-description="Update an existing QuoteAdjustment"> |
| <check-permission permission="ORDERMGR" action="_UPDATE"> |
| <fail-property resource="OrderErrorUiLabels" property="OrderSecurityErrorToRunUpdateQuoteAdjustment"/> |
| </check-permission> |
| <check-errors/> |
| <entity-one entity-name="QuoteAdjustment" value-field="quoteAdjustment" auto-field-map="true"/> |
| <check-errors/> |
| <set-nonpk-fields map="parameters" value-field="quoteAdjustment"/> |
| <store-value value-field="quoteAdjustment"/> |
| <check-errors/> |
| </simple-method> |
| |
| <simple-method method-name="createQuoteFromCart" short-description="Create a Quote from a Cart"> |
| <call-object-method obj-field="parameters.cart" method-name="getPartyId" ret-field="createQuoteInMap.partyId"/> |
| <if> |
| <condition> |
| <and> |
| <not><if-empty field="createQuoteInMap.partyId"/></not> |
| <not><if-compare-field field="createQuoteInMap.partyId" to-field="userLogin.partyId" operator="equals"/></not> |
| <not><if-has-permission permission="ORDERMGR" action="_CREATE"/></not> |
| </and> |
| </condition> |
| <then> |
| <add-error><fail-property resource="OrderErrorUiLabels" property="OrderSecurityErrorToRunCreateQuoteFromCart"/></add-error> |
| </then> |
| </if> |
| <check-errors/> |
| <call-object-method obj-field="parameters.cart" method-name="getCurrency" ret-field="createQuoteInMap.currencyUomId"/> |
| <call-object-method obj-field="parameters.cart" method-name="getChannelType" ret-field="createQuoteInMap.salesChannelEnumId"/> |
| |
| <call-object-method obj-field="parameters.cart" method-name="getOrderType" ret-field="orderType"/> |
| <if-compare field="orderType" operator="equals" value="SALES_ORDER"> |
| <call-object-method obj-field="parameters.cart" method-name="getProductStoreId" ret-field="createQuoteInMap.productStoreId"/> |
| <set field="createQuoteInMap.quoteTypeId" value="PRODUCT_QUOTE"/> |
| </if-compare> |
| <if-compare field="orderType" operator="equals" value="PURCHASE_ORDER"> |
| <set field="createQuoteInMap.quoteTypeId" value="PURCHASE_QUOTE" /> |
| </if-compare> |
| |
| <set value="QUO_CREATED" field="createQuoteInMap.statusId"/> |
| <call-service service-name="createQuote" in-map-name="createQuoteInMap"> |
| <result-to-field result-name="quoteId" field="quoteId"/> |
| </call-service> |
| <entity-one entity-name="Quote" value-field="quote" auto-field-map="true"/> |
| |
| <!-- create, for every cart item, a quote item --> |
| <call-object-method obj-field="parameters.cart" method-name="items" ret-field="items"/> |
| <iterate list="items" entry="item"> |
| <!-- a new quote item is created --> |
| <clear-field field="createQuoteItemInMap"/> |
| <call-object-method obj-field="item" method-name="getIsPromo" ret-field="isPromo"/> |
| <if-compare field="isPromo" value="true" operator="equals" type="Boolean"> |
| <set value="Y" field="createQuoteItemInMap.isPromo"/> |
| </if-compare> |
| <call-object-method obj-field="item" method-name="getConfigWrapper" ret-field="configWrapper"/> |
| <if-not-empty field="configWrapper"> |
| <call-object-method obj-field="configWrapper" method-name="getConfigId" ret-field="configId"/> |
| <set from-field="configId" field="createQuoteItemInMap.configId"/> |
| </if-not-empty> |
| <if> |
| <condition> |
| <or> |
| <if-compare field="parameters.applyStorePromotions" value="N" operator="not-equals" type="String"/> |
| <if-compare field="createQuoteItemInMap.isPromo" value="Y" operator="not-equals" type="String"/> |
| </or> |
| </condition> |
| <then> |
| <set from-field="quote.quoteId" field="createQuoteItemInMap.quoteId"/> |
| <call-object-method obj-field="item" method-name="getProductId" ret-field="createQuoteItemInMap.productId"/> |
| <call-object-method obj-field="item" method-name="getQuantity" ret-field="createQuoteItemInMap.quantity"/> |
| <call-object-method obj-field="item" method-name="getSelectedAmount" ret-field="createQuoteItemInMap.selectedAmount"/> |
| <call-object-method obj-field="item" method-name="getBasePrice" ret-field="createQuoteItemInMap.quoteUnitPrice"/> |
| <call-object-method obj-field="item" method-name="getItemComment" ret-field="createQuoteItemInMap.comments"/> |
| <call-object-method obj-field="item" method-name="getReservStart" ret-field="createQuoteItemInMap.reservStart"/> |
| <call-object-method obj-field="item" method-name="getReservLength" ret-field="createQuoteItemInMap.reservLength"/> |
| <call-object-method obj-field="item" method-name="getReservPersons" ret-field="createQuoteItemInMap.reservPersons"/> |
| |
| <call-service service-name="createQuoteItem" in-map-name="createQuoteItemInMap"> |
| <result-to-field result-name="quoteItemSeqId" field="quoteItemSeqId"/> |
| </call-service> |
| <!-- and the quoteItemSeqId is assigned to the shopping cart item (as orderItemSeqId) --> |
| <call-object-method obj-field="item" method-name="setOrderItemSeqId"> |
| <field field="quoteItemSeqId" type="String"/> |
| </call-object-method> |
| </then> |
| </if> |
| </iterate> |
| |
| <if> |
| <condition> |
| <if-compare field="parameters.applyStorePromotions" value="N" operator="not-equals" type="String"/> |
| </condition> |
| <then> |
| <call-object-method obj-field="parameters.cart" method-name="makeAllQuoteAdjustments" ret-field="adjustments"/> |
| <iterate list="adjustments" entry="adjustment"> |
| <set from-field="quote.quoteId" field="adjustment.quoteId"/> |
| <sequenced-id sequence-name="QuoteAdjustment" field="adjustment.quoteAdjustmentId"/> |
| <create-value value-field="adjustment"/> |
| </iterate> |
| </then> |
| </if> |
| |
| <field-to-result field="quote.quoteId" result-name="quoteId"/> |
| </simple-method> |
| |
| <simple-method method-name="createQuoteFromShoppingList" short-description="Create a Quote from a Shopping List"> |
| <call-service service-name="loadCartFromShoppingList" in-map-name="parameters"> |
| <result-to-field result-name="shoppingCart" field="cart"/> |
| </call-service> |
| <set from-field="cart" field="createQuoteFromCartInMap.cart"/> |
| <set from-field="parameters.applyStorePromotions" field="createQuoteFromCartInMap.applyStorePromotions"/> |
| <call-service service-name="createQuoteFromCart" in-map-name="createQuoteFromCartInMap"> |
| <result-to-field result-name="quoteId" field="quoteId"/> |
| </call-service> |
| |
| <field-to-result field="quoteId" result-name="quoteId"/> |
| </simple-method> |
| |
| <simple-method method-name="createQuoteFromCustRequest" short-description="Create a Quote from a CustRequest"> |
| <check-permission permission="ORDERMGR" action="_CREATE"> |
| <fail-property resource="OrderErrorUiLabels" property="OrderSecurityErrorToRunCreateQuoteFromCustRequest"/> |
| </check-permission> |
| <check-errors/> |
| <entity-one entity-name="CustRequest" value-field="custRequest" auto-field-map="true"/> |
| <!-- error if request type not equals to RF_QUOTE or RF_PUR_QUOTE --> |
| <if> |
| <condition> |
| <and> |
| <if-compare field="custRequest.custRequestTypeId" operator="not-equals" value="RF_QUOTE"/> |
| <if-compare field="custRequest.custRequestTypeId" operator="not-equals" value="RF_PUR_QUOTE"/> |
| </and> |
| </condition> |
| <then> |
| <add-error> |
| <fail-property resource="OrderErrorUiLabels" property="OrderQuoteNotARequest"/> |
| </add-error> |
| </then> |
| </if> |
| <check-errors/> |
| |
| <set field="createQuoteInMap.partyId" from-field="custRequest.fromPartyId"/> |
| <set field="createQuoteInMap.productStoreId" from-field="custRequest.productStoreId"/> |
| <set field="createQuoteInMap.salesChannelEnumId" from-field="custRequest.salesChannelEnumId"/> |
| <set field="createQuoteInMap.quoteName" from-field="custRequest.custRequestName"/> |
| <set field="createQuoteInMap.description" from-field="custRequest.description"/> |
| <set field="createQuoteInMap.currencyUomId" from-field="custRequest.maximumAmountUomId"/> |
| <set field="createQuoteInMap.statusId" value="QUO_CREATED"/> |
| <set field="createQuoteInMap.quoteTypeId" from-field="parameters.quoteTypeId"/> |
| <!-- set the quoteType (product or purchase) --> |
| <if-empty field="createQuoteInMap.quoteTypeId"> |
| <if-compare field="custRequest.custRequestTypeId" operator="equals" value="RF_QUOTE"> |
| <set field="createQuoteInMap.quoteTypeId" value="PRODUCT_QUOTE"/> |
| <else> |
| <set field="createQuoteInMap.quoteTypeId" value="PURCHASE_QUOTE"/> |
| </else> |
| </if-compare> |
| </if-empty> |
| |
| <call-service service-name="createQuote" in-map-name="createQuoteInMap"> |
| <result-to-field result-name="quoteId" field="quoteId"/> |
| </call-service> |
| <check-errors/> |
| |
| <get-related value-field="custRequest" relation-name="CustRequestItem" list="custRequestItems"/> |
| <iterate list="custRequestItems" entry="custRequestItem"> |
| <clear-field field="createQuoteItemInMap"/> |
| <set field="createQuoteItemInMap.quoteId" from-field="quoteId"/> |
| <set field="createQuoteItemInMap.custRequestId" from-field="custRequestItem.custRequestId"/> |
| <set field="createQuoteItemInMap.custRequestItemSeqId" from-field="custRequestItem.custRequestItemSeqId"/> |
| <set field="createQuoteItemInMap.productId" from-field="custRequestItem.productId"/> |
| <set field="createQuoteItemInMap.quantity" from-field="custRequestItem.quantity"/> |
| <set field="createQuoteItemInMap.selectedAmount" from-field="custRequestItem.selectedAmount"/> |
| <set field="createQuoteItemInMap.reservStart" from-field="custRequestItem.reservStart"/> |
| <set field="createQuoteItemInMap.reservLength" from-field="custRequestItem.reservLength"/> |
| <set field="createQuoteItemInMap.reservPersons" from-field="custRequestItem.reservPersons"/> |
| <set field="createQuoteItemInMap.configId" from-field="custRequestItem.configId"/> |
| <call-service service-name="createQuoteItem" in-map-name="createQuoteItemInMap"/> |
| </iterate> |
| <!-- roles --> |
| <get-related value-field="custRequest" relation-name="CustRequestParty" list="custRequestParties"/> |
| <iterate list="custRequestParties" entry="custRequestParty"> |
| <clear-field field="createQuoteRoleInMap"/> |
| <!-- The REQ_TAKER role is automatically added by the createQuote service --> |
| <if-compare field="custRequestParty.roleTypeId" value="REQ_TAKER" operator="not-equals"> |
| <set field="createQuoteRoleInMap.quoteId" from-field="quoteId"/> |
| <set field="createQuoteRoleInMap.partyId" from-field="custRequestParty.partyId"/> |
| <set field="createQuoteRoleInMap.roleTypeId" from-field="custRequestParty.roleTypeId"/> |
| <call-service service-name="createQuoteRole" in-map-name="createQuoteRoleInMap"/> |
| </if-compare> |
| </iterate> |
| |
| <field-to-result field="quoteId" result-name="quoteId"/> |
| </simple-method> |
| |
| <!--Quote workeffort --> |
| <simple-method method-name="createQuoteWorkEffort" short-description="Create a QuoteWorkEffort"> |
| <make-value entity-name="QuoteWorkEffort" value-field="lookupMap"/> |
| <set-pk-fields map="parameters" value-field="lookupMap"/> |
| <find-by-primary-key entity-name="QuoteWorkEffort" map="lookupMap" value-field="quoteWorkEffort"/> |
| <if-not-empty field="quoteWorkEffort.quoteId"> |
| <add-error> |
| <fail-property resource="OrderErrorUiLabels" property="OrderQuoteNotAWorkEffort"/> |
| </add-error> |
| <check-errors/> |
| </if-not-empty> |
| <set-nonpk-fields map="parameters" value-field="lookupMap"/> |
| <create-value value-field="lookupMap"/> |
| <field-to-result field="lookupMap.quoteId" result-name="quoteId"/> |
| <field-to-result field="lookupMap.workEffortId" result-name="workEffortId"/> |
| </simple-method> |
| <simple-method method-name="deleteQuoteWorkEffort" short-description="Delete a QuoteWorkEffort"> |
| <make-value entity-name="QuoteWorkEffort" value-field="lookupMap"/> |
| <set-pk-fields map="parameters" value-field="lookupMap"/> |
| <find-by-primary-key entity-name="QuoteWorkEffort" map="lookupMap" value-field="quoteWorkEffort"/> |
| <if-empty field="quoteWorkEffort.quoteId"> |
| <add-error> |
| <fail-property resource="OrderErrorUiLabels" property="OrderQuoteWorkEffortDoesNotExists"/> |
| </add-error> |
| <check-errors/> |
| </if-empty> |
| <if-not-empty field="quoteWorkEffort.quoteId"> |
| <remove-value value-field="quoteWorkEffort"/> |
| </if-not-empty> |
| </simple-method> |
| <simple-method method-name="createQuoteTerm" short-description="Create a QuoteTerm"> |
| <make-value value-field="newEntity" entity-name="QuoteTerm"/> |
| <if-empty field="parameters.quoteItemSeqId"> |
| <set field="parameters.quoteItemSeqId" value="_NA_"/> |
| </if-empty> |
| <set-pk-fields map="parameters" value-field="newEntity"/> |
| <set-nonpk-fields map="parameters" value-field="newEntity"/> |
| <create-value value-field="newEntity"/> |
| </simple-method> |
| <simple-method method-name="updateQuoteTerm" short-description="Update a QuoteTerm"> |
| <make-value value-field="newEntity" entity-name="QuoteTerm"/> |
| <set-pk-fields map="parameters" value-field="newEntity"/> |
| <set-nonpk-fields map="parameters" value-field="newEntity"/> |
| <store-value value-field="newEntity"/> |
| </simple-method> |
| <simple-method method-name="deleteQuoteTerm" short-description="Delete a QuoteTerm"> |
| <make-value value-field="newEntity" entity-name="QuoteTerm"/> |
| <set-pk-fields map="parameters" value-field="newEntity"/> |
| <remove-value value-field="newEntity"/> |
| </simple-method> |
| <simple-method method-name="createQuoteNote" short-description="Create a new Note associated with a Quote"> |
| <set-service-fields service-name="createNote" map="parameters" to-map="createNoteMap"/> |
| <!-- passed in field will be noteInfo, which matches entity, but service expects field called note --> |
| <set field="createNoteMap.note" from-field="parameters.noteInfo"/> |
| <call-service service-name="createNote" in-map-name="createNoteMap"> |
| <result-to-field result-name="noteId"/> |
| </call-service> |
| <if-empty field="noteId"> |
| <add-error> |
| <fail-property resource="OrderErrorUiLabels" property="OrderProblemCreatingTheNoteNoNoteIdReturned"/> |
| </add-error> |
| </if-empty> |
| <check-errors/> |
| <make-value value-field="newQuoteNote" entity-name="QuoteNote"/> |
| <set field="newQuoteNote.quoteId" from-field="parameters.quoteId"/> |
| <set field="newQuoteNote.noteId" from-field="noteId"/> |
| <create-value value-field="newQuoteNote"/> |
| </simple-method> |
| </simple-methods> |