You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by ar...@apache.org on 2016/11/02 19:09:18 UTC
svn commit: r1767764 [29/33] - in /ofbiz/trunk:
applications/accounting/groovyScripts/admin/
applications/accounting/groovyScripts/ap/invoices/
applications/accounting/groovyScripts/ar/
applications/accounting/groovyScripts/chartofaccounts/ application...
Modified: ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/order/CustSettings.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/order/CustSettings.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/order/CustSettings.groovy (original)
+++ ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/order/CustSettings.groovy Wed Nov 2 19:09:13 2016
@@ -17,83 +17,83 @@
* under the License.
*/
-import org.apache.ofbiz.base.util.*;
-import org.apache.ofbiz.entity.util.EntityUtil;
+import org.apache.ofbiz.base.util.*
+import org.apache.ofbiz.entity.util.EntityUtil
-partyId = null;
+partyId = null
if (userLogin) {
- partyId = userLogin.partyId;
+ partyId = userLogin.partyId
}
if (!partyId && parameters.partyId) {
- partyId = parameters.partyId;
+ partyId = parameters.partyId
}
if (partyId) {
- parameters.partyId = partyId;
+ parameters.partyId = partyId
// NOTE: if there was an error, then don't look up and fill in all of this data, just use the values from the previous request (which will be in the parameters Map automagically)
if (!request.getAttribute("_ERROR_MESSAGE_") && !request.getAttribute("_ERROR_MESSAGE_LIST_")) {
- person = from("Person").where("partyId", partyId).queryOne();
+ person = from("Person").where("partyId", partyId).queryOne()
if (person) {
- context.callSubmitForm = true;
+ context.callSubmitForm = true
// should never be null for the anonymous checkout, but just in case
- parameters.personalTitle = person.personalTitle;
- parameters.firstName = person.firstName;
- parameters.middleName = person.middleName;
- parameters.lastName = person.lastName;
- parameters.suffix = person.suffix;
+ parameters.personalTitle = person.personalTitle
+ parameters.firstName = person.firstName
+ parameters.middleName = person.middleName
+ parameters.lastName = person.lastName
+ parameters.suffix = person.suffix
//Parameters not in use, Do we really need these here or should be removed.
- parameters.residenceStatusEnumId = person.residenceStatusEnumId;
- parameters.maritalStatus = person.maritalStatus;
- parameters.employmentStatusEnumId = person.employmentStatusEnumId;
- parameters.occupation = person.occupation;
- parameters.yearsWithEmployer = person.yearsWithEmployer;
- parameters.monthsWithEmployer = person.monthsWithEmployer;
- parameters.existingCustomer = person.existingCustomer;
+ parameters.residenceStatusEnumId = person.residenceStatusEnumId
+ parameters.maritalStatus = person.maritalStatus
+ parameters.employmentStatusEnumId = person.employmentStatusEnumId
+ parameters.occupation = person.occupation
+ parameters.yearsWithEmployer = person.yearsWithEmployer
+ parameters.monthsWithEmployer = person.monthsWithEmployer
+ parameters.existingCustomer = person.existingCustomer
// birthDate -> birthDateDay, birthDateMonth, birthDateYear
- birthDate = person.birthDate;
+ birthDate = person.birthDate
if (birthDate) {
// will be in the format "yyyy-mm-dd", like "2006-10-21"
- birthDateString = birthDate.toString();
- parameters.birthDateDay = birthDateString.substring(8);
- parameters.birthDateMonth = birthDateString.substring(5, 7);
- parameters.birthDateYear = birthDateString.substring(0, 4);
+ birthDateString = birthDate.toString()
+ parameters.birthDateDay = birthDateString.substring(8)
+ parameters.birthDateMonth = birthDateString.substring(5, 7)
+ parameters.birthDateYear = birthDateString.substring(0, 4)
// and finally, the whole thing, just in case we want it that way
- parameters.birthDate = birthDateString;
+ parameters.birthDate = birthDateString
}
}
// get the Email Address
- emailPartyContactDetail = from("PartyContactDetailByPurpose").where("partyId", partyId, "contactMechPurposeTypeId", "PRIMARY_EMAIL").filterByDate().queryFirst();
+ emailPartyContactDetail = from("PartyContactDetailByPurpose").where("partyId", partyId, "contactMechPurposeTypeId", "PRIMARY_EMAIL").filterByDate().queryFirst()
if (emailPartyContactDetail) {
- parameters.emailContactMechId = emailPartyContactDetail.contactMechId;
- parameters.emailAddress = emailPartyContactDetail.infoString;
- parameters.emailSol = emailPartyContactDetail.allowSolicitation;
+ parameters.emailContactMechId = emailPartyContactDetail.contactMechId
+ parameters.emailAddress = emailPartyContactDetail.infoString
+ parameters.emailSol = emailPartyContactDetail.allowSolicitation
}
// get the Phone Numbers
- homePhonePartyContactDetail = from("PartyContactDetailByPurpose").where("partyId", partyId, "contactMechPurposeTypeId", "PHONE_HOME").filterByDate().queryFirst();
+ homePhonePartyContactDetail = from("PartyContactDetailByPurpose").where("partyId", partyId, "contactMechPurposeTypeId", "PHONE_HOME").filterByDate().queryFirst()
if (homePhonePartyContactDetail) {
- parameters.homePhoneContactMechId = homePhonePartyContactDetail.contactMechId;
- parameters.homeCountryCode = homePhonePartyContactDetail.countryCode;
- parameters.homeAreaCode = homePhonePartyContactDetail.areaCode;
- parameters.homeContactNumber = homePhonePartyContactDetail.contactNumber;
- parameters.homeExt = homePhonePartyContactDetail.extension;
- parameters.homeSol = homePhonePartyContactDetail.allowSolicitation;
+ parameters.homePhoneContactMechId = homePhonePartyContactDetail.contactMechId
+ parameters.homeCountryCode = homePhonePartyContactDetail.countryCode
+ parameters.homeAreaCode = homePhonePartyContactDetail.areaCode
+ parameters.homeContactNumber = homePhonePartyContactDetail.contactNumber
+ parameters.homeExt = homePhonePartyContactDetail.extension
+ parameters.homeSol = homePhonePartyContactDetail.allowSolicitation
}
- workPhonePartyContactDetail = from("PartyContactDetailByPurpose").where("partyId", partyId, "contactMechPurposeTypeId", "PHONE_WORK").filterByDate().queryFirst();
+ workPhonePartyContactDetail = from("PartyContactDetailByPurpose").where("partyId", partyId, "contactMechPurposeTypeId", "PHONE_WORK").filterByDate().queryFirst()
if (workPhonePartyContactDetail) {
- parameters.workPhoneContactMechId = workPhonePartyContactDetail.contactMechId;
- parameters.workCountryCode = workPhonePartyContactDetail.countryCode;
- parameters.workAreaCode = workPhonePartyContactDetail.areaCode;
- parameters.workContactNumber = workPhonePartyContactDetail.contactNumber;
- parameters.workExt = workPhonePartyContactDetail.extension;
- parameters.workSol = workPhonePartyContactDetail.allowSolicitation;
+ parameters.workPhoneContactMechId = workPhonePartyContactDetail.contactMechId
+ parameters.workCountryCode = workPhonePartyContactDetail.countryCode
+ parameters.workAreaCode = workPhonePartyContactDetail.areaCode
+ parameters.workContactNumber = workPhonePartyContactDetail.contactNumber
+ parameters.workExt = workPhonePartyContactDetail.extension
+ parameters.workSol = workPhonePartyContactDetail.allowSolicitation
}
}
}
Modified: ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/order/OptionSettings.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/order/OptionSettings.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/order/OptionSettings.groovy (original)
+++ ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/order/OptionSettings.groovy Wed Nov 2 19:09:13 2016
@@ -17,40 +17,40 @@
* under the License.
*/
-import org.apache.ofbiz.entity.*;
-import org.apache.ofbiz.base.util.*;
-import org.apache.ofbiz.order.shoppingcart.*;
-import org.apache.ofbiz.order.shoppingcart.shipping.*;
-import org.apache.ofbiz.party.contact.*;
-import org.apache.ofbiz.product.store.*;
-
-shoppingCart = session.getAttribute("shoppingCart");
-context.shoppingCart = shoppingCart;
-productStore = ProductStoreWorker.getProductStore(request);
+import org.apache.ofbiz.entity.*
+import org.apache.ofbiz.base.util.*
+import org.apache.ofbiz.order.shoppingcart.*
+import org.apache.ofbiz.order.shoppingcart.shipping.*
+import org.apache.ofbiz.party.contact.*
+import org.apache.ofbiz.product.store.*
+
+shoppingCart = session.getAttribute("shoppingCart")
+context.shoppingCart = shoppingCart
+productStore = ProductStoreWorker.getProductStore(request)
if (shoppingCart) {
- shippingEstWpr = new ShippingEstimateWrapper(dispatcher, shoppingCart, 0);
- context.shippingEstWpr = shippingEstWpr;
- context.carrierShipmentMethodList = shippingEstWpr.getShippingMethods();
+ shippingEstWpr = new ShippingEstimateWrapper(dispatcher, shoppingCart, 0)
+ context.shippingEstWpr = shippingEstWpr
+ context.carrierShipmentMethodList = shippingEstWpr.getShippingMethods()
}
// nuke the event messages
-request.removeAttribute("_EVENT_MESSAGE_");
+request.removeAttribute("_EVENT_MESSAGE_")
-party = null;
-partyId = session.getAttribute("orderPartyId");
+party = null
+partyId = session.getAttribute("orderPartyId")
if (partyId) {
- party = from("Party").where("partyId", partyId).queryOne();
- context.party = party;
+ party = from("Party").where("partyId", partyId).queryOne()
+ context.party = party
}
-context.emailList = ContactHelper.getContactMechByType(party, "EMAIL_ADDRESS", false);
+context.emailList = ContactHelper.getContactMechByType(party, "EMAIL_ADDRESS", false)
if (shoppingCart && shoppingCart.getShipmentMethodTypeId() && shoppingCart.getCarrierPartyId()) {
- context.chosenShippingMethod = shoppingCart.getShipmentMethodTypeId() + '@' + shoppingCart.getCarrierPartyId();
- context.callSubmitForm = true;
+ context.chosenShippingMethod = shoppingCart.getShipmentMethodTypeId() + '@' + shoppingCart.getCarrierPartyId()
+ context.callSubmitForm = true
}
-context.productStoreId = productStore.productStoreId;
-context.productStore = productStore;
+context.productStoreId = productStore.productStoreId
+context.productStore = productStore
Modified: ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/order/OrderHistory.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/order/OrderHistory.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/order/OrderHistory.groovy (original)
+++ ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/order/OrderHistory.groovy Wed Nov 2 19:09:13 2016
@@ -17,27 +17,27 @@
* under the License.
*/
-import org.apache.ofbiz.base.util.*;
-import org.apache.ofbiz.entity.*;
-import org.apache.ofbiz.entity.util.*;
-import org.apache.ofbiz.entity.condition.*;
+import org.apache.ofbiz.base.util.*
+import org.apache.ofbiz.entity.*
+import org.apache.ofbiz.entity.util.*
+import org.apache.ofbiz.entity.condition.*
-partyRole = from("PartyRole").where("partyId", userLogin.partyId, "roleTypeId", "SUPPLIER").queryOne();
+partyRole = from("PartyRole").where("partyId", userLogin.partyId, "roleTypeId", "SUPPLIER").queryOne()
if (partyRole) {
if ("SUPPLIER".equals(partyRole.roleTypeId)) {
/** drop shipper or supplier **/
- porderRoleCollection = from("OrderRole").where("partyId", userLogin.partyId, "roleTypeId", "SUPPLIER_AGENT").queryList();
+ porderRoleCollection = from("OrderRole").where("partyId", userLogin.partyId, "roleTypeId", "SUPPLIER_AGENT").queryList()
porderHeaderList = EntityUtil.orderBy(EntityUtil.filterByAnd(EntityUtil.getRelated("OrderHeader", null, porderRoleCollection, false),
[EntityCondition.makeCondition("statusId", EntityOperator.NOT_EQUAL, "ORDER_REJECTED"),
EntityCondition.makeCondition("orderTypeId", EntityOperator.EQUALS, "PURCHASE_ORDER")]),
- ["orderDate DESC"]);
- context.porderHeaderList = porderHeaderList;
+ ["orderDate DESC"])
+ context.porderHeaderList = porderHeaderList
}
}
-orderRoleCollection = from("OrderRole").where("partyId", userLogin.partyId, "roleTypeId", "PLACING_CUSTOMER").queryList();
+orderRoleCollection = from("OrderRole").where("partyId", userLogin.partyId, "roleTypeId", "PLACING_CUSTOMER").queryList()
orderHeaderList = EntityUtil.orderBy(EntityUtil.filterByAnd(EntityUtil.getRelated("OrderHeader", null, orderRoleCollection, false),
- [EntityCondition.makeCondition("statusId", EntityOperator.NOT_EQUAL, "ORDER_REJECTED")]), ["orderDate DESC"]);
-context.orderHeaderList = orderHeaderList;
+ [EntityCondition.makeCondition("statusId", EntityOperator.NOT_EQUAL, "ORDER_REJECTED")]), ["orderDate DESC"])
+context.orderHeaderList = orderHeaderList
-downloadOrderRoleAndProductContentInfoList = from("OrderRoleAndProductContentInfo").where("partyId", userLogin.partyId, "roleTypeId", "PLACING_CUSTOMER", "productContentTypeId", "DIGITAL_DOWNLOAD", "statusId", "ITEM_COMPLETED").queryList();
-context.downloadOrderRoleAndProductContentInfoList = downloadOrderRoleAndProductContentInfoList;
+downloadOrderRoleAndProductContentInfoList = from("OrderRoleAndProductContentInfo").where("partyId", userLogin.partyId, "roleTypeId", "PLACING_CUSTOMER", "productContentTypeId", "DIGITAL_DOWNLOAD", "statusId", "ITEM_COMPLETED").queryList()
+context.downloadOrderRoleAndProductContentInfoList = downloadOrderRoleAndProductContentInfoList
Modified: ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/order/OrderStatus.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/order/OrderStatus.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/order/OrderStatus.groovy (original)
+++ ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/order/OrderStatus.groovy Wed Nov 2 19:09:13 2016
@@ -17,140 +17,140 @@
* under the License.
*/
-import java.math.BigDecimal;
-import org.apache.ofbiz.base.util.*;
-import org.apache.ofbiz.entity.*;
-import org.apache.ofbiz.entity.condition.*;
-import org.apache.ofbiz.entity.util.*;
-import org.apache.ofbiz.accounting.payment.*;
-import org.apache.ofbiz.order.order.*;
-import org.apache.ofbiz.party.contact.*;
-import org.apache.ofbiz.product.catalog.*;
-import org.apache.ofbiz.product.store.*;
+import java.math.BigDecimal
+import org.apache.ofbiz.base.util.*
+import org.apache.ofbiz.entity.*
+import org.apache.ofbiz.entity.condition.*
+import org.apache.ofbiz.entity.util.*
+import org.apache.ofbiz.accounting.payment.*
+import org.apache.ofbiz.order.order.*
+import org.apache.ofbiz.party.contact.*
+import org.apache.ofbiz.product.catalog.*
+import org.apache.ofbiz.product.store.*
-orderId = parameters.orderId;
-orderHeader = null;
+orderId = parameters.orderId
+orderHeader = null
// we have a special case here where for an anonymous order the user will already be logged out, but the userLogin will be in the request so we can still do a security check here
if (!userLogin) {
- userLogin = parameters.temporaryAnonymousUserLogin;
+ userLogin = parameters.temporaryAnonymousUserLogin
// This is another special case, when Order is placed by anonymous user from ecommerce and then Order is completed by admin(or any user) from Order Manager
// then userLogin is not found when Order Complete Mail is send to user.
if (!userLogin) {
if (orderId) {
- orderHeader = from("OrderHeader").where("orderId", orderId).queryOne();
- orderStatuses = orderHeader.getRelated("OrderStatus", null, null, false);
- filteredOrderStatusList = [];
- extOfflineModeExists = false;
+ orderHeader = from("OrderHeader").where("orderId", orderId).queryOne()
+ orderStatuses = orderHeader.getRelated("OrderStatus", null, null, false)
+ filteredOrderStatusList = []
+ extOfflineModeExists = false
// Handled the case of OFFLINE payment method. In case of OFFLINE payment "ORDER_CREATED" status must be checked.
- orderPaymentPreferences = orderHeader.getRelated("OrderPaymentPreference", null, UtilMisc.toList("orderPaymentPreferenceId"), false);
- filteredOrderPaymentPreferences = EntityUtil.filterByCondition(orderPaymentPreferences, EntityCondition.makeCondition("paymentMethodTypeId", EntityOperator.IN, ["EXT_OFFLINE"]));
+ orderPaymentPreferences = orderHeader.getRelated("OrderPaymentPreference", null, UtilMisc.toList("orderPaymentPreferenceId"), false)
+ filteredOrderPaymentPreferences = EntityUtil.filterByCondition(orderPaymentPreferences, EntityCondition.makeCondition("paymentMethodTypeId", EntityOperator.IN, ["EXT_OFFLINE"]))
if (filteredOrderPaymentPreferences) {
- extOfflineModeExists = true;
+ extOfflineModeExists = true
}
if (extOfflineModeExists) {
- filteredOrderStatusList = EntityUtil.filterByCondition(orderStatuses, EntityCondition.makeCondition("statusId", EntityOperator.IN, ["ORDER_COMPLETED", "ORDER_APPROVED", "ORDER_CREATED"]));
+ filteredOrderStatusList = EntityUtil.filterByCondition(orderStatuses, EntityCondition.makeCondition("statusId", EntityOperator.IN, ["ORDER_COMPLETED", "ORDER_APPROVED", "ORDER_CREATED"]))
} else {
- filteredOrderStatusList = EntityUtil.filterByCondition(orderStatuses, EntityCondition.makeCondition("statusId", EntityOperator.IN, ["ORDER_COMPLETED", "ORDER_APPROVED"]));
+ filteredOrderStatusList = EntityUtil.filterByCondition(orderStatuses, EntityCondition.makeCondition("statusId", EntityOperator.IN, ["ORDER_COMPLETED", "ORDER_APPROVED"]))
}
if (UtilValidate.isNotEmpty(filteredOrderStatusList)) {
if (filteredOrderStatusList.size() < 2) {
- statusUserLogin = EntityUtil.getFirst(filteredOrderStatusList).statusUserLogin;
- userLogin = from("UserLogin").where("userLoginId", statusUserLogin).queryOne();
+ statusUserLogin = EntityUtil.getFirst(filteredOrderStatusList).statusUserLogin
+ userLogin = from("UserLogin").where("userLoginId", statusUserLogin).queryOne()
} else {
filteredOrderStatusList.each { orderStatus ->
if ("ORDER_COMPLETED".equals(orderStatus.statusId)) {
- statusUserLogin = orderStatus.statusUserLogin;
- userLogin = from("UserLogin").where("userLoginId", statusUserLogin).queryOne();
+ statusUserLogin = orderStatus.statusUserLogin
+ userLogin = from("UserLogin").where("userLoginId", statusUserLogin).queryOne()
}
}
}
}
}
}
- context.userLogin = userLogin;
+ context.userLogin = userLogin
}
-/* partyId = null;
+/* partyId = null
if (userLogin) partyId = userLogin.partyId; */
-partyId = context.partyId;
+partyId = context.partyId
if (userLogin) {
if (!partyId) {
- partyId = userLogin.partyId;
+ partyId = userLogin.partyId
}
}
// can anybody view an anonymous order? this is set in the screen widget and should only be turned on by an email confirmation screen
-allowAnonymousView = context.allowAnonymousView;
+allowAnonymousView = context.allowAnonymousView
-isDemoStore = true;
+isDemoStore = true
if (orderId) {
- orderHeader = from("OrderHeader").where("orderId", orderId).queryOne();
+ orderHeader = from("OrderHeader").where("orderId", orderId).queryOne()
if ("PURCHASE_ORDER".equals(orderHeader?.orderTypeId)) {
//drop shipper or supplier
- roleTypeId = "SUPPLIER_AGENT";
+ roleTypeId = "SUPPLIER_AGENT"
} else {
//customer
- roleTypeId = "PLACING_CUSTOMER";
+ roleTypeId = "PLACING_CUSTOMER"
}
- context.roleTypeId = roleTypeId;
+ context.roleTypeId = roleTypeId
// check OrderRole to make sure the user can view this order. This check must be done for any order which is not anonymously placed and
// any anonymous order when the allowAnonymousView security flag (see above) is not set to Y, to prevent peeking
if (orderHeader && (!"anonymous".equals(orderHeader.createdBy) || ("anonymous".equals(orderHeader.createdBy) && !"Y".equals(allowAnonymousView)))) {
- orderRole = from("OrderRole").where("orderId", orderId, "partyId", partyId, "roleTypeId", roleTypeId).queryFirst();
+ orderRole = from("OrderRole").where("orderId", orderId, "partyId", partyId, "roleTypeId", roleTypeId).queryFirst()
if (!userLogin || !orderRole) {
- context.remove("orderHeader");
- orderHeader = null;
- Debug.logWarning("Warning: in OrderStatus.groovy before getting order detail info: role not found or user not logged in; partyId=[" + partyId + "], userLoginId=[" + (userLogin == null ? "null" : userLogin.get("userLoginId")) + "]", "orderstatus");
+ context.remove("orderHeader")
+ orderHeader = null
+ Debug.logWarning("Warning: in OrderStatus.groovy before getting order detail info: role not found or user not logged in; partyId=[" + partyId + "], userLoginId=[" + (userLogin == null ? "null" : userLogin.get("userLoginId")) + "]", "orderstatus")
}
}
}
if (orderHeader) {
- productStore = orderHeader.getRelatedOne("ProductStore", true);
- if (productStore) isDemoStore = !"N".equals(productStore.isDemoStore);
+ productStore = orderHeader.getRelatedOne("ProductStore", true)
+ if (productStore) isDemoStore = !"N".equals(productStore.isDemoStore)
- orderReadHelper = new OrderReadHelper(orderHeader);
- orderItems = orderReadHelper.getOrderItems();
- orderAdjustments = orderReadHelper.getAdjustments();
- orderHeaderAdjustments = orderReadHelper.getOrderHeaderAdjustments();
- orderSubTotal = orderReadHelper.getOrderItemsSubTotal();
- orderItemShipGroups = orderReadHelper.getOrderItemShipGroups();
- headerAdjustmentsToShow = orderReadHelper.getOrderHeaderAdjustmentsToShow();
-
- orderShippingTotal = OrderReadHelper.getAllOrderItemsAdjustmentsTotal(orderItems, orderAdjustments, false, false, true);
- orderShippingTotal = orderShippingTotal.add(OrderReadHelper.calcOrderAdjustments(orderHeaderAdjustments, orderSubTotal, false, false, true));
-
- orderTaxTotal = OrderReadHelper.getAllOrderItemsAdjustmentsTotal(orderItems, orderAdjustments, false, true, false);
- orderTaxTotal = orderTaxTotal.add(OrderReadHelper.calcOrderAdjustments(orderHeaderAdjustments, orderSubTotal, false, true, false));
+ orderReadHelper = new OrderReadHelper(orderHeader)
+ orderItems = orderReadHelper.getOrderItems()
+ orderAdjustments = orderReadHelper.getAdjustments()
+ orderHeaderAdjustments = orderReadHelper.getOrderHeaderAdjustments()
+ orderSubTotal = orderReadHelper.getOrderItemsSubTotal()
+ orderItemShipGroups = orderReadHelper.getOrderItemShipGroups()
+ headerAdjustmentsToShow = orderReadHelper.getOrderHeaderAdjustmentsToShow()
+
+ orderShippingTotal = OrderReadHelper.getAllOrderItemsAdjustmentsTotal(orderItems, orderAdjustments, false, false, true)
+ orderShippingTotal = orderShippingTotal.add(OrderReadHelper.calcOrderAdjustments(orderHeaderAdjustments, orderSubTotal, false, false, true))
+
+ orderTaxTotal = OrderReadHelper.getAllOrderItemsAdjustmentsTotal(orderItems, orderAdjustments, false, true, false)
+ orderTaxTotal = orderTaxTotal.add(OrderReadHelper.calcOrderAdjustments(orderHeaderAdjustments, orderSubTotal, false, true, false))
- placingCustomerOrderRole = from("OrderRole").where("orderId", orderId, "roleTypeId", roleTypeId).queryFirst();
- placingCustomerPerson = placingCustomerOrderRole == null ? null : from("Person").where("partyId", placingCustomerOrderRole.partyId).queryOne();
+ placingCustomerOrderRole = from("OrderRole").where("orderId", orderId, "roleTypeId", roleTypeId).queryFirst()
+ placingCustomerPerson = placingCustomerOrderRole == null ? null : from("Person").where("partyId", placingCustomerOrderRole.partyId).queryOne()
- billingAccount = orderHeader.getRelatedOne("BillingAccount", false);
+ billingAccount = orderHeader.getRelatedOne("BillingAccount", false)
- orderPaymentPreferences = EntityUtil.filterByAnd(orderHeader.getRelated("OrderPaymentPreference", null, null, false), [EntityCondition.makeCondition("statusId", EntityOperator.NOT_EQUAL, "PAYMENT_CANCELLED")]);
- paymentMethods = [];
+ orderPaymentPreferences = EntityUtil.filterByAnd(orderHeader.getRelated("OrderPaymentPreference", null, null, false), [EntityCondition.makeCondition("statusId", EntityOperator.NOT_EQUAL, "PAYMENT_CANCELLED")])
+ paymentMethods = []
orderPaymentPreferences.each { opp ->
- paymentMethod = opp.getRelatedOne("PaymentMethod", false);
+ paymentMethod = opp.getRelatedOne("PaymentMethod", false)
if (paymentMethod) {
- paymentMethods.add(paymentMethod);
+ paymentMethods.add(paymentMethod)
} else {
- paymentMethodType = opp.getRelatedOne("PaymentMethodType", false);
+ paymentMethodType = opp.getRelatedOne("PaymentMethodType", false)
if (paymentMethodType) {
- context.paymentMethodType = paymentMethodType;
+ context.paymentMethodType = paymentMethodType
}
}
}
- payToPartyId = productStore.payToPartyId;
- paymentAddress = PaymentWorker.getPaymentAddress(delegator, payToPartyId);
- if (paymentAddress) context.paymentAddress = paymentAddress;
+ payToPartyId = productStore.payToPartyId
+ paymentAddress = PaymentWorker.getPaymentAddress(delegator, payToPartyId)
+ if (paymentAddress) context.paymentAddress = paymentAddress
// get Shipment tracking info
orderShipmentInfoSummaryList = select("shipmentId", "shipmentRouteSegmentId", "carrierPartyId", "shipmentMethodTypeId","shipmentPackageSeqId","trackingCode","boxNumber")
@@ -158,59 +158,59 @@ if (orderHeader) {
.where("orderId", orderId)
.orderBy("shipmentId", "shipmentRouteSegmentId", "shipmentPackageSeqId")
.distinct(true)
- .queryList();
+ .queryList()
- customerPoNumberSet = new TreeSet();
+ customerPoNumberSet = new TreeSet()
orderItems.each { orderItemPo ->
- correspondingPoId = orderItemPo.correspondingPoId;
+ correspondingPoId = orderItemPo.correspondingPoId
if (correspondingPoId && !"(none)".equals(correspondingPoId)) {
- customerPoNumberSet.add(correspondingPoId);
+ customerPoNumberSet.add(correspondingPoId)
}
}
// check if there are returnable items
- returned = 0.00;
- totalItems = 0.00;
+ returned = 0.00
+ totalItems = 0.00
orderItems.each { oitem ->
- totalItems += oitem.quantity;
- ritems = oitem.getRelated("ReturnItem", null, null, false);
+ totalItems += oitem.quantity
+ ritems = oitem.getRelated("ReturnItem", null, null, false)
ritems.each { ritem ->
- rh = ritem.getRelatedOne("ReturnHeader", false);
+ rh = ritem.getRelatedOne("ReturnHeader", false)
if (!rh.statusId.equals("RETURN_CANCELLED")) {
- returned += ritem.returnQuantity;
+ returned += ritem.returnQuantity
}
}
}
if (totalItems > returned) {
- context.returnLink = "Y";
+ context.returnLink = "Y"
}
- context.orderId = orderId;
- context.orderHeader = orderHeader;
- context.localOrderReadHelper = orderReadHelper;
- context.orderItems = orderItems;
- context.orderAdjustments = orderAdjustments;
- context.orderHeaderAdjustments = orderHeaderAdjustments;
- context.orderSubTotal = orderSubTotal;
- context.orderItemShipGroups = orderItemShipGroups;
- context.headerAdjustmentsToShow = headerAdjustmentsToShow;
- context.currencyUomId = orderReadHelper.getCurrency();
-
- context.orderShippingTotal = orderShippingTotal;
- context.orderTaxTotal = orderTaxTotal;
- context.orderGrandTotal = OrderReadHelper.getOrderGrandTotal(orderItems, orderAdjustments);
- context.placingCustomerPerson = placingCustomerPerson;
-
- context.billingAccount = billingAccount;
- context.paymentMethods = paymentMethods;
+ context.orderId = orderId
+ context.orderHeader = orderHeader
+ context.localOrderReadHelper = orderReadHelper
+ context.orderItems = orderItems
+ context.orderAdjustments = orderAdjustments
+ context.orderHeaderAdjustments = orderHeaderAdjustments
+ context.orderSubTotal = orderSubTotal
+ context.orderItemShipGroups = orderItemShipGroups
+ context.headerAdjustmentsToShow = headerAdjustmentsToShow
+ context.currencyUomId = orderReadHelper.getCurrency()
+
+ context.orderShippingTotal = orderShippingTotal
+ context.orderTaxTotal = orderTaxTotal
+ context.orderGrandTotal = OrderReadHelper.getOrderGrandTotal(orderItems, orderAdjustments)
+ context.placingCustomerPerson = placingCustomerPerson
+
+ context.billingAccount = billingAccount
+ context.paymentMethods = paymentMethods
- context.productStore = productStore;
- context.isDemoStore = isDemoStore;
+ context.productStore = productStore
+ context.isDemoStore = isDemoStore
- context.orderShipmentInfoSummaryList = orderShipmentInfoSummaryList;
- context.customerPoNumberSet = customerPoNumberSet;
+ context.orderShipmentInfoSummaryList = orderShipmentInfoSummaryList
+ context.customerPoNumberSet = customerPoNumberSet
- orderItemChangeReasons = from("Enumeration").where("enumTypeId", "ODR_ITM_CH_REASON").queryList();
- context.orderItemChangeReasons = orderItemChangeReasons;
+ orderItemChangeReasons = from("Enumeration").where("enumTypeId", "ODR_ITM_CH_REASON").queryList()
+ context.orderItemChangeReasons = orderItemChangeReasons
}
Modified: ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/order/PaymentInformation.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/order/PaymentInformation.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/order/PaymentInformation.groovy (original)
+++ ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/order/PaymentInformation.groovy Wed Nov 2 19:09:13 2016
@@ -17,72 +17,72 @@
* under the License.
*/
-import org.apache.ofbiz.entity.*;
-import org.apache.ofbiz.entity.util.*;
-import org.apache.ofbiz.base.util.*;
-import org.apache.ofbiz.accounting.payment.*;
-import org.apache.ofbiz.order.shoppingcart.*;
-import org.apache.ofbiz.party.contact.*;
+import org.apache.ofbiz.entity.*
+import org.apache.ofbiz.entity.util.*
+import org.apache.ofbiz.base.util.*
+import org.apache.ofbiz.accounting.payment.*
+import org.apache.ofbiz.order.shoppingcart.*
+import org.apache.ofbiz.party.contact.*
-cart = ShoppingCartEvents.getCartObject(request);
-context.cart = cart;
+cart = ShoppingCartEvents.getCartObject(request)
+context.cart = cart
-partyId = cart.getPartyId();
-currencyUomId = cart.getCurrency();
+partyId = cart.getPartyId()
+currencyUomId = cart.getCurrency()
if (!partyId) {
- partyId = userLogin.partyId;
+ partyId = userLogin.partyId
}
-context.partyId = partyId;
+context.partyId = partyId
if (partyId && !partyId.equals("_NA_")) {
- party = from("Party").where("partyId", partyId).queryOne();
- person = party.getRelatedOne("Person", false);
- context.party = party;
- context.person = person;
+ party = from("Party").where("partyId", partyId).queryOne()
+ person = party.getRelatedOne("Person", false)
+ context.party = party
+ context.person = person
}
// nuke the event messages
-request.removeAttribute("_EVENT_MESSAGE_");
+request.removeAttribute("_EVENT_MESSAGE_")
if (parameters.useShipAddr && cart.getShippingContactMechId()) {
- shippingContactMech = cart.getShippingContactMechId();
- postalAddress = from("PostalAddress").where("contactMechId", shippingContactMech).queryOne();
- context.useEntityFields = "Y";
- context.postalAddress = postalAddress;
+ shippingContactMech = cart.getShippingContactMechId()
+ postalAddress = from("PostalAddress").where("contactMechId", shippingContactMech).queryOne()
+ context.useEntityFields = "Y"
+ context.postalAddress = postalAddress
if (postalAddress && partyId) {
- partyContactMech = from("PartyContactMech").where("partyId", partyId, "contactMechId", postalAddress.contactMechId).orderBy("-fromDate").filterByDate().queryFirst();
- context.partyContactMech = partyContactMech;
+ partyContactMech = from("PartyContactMech").where("partyId", partyId, "contactMechId", postalAddress.contactMechId).orderBy("-fromDate").filterByDate().queryFirst()
+ context.partyContactMech = partyContactMech
}
} else {
- context.postalAddress = UtilHttp.getParameterMap(request);
+ context.postalAddress = UtilHttp.getParameterMap(request)
}
if (cart) {
if (cart.getPaymentMethodIds()) {
- paymentMethods = cart.getPaymentMethods();
+ paymentMethods = cart.getPaymentMethods()
paymentMethods.each { paymentMethod ->
- account = null;
+ account = null
if ("CREDIT_CARD".equals(paymentMethod?.paymentMethodTypeId)) {
- account = paymentMethod.getRelatedOne("CreditCard", false);
- context.creditCard = account;
- context.paymentMethodTypeId = "CREDIT_CARD";
+ account = paymentMethod.getRelatedOne("CreditCard", false)
+ context.creditCard = account
+ context.paymentMethodTypeId = "CREDIT_CARD"
} else if ("EFT_ACCOUNT".equals(paymentMethod?.paymentMethodTypeId)) {
- account = paymentMethod.getRelatedOne("EftAccount", false);
- context.eftAccount = account;
- context.paymentMethodTypeId = "EFT_ACCOUNT";
+ account = paymentMethod.getRelatedOne("EftAccount", false)
+ context.eftAccount = account
+ context.paymentMethodTypeId = "EFT_ACCOUNT"
} else if ("GIFT_CARD".equals(paymentMethod?.paymentMethodTypeId)) {
- account = paymentMethod.getRelatedOne("GiftCard", false);
- context.giftCard = account;
- context.paymentMethodTypeId = "GIFT_CARD";
- context.addGiftCard = "Y";
+ account = paymentMethod.getRelatedOne("GiftCard", false)
+ context.giftCard = account
+ context.paymentMethodTypeId = "GIFT_CARD"
+ context.addGiftCard = "Y"
} else {
- context.paymentMethodTypeId = "EXT_OFFLINE";
+ context.paymentMethodTypeId = "EXT_OFFLINE"
}
if (account && !parameters.useShipAddr) {
- address = account.getRelatedOne("PostalAddress", false);
- context.postalAddress = address;
+ address = account.getRelatedOne("PostalAddress", false)
+ context.postalAddress = address
}
}
}
@@ -90,28 +90,28 @@ if (cart) {
if (!parameters.useShipAddr) {
if (cart && context.postalAddress) {
- postalAddress = context.postalAddress;
- shippingContactMechId = cart.getShippingContactMechId();
- contactMechId = postalAddress.contactMechId;
+ postalAddress = context.postalAddress
+ shippingContactMechId = cart.getShippingContactMechId()
+ contactMechId = postalAddress.contactMechId
if (shippingContactMechId?.equals(contactMechId)) {
- context.useShipAddr = "Y";
+ context.useShipAddr = "Y"
}
}
} else {
- context.useShipAddr = parameters.useShipAddr;
+ context.useShipAddr = parameters.useShipAddr
}
// Added here to satisfy GenericAddress.ftl
if (context.postalAddress) {
- postalAddress = context.postalAddress;
- parameters.address1 = postalAddress.address1;
- parameters.address2 = postalAddress.address2;
- parameters.city = postalAddress.city;
- parameters.stateProvinceGeoId = postalAddress.stateProvinceGeoId;
- parameters.postalCode = postalAddress.postalCode;
- parameters.countryGeoId = postalAddress.countryGeoId;
- parameters.contactMechId = postalAddress.contactMechId;
+ postalAddress = context.postalAddress
+ parameters.address1 = postalAddress.address1
+ parameters.address2 = postalAddress.address2
+ parameters.city = postalAddress.city
+ parameters.stateProvinceGeoId = postalAddress.stateProvinceGeoId
+ parameters.postalCode = postalAddress.postalCode
+ parameters.countryGeoId = postalAddress.countryGeoId
+ parameters.contactMechId = postalAddress.contactMechId
if (context.creditCard) {
- context.callSubmitForm = true;
+ context.callSubmitForm = true
}
}
Modified: ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/order/PaymentOptions.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/order/PaymentOptions.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/order/PaymentOptions.groovy (original)
+++ ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/order/PaymentOptions.groovy Wed Nov 2 19:09:13 2016
@@ -17,16 +17,16 @@
* under the License.
*/
-import org.apache.ofbiz.order.shoppingcart.*;
+import org.apache.ofbiz.order.shoppingcart.*
//Get the Cart
-cart = ShoppingCartEvents.getCartObject(request);
-paymentMethodTypeIds = cart.getPaymentMethodTypeIds();
+cart = ShoppingCartEvents.getCartObject(request)
+paymentMethodTypeIds = cart.getPaymentMethodTypeIds()
paymentMethodTypeIds.each { paymentMethodTypeId ->
- context.callSubmitForm = true;
+ context.callSubmitForm = true
if ("GIFT_CARD".equals(paymentMethodTypeId)) {
- context.addGiftCard = "Y";
+ context.addGiftCard = "Y"
} else {
- context.paymentMethodTypeId = paymentMethodTypeId;
+ context.paymentMethodTypeId = paymentMethodTypeId
}
}
Modified: ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/order/QuickAnonCheckoutLinks.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/order/QuickAnonCheckoutLinks.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/order/QuickAnonCheckoutLinks.groovy (original)
+++ ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/order/QuickAnonCheckoutLinks.groovy Wed Nov 2 19:09:13 2016
@@ -16,16 +16,16 @@
* specific language governing permissions and limitations
* under the License.
*/
-import org.apache.ofbiz.order.shoppingcart.ShoppingCartEvents;
+import org.apache.ofbiz.order.shoppingcart.ShoppingCartEvents
-shoppingCart = ShoppingCartEvents.getCartObject(request);
+shoppingCart = ShoppingCartEvents.getCartObject(request)
-userLogin = context.userLogin;
+userLogin = context.userLogin
if (userLogin) {
- context.enableShippingAddress = true;
+ context.enableShippingAddress = true
}
-shippingContactMechId = shoppingCart.getShippingContactMechId();
+shippingContactMechId = shoppingCart.getShippingContactMechId()
if (shippingContactMechId) {
- context.enableShipmentMethod = true;
+ context.enableShipmentMethod = true
}
Modified: ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/order/QuickAnonCustSettings.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/order/QuickAnonCustSettings.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/order/QuickAnonCustSettings.groovy (original)
+++ ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/order/QuickAnonCustSettings.groovy Wed Nov 2 19:09:13 2016
@@ -17,123 +17,123 @@
* under the License.
*/
-import org.apache.ofbiz.base.util.*;
-import org.apache.ofbiz.entity.util.EntityUtil;
-import org.apache.ofbiz.entity.*;
-import org.apache.ofbiz.entity.util.*;
-import org.apache.ofbiz.order.shoppingcart.*;
-import org.apache.ofbiz.party.contact.*;
-import org.apache.ofbiz.product.catalog.*;
+import org.apache.ofbiz.base.util.*
+import org.apache.ofbiz.entity.util.EntityUtil
+import org.apache.ofbiz.entity.*
+import org.apache.ofbiz.entity.util.*
+import org.apache.ofbiz.order.shoppingcart.*
+import org.apache.ofbiz.party.contact.*
+import org.apache.ofbiz.product.catalog.*
-partyId = null;
+partyId = null
-userLogin = context.userLogin;
+userLogin = context.userLogin
if (userLogin) {
- partyId = userLogin.partyId;
+ partyId = userLogin.partyId
}
if (!partyId && parameters.partyId) {
- partyId = parameters.partyId;
+ partyId = parameters.partyId
}
if (partyId) {
- parameters.partyId = partyId;
+ parameters.partyId = partyId
// NOTE: if there was an error, then don't look up and fill in all of this data, just use the values from the previous request (which will be in the parameters Map automagically)
if (!request.getAttribute("_ERROR_MESSAGE_") && !request.getAttribute("_ERROR_MESSAGE_LIST_")) {
- person = from("Person").where("partyId", partyId).queryOne();
+ person = from("Person").where("partyId", partyId).queryOne()
if (person) {
- context.callSubmitForm = true;
+ context.callSubmitForm = true
// should never be null for the anonymous checkout, but just in case
- parameters.firstName = person.firstName;
- parameters.middleName = person.middleName;
- parameters.lastName = person.lastName;
+ parameters.firstName = person.firstName
+ parameters.middleName = person.middleName
+ parameters.lastName = person.lastName
}
// get the Email Address
- emailPartyContactDetail = from("PartyContactDetailByPurpose").where("partyId", partyId, "contactMechPurposeTypeId", "PRIMARY_EMAIL").filterByDate().queryFirst();
+ emailPartyContactDetail = from("PartyContactDetailByPurpose").where("partyId", partyId, "contactMechPurposeTypeId", "PRIMARY_EMAIL").filterByDate().queryFirst()
if (emailPartyContactDetail) {
- parameters.emailContactMechId = emailPartyContactDetail.contactMechId;
- parameters.emailAddress = emailPartyContactDetail.infoString;
- parameters.emailSol = emailPartyContactDetail.allowSolicitation;
+ parameters.emailContactMechId = emailPartyContactDetail.contactMechId
+ parameters.emailAddress = emailPartyContactDetail.infoString
+ parameters.emailSol = emailPartyContactDetail.allowSolicitation
}
// get the Phone Numbers
- homePhonePartyContactDetail = from("PartyContactDetailByPurpose").where("partyId", partyId, "contactMechPurposeTypeId", "PHONE_HOME").filterByDate().queryFirst();
+ homePhonePartyContactDetail = from("PartyContactDetailByPurpose").where("partyId", partyId, "contactMechPurposeTypeId", "PHONE_HOME").filterByDate().queryFirst()
if (homePhonePartyContactDetail) {
- parameters.homePhoneContactMechId = homePhonePartyContactDetail.contactMechId;
- parameters.homeCountryCode = homePhonePartyContactDetail.countryCode;
- parameters.homeAreaCode = homePhonePartyContactDetail.areaCode;
- parameters.homeContactNumber = homePhonePartyContactDetail.contactNumber;
- parameters.homeExt = homePhonePartyContactDetail.extension;
- parameters.homeSol = homePhonePartyContactDetail.allowSolicitation;
+ parameters.homePhoneContactMechId = homePhonePartyContactDetail.contactMechId
+ parameters.homeCountryCode = homePhonePartyContactDetail.countryCode
+ parameters.homeAreaCode = homePhonePartyContactDetail.areaCode
+ parameters.homeContactNumber = homePhonePartyContactDetail.contactNumber
+ parameters.homeExt = homePhonePartyContactDetail.extension
+ parameters.homeSol = homePhonePartyContactDetail.allowSolicitation
}
- workPhonePartyContactDetail = from("PartyContactDetailByPurpose").where(partyId : partyId, contactMechPurposeTypeId : "PHONE_WORK").filterByDate().queryFirst();
+ workPhonePartyContactDetail = from("PartyContactDetailByPurpose").where(partyId : partyId, contactMechPurposeTypeId : "PHONE_WORK").filterByDate().queryFirst()
if (workPhonePartyContactDetail) {
- parameters.workPhoneContactMechId = workPhonePartyContactDetail.contactMechId;
- parameters.workCountryCode = workPhonePartyContactDetail.countryCode;
- parameters.workAreaCode = workPhonePartyContactDetail.areaCode;
- parameters.workContactNumber = workPhonePartyContactDetail.contactNumber;
- parameters.workExt = workPhonePartyContactDetail.extension;
- parameters.workSol = workPhonePartyContactDetail.allowSolicitation;
+ parameters.workPhoneContactMechId = workPhonePartyContactDetail.contactMechId
+ parameters.workCountryCode = workPhonePartyContactDetail.countryCode
+ parameters.workAreaCode = workPhonePartyContactDetail.areaCode
+ parameters.workContactNumber = workPhonePartyContactDetail.contactNumber
+ parameters.workExt = workPhonePartyContactDetail.extension
+ parameters.workSol = workPhonePartyContactDetail.allowSolicitation
}
}
}
-cart = session.getAttribute("shoppingCart");
-cartPartyId = cart.getPartyId();
-context.cart = cart;
+cart = session.getAttribute("shoppingCart")
+cartPartyId = cart.getPartyId()
+context.cart = cart
// nuke the event messages
-request.removeAttribute("_EVENT_MESSAGE_");
+request.removeAttribute("_EVENT_MESSAGE_")
if (cartPartyId && !cartPartyId.equals("_NA_")) {
- cartParty = from("Party").where("partyId", cartPartyId).queryOne();
+ cartParty = from("Party").where("partyId", cartPartyId).queryOne()
if (cartParty) {
- cartPerson = cartParty.getRelatedOne("Person", false);
- context.party = cartParty;
- context.person = cartPerson;
+ cartPerson = cartParty.getRelatedOne("Person", false)
+ context.party = cartParty
+ context.person = cartPerson
}
}
if (cart && cart.getShippingContactMechId()) {
- shippingContactMechId = cart.getShippingContactMechId();
- shippingPartyContactDetail = from("PartyContactDetailByPurpose").where("partyId", cartPartyId, "contactMechId", shippingContactMechId).filterByDate().queryFirst();
- parameters.shippingContactMechId = shippingPartyContactDetail.contactMechId;
- context.callSubmitForm = true;
- parameters.shipToName = shippingPartyContactDetail.toName;
- parameters.shipToAttnName = shippingPartyContactDetail.attnName;
- parameters.shipToAddress1 = shippingPartyContactDetail.address1;
- parameters.shipToAddress2 = shippingPartyContactDetail.address2;
- parameters.shipToCity = shippingPartyContactDetail.city;
- parameters.shipToPostalCode = shippingPartyContactDetail.postalCode;
- parameters.shipToStateProvinceGeoId = shippingPartyContactDetail.stateProvinceGeoId;
- parameters.shipToCountryGeoId = shippingPartyContactDetail.countryGeoId;
+ shippingContactMechId = cart.getShippingContactMechId()
+ shippingPartyContactDetail = from("PartyContactDetailByPurpose").where("partyId", cartPartyId, "contactMechId", shippingContactMechId).filterByDate().queryFirst()
+ parameters.shippingContactMechId = shippingPartyContactDetail.contactMechId
+ context.callSubmitForm = true
+ parameters.shipToName = shippingPartyContactDetail.toName
+ parameters.shipToAttnName = shippingPartyContactDetail.attnName
+ parameters.shipToAddress1 = shippingPartyContactDetail.address1
+ parameters.shipToAddress2 = shippingPartyContactDetail.address2
+ parameters.shipToCity = shippingPartyContactDetail.city
+ parameters.shipToPostalCode = shippingPartyContactDetail.postalCode
+ parameters.shipToStateProvinceGeoId = shippingPartyContactDetail.stateProvinceGeoId
+ parameters.shipToCountryGeoId = shippingPartyContactDetail.countryGeoId
} else {
- context.postalFields = UtilHttp.getParameterMap(request);
+ context.postalFields = UtilHttp.getParameterMap(request)
}
-billingContactMechId = session.getAttribute("billingContactMechId");
+billingContactMechId = session.getAttribute("billingContactMechId")
if (billingContactMechId) {
- billPostalAddress = from("PostalAddress").where("contactMechId", billingContactMechId).queryOne();
- parameters.billingContactMechId = billPostalAddress.contactMechId;
- parameters.billToName = billPostalAddress.toName;
- parameters.billToAttnName = billPostalAddress.attnName;
- parameters.billToAddress1 = billPostalAddress.address1;
- parameters.billToAddress2 = billPostalAddress.address2;
- parameters.billToCity = billPostalAddress.city;
- parameters.billToPostalCode = billPostalAddress.postalCode;
- parameters.billToStateProvinceGeoId = billPostalAddress.stateProvinceGeoId;
- parameters.billToCountryGeoId = billPostalAddress.countryGeoId;
+ billPostalAddress = from("PostalAddress").where("contactMechId", billingContactMechId).queryOne()
+ parameters.billingContactMechId = billPostalAddress.contactMechId
+ parameters.billToName = billPostalAddress.toName
+ parameters.billToAttnName = billPostalAddress.attnName
+ parameters.billToAddress1 = billPostalAddress.address1
+ parameters.billToAddress2 = billPostalAddress.address2
+ parameters.billToCity = billPostalAddress.city
+ parameters.billToPostalCode = billPostalAddress.postalCode
+ parameters.billToStateProvinceGeoId = billPostalAddress.stateProvinceGeoId
+ parameters.billToCountryGeoId = billPostalAddress.countryGeoId
}
if (cart?.getShippingContactMechId() && shippingPartyContactDetail) {
- shippingContactMechId = shippingPartyContactDetail.contactMechId;
+ shippingContactMechId = shippingPartyContactDetail.contactMechId
if (billingContactMechId?.equals(shippingContactMechId)) {
- context.useShippingPostalAddressForBilling = "Y";
+ context.useShippingPostalAddressForBilling = "Y"
}
}
-parameters.shippingContactMechPurposeTypeId = "SHIPPING_LOCATION";
-parameters.billingContactMechPurposeTypeId = "BILLING_LOCATION";
+parameters.shippingContactMechPurposeTypeId = "SHIPPING_LOCATION"
+parameters.billingContactMechPurposeTypeId = "BILLING_LOCATION"
Modified: ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/order/QuickAnonOptionSettings.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/order/QuickAnonOptionSettings.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/order/QuickAnonOptionSettings.groovy (original)
+++ ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/order/QuickAnonOptionSettings.groovy Wed Nov 2 19:09:13 2016
@@ -17,40 +17,40 @@
* under the License.
*/
-import org.apache.ofbiz.entity.*;
-import org.apache.ofbiz.base.util.*;
-import org.apache.ofbiz.order.shoppingcart.*;
-import org.apache.ofbiz.order.shoppingcart.shipping.*;
-import org.apache.ofbiz.party.contact.*;
-import org.apache.ofbiz.product.store.*;
-
-shoppingCart = session.getAttribute("shoppingCart");
-context.shoppingCart = shoppingCart;
-productStore = ProductStoreWorker.getProductStore(request);
+import org.apache.ofbiz.entity.*
+import org.apache.ofbiz.base.util.*
+import org.apache.ofbiz.order.shoppingcart.*
+import org.apache.ofbiz.order.shoppingcart.shipping.*
+import org.apache.ofbiz.party.contact.*
+import org.apache.ofbiz.product.store.*
+
+shoppingCart = session.getAttribute("shoppingCart")
+context.shoppingCart = shoppingCart
+productStore = ProductStoreWorker.getProductStore(request)
if (shoppingCart) {
- shippingEstWpr = new ShippingEstimateWrapper(dispatcher, shoppingCart, 0);
- context.shippingEstWpr = shippingEstWpr;
- context.carrierShipmentMethodList = shippingEstWpr.getShippingMethods();
+ shippingEstWpr = new ShippingEstimateWrapper(dispatcher, shoppingCart, 0)
+ context.shippingEstWpr = shippingEstWpr
+ context.carrierShipmentMethodList = shippingEstWpr.getShippingMethods()
}
// nuke the event messages
-request.removeAttribute("_EVENT_MESSAGE_");
+request.removeAttribute("_EVENT_MESSAGE_")
-party = null;
-partyId = session.getAttribute("orderPartyId");
+party = null
+partyId = session.getAttribute("orderPartyId")
if (partyId) {
- party = from("Party").where("partyId", partyId).queryOne();
- context.party = party;
+ party = from("Party").where("partyId", partyId).queryOne()
+ context.party = party
}
-context.emailList = ContactHelper.getContactMechByType(party, "EMAIL_ADDRESS", false);
+context.emailList = ContactHelper.getContactMechByType(party, "EMAIL_ADDRESS", false)
if (shoppingCart?.getShipmentMethodTypeId() && shoppingCart.getCarrierPartyId()) {
- context.chosenShippingMethod = shoppingCart.getShipmentMethodTypeId() + '@' + shoppingCart.getCarrierPartyId();
- context.callSubmitForm = true;
+ context.chosenShippingMethod = shoppingCart.getShipmentMethodTypeId() + '@' + shoppingCart.getCarrierPartyId()
+ context.callSubmitForm = true
}
-context.productStoreId = productStore.productStoreId;
-context.productStore = productStore;
+context.productStoreId = productStore.productStoreId
+context.productStore = productStore
Modified: ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/order/QuickAnonPaymentInformation.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/order/QuickAnonPaymentInformation.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/order/QuickAnonPaymentInformation.groovy (original)
+++ ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/order/QuickAnonPaymentInformation.groovy Wed Nov 2 19:09:13 2016
@@ -17,27 +17,27 @@
* under the License.
*/
-import org.apache.ofbiz.entity.*;
-import org.apache.ofbiz.entity.util.*;
-import org.apache.ofbiz.base.util.*;
-import org.apache.ofbiz.accounting.payment.*;
-import org.apache.ofbiz.order.shoppingcart.*;
-import org.apache.ofbiz.party.contact.*;
+import org.apache.ofbiz.entity.*
+import org.apache.ofbiz.entity.util.*
+import org.apache.ofbiz.base.util.*
+import org.apache.ofbiz.accounting.payment.*
+import org.apache.ofbiz.order.shoppingcart.*
+import org.apache.ofbiz.party.contact.*
-cart = ShoppingCartEvents.getCartObject(request);
-context.cart = cart;
+cart = ShoppingCartEvents.getCartObject(request)
+context.cart = cart
-paymentMethodTypeId = parameters.paymentMethodTypeId ?: "CREDIT_CARD";
+paymentMethodTypeId = parameters.paymentMethodTypeId ?: "CREDIT_CARD"
// nuke the event messages
-request.removeAttribute("_EVENT_MESSAGE_");
+request.removeAttribute("_EVENT_MESSAGE_")
if (cart?.getPaymentMethodIds()) {
- paymentMethods = cart.getPaymentMethods();
+ paymentMethods = cart.getPaymentMethods()
paymentMethods.each {paymentMethod ->
if ("CREDIT_CARD".equals(paymentMethod?.paymentMethodTypeId)) {
- paymentMethodId = paymentMethod.paymentMethodId;
- parameters.paymentMethodId = paymentMethodId;
+ paymentMethodId = paymentMethod.paymentMethodId
+ parameters.paymentMethodId = paymentMethodId
}
}
}
Modified: ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/order/RequestReturn.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/order/RequestReturn.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/order/RequestReturn.groovy (original)
+++ ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/order/RequestReturn.groovy Wed Nov 2 19:09:13 2016
@@ -17,39 +17,39 @@
* under the License.
*/
-import org.apache.ofbiz.base.util.*;
-import org.apache.ofbiz.entity.*;
-import org.apache.ofbiz.party.contact.*;
+import org.apache.ofbiz.base.util.*
+import org.apache.ofbiz.entity.*
+import org.apache.ofbiz.party.contact.*
-orderId = parameters.orderId;
-context.orderId = orderId;
+orderId = parameters.orderId
+context.orderId = orderId
-party = userLogin.getRelatedOne("Party", false);
-context.party = party;
+party = userLogin.getRelatedOne("Party", false)
+context.party = party
-returnTypes = from("ReturnType").orderBy("sequenceId").queryList();
-context.returnTypes = returnTypes;
+returnTypes = from("ReturnType").orderBy("sequenceId").queryList()
+context.returnTypes = returnTypes
-returnReasons = from("ReturnReason").orderBy("sequenceId").queryList();
-context.returnReasons = returnReasons;
+returnReasons = from("ReturnReason").orderBy("sequenceId").queryList()
+context.returnReasons = returnReasons
if (orderId) {
- returnRes = runService('getReturnableItems', [orderId : orderId]);
- context.returnableItems = returnRes.returnableItems;
- orderHeader = from("OrderHeader").where("orderId", orderId).queryOne();
- context.orderHeader = orderHeader;
+ returnRes = runService('getReturnableItems', [orderId : orderId])
+ context.returnableItems = returnRes.returnableItems
+ orderHeader = from("OrderHeader").where("orderId", orderId).queryOne()
+ context.orderHeader = orderHeader
}
-returnItemTypeMap = from("ReturnItemTypeMap").where("returnHeaderTypeId", "CUSTOMER_RETURN").queryList();
-typeMap = new HashMap();
+returnItemTypeMap = from("ReturnItemTypeMap").where("returnHeaderTypeId", "CUSTOMER_RETURN").queryList()
+typeMap = new HashMap()
returnItemTypeMap.each { value -> typeMap[value.returnItemMapKey] = value.returnItemTypeId }
-context.returnItemTypeMap = typeMap;
+context.returnItemTypeMap = typeMap
//put in the return to party information from the order header
if (orderId) {
- order = from("OrderHeader").where("orderId", orderId).queryOne();
- productStore = order.getRelatedOne("ProductStore", false);
- context.toPartyId = productStore.payToPartyId;
+ order = from("OrderHeader").where("orderId", orderId).queryOne()
+ productStore = order.getRelatedOne("ProductStore", false)
+ context.toPartyId = productStore.payToPartyId
}
-context.shippingContactMechList = ContactHelper.getContactMech(party, "SHIPPING_LOCATION", "POSTAL_ADDRESS", false);
+context.shippingContactMechList = ContactHelper.getContactMech(party, "SHIPPING_LOCATION", "POSTAL_ADDRESS", false)
Modified: ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/order/ShipSettings.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/order/ShipSettings.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/order/ShipSettings.groovy (original)
+++ ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/order/ShipSettings.groovy Wed Nov 2 19:09:13 2016
@@ -17,59 +17,59 @@
* under the License.
*/
-import org.apache.ofbiz.entity.*;
-import org.apache.ofbiz.entity.util.*;
-import org.apache.ofbiz.base.util.*;
-import org.apache.ofbiz.order.shoppingcart.*;
-import org.apache.ofbiz.party.contact.*;
-import org.apache.ofbiz.product.catalog.*;
-
-cart = session.getAttribute("shoppingCart");
-partyId = cart.getPartyId();
-context.cart = cart;
+import org.apache.ofbiz.entity.*
+import org.apache.ofbiz.entity.util.*
+import org.apache.ofbiz.base.util.*
+import org.apache.ofbiz.order.shoppingcart.*
+import org.apache.ofbiz.party.contact.*
+import org.apache.ofbiz.product.catalog.*
+
+cart = session.getAttribute("shoppingCart")
+partyId = cart.getPartyId()
+context.cart = cart
// nuke the event messages
-request.removeAttribute("_EVENT_MESSAGE_");
+request.removeAttribute("_EVENT_MESSAGE_")
if (partyId && !partyId.equals("_NA_")) {
- party = from("Party").where("partyId", partyId).queryOne();
- person = party.getRelatedOne("Person", false);
- context.party = party;
- context.person = person;
+ party = from("Party").where("partyId", partyId).queryOne()
+ person = party.getRelatedOne("Person", false)
+ context.party = party
+ context.person = person
}
if (cart?.getShippingContactMechId()) {
- shippingContactMechId = cart.getShippingContactMechId();
- shippingPartyContactDetail = from("PartyContactDetailByPurpose").where("partyId", partyId, "contactMechId", shippingContactMechId).filterByDate().queryFirst();
- parameters.shippingContactMechId = shippingPartyContactDetail.contactMechId;
- context.callSubmitForm = true;
+ shippingContactMechId = cart.getShippingContactMechId()
+ shippingPartyContactDetail = from("PartyContactDetailByPurpose").where("partyId", partyId, "contactMechId", shippingContactMechId).filterByDate().queryFirst()
+ parameters.shippingContactMechId = shippingPartyContactDetail.contactMechId
+ context.callSubmitForm = true
- fullAddressBuf = new StringBuffer();
- fullAddressBuf.append(shippingPartyContactDetail.address1);
+ fullAddressBuf = new StringBuffer()
+ fullAddressBuf.append(shippingPartyContactDetail.address1)
if (shippingPartyContactDetail.address2) {
- fullAddressBuf.append(", ");
- fullAddressBuf.append(shippingPartyContactDetail.address2);
+ fullAddressBuf.append(", ")
+ fullAddressBuf.append(shippingPartyContactDetail.address2)
}
- fullAddressBuf.append(", ");
- fullAddressBuf.append(shippingPartyContactDetail.city);
- fullAddressBuf.append(", ");
- fullAddressBuf.append(shippingPartyContactDetail.postalCode);
- parameters.fullAddress = fullAddressBuf.toString();
+ fullAddressBuf.append(", ")
+ fullAddressBuf.append(shippingPartyContactDetail.city)
+ fullAddressBuf.append(", ")
+ fullAddressBuf.append(shippingPartyContactDetail.postalCode)
+ parameters.fullAddress = fullAddressBuf.toString()
// NOTE: these parameters are a special case because they might be filled in by the address lookup service, so if they are there we won't fill in over them...
if (!parameters.postalCode) {
- parameters.attnName = shippingPartyContactDetail.attnName;
- parameters.address1 = shippingPartyContactDetail.address1;
- parameters.address2 = shippingPartyContactDetail.address2;
- parameters.city = shippingPartyContactDetail.city;
- parameters.postalCode = shippingPartyContactDetail.postalCode;
- parameters.stateProvinceGeoId = shippingPartyContactDetail.stateProvinceGeoId;
- parameters.countryGeoId = shippingPartyContactDetail.countryGeoId;
- parameters.allowSolicitation = shippingPartyContactDetail.allowSolicitation;
+ parameters.attnName = shippingPartyContactDetail.attnName
+ parameters.address1 = shippingPartyContactDetail.address1
+ parameters.address2 = shippingPartyContactDetail.address2
+ parameters.city = shippingPartyContactDetail.city
+ parameters.postalCode = shippingPartyContactDetail.postalCode
+ parameters.stateProvinceGeoId = shippingPartyContactDetail.stateProvinceGeoId
+ parameters.countryGeoId = shippingPartyContactDetail.countryGeoId
+ parameters.allowSolicitation = shippingPartyContactDetail.allowSolicitation
}
- parameters.yearsAtAddress = shippingPartyContactDetail.yearsWithContactMech;
- parameters.monthsAtAddress = shippingPartyContactDetail.monthsWithContactMech;
+ parameters.yearsAtAddress = shippingPartyContactDetail.yearsWithContactMech
+ parameters.monthsAtAddress = shippingPartyContactDetail.monthsWithContactMech
} else {
- context.postalFields = UtilHttp.getParameterMap(request);
+ context.postalFields = UtilHttp.getParameterMap(request)
}
Modified: ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/order/ShipmentStatus.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/order/ShipmentStatus.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/order/ShipmentStatus.groovy (original)
+++ ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/order/ShipmentStatus.groovy Wed Nov 2 19:09:13 2016
@@ -17,16 +17,16 @@
* under the License.
*/
-import org.apache.ofbiz.base.util.UtilMisc;
-import org.apache.ofbiz.entity.Delegator;
-import org.apache.ofbiz.entity.*;
-import org.apache.ofbiz.entity.condition.*;
-import org.apache.ofbiz.entity.util.*;
+import org.apache.ofbiz.base.util.UtilMisc
+import org.apache.ofbiz.entity.Delegator
+import org.apache.ofbiz.entity.*
+import org.apache.ofbiz.entity.condition.*
+import org.apache.ofbiz.entity.util.*
-shipmentId = parameters.shipmentId;
+shipmentId = parameters.shipmentId
if (shipmentId) {
- shipment = from("Shipment").where("shipmentId", shipmentId).queryOne();
- shipmentItems = from("ShipmentItem").where("shipmentId", shipmentId).queryList();
+ shipment = from("Shipment").where("shipmentId", shipmentId).queryOne()
+ shipmentItems = from("ShipmentItem").where("shipmentId", shipmentId).queryList()
// get Shipment tracking info
orderShipmentInfoSummaryList = select("shipmentId", "shipmentRouteSegmentId", "shipmentPackageSeqId", "carrierPartyId", "trackingCode")
@@ -34,9 +34,9 @@ if (shipmentId) {
.where("shipmentId", shipmentId)
.orderBy("shipmentId", "shipmentRouteSegmentId", "shipmentPackageSeqId")
.distinct()
- .queryList();
+ .queryList()
- context.shipment = shipment;
- context.shipmentItems = shipmentItems;
- context.orderShipmentInfoSummaryList = orderShipmentInfoSummaryList;
+ context.shipment = shipment
+ context.shipmentItems = shipmentItems
+ context.orderShipmentInfoSummaryList = orderShipmentInfoSummaryList
}
Modified: ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/shoppinglist/EditShoppingList.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/shoppinglist/EditShoppingList.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/shoppinglist/EditShoppingList.groovy (original)
+++ ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/shoppinglist/EditShoppingList.groovy Wed Nov 2 19:09:13 2016
@@ -17,212 +17,212 @@
* under the License.
*/
-import java.util.*;
-import org.apache.ofbiz.base.util.*;
-import org.apache.ofbiz.entity.*;
-import org.apache.ofbiz.entity.util.*;
-import org.apache.ofbiz.entity.condition.*;
-import org.apache.ofbiz.order.shoppingcart.ShoppingCartEvents;
-import org.apache.ofbiz.order.shoppingcart.shipping.*;
-import org.apache.ofbiz.order.shoppinglist.*;
-import org.apache.ofbiz.party.contact.*;
-import org.apache.ofbiz.product.catalog.*;
-import org.apache.ofbiz.product.store.*;
-import org.apache.ofbiz.service.calendar.*;
-import org.apache.ofbiz.webapp.website.WebSiteWorker;
+import java.util.*
+import org.apache.ofbiz.base.util.*
+import org.apache.ofbiz.entity.*
+import org.apache.ofbiz.entity.util.*
+import org.apache.ofbiz.entity.condition.*
+import org.apache.ofbiz.order.shoppingcart.ShoppingCartEvents
+import org.apache.ofbiz.order.shoppingcart.shipping.*
+import org.apache.ofbiz.order.shoppinglist.*
+import org.apache.ofbiz.party.contact.*
+import org.apache.ofbiz.product.catalog.*
+import org.apache.ofbiz.product.store.*
+import org.apache.ofbiz.service.calendar.*
+import org.apache.ofbiz.webapp.website.WebSiteWorker
if (userLogin)
{
- party = userLogin.getRelatedOne("Party", false);
+ party = userLogin.getRelatedOne("Party", false)
} else {
- return; // session ended, prevents a NPE
+ return // session ended, prevents a NPE
}
-cart = ShoppingCartEvents.getCartObject(request);
-currencyUomId = cart.getCurrency();
+cart = ShoppingCartEvents.getCartObject(request)
+currencyUomId = cart.getCurrency()
-productStoreId = ProductStoreWorker.getProductStoreId(request);
-prodCatalogId = CatalogWorker.getCurrentCatalogId(request);
-webSiteId = WebSiteWorker.getWebSiteId(request);
+productStoreId = ProductStoreWorker.getProductStoreId(request)
+prodCatalogId = CatalogWorker.getCurrentCatalogId(request)
+webSiteId = WebSiteWorker.getWebSiteId(request)
-context.productStoreId = productStoreId;
-context.currencyUomId = currencyUomId;
+context.productStoreId = productStoreId
+context.currencyUomId = currencyUomId
// get the top level shopping lists for the logged in user
exprList = [EntityCondition.makeCondition("partyId", EntityOperator.EQUALS, userLogin.partyId),
- EntityCondition.makeCondition("listName", EntityOperator.NOT_EQUAL, "auto-save")];
-condition = EntityCondition.makeCondition(exprList, EntityOperator.AND);
-allShoppingLists = from("ShoppingList").where(exprList).orderBy("listName").queryList();
-shoppingLists = EntityUtil.filterByAnd(allShoppingLists, [parentShoppingListId : null]);
-context.allShoppingLists = allShoppingLists;
-context.shoppingLists = shoppingLists;
+ EntityCondition.makeCondition("listName", EntityOperator.NOT_EQUAL, "auto-save")]
+condition = EntityCondition.makeCondition(exprList, EntityOperator.AND)
+allShoppingLists = from("ShoppingList").where(exprList).orderBy("listName").queryList()
+shoppingLists = EntityUtil.filterByAnd(allShoppingLists, [parentShoppingListId : null])
+context.allShoppingLists = allShoppingLists
+context.shoppingLists = shoppingLists
// get all shoppingListTypes
-shoppingListTypes = from("ShoppingListType").orderBy("description").cache(true).queryList();
-context.shoppingListTypes = shoppingListTypes;
+shoppingListTypes = from("ShoppingListType").orderBy("description").cache(true).queryList()
+context.shoppingListTypes = shoppingListTypes
// get the shoppingListId for this reqest
-parameterMap = UtilHttp.getParameterMap(request);
-shoppingListId = parameterMap.shoppingListId ?: request.getAttribute("shoppingListId") ?: session.getAttribute("currentShoppingListId");
-context.shoppingListId = shoppingListId;
+parameterMap = UtilHttp.getParameterMap(request)
+shoppingListId = parameterMap.shoppingListId ?: request.getAttribute("shoppingListId") ?: session.getAttribute("currentShoppingListId")
+context.shoppingListId = shoppingListId
// no passed shopping list id default to first list
if (!shoppingListId) {
- firstList = EntityUtil.getFirst(shoppingLists);
+ firstList = EntityUtil.getFirst(shoppingLists)
if (firstList) {
- shoppingListId = firstList.shoppingListId;
+ shoppingListId = firstList.shoppingListId
}
}
-session.setAttribute("currentShoppingListId", shoppingListId);
+session.setAttribute("currentShoppingListId", shoppingListId)
// if we passed a shoppingListId get the shopping list info
if (shoppingListId) {
- shoppingList = from("ShoppingList").where("shoppingListId", shoppingListId).queryOne();
- context.shoppingList = shoppingList;
+ shoppingList = from("ShoppingList").where("shoppingListId", shoppingListId).queryOne()
+ context.shoppingList = shoppingList
if (shoppingList) {
- shoppingListItemTotal = 0.0;
- shoppingListChildTotal = 0.0;
+ shoppingListItemTotal = 0.0
+ shoppingListChildTotal = 0.0
- shoppingListItems = shoppingList.getRelated("ShoppingListItem", null, null, true);
+ shoppingListItems = shoppingList.getRelated("ShoppingListItem", null, null, true)
if (shoppingListItems) {
- shoppingListItemDatas = new ArrayList(shoppingListItems.size());
+ shoppingListItemDatas = new ArrayList(shoppingListItems.size())
shoppingListItems.each { shoppingListItem ->
- shoppingListItemData = [:];
+ shoppingListItemData = [:]
- product = shoppingListItem.getRelatedOne("Product", true);
+ product = shoppingListItem.getRelatedOne("Product", true)
calcPriceOutMap = runService('calculateProductPrice', [product : product, quantity : shoppingListItem.quantity, currencyUomId : currencyUomId, userLogin : userLogin,
- webSiteId: webSiteId, prodCatalogId: prodCatalogId, productStoreId: productStoreId]);
- price = calcPriceOutMap.price;
- totalPrice = price * shoppingListItem.quantity;
+ webSiteId: webSiteId, prodCatalogId: prodCatalogId, productStoreId: productStoreId])
+ price = calcPriceOutMap.price
+ totalPrice = price * shoppingListItem.quantity
// similar code at ShoppingCartItem.java getRentalAdjustment
if ("ASSET_USAGE".equals(product.productTypeId) || "ASSET_USAGE_OUT_IN".equals(product.productTypeId)) {
- persons = shoppingListItem.reservPersons ?: 0;
- reservNthPPPerc = product.reservNthPPPerc ?: 0;
- reserv2ndPPPerc = product.reserv2ndPPPerc ?: 0;
- rentalValue = 0;
+ persons = shoppingListItem.reservPersons ?: 0
+ reservNthPPPerc = product.reservNthPPPerc ?: 0
+ reserv2ndPPPerc = product.reserv2ndPPPerc ?: 0
+ rentalValue = 0
if (persons) {
if (persons > 2) {
- persons -= 2;
+ persons -= 2
if (reservNthPPPerc) {
- rentalValue = persons * reservNthPPPerc;
+ rentalValue = persons * reservNthPPPerc
} else if (reserv2ndPPPerc) {
- rentalValue = persons * reserv2ndPPPerc;
+ rentalValue = persons * reserv2ndPPPerc
}
- persons = 2;
+ persons = 2
}
if (persons == 2) {
if (reserv2ndPPPerc) {
- rentalValue += reserv2ndPPPerc;
+ rentalValue += reserv2ndPPPerc
} else if (reservNthPPPerc) {
- rentalValue = persons * reservNthPPPerc;
+ rentalValue = persons * reservNthPPPerc
}
}
}
- rentalValue += 100; // add final 100 percent for first person
- reservLength = shoppingListItem.reservLength ?: 0;
- totalPrice *= (rentalValue/100 * reservLength);
+ rentalValue += 100 // add final 100 percent for first person
+ reservLength = shoppingListItem.reservLength ?: 0
+ totalPrice *= (rentalValue/100 * reservLength)
}
- shoppingListItemTotal += totalPrice;
+ shoppingListItemTotal += totalPrice
- productVariantAssocs = null;
+ productVariantAssocs = null
if ("Y".equals(product.isVirtual)) {
- productVariantAssocs = product.getRelated("MainProductAssoc", [productAssocTypeId : "PRODUCT_VARIANT"], ["sequenceNum"], true);
- productVariantAssocs = EntityUtil.filterByDate(productVariantAssocs);
+ productVariantAssocs = product.getRelated("MainProductAssoc", [productAssocTypeId : "PRODUCT_VARIANT"], ["sequenceNum"], true)
+ productVariantAssocs = EntityUtil.filterByDate(productVariantAssocs)
}
- shoppingListItemData.shoppingListItem = shoppingListItem;
- shoppingListItemData.product = product;
- shoppingListItemData.unitPrice = price;
- shoppingListItemData.totalPrice = totalPrice;
- shoppingListItemData.productVariantAssocs = productVariantAssocs;
- shoppingListItemDatas.add(shoppingListItemData);
+ shoppingListItemData.shoppingListItem = shoppingListItem
+ shoppingListItemData.product = product
+ shoppingListItemData.unitPrice = price
+ shoppingListItemData.totalPrice = totalPrice
+ shoppingListItemData.productVariantAssocs = productVariantAssocs
+ shoppingListItemDatas.add(shoppingListItemData)
}
- context.shoppingListItemDatas = shoppingListItemDatas;
+ context.shoppingListItemDatas = shoppingListItemDatas
// pagination for the shopping list
- viewIndex = Integer.valueOf(parameters.VIEW_INDEX ?: 1);
- viewSize = parameters.VIEW_SIZE ?: EntityUtilProperties.getPropertyAsInteger("widget", "widget.form.defaultViewSize", 20);
- listSize = shoppingListItemDatas ? shoppingListItemDatas.size() : 0;
-
- lowIndex = ((viewIndex - 1) * viewSize) + 1;
- highIndex = viewIndex * viewSize;
- highIndex = highIndex > listSize ? listSize : highIndex;
- lowIndex = lowIndex > highIndex ? highIndex : lowIndex;
-
- context.viewIndex = viewIndex;
- context.viewSize = viewSize;
- context.listSize = listSize;
- context.lowIndex = lowIndex;
- context.highIndex = highIndex;
+ viewIndex = Integer.valueOf(parameters.VIEW_INDEX ?: 1)
+ viewSize = parameters.VIEW_SIZE ?: EntityUtilProperties.getPropertyAsInteger("widget", "widget.form.defaultViewSize", 20)
+ listSize = shoppingListItemDatas ? shoppingListItemDatas.size() : 0
+
+ lowIndex = ((viewIndex - 1) * viewSize) + 1
+ highIndex = viewIndex * viewSize
+ highIndex = highIndex > listSize ? listSize : highIndex
+ lowIndex = lowIndex > highIndex ? highIndex : lowIndex
+
+ context.viewIndex = viewIndex
+ context.viewSize = viewSize
+ context.listSize = listSize
+ context.lowIndex = lowIndex
+ context.highIndex = highIndex
}
- shoppingListType = shoppingList.getRelatedOne("ShoppingListType", false);
- context.shoppingListType = shoppingListType;
+ shoppingListType = shoppingList.getRelatedOne("ShoppingListType", false)
+ context.shoppingListType = shoppingListType
// get the child shopping lists of the current list for the logged in user
- childShoppingLists = from("ShoppingList").where("partyId", userLogin.partyId, "parentShoppingListId", shoppingListId).orderBy("listName").cache(true).queryList();
+ childShoppingLists = from("ShoppingList").where("partyId", userLogin.partyId, "parentShoppingListId", shoppingListId).orderBy("listName").cache(true).queryList()
// now get prices for each child shopping list...
if (childShoppingLists) {
- childShoppingListDatas = new ArrayList(childShoppingLists.size());
+ childShoppingListDatas = new ArrayList(childShoppingLists.size())
childShoppingLists.each { childShoppingList ->
- childShoppingListData = [:];
+ childShoppingListData = [:]
- childShoppingListPriceMap = runService('calculateShoppingListDeepTotalPrice', [shoppingListId : childShoppingList.shoppingListId, prodCatalogId : prodCatalogId, webSiteId : webSiteId, userLogin : userLogin, currencyUomId : currencyUomId]);
- totalPrice = childShoppingListPriceMap.totalPrice;
- shoppingListChildTotal += totalPrice;
-
- childShoppingListData.childShoppingList = childShoppingList;
- childShoppingListData.totalPrice = totalPrice;
- childShoppingListDatas.add(childShoppingListData);
+ childShoppingListPriceMap = runService('calculateShoppingListDeepTotalPrice', [shoppingListId : childShoppingList.shoppingListId, prodCatalogId : prodCatalogId, webSiteId : webSiteId, userLogin : userLogin, currencyUomId : currencyUomId])
+ totalPrice = childShoppingListPriceMap.totalPrice
+ shoppingListChildTotal += totalPrice
+
+ childShoppingListData.childShoppingList = childShoppingList
+ childShoppingListData.totalPrice = totalPrice
+ childShoppingListDatas.add(childShoppingListData)
}
- context.childShoppingListDatas = childShoppingListDatas;
+ context.childShoppingListDatas = childShoppingListDatas
}
- context.shoppingListTotalPrice = shoppingListItemTotal + shoppingListChildTotal;
- context.shoppingListItemTotal = shoppingListItemTotal;
- context.shoppingListChildTotal = shoppingListChildTotal;
+ context.shoppingListTotalPrice = shoppingListItemTotal + shoppingListChildTotal
+ context.shoppingListItemTotal = shoppingListItemTotal
+ context.shoppingListChildTotal = shoppingListChildTotal
// get the parent shopping list if there is one
- parentShoppingList = shoppingList.getRelatedOne("ParentShoppingList", false);
- context.parentShoppingList = parentShoppingList;
+ parentShoppingList = shoppingList.getRelatedOne("ParentShoppingList", false)
+ context.parentShoppingList = parentShoppingList
- context.canView = userLogin.partyId.equals(shoppingList.partyId);
+ context.canView = userLogin.partyId.equals(shoppingList.partyId)
// auto-reorder info
if ("SLT_AUTO_REODR".equals(shoppingListType?.shoppingListTypeId)) {
- recurrenceVo = shoppingList.getRelatedOne("RecurrenceInfo", false);
- context.recurrenceInfo = recurrenceVo;
+ recurrenceVo = shoppingList.getRelatedOne("RecurrenceInfo", false)
+ context.recurrenceInfo = recurrenceVo
if (userLogin.partyId.equals(shoppingList.partyId)) {
- listCart = ShoppingListServices.makeShoppingListCart(dispatcher, shoppingListId, locale);
+ listCart = ShoppingListServices.makeShoppingListCart(dispatcher, shoppingListId, locale)
// get customer's shipping & payment info
- context.chosenShippingMethod = shoppingList.shipmentMethodTypeId + "@" + shoppingList.carrierPartyId;
- context.shippingContactMechList = ContactHelper.getContactMech(party, "SHIPPING_LOCATION", "POSTAL_ADDRESS", false);
- context.paymentMethodList = EntityUtil.filterByDate(party.getRelated("PaymentMethod", null, ["paymentMethodTypeId"], false));
+ context.chosenShippingMethod = shoppingList.shipmentMethodTypeId + "@" + shoppingList.carrierPartyId
+ context.shippingContactMechList = ContactHelper.getContactMech(party, "SHIPPING_LOCATION", "POSTAL_ADDRESS", false)
+ context.paymentMethodList = EntityUtil.filterByDate(party.getRelated("PaymentMethod", null, ["paymentMethodTypeId"], false))
- shipAddress = from("PostalAddress").where("contactMechId", shoppingList.contactMechId).queryOne();
- Debug.log("SL - address : " + shipAddress);
+ shipAddress = from("PostalAddress").where("contactMechId", shoppingList.contactMechId).queryOne()
+ Debug.log("SL - address : " + shipAddress)
if (shipAddress) {
- listCart = ShoppingListServices.makeShoppingListCart(dispatcher, shoppingListId, locale);
+ listCart = ShoppingListServices.makeShoppingListCart(dispatcher, shoppingListId, locale)
if (listCart) {
- shippingEstWpr = new ShippingEstimateWrapper(dispatcher, listCart, 0);
- carrierShipMeths = shippingEstWpr.getShippingMethods();
- context.listCart = listCart;
- context.shippingEstWpr = shippingEstWpr;
- context.carrierShipMethods = carrierShipMeths;
+ shippingEstWpr = new ShippingEstimateWrapper(dispatcher, listCart, 0)
+ carrierShipMeths = shippingEstWpr.getShippingMethods()
+ context.listCart = listCart
+ context.shippingEstWpr = shippingEstWpr
+ context.carrierShipMethods = carrierShipMeths
}
}
if (recurrenceVo) {
- recInfo = new RecurrenceInfo(recurrenceVo);
- context.recInfo = recInfo;
- lastSlOrderDate = shoppingList.lastOrderedDate;
- context.lastSlOrderDate = lastSlOrderDate;
+ recInfo = new RecurrenceInfo(recurrenceVo)
+ context.recInfo = recInfo
+ lastSlOrderDate = shoppingList.lastOrderedDate
+ context.lastSlOrderDate = lastSlOrderDate
if (!lastSlOrderDate) {
- lastSlOrderDate = recurrenceVo.startDateTime;
+ lastSlOrderDate = recurrenceVo.startDateTime
}
- context.lastSlOrderTime = lastSlOrderDate.getTime();
+ context.lastSlOrderTime = lastSlOrderDate.getTime()
}
}
}