Hi Vikas Sorry for the delay in replying and thanks for taking the time to explain. I'm a bit busy with a few things at the moment but when I get a chance I'll take a look through the one page checkout to better understand the issue.
Thanks Scott 2008/8/2 Vikas Mayur <[EMAIL PROTECTED]>: > Hi Scott, > > The only reason that I use this way depends on how the new one page checkout > is designed. > There are couple of json requests that being called on separate forms for > shipping, billing and payment etc on one page. > This will generate a new separate context and so is the reason to put the > input values in parameters to make them available on the forms irrespective > of the context. > > Another reason I think is that we do keep values for input fields in > parameters to populate only recently filled values - if any error occur on > submitting a form. > > Also I try to understand how it is done in EditContactMech.groovy where a > tryEntity attribute is used - I am not sure if it could be used. But I could > not figure out how it is set. > > Please let me know your comments, best approach to follow - as I might be > wrong in my explanation. > > > Thanks, > Vikas > > On Sat, Aug 2, 2008 at 3:33 AM, Scott Gray <[EMAIL PROTECTED]> wrote: > >> Hi Vikas >> >> Why are the groovy scripts putting all their output variables into the >> parameters map rather than straight into the context? I only ask >> because I've converted a lot of bsh scripts to groovy and I'm not used >> to seeing that done. >> >> Thanks >> Scott >> >> 2008/8/2 <[EMAIL PROTECTED]>: >> > Author: mor >> > Date: Fri Aug 1 10:04:44 2008 >> > New Revision: 681750 >> > >> > URL: http://svn.apache.org/viewvc?rev=681750&view=rev >> > Log: >> > From now One Page Checkout supports registered process. Thanks to Sumit >> Pandit, Jyotsna Rathore, Brajesh Patel and Rishi Solanki their efforts ... >> > >> > Added: >> > >> >> ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/customer/EditBillingAddress.groovy >> (with props) >> > >> >> ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/customer/EditEmailAndTelecomNumber.groovy >> (with props) >> > >> >> ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/customer/EditShippingAddress.groovy >> (with props) >> > Modified: >> > >> >> ofbiz/trunk/applications/ecommerce/script/org/ofbiz/ecommerce/customer/CustomerEvents.xml >> > >> ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/controller.xml >> > ofbiz/trunk/applications/ecommerce/webapp/ecommerce/login.ftl >> > >> >> ofbiz/trunk/applications/ecommerce/webapp/ecommerce/order/OnePageCheckoutProcess.ftl >> > ofbiz/trunk/applications/ecommerce/widget/OrderScreens.xml >> > ofbiz/trunk/applications/order/webapp/ordermgr/entry/cart/minicart.ftl >> > >> > Modified: >> ofbiz/trunk/applications/ecommerce/script/org/ofbiz/ecommerce/customer/CustomerEvents.xml >> > URL: >> http://svn.apache.org/viewvc/ofbiz/trunk/applications/ecommerce/script/org/ofbiz/ecommerce/customer/CustomerEvents.xml?rev=681750&r1=681749&r2=681750&view=diff >> > >> ============================================================================== >> > --- >> ofbiz/trunk/applications/ecommerce/script/org/ofbiz/ecommerce/customer/CustomerEvents.xml >> (original) >> > +++ >> ofbiz/trunk/applications/ecommerce/script/org/ofbiz/ecommerce/customer/CustomerEvents.xml >> Fri Aug 1 10:04:44 2008 >> > @@ -1023,8 +1023,8 @@ >> > processor-name="shipToAddress" in-map-name="parameters" >> out-map-name="shipToAddressCtx"/> >> > <check-errors/> >> > <set field="shipToAddressCtx.partyId" from-field="partyId"/> >> > + <set field="shipToAddressCtx.contactMechPurposeTypeId" >> value="SHIPPING_LOCATION"/> >> > <if-empty field="parameters.shipToContactMechId"> >> > - <set field="shipToAddressCtx.contactMechPurposeTypeId" >> value="SHIPPING_LOCATION"/> >> > <call-service service-name="createPartyPostalAddress" >> in-map-name="shipToAddressCtx"> >> > <result-to-field result-name="contactMechId" >> field-name="parameters.shipToContactMechId"/> >> > </call-service> >> > @@ -1042,7 +1042,6 @@ >> > <set-service-fields >> service-name="deletePartyContactMechPurposeIfExists" map-name="pcmp" >> to-map-name="deletePartyContactMechPurposeCtx"/> >> > <call-service >> service-name="deletePartyContactMechPurposeIfExists" >> in-map-name="deletePartyContactMechPurposeCtx"/> >> > </if-not-empty> >> > - <set field="shipToAddressCtx.contactMechPurposeTypeId" >> value="SHIPPING_LOCATION"/> >> > <call-service service-name="createPartyPostalAddress" >> in-map-name="shipToAddressCtx"> >> > <result-to-field result-name="contactMechId" >> field-name="parameters.shipToContactMechId"/> >> > </call-service> >> > @@ -1194,130 +1193,131 @@ >> > </if-not-empty> >> > <set-current-user-login value-name="userLogin"/> >> > >> > - <!--=================== Validate Bill and Payment settings >> ================--> >> > - <call-map-processor >> xml-resource="org/ofbiz/accounting/payment/PaymentMapProcs.xml" >> > - processor-name="createCreditCard" >> in-map-name="parameters" out-map-name="creditCardContext"/> >> > + <call-simple-method method-name="createUpdateBillingAddress"/> >> > + <call-simple-method method-name="createUpdateCreditCard"/> >> > + >> > + <!--============== Set Payment Method ================--> >> > + <set field="paymentMethodId" >> from-field="parameters.paymentMethodId"/> >> > + <set field="cardSecurityCode" >> from-field="parameters.cardSecurityCode"/> >> > + <field-to-session field-name="userLogin" >> session-name="userLogin"/> >> > + <call-bsh> >> > + <![CDATA[ >> > + import org.ofbiz.order.shoppingcart.ShoppingCart; >> > + checkOutHelper = new >> org.ofbiz.order.shoppingcart.CheckOutHelper(dispatcher, delegator, >> shoppingCart); >> > + callResult = >> checkOutHelper.finalizeOrderEntryPayment(paymentMethodId, null, false, >> false); >> > + ShoppingCart.CartPaymentInfo cpi = >> shoppingCart.getPaymentInfo(paymentMethodId, null, null, null, true); >> > + cpi.securityCode = cardSecurityCode; >> > + ]]> >> > + </call-bsh> >> > + </simple-method> >> > + >> > + <simple-method method-name="createUpdateBillingAddress" >> short-description="create and update billing address"> >> > >> > <if-compare field="parameters.useShippingAddressForBilling" >> operator="not-equals" value="Y"> >> > - <set field="parameters.billToName" >> value="${parameters.firstNameOnCard} ${parameters.lastNameOnCard}"/> >> > <call-map-processor >> xml-resource="org/ofbiz/ecommerce/customer/CheckoutMapProcs.xml" >> > - processor-name="billToAddress" >> in-map-name="parameters" out-map-name="billToAddressContext"/> >> > - <map-to-map map-name="billToAddressContext" >> to-map-name="billToAddressAndCreditCardCtx"/> >> > - <map-to-map map-name="creditCardContext" >> to-map-name="billToAddressAndCreditCardCtx"/> >> > - <if-compare field="parameters.billToCountryGeoId" >> value="USA" operator="equals"> >> > - <if-empty field="parameters.billToStateProvinceGeoId"> >> > - <set field="tempErrorMessage" value="State is >> missing, and is required for an address in the United States."/> >> > - <field-to-list field-name="tempErrorMessage" >> list-name="error_list"/> >> > - </if-empty> >> > - </if-compare> >> > - <check-errors/> >> > - <set field="billToAddressAndCreditCardCtx.partyId" >> from-field="partyId"/> >> > - <set field="creditCardContext.partyId" >> from-field="partyId"/> >> > - <set field="creditCardContext.userLogin" >> from-field="userLogin"/> >> > + processor-name="billToAddress" in-map-name="parameters" >> out-map-name="billToAddressCtx"/> >> > + </if-compare> >> > + <check-errors/> >> > + <set field="billToAddressCtx.contactMechPurposeTypeId" >> value="BILLING_LOCATION"/> >> > + <set field="billToAddressCtx.partyId" from-field="partyId"/> >> > + >> > + <if-compare field="parameters.useShippingAddressForBilling" >> operator="equals" value="Y"> >> > + <set field="billToAddressCtx.contactMechId" >> from-field="parameters.shipToContactMechId"/> >> > <if-empty field="parameters.billToContactMechId"> >> > - <entity-and entity-name="PartyContactMechPurpose" >> list-name="pcmpList" filter-by-date="true"> >> > - <field-map field-name="partyId" >> env-name="userLogin.partyId"/> >> > - <field-map field-name="contactMechPurposeTypeId" >> value="BILLING_LOCATION"/> >> > - </entity-and> >> > - <first-from-list list-name="pcmpList" >> entry-name="pcmp"/> >> > - <if-not-empty field="pcmp"> >> > - <set-service-fields >> service-name="deletePartyContactMechPurposeIfExists" map-name="pcmp" >> to-map-name="deletePartyContactMechPurposeCtx"/> >> > - <call-service >> service-name="deletePartyContactMechPurposeIfExists" >> in-map-name="deletePartyContactMechPurposeCtx"/> >> > - </if-not-empty> >> > - <entity-and entity-name="PaymentMethod" >> list-name="paymentMethodList" filter-by-date="true"> >> > - <field-map field-name="partyId" >> env-name="parameters.partyId"/> >> > - <order-by field-name="-fromDate"/> >> > - </entity-and> >> > - <first-from-list list-name="paymentMethodList" >> entry-name="paymentMethod"/> >> > - <set >> field="billToAddressAndCreditCardCtx.paymentMethodId" >> from-field="paymentMethod.paymentMethodId"/> >> > - <!-- Create Credit Card and Address --> >> > - <call-service service-name="createCreditCardAndAddress" >> in-map-name="billToAddressAndCreditCardCtx"> >> > - <result-to-field result-name="contactMechId" >> field-name="parameters.billToContactMechId"/> >> > - <result-to-field result-name="paymentMethodId" >> field-name="parameters.paymentMethodId"/> >> > - </call-service> >> > + <call-service >> service-name="createPartyContactMechPurpose" >> in-map-name="billToAddressCtx"/> >> > <else> >> > - <!-- Update Credit Card and Address --> >> > - <set field="billToAddressAndCreditCardCtx.contactMechId" >> from-field="parameters.billToContactMechId"/> >> > - <set >> field="billToAddressAndCreditCardCtx.paymentMethodId" >> from-field="parameters.paymentMethodId"/> >> > - <call-service service-name="updateCreditCardAndAddress" >> in-map-name="billToAddressAndCreditCardCtx"> >> > - <result-to-field result-name="contactMechId" >> field-name="parameters.billToContactMechId"/> >> > - <result-to-field result-name="paymentMethodId" >> field-name="parameters.paymentMethodId"/> >> > - </call-service> >> > - <entity-and entity-name="PartyContactMechPurpose" >> list-name="pcmpList" filter-by-date="true"> >> > - <field-map field-name="partyId" >> env-name="userLogin.partyId"/> >> > - <field-map field-name="contactMechPurposeTypeId" >> value="BILLING_LOCATION"/> >> > - </entity-and> >> > - <first-from-list list-name="pcmpList" >> entry-name="pcmp"/> >> > - <if-compare-field field="parameters.billToContactMechId" >> operator="not-equals" to-field="pcmp.contactMechId"> >> > - <if-not-empty field="pcmp"> >> > + <if-compare-field field="parameters.shipToContactMechId" >> operator="not-equals" to-field="parameters.billToContactMechId"> >> > + <entity-and entity-name="PartyContactMechPurpose" >> list-name="pcmpList"> >> > + <field-map field-name="contactMechId" >> env-name="parameters.billToContactMechId"/> >> > + <field-map field-name="partyId" >> env-name="partyId"/> >> > + <field-map field-name="contactMechPurposeTypeId" >> value="BILLING_LOCATION"/> >> > + </entity-and> >> > + <filter-list-by-date list-name="pcmpList"/> >> > + <iterate list-name="pcmpList" entry-name="pcmp"> >> > <set-service-fields >> service-name="deletePartyContactMechPurposeIfExists" map-name="pcmp" >> to-map-name="deletePartyContactMechPurposeCtx"/> >> > <call-service >> service-name="deletePartyContactMechPurposeIfExists" >> in-map-name="deletePartyContactMechPurposeCtx"/> >> > - <set-service-fields >> service-name="deletePartyContactMech" map-name="pcmp" >> to-map-name="serviceInMap"/> >> > - <call-service >> service-name="deletePartyContactMech" in-map-name="serviceInMap"/> >> > - </if-not-empty> >> > + </iterate> >> > + <call-service >> service-name="createPartyContactMechPurpose" >> in-map-name="billToAddressCtx"/> >> > + <log level="info" message="Billing address updated >> with contactMechId ${parameters.billToContactMechId}"/> >> > </if-compare-field> >> > </else> >> > </if-empty> >> > - <field-to-request field-name="parameters.paymentMethodId" >> request-name="paymentMethodId"/> >> > - <field-to-request >> field-name="parameters.billToContactMechId" >> request-name="billToContactMechId"/> >> > + <set field="parameters.billToContactMechId" >> from-field="parameters.shipToContactMechId"/> >> > </if-compare> >> > - >> > - <if-compare field="parameters.useShippingAddressForBilling" >> operator="equals" value="Y"> >> > - <entity-and entity-name="PartyContactMechPurpose" >> list-name="pcmpList" filter-by-date="true"> >> > - <field-map field-name="partyId" >> env-name="userLogin.partyId"/> >> > - <field-map field-name="contactMechPurposeTypeId" >> value="BILLING_LOCATION"/> >> > - </entity-and> >> > - <first-from-list list-name="pcmpList" entry-name="pcmp"/> >> > - <if-compare-field field="parameters.shipToContactMechId" >> operator="not-equals" to-field="pcmp.contactMechId"> >> > - <if-not-empty field="pcmp"> >> > - <set-service-fields >> service-name="deletePartyContactMechPurposeIfExists" map-name="pcmp" >> to-map-name="deletePartyContactMechPurposeCtx"/> >> > - <call-service >> service-name="deletePartyContactMechPurposeIfExists" >> in-map-name="deletePartyContactMechPurposeCtx"/> >> > - <set-service-fields >> service-name="deletePartyContactMech" map-name="pcmp" >> to-map-name="serviceInMap"/> >> > - <call-service service-name="deletePartyContactMech" >> in-map-name="serviceInMap"/> >> > - </if-not-empty> >> > - <set field="createPartyContactMechPurposeCtx.partyId" >> from-field="userLogin.partyId"/> >> > - <set >> field="createPartyContactMechPurposeCtx.contactMechId" >> from-field="parameters.shipToContactMechId"/> >> > - <set >> field="createPartyContactMechPurposeCtx.contactMechPurposeTypeId" >> value="BILLING_LOCATION"/> >> > - <call-service >> service-name="createPartyContactMechPurpose" >> in-map-name="createPartyContactMechPurposeCtx"/> >> > - </if-compare-field> >> > - <field-to-request >> field-name="parameters.shipToContactMechId" >> request-name="billToContactMechId"/> >> > - >> > - <set field="creditCardContext.contactMechId" >> from-field="parameters.shipToContactMechId"/> >> > - <if-empty field="parameters.paymentMethodId"> >> > - <!-- Create Credit Card --> >> > - <call-service service-name="createCreditCard" >> in-map-name="creditCardContext"> >> > - <result-to-field result-name="paymentMethodId" >> field-name="parameters.paymentMethodId"/> >> > + <if-compare field="parameters.useShippingAddressForBilling" >> operator="not-equals" value="Y"> >> > + <if-empty field="parameters.billToContactMechId"> >> > + <call-service service-name="createPartyPostalAddress" >> in-map-name="billToAddressCtx"> >> > + <result-to-field result-name="contactMechId" >> field-name="parameters.billToContactMechId"/> >> > </call-service> >> > + <log level="info" message="Billing address created with >> contactmechId ${parameters.billToContactMechId}"/> >> > <else> >> > - <entity-and entity-name="PaymentMethod" >> list-name="paymentMethodList" filter-by-date="true"> >> > - <field-map field-name="partyId" >> env-name="parameters.partyId"/> >> > - <order-by field-name="-fromDate"/> >> > + <entity-and entity-name="PartyContactMechPurpose" >> list-name="pcmpList"> >> > + <field-map field-name="contactMechId" >> env-name="parameters.billToContactMechId"/> >> > + <field-map field-name="partyId" env-name="partyId"/> >> > + <field-map field-name="contactMechPurposeTypeId" >> value="BILLING_LOCATION"/> >> > </entity-and> >> > - <first-from-list list-name="paymentMethodList" >> entry-name="paymentMethod"/> >> > - <set field="creditCardContext.paymentMethodId" >> from-field="paymentMethod.paymentMethodId"/> >> > - <!-- Update Credit Card --> >> > - <set field="creditCardContext.paymentMethodId" >> from-field="parameters.paymentMethodId"/> >> > - <call-service service-name="updateCreditCard" >> in-map-name="creditCardContext"> >> > - <result-to-field result-name="paymentMethodId" >> field-name="parameters.paymentMethodId"/> >> > - </call-service> >> > + <filter-list-by-date list-name="pcmpList"/> >> > + <if-compare-field field="parameters.shipToContactMechId" >> operator="equals" to-field="parameters.billToContactMechId"> >> > + <iterate list-name="pcmpList" entry-name="pcmp"> >> > + <set-service-fields >> service-name="deletePartyContactMechPurposeIfExists" map-name="pcmp" >> to-map-name="deletePartyContactMechPurposeCtx"/> >> > + <call-service >> service-name="deletePartyContactMechPurposeIfExists" >> in-map-name="deletePartyContactMechPurposeCtx"/> >> > + </iterate> >> > + <call-service >> service-name="createPartyPostalAddress" in-map-name="billToAddressCtx"> >> > + <result-to-field result-name="contactMechId" >> field-name="parameters.billToContactMechId"/> >> > + </call-service> >> > + <log level="info" message="Billing address updated >> with contactMechId ${parameters.billToContactMechId}"/> >> > + <else> >> > + <first-from-list list-name="pcmpList" >> entry-name="pcmp"/> >> > + <if-compare-field >> field="parameters.billToContactMechId" operator="equals" >> to-field="pcmp.contactMechId"> >> > + <call-service >> service-name="updatePartyPostalAddress" in-map-name="billToAddressCtx"> >> > + <result-to-field result-name="contactMechId" >> field-name="parameters.billToContactMechId"/> >> > + </call-service> >> > + <log level="info" message="Billing Postal >> Address Updated billToContactMechId is ${parameters.billToContactMechId}"/> >> > + <else> >> > + <if-not-empty field="pcmp"> >> > + <set-service-fields >> service-name="deletePartyContactMechPurposeIfExists" map-name="pcmp" >> to-map-name="deletePartyContactMechPurposeCtx"/> >> > + <call-service >> service-name="deletePartyContactMechPurposeIfExists" >> in-map-name="deletePartyContactMechPurposeCtx"/> >> > + </if-not-empty> >> > + <call-service >> service-name="createPartyPostalAddress" in-map-name="billToAddressCtx"> >> > + <result-to-field result-name="contactMechId" >> field-name="parameters.billToContactMechId"/> >> > + </call-service> >> > + <log level="info" message="Billing Postal >> Address created billToContactMechId is ${parameters.billToContactMechId}"/> >> > + </else> >> > + </if-compare-field> >> > + </else> >> > + </if-compare-field> >> > </else> >> > </if-empty> >> > - <field-to-request field-name="parameters.paymentMethodId" >> request-name="paymentMethodId"/> >> > - </if-compare> >> > + </if-compare> >> > + <field-to-request field-name="parameters.billToContactMechId" >> request-name="billToContactMechId"/> >> > + </simple-method> >> > >> > - <!--============== Set Payment Method ================--> >> > + <simple-method method-name="createUpdateCreditCard" >> short-description="create and update credit card"> >> > + <call-map-processor >> xml-resource="org/ofbiz/accounting/payment/PaymentMapProcs.xml" >> > + processor-name="createCreditCard" >> in-map-name="parameters" out-map-name="creditCardContext"/> >> > + <check-errors/> >> > + <set field="creditCardContext.partyId" from-field="partyId"/> >> > + <set field="creditCardContext.contactMechId" >> from-field="parameters.billToContactMechId"/> >> > + <if-empty field="parameters.paymentMethodId"> >> > + <!-- call create Credit Card --> >> > + <call-service service-name="createCreditCard" >> in-map-name="creditCardContext"> >> > + <result-to-field result-name="paymentMethodId" >> field-name="parameters.paymentMethodId"/> >> > + </call-service> >> > + <else> >> > + <!-- call update Credit Card --> >> > + <entity-and entity-name="PaymentMethod" >> list-name="paymentMethodList" filter-by-date="true"> >> > + <field-map field-name="partyId" env-name="partyId"/> >> > + <order-by field-name="-fromDate"/> >> > + </entity-and> >> > + <first-from-list list-name="paymentMethodList" >> entry-name="paymentMethod"/> >> > + <set field="creditCardContext.paymentMethodId" >> from-field="paymentMethod.paymentMethodId"/> >> > + <call-service service-name="updateCreditCard" >> in-map-name="creditCardContext"> >> > + <result-to-field result-name="paymentMethodId" >> field-name="parameters.paymentMethodId"/> >> > + </call-service> >> > + </else> >> > + </if-empty> >> > <set field="paymentMethodId" >> from-field="parameters.paymentMethodId"/> >> > - <set field="cardSecurityCode" >> from-field="parameters.cardSecurityCode"/> >> > - <field-to-session field-name="userLogin" >> session-name="userLogin"/> >> > - <call-bsh> >> > - <![CDATA[ >> > - import org.ofbiz.order.shoppingcart.ShoppingCart; >> > - checkOutHelper = new >> org.ofbiz.order.shoppingcart.CheckOutHelper(dispatcher, delegator, >> shoppingCart); >> > - callResult = >> checkOutHelper.finalizeOrderEntryPayment(paymentMethodId, null, false, >> false); >> > - ShoppingCart.CartPaymentInfo cpi = >> shoppingCart.getPaymentInfo(paymentMethodId, null, null, null, true); >> > - cpi.securityCode = cardSecurityCode; >> > - ]]> >> > - </call-bsh> >> > + <field-to-request field-name="parameters.paymentMethodId" >> request-name="paymentMethodId"/> >> > </simple-method> >> > >> > </simple-methods> >> > >> > Added: >> ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/customer/EditBillingAddress.groovy >> > URL: >> http://svn.apache.org/viewvc/ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/customer/EditBillingAddress.groovy?rev=681750&view=auto >> > >> ============================================================================== >> > --- >> ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/customer/EditBillingAddress.groovy >> (added) >> > +++ >> ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/customer/EditBillingAddress.groovy >> Fri Aug 1 10:04:44 2008 >> > @@ -0,0 +1,60 @@ >> > +/* >> > + * 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. >> > + */ >> > + >> > +import org.ofbiz.entity.util.EntityUtil; >> > +import org.ofbiz.party.contact.ContactHelper; >> > +import org.ofbiz.entity.condition.EntityCondition; >> > + >> > +if (userLogin) { >> > + party = userLogin.getRelatedOne("Party"); >> > + contactMech = >> EntityUtil.getFirst(ContactHelper.getContactMech(party, "BILLING_LOCATION", >> "POSTAL_ADDRESS", false)); >> > + if (contactMech) { >> > + postalAddress = contactMech.getRelatedOne("PostalAddress"); >> > + parameters.billToContactMechId = postalAddress.contactMechId; >> > + parameters.billToAddress1 = postalAddress.address1; >> > + parameters.billToAddress2 = postalAddress.address2; >> > + parameters.billToCity = postalAddress.city; >> > + parameters.billToPostalCode = postalAddress.postalCode; >> > + parameters.billToStateProvinceGeoId = >> postalAddress.stateProvinceGeoId; >> > + parameters.billToCountryGeoId = postalAddress.countryGeoId; >> > + billToStateProvinceGeo = delegator.findByPrimaryKey("Geo", >> [geoId : postalAddress.stateProvinceGeoId]); >> > + if (billToStateProvinceGeo) { >> > + parameters.billToStateProvinceGeo = >> billToStateProvinceGeo.geoName; >> > + } >> > + billToCountryProvinceGeo = delegator.findByPrimaryKey("Geo", >> [geoId : postalAddress.countryGeoId]); >> > + if (billToCountryProvinceGeo) { >> > + parameters.billToCountryProvinceGeo = >> billToCountryProvinceGeo.geoName; >> > + } >> > + } >> > + >> > + creditCards = []; >> > + paymentMethod = >> EntityUtil.getFirst(EntityUtil.filterByDate(delegator.findList("PaymentMethod", >> EntityCondition.makeCondition([partyId : party.partyId]), null, >> ["fromDate"], null, null))); >> > + if (paymentMethod) { >> > + creditCard = paymentMethod.getRelatedOne("CreditCard"); >> > + if (creditCard) { >> > + parameters.paymentMethodTypeId = "CREDIT_CARD"; >> > + parameters.cardNumber = creditCard.cardNumber; >> > + parameters.paymentMethodId = creditCard.paymentMethodId; >> > + parameters.firstNameOnCard = creditCard.firstNameOnCard; >> > + parameters.lastNameOnCard = creditCard.lastNameOnCard; >> > + parameters.expMonth = (creditCard.expireDate).substring(0, >> 2); >> > + parameters.expYear = (creditCard.expireDate).substring(3); >> > + } >> > + } >> > +} >> > \ No newline at end of file >> > >> > Propchange: >> ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/customer/EditBillingAddress.groovy >> > >> ------------------------------------------------------------------------------ >> > svn:eol-style = native >> > >> > Propchange: >> ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/customer/EditBillingAddress.groovy >> > >> ------------------------------------------------------------------------------ >> > svn:keywords = "Date Rev Author URL Id" >> > >> > Propchange: >> ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/customer/EditBillingAddress.groovy >> > >> ------------------------------------------------------------------------------ >> > svn:mime-type = text/plain >> > >> > Added: >> ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/customer/EditEmailAndTelecomNumber.groovy >> > URL: >> http://svn.apache.org/viewvc/ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/customer/EditEmailAndTelecomNumber.groovy?rev=681750&view=auto >> > >> ============================================================================== >> > --- >> ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/customer/EditEmailAndTelecomNumber.groovy >> (added) >> > +++ >> ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/customer/EditEmailAndTelecomNumber.groovy >> Fri Aug 1 10:04:44 2008 >> > @@ -0,0 +1,44 @@ >> > +/* >> > + * 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. >> > + */ >> > + >> > +import org.ofbiz.entity.util.EntityUtil; >> > +import org.ofbiz.party.contact.ContactHelper; >> > + >> > +if (userLogin) { >> > + party = userLogin.getRelatedOne("Party"); >> > + >> > + contactMech = >> EntityUtil.getFirst(ContactHelper.getContactMech(party, "PRIMARY_EMAIL", >> "EMAIL_ADDRESS", false)); >> > + if (contactMech) { >> > + parameters.emailContactMechId = contactMech.contactMechId; >> > + parameters.emailAddress = contactMech.infoString; >> > + } >> > + >> > + contactMech = >> EntityUtil.getFirst(ContactHelper.getContactMech(party, "PRIMARY_PHONE", >> "TELECOM_NUMBER", false)); >> > + if (contactMech) { >> > + partyContactMech = >> EntityUtil.getFirst(delegator.findByAnd("PartyContactMech", [partyId : >> party.partyId, contactMechId : contactMech.contactMechId])); >> > + if (partyContactMech) { >> > + telecomNumber = >> partyContactMech.getRelatedOne("TelecomNumber"); >> > + parameters.phoneContactMechId = >> telecomNumber.contactMechId; >> > + parameters.countryCode = telecomNumber.countryCode; >> > + parameters.areaCode = telecomNumber.areaCode; >> > + parameters.contactNumber = telecomNumber.contactNumber; >> > + parameters.extension = partyContactMech.extension; >> > + } >> > + } >> > +} >> > \ No newline at end of file >> > >> > Propchange: >> ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/customer/EditEmailAndTelecomNumber.groovy >> > >> ------------------------------------------------------------------------------ >> > svn:eol-style = native >> > >> > Propchange: >> ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/customer/EditEmailAndTelecomNumber.groovy >> > >> ------------------------------------------------------------------------------ >> > svn:keywords = "Date Rev Author URL Id" >> > >> > Propchange: >> ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/customer/EditEmailAndTelecomNumber.groovy >> > >> ------------------------------------------------------------------------------ >> > svn:mime-type = text/plain >> > >> > Added: >> ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/customer/EditShippingAddress.groovy >> > URL: >> http://svn.apache.org/viewvc/ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/customer/EditShippingAddress.groovy?rev=681750&view=auto >> > >> ============================================================================== >> > --- >> ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/customer/EditShippingAddress.groovy >> (added) >> > +++ >> ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/customer/EditShippingAddress.groovy >> Fri Aug 1 10:04:44 2008 >> > @@ -0,0 +1,48 @@ >> > +/* >> > + * 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. >> > + */ >> > + >> > +import org.ofbiz.entity.util.EntityUtil; >> > +import org.ofbiz.party.contact.ContactHelper; >> > + >> > +if (userLogin) { >> > + party = userLogin.getRelatedOne("Party"); >> > + contactMech = >> EntityUtil.getFirst(ContactHelper.getContactMech(party, "SHIPPING_LOCATION", >> "POSTAL_ADDRESS", false)); >> > + if (contactMech) { >> > + postalAddress = contactMech.getRelatedOne("PostalAddress"); >> > + parameters.shipToContactMechId = postalAddress.contactMechId; >> > + >> > + parameters.shipToAddress1 = postalAddress.address1; >> > + parameters.shipToAddress2 = postalAddress.address2; >> > + parameters.shipToCity = postalAddress.city; >> > + parameters.shipToPostalCode = postalAddress.postalCode; >> > + parameters.shipToStateProvinceGeoId = >> postalAddress.stateProvinceGeoId; >> > + parameters.shipToCountryGeoId = postalAddress.countryGeoId; >> > + shipToStateProvinceGeo = delegator.findByPrimaryKey("Geo", >> [geoId : postalAddress.stateProvinceGeoId]); >> > + if (shipToStateProvinceGeo) { >> > + parameters.shipToStateProvinceGeo = >> shipToStateProvinceGeo.geoName; >> > + } >> > + shipToCountryProvinceGeo = delegator.findByPrimaryKey("Geo", >> [geoId : postalAddress.countryGeoId]); >> > + if (shipToCountryProvinceGeo) { >> > + parameters.shipToCountryProvinceGeo = >> shipToCountryProvinceGeo.geoName; >> > + } >> > + person = delegator.findByPrimaryKey("Person", [partyId : >> partyId]); >> > + parameters.firstName = person.firstName; >> > + parameters.lastName = person.lastName; >> > + } >> > +} >> > \ No newline at end of file >> > >> > Propchange: >> ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/customer/EditShippingAddress.groovy >> > >> ------------------------------------------------------------------------------ >> > svn:eol-style = native >> > >> > Propchange: >> ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/customer/EditShippingAddress.groovy >> > >> ------------------------------------------------------------------------------ >> > svn:keywords = "Date Rev Author URL Id" >> > >> > Propchange: >> ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/customer/EditShippingAddress.groovy >> > >> ------------------------------------------------------------------------------ >> > svn:mime-type = text/plain >> > >> > Modified: >> ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/controller.xml >> > URL: >> http://svn.apache.org/viewvc/ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/controller.xml?rev=681750&r1=681749&r2=681750&view=diff >> > >> ============================================================================== >> > --- >> ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/controller.xml >> (original) >> > +++ >> ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/controller.xml >> Fri Aug 1 10:04:44 2008 >> > @@ -1580,12 +1580,19 @@ >> > >> > <!-- ============== One Page Checkout Requests ============== --> >> > <request-map uri="onePageCheckout"> >> > - <security https="true" auth="false"/> >> > + <security https="true" auth="true"/> >> > <event type="java" >> path="org.ofbiz.order.shoppingcart.CheckOutEvents" invoke="cartNotEmpty"/> >> > <response name="success" type="view" value="OnePageCheckout"/> >> > <response name="error" type="view" value="main"/> >> > </request-map> >> > >> > + <request-map uri="anonOnePageCheckout"> >> > + <security https="true" auth="false"/> >> > + <event type="java" >> path="org.ofbiz.order.shoppingcart.CheckOutEvents" invoke="cartNotEmpty"/> >> > + <response name="success" type="view" value="OnePageCheckout"/> >> > + <response name="error" type="view" value="main"/> >> > + </request-map> >> > + >> > <request-map uri="getCountryList"> >> > <event type="jsonservice" invoke="getCountryList"/> >> > <response name="success" type="none"/> >> > >> > Modified: ofbiz/trunk/applications/ecommerce/webapp/ecommerce/login.ftl >> > URL: >> http://svn.apache.org/viewvc/ofbiz/trunk/applications/ecommerce/webapp/ecommerce/login.ftl?rev=681750&r1=681749&r2=681750&view=diff >> > >> ============================================================================== >> > --- ofbiz/trunk/applications/ecommerce/webapp/ecommerce/login.ftl >> (original) >> > +++ ofbiz/trunk/applications/ecommerce/webapp/ecommerce/login.ftl Fri Aug >> 1 10:04:44 2008 >> > @@ -94,7 +94,7 @@ >> > <form method="post" >> action="<@ofbizUrl>quickAnonCheckout</@ofbizUrl>" style="margin: 0;"> >> > <div align="center"><input type="submit" class="smallSubmit" >> value="${uiLabelMap.OrderCheckoutQuick}"/></div> >> > </form> >> > - <form method="post" >> action="<@ofbizUrl>onePageCheckout</@ofbizUrl>" style="margin: 0;"> >> > + <form method="post" >> action="<@ofbizUrl>anonOnePageCheckout</@ofbizUrl>" style="margin: 0;"> >> > <div align="center"><input type="submit" class="smallSubmit" >> value="${uiLabelMap.EcommerceOnePageCheckout}"/></div> >> > </form> >> > </div> >> > >> > Modified: >> ofbiz/trunk/applications/ecommerce/webapp/ecommerce/order/OnePageCheckoutProcess.ftl >> > URL: >> http://svn.apache.org/viewvc/ofbiz/trunk/applications/ecommerce/webapp/ecommerce/order/OnePageCheckoutProcess.ftl?rev=681750&r1=681749&r2=681750&view=diff >> > >> ============================================================================== >> > --- >> ofbiz/trunk/applications/ecommerce/webapp/ecommerce/order/OnePageCheckoutProcess.ftl >> (original) >> > +++ >> ofbiz/trunk/applications/ecommerce/webapp/ecommerce/order/OnePageCheckoutProcess.ftl >> Fri Aug 1 10:04:44 2008 >> > @@ -282,11 +282,11 @@ >> > <div id="editShippingPanel" class="screenlet-body" >> style="display: none;"> >> > <form name="shippingForm" id="shippingForm" >> action="<@ofbizUrl>createUpdateShippingAddress</@ofbizUrl>" method="post"> >> > <input type="hidden" id="shipToContactMechId" >> name="shipToContactMechId" >> value="${parameters.shipToContactMechId?if_exists}"/> >> > - <input type="hidden" name="contactMechPurposeTypeId" >> value="SHIPPING_LOCATION"/> >> > <input type="hidden" id="shippingPartyId" name="partyId" >> value="${parameters.partyId?if_exists}"/> >> > <input type="hidden" name="userLogin" >> value="${parameters.userLogin?if_exists}"/> >> > <input type="hidden" id="phoneContactMechId" >> name="phoneContactMechId" >> value="${parameters.phoneContactMechId?if_exists}"/> >> > <input type="hidden" id="emailContactMechId" >> name="emailContactMechId" >> value="${parameters.emailContactMechId?if_exists}"/> >> > + <input type="hidden" name="roleTypeId" >> value="CUSTOMER"/> >> > <div id="shippingFormServerError" >> class="errorMessage"></div> >> > <table> >> > <tr><td width="40%" valign="top"> >> > @@ -297,7 +297,7 @@ >> > </label> >> > </div> >> > <div class="field-widget"> >> > - <input id="firstName" >> name="firstName" class="inputBox required" type="text" >> value="${parameters.firstName?if_exists}"/> >> > + <input id="firstName" >> name="firstName" class="inputBox required" type="text" >> value="${(parameters.firstName)?if_exists}"/> >> > </div> >> > </div> >> > <div class="form-row"> >> > @@ -307,7 +307,7 @@ >> > </label> >> > </div> >> > <div class="field-widget"> >> > - <input id="lastName" name="lastName" >> class="inputBox required" type="text" >> value="${parameters.lastName?if_exists}"/> >> > + <input id="lastName" name="lastName" >> class="inputBox required" type="text" >> value="${(parameters.lastName)?if_exists}"/> >> > </div> >> > </div> >> > <div class="form-row"> >> > @@ -373,8 +373,8 @@ >> > </div> >> > <div class="field-widget"> >> > <div> >> > - <input name="shipToCountryGeo" >> id="shipToCountryGeo" size="30" class="inputBox required" type="text" >> value="${parameters.shipToCountryGeo?if_exists}"/> >> > - <input name="countryGeoId" >> id="shipToCountryGeoId" type="hidden" >> value="${parameters.countryGeoId?if_exists}"/> >> > + <input name="shipToCountryGeo" >> id="shipToCountryGeo" size="30" class="inputBox required" type="text" >> value="${parameters.shipToCountryProvinceGeo?if_exists}"/> >> > + <input name="countryGeoId" >> id="shipToCountryGeoId" type="hidden" >> value="${parameters.shipToCountryGeoId?if_exists}"/> >> > <div id="shipToCountries" >> class="autocomplete" style="display:none"></div> >> > </div> >> > </div> >> > @@ -482,10 +482,11 @@ >> > <input type="hidden" id ="billToContactMechId" >> name="billToContactMechId" >> value="${parameters.billToContactMechId?if_exists}"/> >> > <input type="hidden" >> id="shipToContactMechIdInBillingForm" name="shipToContactMechId" >> value="${parameters.shipToContactMechId?if_exists}"/> >> > <input type="hidden" id="paymentMethodId" >> name="paymentMethodId" value="${parameters.paymentMethodId?if_exists}"/> >> > - <input type="hidden" id="paymentMethodTypeId" >> name="paymentMethodTypeId" value="CREDIT_CARD"/> >> > + <input type="hidden" id="paymentMethodTypeId" >> name="paymentMethodTypeId" >> value="${parameters.paymentMethodTypeId?if_exists}"/> >> > <input type="hidden" id="billingPartyId" name="partyId" >> value="${parameters.partyId?if_exists}"/> >> > <input type="hidden" name="userLogin" >> value="${parameters.userLogin?if_exists}"/> >> > <input type="hidden" name="expireDate" >> value="${parameters.expireDate?if_exists}"/> >> > + <input type="hidden" name="roleTypeId" >> value="CUSTOMER"/> >> > <div id="billingFormServerError" >> class="errorMessage"></div> >> > <table> >> > <tr><td valign="top"> >> > @@ -528,10 +529,10 @@ >> > </div> >> > <div class="form-row"> >> > <div class="field-label"> >> > - <label for="CVV2">CVV2<span>*</span><span >> id="advice-required-CVV2" style="display:none" class="errorMessage"> >> (required)</span></label> >> > + <label for="CVV2">CVV2</label> >> > </div> >> > <div class="field-widget"> >> > - <input id="CVV2" autocomplete="off" >> name="cardSecurityCode" class="inputBox required" size="4" type="text" >> maxlength="4" value=""/> >> > + <input id="CVV2" autocomplete="off" >> name="cardSecurityCode" class="inputBox" size="4" type="text" maxlength="4" >> value=""/> >> > </div> >> > </div> >> > <div class="form-row"> >> > @@ -610,8 +611,8 @@ >> > <div class="field-widget"> >> > <select name="countryGeoId" >> id="billToCountryGeoId" class="required selectBox"> >> > <#if (parameters.countryGeoId)?exists> >> > - >> <option>${parameters.countryGeoId}</option> >> > - <option >> value="${parameters.countryGeoId}">---</option> >> > + >> <option>${parameters.billToCountryProvinceGeo}</option> >> > + <option >> value="${parameters.billToCountryGeoId}">---</option> >> > </#if> >> > >> ${screens.render("component://common/widget/CommonScreens.xml#countries")} >> > </select> >> > @@ -624,7 +625,7 @@ >> > <div class="field-widget"> >> > <select id="billToStateProvinceGeoId" >> name="billToStateProvinceGeoId" class="required selectBox"> >> > <#if >> parameters.billToStateProvinceGeoId?has_content> >> > - >> <option>${parameters.billToStateProvinceGeoId}</option> >> > + >> <option>${parameters.billToStateProvinceGeo}</option> >> > <option >> value="${parameters.billToStateProvinceGeoId}">---</option> >> > <#else> >> > <option >> value="">${uiLabelMap.PartyNoState}</option> >> > >> > Modified: ofbiz/trunk/applications/ecommerce/widget/OrderScreens.xml >> > URL: >> http://svn.apache.org/viewvc/ofbiz/trunk/applications/ecommerce/widget/OrderScreens.xml?rev=681750&r1=681749&r2=681750&view=diff >> > >> ============================================================================== >> > --- ofbiz/trunk/applications/ecommerce/widget/OrderScreens.xml (original) >> > +++ ofbiz/trunk/applications/ecommerce/widget/OrderScreens.xml Fri Aug 1 >> 10:04:44 2008 >> > @@ -618,6 +618,10 @@ >> > <set field="layoutSettings.javaScripts[]" >> value="/images/prototypejs/controls.js" global="true"/> >> > <set field="layoutSettings.javaScripts[]" >> value="/ecommerce/images/checkoutProcess.js" global="true"/> >> > <script >> location="component://ecommerce/webapp/ecommerce/WEB-INF/actions/cart/ShowCart.groovy"/> >> > + <script >> location="component://ecommerce/webapp/ecommerce/WEB-INF/actions/customer/EditShippingAddress.groovy"/> >> > + <script >> location="component://ecommerce/webapp/ecommerce/WEB-INF/actions/customer/EditBillingAddress.groovy"/> >> > + <script >> location="component://ecommerce/webapp/ecommerce/WEB-INF/actions/customer/EditEmailAndTelecomNumber.groovy"/> >> > + >> > </actions> >> > <widgets> >> > <decorator-screen name="main-decorator" >> location="${parameters.mainDecoratorLocation}"> >> > >> > Modified: >> ofbiz/trunk/applications/order/webapp/ordermgr/entry/cart/minicart.ftl >> > URL: >> http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/entry/cart/minicart.ftl?rev=681750&r1=681749&r2=681750&view=diff >> > >> ============================================================================== >> > --- >> ofbiz/trunk/applications/order/webapp/ordermgr/entry/cart/minicart.ftl >> (original) >> > +++ >> ofbiz/trunk/applications/order/webapp/ordermgr/entry/cart/minicart.ftl Fri >> Aug 1 10:04:44 2008 >> > @@ -68,7 +68,7 @@ >> > <#if hidebottomlinks?default("N") != "Y"> >> > <div><a href="<@ofbizUrl>view/showcart</@ofbizUrl>" >> class="buttontext">${uiLabelMap.OrderViewCart}</a> <a >> href="<@ofbizUrl>checkoutoptions</@ofbizUrl>" >> class="buttontext">${uiLabelMap.OrderCheckout}</a></div> >> > <div style="margin-top: 4px;"><a >> href="<@ofbizUrl>quickcheckout</@ofbizUrl>" >> class="buttontext">${uiLabelMap.OrderCheckoutQuick}</a></div> >> > - <div style="margin-top: 4px;"><a >> href="<@ofbizUrl>checkoutoptions</@ofbizUrl>" >> class="buttontext">${uiLabelMap.EcommerceOnePageCheckout}</a></div> >> > + <div style="margin-top: 4px;"><a >> href="<@ofbizUrl>onePageCheckout</@ofbizUrl>" >> class="buttontext">${uiLabelMap.EcommerceOnePageCheckout}</a></div> >> > </#if> >> > <#else> >> > <div>${uiLabelMap.OrderShoppingCartEmpty}</div> >> > >> > >> > >> >
