Modified: ofbiz/trunk/applications/order/groovyScripts/requirement/ApprovedProductRequirements.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/groovyScripts/requirement/ApprovedProductRequirements.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/applications/order/groovyScripts/requirement/ApprovedProductRequirements.groovy (original) +++ ofbiz/trunk/applications/order/groovyScripts/requirement/ApprovedProductRequirements.groovy Wed Nov 2 19:09:13 2016 @@ -17,9 +17,9 @@ * under the License. */ -prepare = runService('prepareFind', [inputFields : parameters, entityName : "Requirement"]); +prepare = runService('prepareFind', [inputFields : parameters, entityName : "Requirement"]) if (prepare.entityConditionList) { - results = runService('getRequirementsForSupplier', [requirementConditions : prepare.entityConditionList, partyId : parameters.partyId]); - context.requirementsForSupplier = results.requirementsForSupplier; - context.quantityReport = [distinctProductCount : results.distinctProductCount, quantityTotal : results.quantityTotal, amountTotal : results.amountTotal]; + results = runService('getRequirementsForSupplier', [requirementConditions : prepare.entityConditionList, partyId : parameters.partyId]) + context.requirementsForSupplier = results.requirementsForSupplier + context.quantityReport = [distinctProductCount : results.distinctProductCount, quantityTotal : results.quantityTotal, amountTotal : results.amountTotal] } Modified: ofbiz/trunk/applications/order/groovyScripts/requirement/ApprovedProductRequirementsByVendor.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/groovyScripts/requirement/ApprovedProductRequirementsByVendor.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/applications/order/groovyScripts/requirement/ApprovedProductRequirementsByVendor.groovy (original) +++ ofbiz/trunk/applications/order/groovyScripts/requirement/ApprovedProductRequirementsByVendor.groovy Wed Nov 2 19:09:13 2016 @@ -24,16 +24,16 @@ // view entitities chained together, RequirementByPartyCount and // ProductRequirementCount (see order entitymodel_view.xml). -import org.apache.ofbiz.base.util.UtilMisc; -import org.apache.ofbiz.entity.*; -import org.apache.ofbiz.entity.util.*; -import org.apache.ofbiz.entity.condition.*; +import org.apache.ofbiz.base.util.UtilMisc +import org.apache.ofbiz.entity.* +import org.apache.ofbiz.entity.util.* +import org.apache.ofbiz.entity.condition.* conditions = EntityCondition.makeCondition([ EntityCondition.makeCondition("roleTypeId", EntityOperator.EQUALS, "SUPPLIER"), EntityCondition.makeCondition("statusId", EntityOperator.EQUALS, "REQ_APPROVED"), EntityCondition.makeCondition("requirementTypeId", EntityOperator.EQUALS, "PRODUCT_REQUIREMENT"), EntityUtil.getFilterByDateExpr() - ], EntityOperator.AND); -requirements = select("partyId", "productId").from("RequirementPartyProductCount").where(conditions).orderBy("partyId").cursorScrollInsensitive().distinct().queryIterator(); -context.requirements = requirements; + ], EntityOperator.AND) +requirements = select("partyId", "productId").from("RequirementPartyProductCount").where(conditions).orderBy("partyId").cursorScrollInsensitive().distinct().queryIterator() +context.requirements = requirements Modified: ofbiz/trunk/applications/order/groovyScripts/requirement/SelectCreatedProposed.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/groovyScripts/requirement/SelectCreatedProposed.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/applications/order/groovyScripts/requirement/SelectCreatedProposed.groovy (original) +++ ofbiz/trunk/applications/order/groovyScripts/requirement/SelectCreatedProposed.groovy Wed Nov 2 19:09:13 2016 @@ -17,23 +17,23 @@ * under the License. */ -import org.apache.ofbiz.base.util.UtilMisc; -import org.apache.ofbiz.base.util.UtilValidate; -import org.apache.ofbiz.entity.condition.EntityCondition; -import org.apache.ofbiz.entity.condition.EntityConditionList; -import org.apache.ofbiz.entity.condition.EntityExpr; -import org.apache.ofbiz.entity.condition.EntityOperator; +import org.apache.ofbiz.base.util.UtilMisc +import org.apache.ofbiz.base.util.UtilValidate +import org.apache.ofbiz.entity.condition.EntityCondition +import org.apache.ofbiz.entity.condition.EntityConditionList +import org.apache.ofbiz.entity.condition.EntityExpr +import org.apache.ofbiz.entity.condition.EntityOperator -prepare = runService('prepareFind', [inputFields : parameters, entityName : "Requirement"]); +prepare = runService('prepareFind', [inputFields : parameters, entityName : "Requirement"]) statusCondition = EntityCondition.makeCondition([ EntityCondition.makeCondition("statusId", EntityOperator.EQUALS, "REQ_CREATED"), EntityCondition.makeCondition("statusId", EntityOperator.EQUALS, "REQ_PROPOSED")], - EntityOperator.OR); -ecl = null; + EntityOperator.OR) +ecl = null if (prepare.entityConditionList) { - ecl = EntityCondition.makeCondition([prepare.entityConditionList, statusCondition], EntityOperator.AND); + ecl = EntityCondition.makeCondition([prepare.entityConditionList, statusCondition], EntityOperator.AND) } else { - ecl = statusCondition; + ecl = statusCondition } -results = runService('executeFind', [entityConditionList : ecl, entityName : "Requirement"]); -context.requirements = results.listIt; +results = runService('executeFind', [entityConditionList : ecl, entityName : "Requirement"]) +context.requirements = results.listIt Modified: ofbiz/trunk/applications/order/groovyScripts/return/QuickReturn.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/groovyScripts/return/QuickReturn.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/applications/order/groovyScripts/return/QuickReturn.groovy (original) +++ ofbiz/trunk/applications/order/groovyScripts/return/QuickReturn.groovy Wed Nov 2 19:09:13 2016 @@ -17,85 +17,85 @@ * under the License. */ -import org.apache.ofbiz.base.util.*; -import org.apache.ofbiz.entity.*; -import org.apache.ofbiz.entity.util.*; -import org.apache.ofbiz.order.order.*; -import org.apache.ofbiz.party.contact.*; -import org.apache.ofbiz.product.store.*; +import org.apache.ofbiz.base.util.* +import org.apache.ofbiz.entity.* +import org.apache.ofbiz.entity.util.* +import org.apache.ofbiz.order.order.* +import org.apache.ofbiz.party.contact.* +import org.apache.ofbiz.product.store.* -orderId = parameters.orderId; -context.orderId = orderId; +orderId = parameters.orderId +context.orderId = orderId -returnHeaderTypeId = parameters.returnHeaderTypeId; -context.returnHeaderTypeId = returnHeaderTypeId; +returnHeaderTypeId = parameters.returnHeaderTypeId +context.returnHeaderTypeId = returnHeaderTypeId -partyId = parameters.party_id; +partyId = parameters.party_id if (partyId) { if (("VENDOR_RETURN").equals(returnHeaderTypeId)) { - context.toPartyId = partyId; + context.toPartyId = partyId } - party = from("Party").where("partyId", partyId).queryOne(); - context.party = party; + party = from("Party").where("partyId", partyId).queryOne() + context.party = party } -returnHeaders = from("ReturnHeader").where("statusId", "RETURN_REQUESTED").queryList(); -context.returnHeaders = returnHeaders; +returnHeaders = from("ReturnHeader").where("statusId", "RETURN_REQUESTED").queryList() +context.returnHeaders = returnHeaders // 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); + order = from("OrderHeader").where("orderId", orderId).queryOne() + productStore = order.getRelatedOne("ProductStore", false) if (productStore) { if (("VENDOR_RETURN").equals(returnHeaderTypeId)) { - context.partyId = productStore.payToPartyId; + context.partyId = productStore.payToPartyId } else { - context.destinationFacilityId = ProductStoreWorker.determineSingleFacilityForStore(delegator, productStore.productStoreId); - context.toPartyId = productStore.payToPartyId; - context.partyId = partyId; + context.destinationFacilityId = ProductStoreWorker.determineSingleFacilityForStore(delegator, productStore.productStoreId) + context.toPartyId = productStore.payToPartyId + context.partyId = partyId } } - orh = new OrderReadHelper(order); - context.orh = orh; - context.orderHeaderAdjustments = orh.getAvailableOrderHeaderAdjustments(); + orh = new OrderReadHelper(order) + context.orh = orh + context.orderHeaderAdjustments = orh.getAvailableOrderHeaderAdjustments() } // payment method info if (partyId) { - creditCardList = from("PaymentMethodAndCreditCard").where("partyId", partyId).filterByDate().queryList(); + creditCardList = from("PaymentMethodAndCreditCard").where("partyId", partyId).filterByDate().queryList() if (creditCardList) { - context.creditCardList = creditCardList; + context.creditCardList = creditCardList } - eftAccountList = from("PaymentMethodAndEftAccount").where("partyId", partyId).filterByDate().queryList(); + eftAccountList = from("PaymentMethodAndEftAccount").where("partyId", partyId).filterByDate().queryList() if (eftAccountList) { - context.eftAccountList = eftAccountList; + context.eftAccountList = eftAccountList } } -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 -itemStts = from("StatusItem").where("statusTypeId", "INV_SERIALIZED_STTS").orderBy("sequenceId").queryList(); -context.itemStts = itemStts; +itemStts = from("StatusItem").where("statusTypeId", "INV_SERIALIZED_STTS").orderBy("sequenceId").queryList() +context.itemStts = itemStts -typeMap = [:]; -returnItemTypeMap = from("ReturnItemTypeMap").where("returnHeaderTypeId", returnHeaderTypeId).queryList(); +typeMap = [:] +returnItemTypeMap = from("ReturnItemTypeMap").where("returnHeaderTypeId", returnHeaderTypeId).queryList() returnItemTypeMap.each { value -> - typeMap[value.returnItemMapKey] = value.returnItemTypeId; + typeMap[value.returnItemMapKey] = value.returnItemTypeId } -context.returnItemTypeMap = typeMap; +context.returnItemTypeMap = typeMap 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 } -context.shippingContactMechList = ContactHelper.getContactMech(party, "SHIPPING_LOCATION", "POSTAL_ADDRESS", false); +context.shippingContactMechList = ContactHelper.getContactMech(party, "SHIPPING_LOCATION", "POSTAL_ADDRESS", false) Modified: ofbiz/trunk/applications/order/groovyScripts/return/ReturnHeader.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/groovyScripts/return/ReturnHeader.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/applications/order/groovyScripts/return/ReturnHeader.groovy (original) +++ ofbiz/trunk/applications/order/groovyScripts/return/ReturnHeader.groovy Wed Nov 2 19:09:13 2016 @@ -17,93 +17,93 @@ * 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.EntityCondition; -import org.apache.ofbiz.entity.condition.EntityOperator; -import org.apache.ofbiz.party.contact.*; +import org.apache.ofbiz.base.util.* +import org.apache.ofbiz.entity.* +import org.apache.ofbiz.entity.util.* +import org.apache.ofbiz.entity.condition.EntityCondition +import org.apache.ofbiz.entity.condition.EntityOperator +import org.apache.ofbiz.party.contact.* if (parameters.userLogin) { - userLogin = parameters.userLogin; - context.userLogin = userLogin; + userLogin = parameters.userLogin + context.userLogin = userLogin } -returnHeader = null; -orderId = parameters.orderId; +returnHeader = null +orderId = parameters.orderId if (parameters.returnHeader) { - returnHeader = parameters.returnHeader; - returnId = returnHeader.returnId; - partyId = returnHeader.fromPartyId; + returnHeader = parameters.returnHeader + returnId = returnHeader.returnId + partyId = returnHeader.fromPartyId } else { - partyId = parameters.fromPartyId; - returnId = parameters.returnId; + partyId = parameters.fromPartyId + returnId = parameters.returnId } if (returnId) { - returnHeader = from("ReturnHeader").where("returnId", returnId).queryOne(); + returnHeader = from("ReturnHeader").where("returnId", returnId).queryOne() if (returnHeader) { - partyId = returnHeader.fromPartyId; - toPartyId = parameters.toPartyId; + partyId = returnHeader.fromPartyId + toPartyId = parameters.toPartyId - context.currentStatus = returnHeader.getRelatedOne("StatusItem", true); + context.currentStatus = returnHeader.getRelatedOne("StatusItem", true) } } -context.returnHeader = returnHeader; -context.returnId = returnId; +context.returnHeader = returnHeader +context.returnId = returnId //fin account info -finAccounts = null; +finAccounts = null if (partyId) { - finAccounts = from("FinAccountAndRole").where("partyId", partyId, "finAccountTypeId", "STORE_CREDIT_ACCT", "roleTypeId", "OWNER", "statusId", "FNACT_ACTIVE").filterByDate().queryList(); + finAccounts = from("FinAccountAndRole").where("partyId", partyId, "finAccountTypeId", "STORE_CREDIT_ACCT", "roleTypeId", "OWNER", "statusId", "FNACT_ACTIVE").filterByDate().queryList() } -context.finAccounts = finAccounts; +context.finAccounts = finAccounts // billing account info -billingAccountList = null; +billingAccountList = null if (partyId) { - billingAccountList = from("BillingAccountAndRole").where("partyId", partyId).filterByDate().queryList(); + billingAccountList = from("BillingAccountAndRole").where("partyId", partyId).filterByDate().queryList() } -context.billingAccountList = billingAccountList; +context.billingAccountList = billingAccountList // payment method info -List creditCardList = null; -List eftAccountList = null; +List creditCardList = null +List eftAccountList = null if (partyId) { - creditCardList = from("PaymentMethodAndCreditCard").where("partyId", partyId).filterByDate().queryList(); - eftAccountList = from("PaymentMethodAndEftAccount").where("partyId", partyId).filterByDate().queryList(); + creditCardList = from("PaymentMethodAndCreditCard").where("partyId", partyId).filterByDate().queryList() + eftAccountList = from("PaymentMethodAndEftAccount").where("partyId", partyId).filterByDate().queryList() } -context.creditCardList = creditCardList; -context.eftAccountList = eftAccountList; +context.creditCardList = creditCardList +context.eftAccountList = eftAccountList -orderRole = null; -orderHeader = null; +orderRole = null +orderHeader = null if (orderId) { - orderRole = from("OrderRole").where("orderId", orderId, "roleTypeId", "BILL_TO_CUSTOMER").queryFirst(); - orderHeader = from("OrderHeader").where("orderId", orderId).queryOne(); + orderRole = from("OrderRole").where("orderId", orderId, "roleTypeId", "BILL_TO_CUSTOMER").queryFirst() + orderHeader = from("OrderHeader").where("orderId", orderId).queryOne() } -context.orderRole = orderRole; -context.orderHeader = orderHeader; +context.orderRole = orderRole +context.orderHeader = orderHeader // from address -addresses = null; +addresses = null if (context.request) { - addresses = ContactMechWorker.getPartyPostalAddresses(request, partyId, "_NA_"); + addresses = ContactMechWorker.getPartyPostalAddresses(request, partyId, "_NA_") } -context.addresses = addresses; +context.addresses = addresses if (returnHeader) { - contactMechTo = ContactMechWorker.getFacilityContactMechByPurpose(delegator, returnHeader.destinationFacilityId, ["PUR_RET_LOCATION", "SHIPPING_LOCATION", "PRIMARY_LOCATION"]); + contactMechTo = ContactMechWorker.getFacilityContactMechByPurpose(delegator, returnHeader.destinationFacilityId, ["PUR_RET_LOCATION", "SHIPPING_LOCATION", "PRIMARY_LOCATION"]) if (contactMechTo) { - postalAddressTo = from("PostalAddress").where("contactMechId", contactMechTo.contactMechId).cache(true).queryOne(); - context.postalAddressTo = postalAddressTo; + postalAddressTo = from("PostalAddress").where("contactMechId", contactMechTo.contactMechId).cache(true).queryOne() + context.postalAddressTo = postalAddressTo } - party = from("Party").where("partyId", partyId).cache(true).queryOne(); + party = from("Party").where("partyId", partyId).cache(true).queryOne() if (party) { - shippingContactMechList = ContactHelper.getContactMech(party, "SHIPPING_LOCATION", "POSTAL_ADDRESS", false); + shippingContactMechList = ContactHelper.getContactMech(party, "SHIPPING_LOCATION", "POSTAL_ADDRESS", false) if (shippingContactMechList) { - context.postalAddressFrom = from("PostalAddress").where("contactMechId", EntityUtil.getFirst(shippingContactMechList).contactMechId).cache(true).queryOne(); + context.postalAddressFrom = from("PostalAddress").where("contactMechId", EntityUtil.getFirst(shippingContactMechList).contactMechId).cache(true).queryOne() } } } Modified: ofbiz/trunk/applications/order/groovyScripts/return/ReturnHistory.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/groovyScripts/return/ReturnHistory.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/applications/order/groovyScripts/return/ReturnHistory.groovy (original) +++ ofbiz/trunk/applications/order/groovyScripts/return/ReturnHistory.groovy Wed Nov 2 19:09:13 2016 @@ -17,25 +17,25 @@ * under the License. */ -import org.apache.ofbiz.entity.condition.EntityCondition; -import org.apache.ofbiz.entity.condition.EntityOperator; +import org.apache.ofbiz.entity.condition.EntityCondition +import org.apache.ofbiz.entity.condition.EntityOperator commonReturnHistoryCond = [EntityCondition.makeCondition("changedEntityName", EntityOperator.EQUALS, "ReturnItem"), EntityCondition.makeCondition("changedFieldName", EntityOperator.EQUALS, entityField), EntityCondition.makeCondition("pkCombinedValueText", EntityOperator.LIKE, returnId + "%"), EntityCondition.makeCondition("newValueText", EntityOperator.NOT_EQUAL, null), - EntityCondition.makeCondition("oldValueText", EntityOperator.NOT_EQUAL, null)]; + EntityCondition.makeCondition("oldValueText", EntityOperator.NOT_EQUAL, null)] -returnHistoryList = from("EntityAuditLog").where(commonReturnHistoryCond).queryList(); +returnHistoryList = from("EntityAuditLog").where(commonReturnHistoryCond).queryList() -orderReturnItemHistories = []; +orderReturnItemHistories = [] returnHistoryList.each { returnHistory -> if ("returnTypeId".equals(entityField) || "returnReasonId".equals(entityField)) { if (returnHistory.newValueText.toString() != returnHistory.oldValueText.toString()) { - orderReturnItemHistories.add(returnHistory); + orderReturnItemHistories.add(returnHistory) } } else if ((Float.valueOf(returnHistory.oldValueText)).compareTo(Float.valueOf(returnHistory.newValueText)) != 0) { - orderReturnItemHistories.add(returnHistory); + orderReturnItemHistories.add(returnHistory) } } -context.orderReturnItemHistories = orderReturnItemHistories; +context.orderReturnItemHistories = orderReturnItemHistories Modified: ofbiz/trunk/applications/order/groovyScripts/return/ReturnItems.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/groovyScripts/return/ReturnItems.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/applications/order/groovyScripts/return/ReturnItems.groovy (original) +++ ofbiz/trunk/applications/order/groovyScripts/return/ReturnItems.groovy Wed Nov 2 19:09:13 2016 @@ -17,76 +17,76 @@ * under the License. */ -import org.apache.ofbiz.base.util.*; -import org.apache.ofbiz.entity.*; -import org.apache.ofbiz.entity.condition.EntityCondition; -import org.apache.ofbiz.entity.util.EntityFindOptions; -import org.apache.ofbiz.order.order.OrderReadHelper; -import java.math.BigDecimal; - -returnId = parameters.returnId; -if (!returnId) return; -context.returnId = returnId; - -orderId = parameters.orderId; -context.orderId = orderId; +import org.apache.ofbiz.base.util.* +import org.apache.ofbiz.entity.* +import org.apache.ofbiz.entity.condition.EntityCondition +import org.apache.ofbiz.entity.util.EntityFindOptions +import org.apache.ofbiz.order.order.OrderReadHelper +import java.math.BigDecimal + +returnId = parameters.returnId +if (!returnId) return +context.returnId = returnId + +orderId = parameters.orderId +context.orderId = orderId -returnHeader = from("ReturnHeader").where("returnId", returnId).queryOne(); -context.returnHeader = returnHeader; +returnHeader = from("ReturnHeader").where("returnId", returnId).queryOne() +context.returnHeader = returnHeader -returnHeaderTypeId = returnHeader.returnHeaderTypeId; -context.toPartyId = returnHeader.toPartyId; +returnHeaderTypeId = returnHeader.returnHeaderTypeId +context.toPartyId = returnHeader.toPartyId -returnItems = from("ReturnItem").where("returnId", returnId).queryList(); -context.returnItems = returnItems; +returnItems = from("ReturnItem").where("returnId", returnId).queryList() +context.returnItems = returnItems // these are just the adjustments not associated directly with a return item--the rest are gotten with a .getRelated on the returnItems in the .FTL -returnAdjustments = from("ReturnAdjustment").where("returnId", returnId, "returnItemSeqId", "_NA_").orderBy("returnItemSeqId", "returnAdjustmentTypeId").queryList(); -context.returnAdjustments = returnAdjustments; +returnAdjustments = from("ReturnAdjustment").where("returnId", returnId, "returnItemSeqId", "_NA_").orderBy("returnItemSeqId", "returnAdjustmentTypeId").queryList() +context.returnAdjustments = returnAdjustments -returnTypes = from("ReturnType").orderBy("sequenceId").queryList(); -context.returnTypes = returnTypes; +returnTypes = from("ReturnType").orderBy("sequenceId").queryList() +context.returnTypes = returnTypes -itemStatus = from("StatusItem").where("statusTypeId", "INV_SERIALIZED_STTS").orderBy("statusId", "description").queryList(); -context.itemStatus = itemStatus; +itemStatus = from("StatusItem").where("statusTypeId", "INV_SERIALIZED_STTS").orderBy("statusId", "description").queryList() +context.itemStatus = itemStatus -returnReasons = from("ReturnReason").orderBy("sequenceId").queryList(); -context.returnReasons = returnReasons; +returnReasons = from("ReturnReason").orderBy("sequenceId").queryList() +context.returnReasons = returnReasons -itemStts = from("StatusItem").where("statusTypeId", "INV_SERIALIZED_STTS").orderBy("sequenceId").queryList(); -context.itemStts = itemStts; +itemStts = from("StatusItem").where("statusTypeId", "INV_SERIALIZED_STTS").orderBy("sequenceId").queryList() +context.itemStts = itemStts -returnItemTypeMap = from("ReturnItemTypeMap").where("returnHeaderTypeId", returnHeaderTypeId).queryList(); -typeMap = [:]; +returnItemTypeMap = from("ReturnItemTypeMap").where("returnHeaderTypeId", returnHeaderTypeId).queryList() +typeMap = [:] returnItemTypeMap.each { value -> - typeMap[value.returnItemMapKey] = value.returnItemTypeId; + typeMap[value.returnItemMapKey] = value.returnItemTypeId } -context.returnItemTypeMap = typeMap; +context.returnItemTypeMap = typeMap if (orderId) { - order = from("OrderHeader").where("orderId", orderId).queryOne(); - returnRes = runService('getReturnableItems', [orderId : orderId]); - context.returnableItems = returnRes.returnableItems; - - orh = new OrderReadHelper(order); - context.orh = orh; - context.orderHeaderAdjustments = orh.getAvailableOrderHeaderAdjustments(); + order = from("OrderHeader").where("orderId", orderId).queryOne() + returnRes = runService('getReturnableItems', [orderId : orderId]) + context.returnableItems = returnRes.returnableItems + + orh = new OrderReadHelper(order) + context.orh = orh + context.orderHeaderAdjustments = orh.getAvailableOrderHeaderAdjustments() // get the order shipping amount - shipRes = runService('getOrderShippingAmount', [orderId : orderId]); - shippingAmount = shipRes.shippingAmount; - context.shippingAmount = shippingAmount; + shipRes = runService('getOrderShippingAmount', [orderId : orderId]) + shippingAmount = shipRes.shippingAmount + context.shippingAmount = shippingAmount } -roleTypeId = "PLACING_CUSTOMER"; -partyId = returnHeader.fromPartyId; +roleTypeId = "PLACING_CUSTOMER" +partyId = returnHeader.fromPartyId if (returnHeaderTypeId == "VENDOR_RETURN") { - roleTypeId = "BILL_FROM_VENDOR"; - partyId = returnHeader.toPartyId; + roleTypeId = "BILL_FROM_VENDOR" + partyId = returnHeader.toPartyId } -partyOrders = select("orderId","orderDate").from("OrderHeaderItemAndRoles").where("roleTypeId", roleTypeId, "partyId", partyId, "orderItemStatusId", "ITEM_COMPLETED").orderBy("orderId").distinct().queryList(); -context.partyOrders = partyOrders; -context.partyId = partyId; +partyOrders = select("orderId","orderDate").from("OrderHeaderItemAndRoles").where("roleTypeId", roleTypeId, "partyId", partyId, "orderItemStatusId", "ITEM_COMPLETED").orderBy("orderId").distinct().queryList() +context.partyOrders = partyOrders +context.partyId = partyId // get the list of return shipments associated to the return -returnShipmentIds = select("shipmentId").from("ReturnItemShipment").where("returnId", returnId).distinct().cache(true).queryList(); -context.returnShipmentIds = returnShipmentIds; +returnShipmentIds = select("shipmentId").from("ReturnItemShipment").where("returnId", returnId).distinct().cache(true).queryList() +context.returnShipmentIds = returnShipmentIds Modified: ofbiz/trunk/applications/order/groovyScripts/setup/PaymentSetup.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/groovyScripts/setup/PaymentSetup.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/applications/order/groovyScripts/setup/PaymentSetup.groovy (original) +++ ofbiz/trunk/applications/order/groovyScripts/setup/PaymentSetup.groovy Wed Nov 2 19:09:13 2016 @@ -17,29 +17,29 @@ * under the License. */ -import org.apache.ofbiz.entity.*; -import org.apache.ofbiz.base.util.*; +import org.apache.ofbiz.entity.* +import org.apache.ofbiz.base.util.* -paymentSetup = from("WebSitePaymentSettingView").orderBy("webSiteId", "paymentMethodTypeId").queryList(); -context.paymentSetups = paymentSetup; +paymentSetup = from("WebSitePaymentSettingView").orderBy("webSiteId", "paymentMethodTypeId").queryList() +context.paymentSetups = paymentSetup -webSiteId = parameters.webSiteId; -paymentMethodTypeId = parameters.paymentMethodTypeId; +webSiteId = parameters.webSiteId +paymentMethodTypeId = parameters.paymentMethodTypeId -webSitePayment = null; +webSitePayment = null if (webSiteId && paymentMethodTypeId) { - webSitePayment = from("WebSitePaymentSettingView").where("webSiteId", webSiteId, "paymentMethodTypeId", paymentMethodTypeId).queryOne(); + webSitePayment = from("WebSitePaymentSettingView").where("webSiteId", webSiteId, "paymentMethodTypeId", paymentMethodTypeId).queryOne() } -context.webSitePayment = webSitePayment; +context.webSitePayment = webSitePayment -webSites = from("WebSite").orderBy("siteName").queryList(); -context.webSites = webSites; +webSites = from("WebSite").orderBy("siteName").queryList() +context.webSites = webSites -paymentMethodTypes = from("PaymentMethodType").orderBy("description").queryList(); -context.paymentMethodTypes = paymentMethodTypes; +paymentMethodTypes = from("PaymentMethodType").orderBy("description").queryList() +context.paymentMethodTypes = paymentMethodTypes -payInfo = UtilHttp.getParameterMap(request); +payInfo = UtilHttp.getParameterMap(request) if (webSitePayment) { - payInfo = webSitePayment; + payInfo = webSitePayment } -context.payInfo = payInfo; +context.payInfo = payInfo Modified: ofbiz/trunk/applications/order/groovyScripts/task/OrderTaskList.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/groovyScripts/task/OrderTaskList.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/applications/order/groovyScripts/task/OrderTaskList.groovy (original) +++ ofbiz/trunk/applications/order/groovyScripts/task/OrderTaskList.groovy Wed Nov 2 19:09:13 2016 @@ -17,87 +17,87 @@ * under the License. */ -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.order.task.*; +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.order.task.* -context.userLogin = userLogin; +context.userLogin = userLogin // create the sort order -sort = parameters.sort; -sortOrder = ["currentStatusId", "-priority", "orderDate"]; +sort = parameters.sort +sortOrder = ["currentStatusId", "-priority", "orderDate"] if (sort) { if (sort.equals("name")) { - sortOrder.add(0, "firstName"); - sortOrder.add(0, "lastName"); + sortOrder.add(0, "firstName") + sortOrder.add(0, "lastName") } else if (sort.equals("grandTotal")) { - sortOrder.add(0, "-grandTotal"); + sortOrder.add(0, "-grandTotal") } else { - sortOrder.add(0, sort); + sortOrder.add(0, sort) } } -partyBase = [EntityCondition.makeCondition("statusId", EntityOperator.EQUALS, "CAL_ACCEPTED"), EntityCondition.makeCondition("wepaPartyId", EntityOperator.EQUALS, userLogin.partyId)]; -partyRole = [EntityCondition.makeCondition("orderRoleTypeId", EntityOperator.EQUALS, "PLACING_CUSTOMER"), EntityCondition.makeCondition("orderRoleTypeId", EntityOperator.EQUALS, "SUPPLIER_AGENT")]; -partyExpr = [EntityCondition.makeCondition(partyBase, EntityOperator.AND), EntityCondition.makeCondition(partyRole, EntityOperator.OR)]; -partyTasks = from("OrderTaskList").where(partyExpr).orderBy(sortOrder).queryList(); +partyBase = [EntityCondition.makeCondition("statusId", EntityOperator.EQUALS, "CAL_ACCEPTED"), EntityCondition.makeCondition("wepaPartyId", EntityOperator.EQUALS, userLogin.partyId)] +partyRole = [EntityCondition.makeCondition("orderRoleTypeId", EntityOperator.EQUALS, "PLACING_CUSTOMER"), EntityCondition.makeCondition("orderRoleTypeId", EntityOperator.EQUALS, "SUPPLIER_AGENT")] +partyExpr = [EntityCondition.makeCondition(partyBase, EntityOperator.AND), EntityCondition.makeCondition(partyRole, EntityOperator.OR)] +partyTasks = from("OrderTaskList").where(partyExpr).orderBy(sortOrder).queryList() -if (partyTasks) partyTasks = EntityUtil.filterByDate(partyTasks); -context.partyTasks = partyTasks; +if (partyTasks) partyTasks = EntityUtil.filterByDate(partyTasks) +context.partyTasks = partyTasks // Build a map of orderId and currency -orderCurrencyMap = [:]; +orderCurrencyMap = [:] partyTasks.each { ptItem -> - orderHeader = from("OrderHeader").where("orderId", ptItem.orderId).queryOne(); - orderCurrencyMap[ptItem.orderId] = orderHeader.currencyUom; + orderHeader = from("OrderHeader").where("orderId", ptItem.orderId).queryOne() + orderCurrencyMap[ptItem.orderId] = orderHeader.currencyUom } // get this user's roles -partyRoles = from("PartyRole").where("partyId", userLogin.partyId).queryList(); +partyRoles = from("PartyRole").where("partyId", userLogin.partyId).queryList() // build the role list -pRolesList = []; +pRolesList = [] partyRoles.each { partyRole -> if (!partyRole.roleTypeId.equals("_NA_")) - pRolesList.add(EntityCondition.makeCondition("roleTypeId", EntityOperator.EQUALS, partyRole.roleTypeId)); + pRolesList.add(EntityCondition.makeCondition("roleTypeId", EntityOperator.EQUALS, partyRole.roleTypeId)) } -custList = [EntityCondition.makeCondition("orderRoleTypeId", EntityOperator.EQUALS, "PLACING_CUSTOMER"), EntityCondition.makeCondition("orderRoleTypeId", EntityOperator.EQUALS, "SUPPLIER_AGENT")]; -baseList = [EntityCondition.makeCondition("statusId", EntityOperator.NOT_EQUAL, "CAL_CANCELLED"), EntityCondition.makeCondition("statusId", EntityOperator.NOT_EQUAL, "CAL_COMPLETED"), EntityCondition.makeCondition("statusId", EntityOperator.NOT_EQUAL, "CAL_DELEGATED")]; -expressions = []; -expressions.add(EntityCondition.makeCondition(custList, EntityOperator.OR)); -if (pRolesList) expressions.add(EntityCondition.makeCondition(pRolesList, EntityOperator.OR)); -expressions.add(EntityCondition.makeCondition(baseList, EntityOperator.AND)); +custList = [EntityCondition.makeCondition("orderRoleTypeId", EntityOperator.EQUALS, "PLACING_CUSTOMER"), EntityCondition.makeCondition("orderRoleTypeId", EntityOperator.EQUALS, "SUPPLIER_AGENT")] +baseList = [EntityCondition.makeCondition("statusId", EntityOperator.NOT_EQUAL, "CAL_CANCELLED"), EntityCondition.makeCondition("statusId", EntityOperator.NOT_EQUAL, "CAL_COMPLETED"), EntityCondition.makeCondition("statusId", EntityOperator.NOT_EQUAL, "CAL_DELEGATED")] +expressions = [] +expressions.add(EntityCondition.makeCondition(custList, EntityOperator.OR)) +if (pRolesList) expressions.add(EntityCondition.makeCondition(pRolesList, EntityOperator.OR)) +expressions.add(EntityCondition.makeCondition(baseList, EntityOperator.AND)) // invoke the query -roleTasks = from("OrderTaskList").where(expressions).orderBy(sortOrder).queryList(); -roleTasks = EntityUtil.filterByAnd(roleTasks, baseList); -roleTasks = EntityUtil.filterByDate(roleTasks); -context.roleTasks = roleTasks; +roleTasks = from("OrderTaskList").where(expressions).orderBy(sortOrder).queryList() +roleTasks = EntityUtil.filterByAnd(roleTasks, baseList) +roleTasks = EntityUtil.filterByDate(roleTasks) +context.roleTasks = roleTasks // Add to the map of orderId and currency roleTasks.each { rtItem -> - orderHeader = from("OrderHeader").where("orderId", rtItem.orderId).queryOne(); - orderCurrencyMap[rtItem.orderId] = orderHeader.currencyUom; + orderHeader = from("OrderHeader").where("orderId", rtItem.orderId).queryOne() + orderCurrencyMap[rtItem.orderId] = orderHeader.currencyUom } -context.orderCurrencyMap = orderCurrencyMap; +context.orderCurrencyMap = orderCurrencyMap -context.now = nowTimestamp; +context.now = nowTimestamp // purchase order schedule -poList = from("OrderHeaderAndRoles").where("partyId", userLogin.partyId, "orderTypeId", "PURCHASE_ORDER").queryList(); -poIter = poList.iterator(); -listedPoIds = new HashSet(); +poList = from("OrderHeaderAndRoles").where("partyId", userLogin.partyId, "orderTypeId", "PURCHASE_ORDER").queryList() +poIter = poList.iterator() +listedPoIds = new HashSet() while (poIter.hasNext()) { - poGv = poIter.next(); - poOrderId = poGv.orderId; + poGv = poIter.next() + poOrderId = poGv.orderId if (listedPoIds.contains(poOrderId)) { - poIter.remove(); + poIter.remove() } else { - listedPoIds.add(poOrderId); + listedPoIds.add(poOrderId) } } -context.poList = poList; +context.poList = poList Modified: ofbiz/trunk/applications/party/groovyScripts/HasPartyPermissions.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/groovyScripts/HasPartyPermissions.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/applications/party/groovyScripts/HasPartyPermissions.groovy (original) +++ ofbiz/trunk/applications/party/groovyScripts/HasPartyPermissions.groovy Wed Nov 2 19:09:13 2016 @@ -18,12 +18,12 @@ */ // standard partymgr permissions -context.hasViewPermission = security.hasEntityPermission("PARTYMGR", "_VIEW", session); -context.hasCreatePermission = security.hasEntityPermission("PARTYMGR", "_CREATE", session); -context.hasUpdatePermission = security.hasEntityPermission("PARTYMGR", "_UPDATE", session); -context.hasDeletePermission = security.hasEntityPermission("PARTYMGR", "_DELETE", session); +context.hasViewPermission = security.hasEntityPermission("PARTYMGR", "_VIEW", session) +context.hasCreatePermission = security.hasEntityPermission("PARTYMGR", "_CREATE", session) +context.hasUpdatePermission = security.hasEntityPermission("PARTYMGR", "_UPDATE", session) +context.hasDeletePermission = security.hasEntityPermission("PARTYMGR", "_DELETE", session) // extended pay_info permissions -context.hasPayInfoPermission = security.hasEntityPermission("PAY_INFO", "_VIEW", session) || security.hasEntityPermission("ACCOUNTING", "_VIEW", session); +context.hasPayInfoPermission = security.hasEntityPermission("PAY_INFO", "_VIEW", session) || security.hasEntityPermission("ACCOUNTING", "_VIEW", session) // extended pcm (party contact mechanism) permissions -context.hasPcmCreatePermission = security.hasEntityPermission("PARTYMGR_PCM", "_CREATE", session); -context.hasPcmUpdatePermission = security.hasEntityPermission("PARTYMGR_PCM", "_UPDATE", session); +context.hasPcmCreatePermission = security.hasEntityPermission("PARTYMGR_PCM", "_CREATE", session) +context.hasPcmUpdatePermission = security.hasEntityPermission("PARTYMGR_PCM", "_UPDATE", session) Modified: ofbiz/trunk/applications/party/groovyScripts/communication/FindCommEventContactMechs.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/groovyScripts/communication/FindCommEventContactMechs.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/applications/party/groovyScripts/communication/FindCommEventContactMechs.groovy (original) +++ ofbiz/trunk/applications/party/groovyScripts/communication/FindCommEventContactMechs.groovy Wed Nov 2 19:09:13 2016 @@ -24,17 +24,17 @@ * expanded to work off other communication event types. */ -import org.apache.ofbiz.base.util.UtilDateTime; +import org.apache.ofbiz.base.util.UtilDateTime -partyIdFrom = context.partyIdFrom; -partyIdTo = context.partyIdTo; +partyIdFrom = context.partyIdFrom +partyIdTo = context.partyIdTo if (parameters.communicationEventTypeId) { if ("EMAIL_COMMUNICATION".equals(parameters.communicationEventTypeId)) { - userEmailAddresses = from("PartyContactWithPurpose").where("contactMechTypeId", "EMAIL_ADDRESS" , "partyId", partyIdFrom).filterByDate(UtilDateTime.nowTimestamp(), "contactFromDate", "contactThruDate").queryList(); - context.userEmailAddresses = userEmailAddresses; + userEmailAddresses = from("PartyContactWithPurpose").where("contactMechTypeId", "EMAIL_ADDRESS" , "partyId", partyIdFrom).filterByDate(UtilDateTime.nowTimestamp(), "contactFromDate", "contactThruDate").queryList() + context.userEmailAddresses = userEmailAddresses - targetEmailAddresses = from("PartyContactWithPurpose").where("contactMechTypeId", "EMAIL_ADDRESS", "partyId", partyIdTo).filterByDate(UtilDateTime.nowTimestamp(), "contactFromDate", "contactThruDate").queryList(); - context.targetEmailAddresses = targetEmailAddresses; + targetEmailAddresses = from("PartyContactWithPurpose").where("contactMechTypeId", "EMAIL_ADDRESS", "partyId", partyIdTo).filterByDate(UtilDateTime.nowTimestamp(), "contactFromDate", "contactThruDate").queryList() + context.targetEmailAddresses = targetEmailAddresses } } Modified: ofbiz/trunk/applications/party/groovyScripts/communication/GetMyCommunicationEventRole.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/groovyScripts/communication/GetMyCommunicationEventRole.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/applications/party/groovyScripts/communication/GetMyCommunicationEventRole.groovy (original) +++ ofbiz/trunk/applications/party/groovyScripts/communication/GetMyCommunicationEventRole.groovy Wed Nov 2 19:09:13 2016 @@ -16,12 +16,12 @@ * specific language governing permissions and limitations * under the License. */ -import org.apache.ofbiz.base.component.ComponentConfig; +import org.apache.ofbiz.base.component.ComponentConfig if (parameters.communicationEventId) { context.communicationEventRole = from("CommunicationEventRole") .where("communicationEventId", parameters.communicationEventId, "partyId", parameters.partyId, "roleTypeId", parameters.roleTypeId) - .queryOne(); + .queryOne() - context.projectMgrExists = ComponentConfig.componentExists("projectmgr"); + context.projectMgrExists = ComponentConfig.componentExists("projectmgr") } Modified: ofbiz/trunk/applications/party/groovyScripts/communication/GetPartyEmailFromCommEventInfo.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/groovyScripts/communication/GetPartyEmailFromCommEventInfo.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/applications/party/groovyScripts/communication/GetPartyEmailFromCommEventInfo.groovy (original) +++ ofbiz/trunk/applications/party/groovyScripts/communication/GetPartyEmailFromCommEventInfo.groovy Wed Nov 2 19:09:13 2016 @@ -17,45 +17,45 @@ * under the License. */ -communicationEvent = from("CommunicationEvent").where("communicationEventId", parameters.communicationEventId).cache(true).queryOne(); +communicationEvent = from("CommunicationEvent").where("communicationEventId", parameters.communicationEventId).cache(true).queryOne() -if (!communicationEvent.note) return; -nameString = "Sent from: "; -nameStringIndexValue = communicationEvent.note.indexOf(nameString); -if (nameStringIndexValue == -1) return; -int startEmail = nameStringIndexValue + nameString.length(); -int endEmail = communicationEvent.note.indexOf(";", startEmail); -context.emailAddress = communicationEvent.note.substring(startEmail, endEmail); +if (!communicationEvent.note) return +nameString = "Sent from: " +nameStringIndexValue = communicationEvent.note.indexOf(nameString) +if (nameStringIndexValue == -1) return +int startEmail = nameStringIndexValue + nameString.length() +int endEmail = communicationEvent.note.indexOf(";", startEmail) +context.emailAddress = communicationEvent.note.substring(startEmail, endEmail) -nameString = "Sent Name from: "; -nameStringIndexValue = communicationEvent.note.indexOf(nameString); -if (nameStringIndexValue == -1) return; -int startName = nameStringIndexValue + nameString.length(); -int endName = communicationEvent.note.indexOf(";", startName); -name = communicationEvent.note.substring(startName, endName); +nameString = "Sent Name from: " +nameStringIndexValue = communicationEvent.note.indexOf(nameString) +if (nameStringIndexValue == -1) return +int startName = nameStringIndexValue + nameString.length() +int endName = communicationEvent.note.indexOf(";", startName) +name = communicationEvent.note.substring(startName, endName) if (name) { - counter = 0; - lastBlank = 0; - List names = []; + counter = 0 + lastBlank = 0 + List names = [] while ((nextBlank = name.indexOf(" ", lastBlank)) != -1) { - names.add(name.substring(lastBlank, nextBlank)); - lastBlank = nextBlank + 1; + names.add(name.substring(lastBlank, nextBlank)) + lastBlank = nextBlank + 1 } if (lastBlank > 0) { - names.add(name.substring(lastBlank)); + names.add(name.substring(lastBlank)) } if (names && names.size() > 0) { //lastname - context.lastName = names[names.size()-1]; + context.lastName = names[names.size()-1] if (names.size() > 1) { // firstname - context.firstName = names[0]; + context.firstName = names[0] } if (names.size() > 2) { // middle name(s) - context.middleName = ""; + context.middleName = "" for (counter = 1; counter < names.size()-1; counter++) { context.middleName = context.middleName.concat(names[counter]).concat(" ") } } } else { - context.lastName = name; + context.lastName = name } } Modified: ofbiz/trunk/applications/party/groovyScripts/communication/ListCommunications.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/groovyScripts/communication/ListCommunications.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/applications/party/groovyScripts/communication/ListCommunications.groovy (original) +++ ofbiz/trunk/applications/party/groovyScripts/communication/ListCommunications.groovy Wed Nov 2 19:09:13 2016 @@ -17,36 +17,36 @@ * under the License. */ -import org.apache.ofbiz.entity.condition.EntityOperator; -import org.apache.ofbiz.entity.condition.EntityCondition; +import org.apache.ofbiz.entity.condition.EntityOperator +import org.apache.ofbiz.entity.condition.EntityCondition -partyId = parameters.partyId; -context.partyId = partyId; +partyId = parameters.partyId +context.partyId = partyId -party = from("Party").where("partyId", partyId).queryOne(); -context.party = party; +party = from("Party").where("partyId", partyId).queryOne() +context.party = party // get the sort field -sortField = parameters.sort ?: "entryDate"; -context.previousSort = sortField; +sortField = parameters.sort ?: "entryDate" +context.previousSort = sortField // previous sort field -previousSort = parameters.previousSort; +previousSort = parameters.previousSort if (previousSort?.equals(sortField)) { - sortField = "-" + sortField; + sortField = "-" + sortField } -List eventExprs = []; -expr = EntityCondition.makeCondition("partyIdTo", EntityOperator.EQUALS, partyId); -eventExprs.add(expr); -expr = EntityCondition.makeCondition("partyIdFrom", EntityOperator.EQUALS, partyId); -eventExprs.add(expr); -ecl = EntityCondition.makeCondition(eventExprs, EntityOperator.OR); -events = from("CommunicationEvent").where(ecl).orderBy(sortField).queryList(); - -context.eventList = events; -context.eventListSize = events.size(); -context.highIndex = events.size(); -context.viewSize = events.size(); -context.lowIndex = 1; -context.viewIndex = 1; +List eventExprs = [] +expr = EntityCondition.makeCondition("partyIdTo", EntityOperator.EQUALS, partyId) +eventExprs.add(expr) +expr = EntityCondition.makeCondition("partyIdFrom", EntityOperator.EQUALS, partyId) +eventExprs.add(expr) +ecl = EntityCondition.makeCondition(eventExprs, EntityOperator.OR) +events = from("CommunicationEvent").where(ecl).orderBy(sortField).queryList() + +context.eventList = events +context.eventListSize = events.size() +context.highIndex = events.size() +context.viewSize = events.size() +context.lowIndex = 1 +context.viewIndex = 1 Modified: ofbiz/trunk/applications/party/groovyScripts/communication/RecentVisitor.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/groovyScripts/communication/RecentVisitor.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/applications/party/groovyScripts/communication/RecentVisitor.groovy (original) +++ ofbiz/trunk/applications/party/groovyScripts/communication/RecentVisitor.groovy Wed Nov 2 19:09:13 2016 @@ -17,12 +17,12 @@ * under the License. */ -import org.apache.ofbiz.entity.condition.EntityCondition; -import org.apache.ofbiz.entity.condition.EntityOperator; -import org.apache.ofbiz.base.util.UtilDateTime; -import org.apache.ofbiz.entity.util.EntityUtil; +import org.apache.ofbiz.entity.condition.EntityCondition +import org.apache.ofbiz.entity.condition.EntityOperator +import org.apache.ofbiz.base.util.UtilDateTime +import org.apache.ofbiz.entity.util.EntityUtil -lastDate = UtilDateTime.addDaysToTimestamp(UtilDateTime.nowTimestamp(), -21); // should be there the last 3 weeks. +lastDate = UtilDateTime.addDaysToTimestamp(UtilDateTime.nowTimestamp(), -21) // should be there the last 3 weeks. visits = select('partyId') .from('Visit') .where(EntityCondition.makeCondition("fromDate", EntityOperator.GREATER_THAN, lastDate)) @@ -33,4 +33,4 @@ context.recentParties = select("partyId" .from("PartyNameView") .where(EntityCondition.makeCondition('partyId', EntityOperator.IN, partyIds)) .distinct() - .queryList(); + .queryList() Modified: ofbiz/trunk/applications/party/groovyScripts/party/EditContactMech.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/groovyScripts/party/EditContactMech.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/applications/party/groovyScripts/party/EditContactMech.groovy (original) +++ ofbiz/trunk/applications/party/groovyScripts/party/EditContactMech.groovy Wed Nov 2 19:09:13 2016 @@ -17,27 +17,27 @@ * under the License. */ -import org.apache.ofbiz.party.contact.ContactMechWorker; +import org.apache.ofbiz.party.contact.ContactMechWorker -partyId = parameters.partyId; -context.partyId = partyId; +partyId = parameters.partyId +context.partyId = partyId -Map mechMap = new HashMap(); -ContactMechWorker.getContactMechAndRelated(request, partyId, mechMap); -context.mechMap = mechMap; +Map mechMap = new HashMap() +ContactMechWorker.getContactMechAndRelated(request, partyId, mechMap) +context.mechMap = mechMap -context.contactMechId = mechMap.contactMechId; -context.preContactMechTypeId = parameters.preContactMechTypeId; -context.paymentMethodId = parameters.paymentMethodId; +context.contactMechId = mechMap.contactMechId +context.preContactMechTypeId = parameters.preContactMechTypeId +context.paymentMethodId = parameters.paymentMethodId -cmNewPurposeTypeId = parameters.contactMechPurposeTypeId; +cmNewPurposeTypeId = parameters.contactMechPurposeTypeId if (cmNewPurposeTypeId) { - contactMechPurposeType = from("ContactMechPurposeType").where("contactMechPurposeTypeId", cmNewPurposeTypeId).queryOne(); + contactMechPurposeType = from("ContactMechPurposeType").where("contactMechPurposeTypeId", cmNewPurposeTypeId).queryOne() if (contactMechPurposeType) { - context.contactMechPurposeType = contactMechPurposeType; + context.contactMechPurposeType = contactMechPurposeType } else { - cmNewPurposeTypeId = null; + cmNewPurposeTypeId = null } - context.cmNewPurposeTypeId = cmNewPurposeTypeId; + context.cmNewPurposeTypeId = cmNewPurposeTypeId } -context.donePage = parameters.DONE_PAGE ?:"viewprofile?party_id=" + partyId + "&partyId=" + partyId;; +context.donePage = parameters.DONE_PAGE ?:"viewprofile?party_id=" + partyId + "&partyId=" + partyId Modified: ofbiz/trunk/applications/party/groovyScripts/party/EditPaymentMethod.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/groovyScripts/party/EditPaymentMethod.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/applications/party/groovyScripts/party/EditPaymentMethod.groovy (original) +++ ofbiz/trunk/applications/party/groovyScripts/party/EditPaymentMethod.groovy Wed Nov 2 19:09:13 2016 @@ -17,45 +17,45 @@ * under the License. */ -import org.apache.ofbiz.accounting.payment.PaymentWorker; -import org.apache.ofbiz.party.contact.ContactMechWorker; +import org.apache.ofbiz.accounting.payment.PaymentWorker +import org.apache.ofbiz.party.contact.ContactMechWorker -partyId = parameters.partyId ?: parameters.party_id; -context.partyId = partyId; +partyId = parameters.partyId ?: parameters.party_id +context.partyId = partyId // payment info -paymentResults = PaymentWorker.getPaymentMethodAndRelated(request, partyId); +paymentResults = PaymentWorker.getPaymentMethodAndRelated(request, partyId) //returns the following: "paymentMethod", "creditCard", "giftCard", "eftAccount", "paymentMethodId", "curContactMechId", "donePage", "tryEntity" -context.putAll(paymentResults); +context.putAll(paymentResults) -curPostalAddressResults = ContactMechWorker.getCurrentPostalAddress(request, partyId, paymentResults.curContactMechId); +curPostalAddressResults = ContactMechWorker.getCurrentPostalAddress(request, partyId, paymentResults.curContactMechId) //returns the following: "curPartyContactMech", "curContactMech", "curPostalAddress", "curPartyContactMechPurposes" -context.putAll(curPostalAddressResults); +context.putAll(curPostalAddressResults) -context.postalAddressInfos = ContactMechWorker.getPartyPostalAddresses(request, partyId, paymentResults.curContactMechId); +context.postalAddressInfos = ContactMechWorker.getPartyPostalAddresses(request, partyId, paymentResults.curContactMechId) //prepare "Data" maps for filling form input boxes -tryEntity = paymentResults.tryEntity; +tryEntity = paymentResults.tryEntity -creditCardData = paymentResults.creditCard; -if (!tryEntity) creditCardData = parameters; -context.creditCardData = creditCardData ?:[:]; - -giftCardData = paymentResults.giftCard; -if (!tryEntity) giftCardData = parameters; -context.giftCardData = giftCardData ?: [:]; - -eftAccountData = paymentResults.eftAccount; -if (!tryEntity) eftAccountData = parameters; -context.eftAccountData = eftAccountData ?: [:]; - -checkAccountData = paymentResults.checkAccount; -if (!tryEntity) checkAccountData = parameters; -context.checkAccountData = checkAccountData ?: [:]; - -context.donePage = parameters.DONE_PAGE ?:"viewprofile"; - -paymentMethodData = paymentResults.paymentMethod; -if (!tryEntity.booleanValue()) paymentMethodData = parameters; -if (!paymentMethodData) paymentMethodData = new HashMap(); -if (paymentMethodData) context.paymentMethodData = paymentMethodData; +creditCardData = paymentResults.creditCard +if (!tryEntity) creditCardData = parameters +context.creditCardData = creditCardData ?:[:] + +giftCardData = paymentResults.giftCard +if (!tryEntity) giftCardData = parameters +context.giftCardData = giftCardData ?: [:] + +eftAccountData = paymentResults.eftAccount +if (!tryEntity) eftAccountData = parameters +context.eftAccountData = eftAccountData ?: [:] + +checkAccountData = paymentResults.checkAccount +if (!tryEntity) checkAccountData = parameters +context.checkAccountData = checkAccountData ?: [:] + +context.donePage = parameters.DONE_PAGE ?:"viewprofile" + +paymentMethodData = paymentResults.paymentMethod +if (!tryEntity.booleanValue()) paymentMethodData = parameters +if (!paymentMethodData) paymentMethodData = new HashMap() +if (paymentMethodData) context.paymentMethodData = paymentMethodData Modified: ofbiz/trunk/applications/party/groovyScripts/party/EditShoppingList.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/groovyScripts/party/EditShoppingList.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/applications/party/groovyScripts/party/EditShoppingList.groovy (original) +++ ofbiz/trunk/applications/party/groovyScripts/party/EditShoppingList.groovy Wed Nov 2 19:09:13 2016 @@ -17,128 +17,128 @@ * under the License. */ -import org.apache.ofbiz.entity.util.EntityUtil; -import org.apache.ofbiz.base.util.UtilHttp; -import org.apache.ofbiz.product.catalog.CatalogWorker; -import org.apache.ofbiz.webapp.website.WebSiteWorker; -import org.apache.ofbiz.entity.util.EntityUtilProperties; +import org.apache.ofbiz.entity.util.EntityUtil +import org.apache.ofbiz.base.util.UtilHttp +import org.apache.ofbiz.product.catalog.CatalogWorker +import org.apache.ofbiz.webapp.website.WebSiteWorker +import org.apache.ofbiz.entity.util.EntityUtilProperties -prodCatalogId = CatalogWorker.getCurrentCatalogId(request); -webSiteId = WebSiteWorker.getWebSiteId(request); +prodCatalogId = CatalogWorker.getCurrentCatalogId(request) +webSiteId = WebSiteWorker.getWebSiteId(request) -currencyUomId = parameters.currencyUomId ?: UtilHttp.getCurrencyUom(request); -context.currencyUomId = currencyUomId; +currencyUomId = parameters.currencyUomId ?: UtilHttp.getCurrencyUom(request) +context.currencyUomId = currencyUomId -partyId = parameters.partyId ?:request.getAttribute("partyId"); +partyId = parameters.partyId ?:request.getAttribute("partyId") -party = from("Party").where("partyId", partyId).queryOne(); -context.party = party; +party = from("Party").where("partyId", partyId).queryOne() +context.party = party if (party) { - context.lookupPerson = party.getRelatedOne("Person", false); - context.lookupGroup = party.getRelatedOne("PartyGroup", false); + context.lookupPerson = party.getRelatedOne("Person", false) + context.lookupGroup = party.getRelatedOne("PartyGroup", false) } -shoppingListId = parameters.shoppingListId ?: request.getAttribute("shoppingListId"); +shoppingListId = parameters.shoppingListId ?: request.getAttribute("shoppingListId") //get the party for listid if it exists if (!partyId && shoppingListId) { - partyId = from("ShoppingList").where("shoppingListId", shoppingListId).queryOne().partyId; + partyId = from("ShoppingList").where("shoppingListId", shoppingListId).queryOne().partyId } -context.partyId = partyId; +context.partyId = partyId // get the top level shopping lists for the party -allShoppingLists = from("ShoppingList").where("partyId", partyId).queryList(); -shoppingLists = EntityUtil.filterByAnd(allShoppingLists, [parentShoppingListId : null]); -context.allShoppingLists = allShoppingLists; -context.shoppingLists = shoppingLists; +allShoppingLists = from("ShoppingList").where("partyId", partyId).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 // 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 } } // if we passed a shoppingListId get the shopping list info if (shoppingListId) { - shoppingList = from("ShoppingList").where("shoppingListId", shoppingListId).queryOne(); - context.shoppingList = shoppingList; - context.shoppingListId = shoppingListId; + shoppingList = from("ShoppingList").where("shoppingListId", shoppingListId).queryOne() + context.shoppingList = shoppingList + context.shoppingListId = shoppingListId 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 = [:]; - product = shoppingListItem.getRelatedOne("Product", true); + shoppingListItemData = [:] + product = shoppingListItem.getRelatedOne("Product", true) // DEJ20050704 not sure about calculating price here, will have some bogus data when not in a store webapp - calcPriceOutMap = runService('calculateProductPrice', [product : product, quantity : shoppingListItem.quantity , currencyUomId : currencyUomId, userLogin : userLogin, productStoreId : shoppingList.productStoreId]); - price = calcPriceOutMap.price; - totalPrice = price * shoppingListItem.getDouble("quantity"); - shoppingListItemTotal += totalPrice; + calcPriceOutMap = runService('calculateProductPrice', [product : product, quantity : shoppingListItem.quantity , currencyUomId : currencyUomId, userLogin : userLogin, productStoreId : shoppingList.productStoreId]) + price = calcPriceOutMap.price + totalPrice = price * shoppingListItem.getDouble("quantity") + 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 ?: 0); - viewSize = parameters.VIEW_SIZE ?: EntityUtilProperties.getPropertyAsInteger("widget", "widget.form.defaultViewSize", 20); - listSize = shoppingListItemDatas ? shoppingListItemDatas.size() : 0; - - lowIndex = (viewIndex * viewSize) + 1; - highIndex = (viewIndex + 1) * 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 ?: 0) + viewSize = parameters.VIEW_SIZE ?: EntityUtilProperties.getPropertyAsInteger("widget", "widget.form.defaultViewSize", 20) + listSize = shoppingListItemDatas ? shoppingListItemDatas.size() : 0 + + lowIndex = (viewIndex * viewSize) + 1 + highIndex = (viewIndex + 1) * 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", partyId, "parentShoppingListId", shoppingListId).orderBy("listName").cache(true).queryList(); + childShoppingLists = from("ShoppingList").where("partyId", 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()) childShoppingListDatas.each { childShoppingList -> - childShoppingListData = [:]; - calcListPriceInMap = [shoppingListId : childShoppingList.shoppingListId , prodCatalogId : prodCatalogId , webSiteId : webSiteId, userLogin : userLogin]; - childShoppingListData.childShoppingList = childShoppingList; - childShoppingListDatas.add(childShoppingListData); + childShoppingListData = [:] + calcListPriceInMap = [shoppingListId : childShoppingList.shoppingListId , prodCatalogId : prodCatalogId , webSiteId : webSiteId, userLogin : userLogin] + childShoppingListData.childShoppingList = childShoppingList + childShoppingListDatas.add(childShoppingListData) } - context.childShoppingListDatas = childShoppingListDatas; + context.childShoppingListDatas = childShoppingListDatas } // 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 } } Modified: ofbiz/trunk/applications/party/groovyScripts/party/FindLookUp.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/groovyScripts/party/FindLookUp.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/applications/party/groovyScripts/party/FindLookUp.groovy (original) +++ ofbiz/trunk/applications/party/groovyScripts/party/FindLookUp.groovy Wed Nov 2 19:09:13 2016 @@ -20,45 +20,45 @@ -import org.apache.ofbiz.base.util.Debug; -import org.apache.ofbiz.entity.condition.EntityCondition; -import org.apache.ofbiz.entity.condition.EntityOperator; -import org.apache.ofbiz.entity.util.EntityUtilProperties; +import org.apache.ofbiz.base.util.Debug +import org.apache.ofbiz.entity.condition.EntityCondition +import org.apache.ofbiz.entity.condition.EntityOperator +import org.apache.ofbiz.entity.util.EntityUtilProperties if (context.noConditionFind == null) { - context.noConditionFind = parameters.noConditionFind; + context.noConditionFind = parameters.noConditionFind } if (context.noConditionFind == null) { - context.noConditionFind = EntityUtilProperties.getPropertyValue("widget", "widget.defaultNoConditionFind", delegator); + context.noConditionFind = EntityUtilProperties.getPropertyValue("widget", "widget.defaultNoConditionFind", delegator) } if (context.filterByDate == null) { - context.filterByDate = parameters.filterByDate; + context.filterByDate = parameters.filterByDate } prepareResult = runService('prepareFind', [entityName : context.entityName, orderBy : context.orderBy, inputFields : parameters, filterByDate : context.filterByDate, filterByDateValue : context.filterByDateValue, - userLogin : context.userLogin]); + userLogin : context.userLogin]) exprList = [EntityCondition.makeCondition("statusId", null), - EntityCondition.makeCondition("statusId", EntityOperator.NOT_EQUAL, "PARTY_DISABLED")]; -statusPartyDisable = EntityCondition.makeCondition(exprList, EntityOperator.OR); -entityConditionList = null; + EntityCondition.makeCondition("statusId", EntityOperator.NOT_EQUAL, "PARTY_DISABLED")] +statusPartyDisable = EntityCondition.makeCondition(exprList, EntityOperator.OR) +entityConditionList = null if (prepareResult.entityConditionList != null) { - ConditionList = [prepareResult.entityConditionList, statusPartyDisable]; - entityConditionList = EntityCondition.makeCondition(ConditionList); + ConditionList = [prepareResult.entityConditionList, statusPartyDisable] + entityConditionList = EntityCondition.makeCondition(ConditionList) } else if (context.noConditionFind == "Y") { - entityConditionList = statusPartyDisable; + entityConditionList = statusPartyDisable } executeResult = runService('executeFind', [entityName : context.entityName, orderByList : prepareResult.orderByList, entityConditionList : entityConditionList, - noConditionFind : context.noConditionFind]); + noConditionFind : context.noConditionFind]) if (executeResult.listIt == null) { - Debug.logWarning("No list found for query string + [" + prepareResult.queryString + "]", "FindLookUp.groovy"); + Debug.logWarning("No list found for query string + [" + prepareResult.queryString + "]", "FindLookUp.groovy") } -context.listIt = executeResult.listIt; -context.queryString = prepareResult.queryString; -context.queryStringMap = prepareResult.queryStringMap; +context.listIt = executeResult.listIt +context.queryString = prepareResult.queryString +context.queryStringMap = prepareResult.queryStringMap Modified: ofbiz/trunk/applications/party/groovyScripts/party/FindMatches.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/groovyScripts/party/FindMatches.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/applications/party/groovyScripts/party/FindMatches.groovy (original) +++ ofbiz/trunk/applications/party/groovyScripts/party/FindMatches.groovy Wed Nov 2 19:09:13 2016 @@ -17,34 +17,34 @@ * under the License. */ -import org.apache.ofbiz.party.party.PartyWorker; +import org.apache.ofbiz.party.party.PartyWorker -match = parameters.match; +match = parameters.match if (match) { - context.match = match; + context.match = match - lastName = parameters.lastName ?: null; - firstName = parameters.firstName ?: null; - address1 = parameters.address1 ?: null; - address2 = parameters.address2 ?: null; - city = parameters.city ?: null; - state = parameters.stateProvinceGeoId ?: null; - if ("ANY".equals(state)) state = null; - postalCode = parameters.postalCode ?: null; + lastName = parameters.lastName ?: null + firstName = parameters.firstName ?: null + address1 = parameters.address1 ?: null + address2 = parameters.address2 ?: null + city = parameters.city ?: null + state = parameters.stateProvinceGeoId ?: null + if ("ANY".equals(state)) state = null + postalCode = parameters.postalCode ?: null if (state) { - context.currentStateGeo = from("Geo").where("geoId", state).queryOne(); + context.currentStateGeo = from("Geo").where("geoId", state).queryOne() } if (!firstName || !lastName || !address1 || !city || !postalCode) { - request.setAttribute("_ERROR_MESSAGE_", "Required fields not set!"); - return; + request.setAttribute("_ERROR_MESSAGE_", "Required fields not set!") + return } context.matches = PartyWorker.findMatchingPersonPostalAddresses(delegator, address1, address2, city, - state, postalCode, null, null, firstName, null, lastName); + state, postalCode, null, null, firstName, null, lastName) - context.addressString = PartyWorker.makeMatchingString(delegator, address1); - context.lastName = lastName; - context.firstName = firstName; + context.addressString = PartyWorker.makeMatchingString(delegator, address1) + context.lastName = lastName + context.firstName = firstName } Modified: ofbiz/trunk/applications/party/groovyScripts/party/FindParty.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/groovyScripts/party/FindParty.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/applications/party/groovyScripts/party/FindParty.groovy (original) +++ ofbiz/trunk/applications/party/groovyScripts/party/FindParty.groovy Wed Nov 2 19:09:13 2016 @@ -18,15 +18,15 @@ */ if (!context.extInfo || context.extInfo == 'N') { - if (parameters.partyIdentificationTypeId || parameters.idValue) context.extInfo='I'; + if (parameters.partyIdentificationTypeId || parameters.idValue) context.extInfo='I' else if (parameters.address1 || parameters.address2 || parameters.city || parameters.postalCode - || parameters.stateProvinceGeoId) context.extInfo='P'; + || parameters.stateProvinceGeoId) context.extInfo='P' else if (parameters.countryCode || parameters.areaCode - || parameters.contactNumber) context.extInfo='T'; - else if (parameters.infoString) context.extInfo='O'; - if (!context.extInfo) context.extInfo == 'N'; + || parameters.contactNumber) context.extInfo='T' + else if (parameters.infoString) context.extInfo='O' + if (!context.extInfo) context.extInfo == 'N' } \ No newline at end of file Modified: ofbiz/trunk/applications/party/groovyScripts/party/GetContactMechs.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/groovyScripts/party/GetContactMechs.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/applications/party/groovyScripts/party/GetContactMechs.groovy (original) +++ ofbiz/trunk/applications/party/groovyScripts/party/GetContactMechs.groovy Wed Nov 2 19:09:13 2016 @@ -17,8 +17,8 @@ * under the License. */ -import org.apache.ofbiz.party.contact.ContactMechWorker; +import org.apache.ofbiz.party.contact.ContactMechWorker -partyId = partyId ?: parameters.partyId; -showOld = "true".equals(parameters.SHOW_OLD); -context.contactMeches = ContactMechWorker.getPartyContactMechValueMaps(delegator, partyId, showOld); +partyId = partyId ?: parameters.partyId +showOld = "true".equals(parameters.SHOW_OLD) +context.contactMeches = ContactMechWorker.getPartyContactMechValueMaps(delegator, partyId, showOld) Modified: ofbiz/trunk/applications/party/groovyScripts/party/GetCurrentCart.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/groovyScripts/party/GetCurrentCart.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/applications/party/groovyScripts/party/GetCurrentCart.groovy (original) +++ ofbiz/trunk/applications/party/groovyScripts/party/GetCurrentCart.groovy Wed Nov 2 19:09:13 2016 @@ -17,11 +17,11 @@ * under the License. */ -partyId = partyId ?: parameters.partyId; +partyId = partyId ?: parameters.partyId -savedCart = from("ShoppingList").where("partyId", partyId, "shoppingListTypeId", "SLT_SPEC_PURP" , "listName", "auto-save").queryFirst(); +savedCart = from("ShoppingList").where("partyId", partyId, "shoppingListTypeId", "SLT_SPEC_PURP" , "listName", "auto-save").queryFirst() if (savedCart) { - context.savedCartListId = savedCart.shoppingListId; - context.savedCartItems = savedCart.getRelated("ShoppingListItem", null, null, false); + context.savedCartListId = savedCart.shoppingListId + context.savedCartItems = savedCart.getRelated("ShoppingListItem", null, null, false) } Modified: ofbiz/trunk/applications/party/groovyScripts/party/GetGeoLocation.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/groovyScripts/party/GetGeoLocation.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/applications/party/groovyScripts/party/GetGeoLocation.groovy (original) +++ ofbiz/trunk/applications/party/groovyScripts/party/GetGeoLocation.groovy Wed Nov 2 19:09:13 2016 @@ -17,17 +17,17 @@ * under the License. */ -import org.apache.ofbiz.common.geo.GeoWorker; +import org.apache.ofbiz.common.geo.GeoWorker if (partyId) { - context.partyId = partyId; - latestGeoPoint = GeoWorker.findLatestGeoPoint(delegator, "PartyAndGeoPoint", "partyId", partyId, null, null); + context.partyId = partyId + latestGeoPoint = GeoWorker.findLatestGeoPoint(delegator, "PartyAndGeoPoint", "partyId", partyId, null, null) if (latestGeoPoint) { - context.geoPointId = latestGeoPoint.geoPointId; - context.latitude = latestGeoPoint.latitude; - context.longitude = latestGeoPoint.longitude; + context.geoPointId = latestGeoPoint.geoPointId + context.latitude = latestGeoPoint.latitude + context.longitude = latestGeoPoint.longitude } else { - context.latitude = 0; - context.longitude = 0; + context.latitude = 0 + context.longitude = 0 } } Modified: ofbiz/trunk/applications/party/groovyScripts/party/GetLoyaltyPoints.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/groovyScripts/party/GetLoyaltyPoints.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/applications/party/groovyScripts/party/GetLoyaltyPoints.groovy (original) +++ ofbiz/trunk/applications/party/groovyScripts/party/GetLoyaltyPoints.groovy Wed Nov 2 19:09:13 2016 @@ -17,18 +17,18 @@ * under the License. */ -partyId = parameters.partyId ? parameters.partyId : userLogin.partyId ; +partyId = parameters.partyId ? parameters.partyId : userLogin.partyId if (partyId) { // get the system user - system = from("UserLogin").where("userLoginId", "system").queryOne(); + system = from("UserLogin").where("userLoginId", "system").queryOne() - monthsToInclude = 12; + monthsToInclude = 12 Map result = runService('getOrderedSummaryInformation', ["partyId": partyId, "roleTypeId": "PLACING_CUSTOMER", "orderTypeId": "SALES_ORDER", - "statusId": "ORDER_COMPLETED", "monthsToInclude": monthsToInclude, "userLogin": system]); + "statusId": "ORDER_COMPLETED", "monthsToInclude": monthsToInclude, "userLogin": system]) - context.monthsToInclude = monthsToInclude; - context.totalSubRemainingAmount = result.totalSubRemainingAmount; - context.totalOrders = result.totalOrders; + context.monthsToInclude = monthsToInclude + context.totalSubRemainingAmount = result.totalSubRemainingAmount + context.totalOrders = result.totalOrders } Modified: ofbiz/trunk/applications/party/groovyScripts/party/GetMyCompany.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/groovyScripts/party/GetMyCompany.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/applications/party/groovyScripts/party/GetMyCompany.groovy (original) +++ ofbiz/trunk/applications/party/groovyScripts/party/GetMyCompany.groovy Wed Nov 2 19:09:13 2016 @@ -18,11 +18,11 @@ */ if (userLogin) { - companies = from("PartyRelationship").where(partyIdTo: userLogin.partyId, roleTypeIdTo: "CONTACT", roleTypeIdFrom: "ACCOUNT").queryList(); + companies = from("PartyRelationship").where(partyIdTo: userLogin.partyId, roleTypeIdTo: "CONTACT", roleTypeIdFrom: "ACCOUNT").queryList() if (companies) { - company = companies[0]; - context.myCompanyId = company.partyIdFrom; + company = companies[0] + context.myCompanyId = company.partyIdFrom } else { - context.myCompanyId = userLogin.partyId; + context.myCompanyId = userLogin.partyId } } Modified: ofbiz/trunk/applications/party/groovyScripts/party/GetPaymentMethods.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/groovyScripts/party/GetPaymentMethods.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/applications/party/groovyScripts/party/GetPaymentMethods.groovy (original) +++ ofbiz/trunk/applications/party/groovyScripts/party/GetPaymentMethods.groovy Wed Nov 2 19:09:13 2016 @@ -17,20 +17,20 @@ * under the License. */ -import org.apache.ofbiz.accounting.payment.PaymentWorker; -import org.apache.ofbiz.accounting.payment.BillingAccountWorker; +import org.apache.ofbiz.accounting.payment.PaymentWorker +import org.apache.ofbiz.accounting.payment.BillingAccountWorker -partyId = parameters.partyId ?: userLogin.partyId; -showOld = "true".equals(parameters.SHOW_OLD); +partyId = parameters.partyId ?: userLogin.partyId +showOld = "true".equals(parameters.SHOW_OLD) -currencyUomId = null; -billingAccounts = []; +currencyUomId = null +billingAccounts = [] if (partyId) { - billingAccountAndRoles = from("BillingAccountAndRole").where("partyId", partyId).queryList(); - if (billingAccountAndRoles) currencyUomId = billingAccountAndRoles.first().accountCurrencyUomId; - if (currencyUomId) billingAccounts = BillingAccountWorker.makePartyBillingAccountList(userLogin, currencyUomId, partyId, delegator, dispatcher); + billingAccountAndRoles = from("BillingAccountAndRole").where("partyId", partyId).queryList() + if (billingAccountAndRoles) currencyUomId = billingAccountAndRoles.first().accountCurrencyUomId + if (currencyUomId) billingAccounts = BillingAccountWorker.makePartyBillingAccountList(userLogin, currencyUomId, partyId, delegator, dispatcher) } -context.billingAccounts = billingAccounts; -context.showOld = showOld; -context.partyId = partyId; -context.paymentMethodValueMaps = PaymentWorker.getPartyPaymentMethodValueMaps(delegator, partyId, showOld); +context.billingAccounts = billingAccounts +context.showOld = showOld +context.partyId = partyId +context.paymentMethodValueMaps = PaymentWorker.getPartyPaymentMethodValueMaps(delegator, partyId, showOld) Modified: ofbiz/trunk/applications/party/groovyScripts/party/GetPostalAddressTemplate.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/groovyScripts/party/GetPostalAddressTemplate.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/applications/party/groovyScripts/party/GetPostalAddressTemplate.groovy (original) +++ ofbiz/trunk/applications/party/groovyScripts/party/GetPostalAddressTemplate.groovy Wed Nov 2 19:09:13 2016 @@ -17,17 +17,17 @@ * under the License. */ -postalAddressForTemplate = context.postalAddress; -postalAddressTemplateSuffix = context.postalAddressTemplateSuffix; +postalAddressForTemplate = context.postalAddress +postalAddressTemplateSuffix = context.postalAddressTemplateSuffix if (!postalAddressTemplateSuffix) { - postalAddressTemplateSuffix = ".ftl"; + postalAddressTemplateSuffix = ".ftl" } -context.postalAddressTemplate = "PostalAddress" + postalAddressTemplateSuffix; +context.postalAddressTemplate = "PostalAddress" + postalAddressTemplateSuffix if (postalAddressForTemplate && postalAddressForTemplate.countryGeoId) { - postalAddressTemplate = "PostalAddress_" + postalAddressForTemplate.countryGeoId + postalAddressTemplateSuffix; - file = new File(addressTemplatePath + postalAddressTemplate); + postalAddressTemplate = "PostalAddress_" + postalAddressForTemplate.countryGeoId + postalAddressTemplateSuffix + file = new File(addressTemplatePath + postalAddressTemplate) if (file.exists()) { - context.postalAddressTemplate = postalAddressTemplate; + context.postalAddressTemplate = postalAddressTemplate } } Modified: ofbiz/trunk/applications/party/groovyScripts/party/GetUserLoginPrimaryEmail.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/groovyScripts/party/GetUserLoginPrimaryEmail.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/applications/party/groovyScripts/party/GetUserLoginPrimaryEmail.groovy (original) +++ ofbiz/trunk/applications/party/groovyScripts/party/GetUserLoginPrimaryEmail.groovy Wed Nov 2 19:09:13 2016 @@ -20,11 +20,11 @@ //figure out the PRIMARY_EMAIL of the logged in user, for setting in the send email link //maybe nice to put in some secondary emails later if (userLogin) { - userLoginParty = userLogin.getRelatedOne("Party", true); + userLoginParty = userLogin.getRelatedOne("Party", true) if (userLoginParty) { - userLoginPartyPrimaryEmails = userLoginParty.getRelated("PartyContactMechPurpose", [contactMechPurposeTypeId : "PRIMARY_EMAIL"], null, false); + userLoginPartyPrimaryEmails = userLoginParty.getRelated("PartyContactMechPurpose", [contactMechPurposeTypeId : "PRIMARY_EMAIL"], null, false) if (userLoginPartyPrimaryEmails) { - context.thisUserPrimaryEmail = userLoginPartyPrimaryEmails.get(0); + context.thisUserPrimaryEmail = userLoginPartyPrimaryEmails.get(0) } } } |
Free forum by Nabble | Edit this page |