diff --git a/applications/accounting/groovyScripts/admin/FilterOutReceipts.groovy b/applications/accounting/groovyScripts/admin/FilterOutReceipts.groovy
index 3209e58f96..e0e8c0eddf 100644
--- a/applications/accounting/groovyScripts/admin/FilterOutReceipts.groovy
+++ b/applications/accounting/groovyScripts/admin/FilterOutReceipts.groovy
@@ -18,6 +18,6 @@
*/
// simple script to filter out receipts in a list of payments
-import org.apache.ofbiz.accounting.util.UtilAccounting;
+import org.apache.ofbiz.accounting.util.UtilAccounting
-context.payments.removeAll{UtilAccounting.isReceipt(it)};
+context.payments.removeAll{UtilAccounting.isReceipt(it)}
diff --git a/applications/accounting/groovyScripts/admin/ListInvoiceItemTypesGlAccount.groovy b/applications/accounting/groovyScripts/admin/ListInvoiceItemTypesGlAccount.groovy
index 95421efbdc..38bd644d99 100644
--- a/applications/accounting/groovyScripts/admin/ListInvoiceItemTypesGlAccount.groovy
+++ b/applications/accounting/groovyScripts/admin/ListInvoiceItemTypesGlAccount.groovy
@@ -17,32 +17,32 @@
* under the License.
*/
-import org.apache.ofbiz.entity.condition.EntityConditionBuilder;
+import org.apache.ofbiz.entity.condition.EntityConditionBuilder
// Optional prefix parameter to filter InvoiceItemTypes by (i.e. "INV" or "PINV") defaults to INV
-invItemTypePrefix = context.invItemTypePrefix ?: "INV";
-invItemTypePrefix += "_%";
+invItemTypePrefix = context.invItemTypePrefix ?: "INV"
+invItemTypePrefix += "_%"
-organizationPartyId = parameters.organizationPartyId;
-exprBldr = new EntityConditionBuilder();
-invoiceItemTypes = from('InvoiceItemType').where(exprBldr.LIKE(invoiceItemTypeId: invItemTypePrefix)).queryList();
+organizationPartyId = parameters.organizationPartyId
+exprBldr = new EntityConditionBuilder()
+invoiceItemTypes = from('InvoiceItemType').where(exprBldr.LIKE(invoiceItemTypeId: invItemTypePrefix)).queryList()
context.invoiceItemTypes = invoiceItemTypes.collect { invoiceItemType ->
defaultAccount = true
- glAccount = null;
- invoiceItemTypeOrgs = invoiceItemType.getRelated("InvoiceItemTypeGlAccount", [organizationPartyId : organizationPartyId], null, false);
+ glAccount = null
+ invoiceItemTypeOrgs = invoiceItemType.getRelated("InvoiceItemTypeGlAccount", [organizationPartyId : organizationPartyId], null, false)
overrideGlAccountId = null
if (invoiceItemTypeOrgs) {
- invoiceItemTypeOrg = invoiceItemTypeOrgs[0];
- overrideGlAccountId = invoiceItemTypeOrg.glAccountId;
+ invoiceItemTypeOrg = invoiceItemTypeOrgs[0]
+ overrideGlAccountId = invoiceItemTypeOrg.glAccountId
- glAccounts = invoiceItemTypeOrg.getRelated("GlAccount", null, null, false);
+ glAccounts = invoiceItemTypeOrg.getRelated("GlAccount", null, null, false)
if (glAccounts) {
- glAccount = glAccounts[0];
+ glAccount = glAccounts[0]
defaultAccount = false
}
} else {
- glAccount = invoiceItemType.getRelatedOne("DefaultGlAccount", false);
+ glAccount = invoiceItemType.getRelatedOne("DefaultGlAccount", false)
}
return [invoiceItemTypeId : invoiceItemType.invoiceItemTypeId,
@@ -50,5 +50,5 @@ context.invoiceItemTypes = invoiceItemTypes.collect { invoiceItemType ->
defaultGlAccountId : invoiceItemType.defaultGlAccountId,
overrideGlAccountId : overrideGlAccountId,
defaultAccount : defaultAccount,
- activeGlDescription : glAccount?.accountName];
+ activeGlDescription : glAccount?.accountName]
}
diff --git a/applications/accounting/groovyScripts/ap/invoices/CommissionReport.groovy b/applications/accounting/groovyScripts/ap/invoices/CommissionReport.groovy
index b3ae713af8..2ea8c7b326 100644
--- a/applications/accounting/groovyScripts/ap/invoices/CommissionReport.groovy
+++ b/applications/accounting/groovyScripts/ap/invoices/CommissionReport.groovy
@@ -25,81 +25,81 @@ import org.apache.ofbiz.entity.util.EntityUtil
import java.sql.Timestamp
if ("Y".equals(parameters.isSearch)) {
- fromDate = parameters.fromDate;
- thruDate = parameters.thruDate;
- partyId = parameters.partyId;
- productId = parameters.productId;
- invoiceItemAndAssocProductCond = [];
+ fromDate = parameters.fromDate
+ thruDate = parameters.thruDate
+ partyId = parameters.partyId
+ productId = parameters.productId
+ invoiceItemAndAssocProductCond = []
if (productId) {
- invoiceItemAndAssocProductCond.add(EntityCondition.makeCondition("productId", EntityOperator.EQUALS, productId));
+ invoiceItemAndAssocProductCond.add(EntityCondition.makeCondition("productId", EntityOperator.EQUALS, productId))
}
if (partyId) {
- invoiceItemAndAssocProductCond.add(EntityCondition.makeCondition("partyIdFrom", EntityOperator.EQUALS, partyId));
+ invoiceItemAndAssocProductCond.add(EntityCondition.makeCondition("partyIdFrom", EntityOperator.EQUALS, partyId))
}
if (fromDate) {
- invoiceItemAndAssocProductCond.add(EntityCondition.makeCondition("fromDate", EntityOperator.GREATER_THAN_EQUAL_TO, Timestamp.valueOf(fromDate)));
+ invoiceItemAndAssocProductCond.add(EntityCondition.makeCondition("fromDate", EntityOperator.GREATER_THAN_EQUAL_TO, Timestamp.valueOf(fromDate)))
}
if (thruDate) {
- invoiceItemAndAssocProductCond.add(EntityCondition.makeCondition("thruDate", EntityOperator.LESS_THAN_EQUAL_TO, Timestamp.valueOf(thruDate)));
+ invoiceItemAndAssocProductCond.add(EntityCondition.makeCondition("thruDate", EntityOperator.LESS_THAN_EQUAL_TO, Timestamp.valueOf(thruDate)))
}
- invoiceItemAndAssocProductList = [];
- invoiceItemAndAssocProductList = from("InvoiceItemAndAssocProduct").where(invoiceItemAndAssocProductCond).queryList();
+ invoiceItemAndAssocProductList = []
+ invoiceItemAndAssocProductList = from("InvoiceItemAndAssocProduct").where(invoiceItemAndAssocProductCond).queryList()
//filtering invoiceItemAndAssocProductList for each productId with updating quantity, commission amount and number of order which generated sales invoices.
- totalQuantity = BigDecimal.ZERO;
- totalNumberOfOrders = BigDecimal.ZERO;
- totalCommissionAmount = BigDecimal.ZERO;
- totalNetSales = BigDecimal.ZERO;
- commissionReportList = [];
+ totalQuantity = BigDecimal.ZERO
+ totalNumberOfOrders = BigDecimal.ZERO
+ totalCommissionAmount = BigDecimal.ZERO
+ totalNetSales = BigDecimal.ZERO
+ commissionReportList = []
if (invoiceItemAndAssocProductList) {
- productIds = EntityUtil.getFieldListFromEntityList(invoiceItemAndAssocProductList, "productId", true);
+ productIds = EntityUtil.getFieldListFromEntityList(invoiceItemAndAssocProductList, "productId", true)
productIds.each { productId ->
- quantity = BigDecimal.ZERO;
- commissionAmount = BigDecimal.ZERO;
- termAmount = BigDecimal.ZERO;
- invoiceItemProductAmount = BigDecimal.ZERO;
- assocProductId = null;
- productName = null;
- commissionReportMap = [:];
- salesAgentAndTermAmtMap = [:];
- salesInvoiceIds = [];
+ quantity = BigDecimal.ZERO
+ commissionAmount = BigDecimal.ZERO
+ termAmount = BigDecimal.ZERO
+ invoiceItemProductAmount = BigDecimal.ZERO
+ assocProductId = null
+ productName = null
+ commissionReportMap = [:]
+ salesAgentAndTermAmtMap = [:]
+ salesInvoiceIds = []
invoiceItemAndAssocProductList.each { invoiceItemAndAssocProduct ->
if (productId.equals(invoiceItemAndAssocProduct.productId)) {
- partyIdTermAmountMap = [:];
- partyIdTermAmountKey = null;
- assocProductId = invoiceItemAndAssocProduct.productId;
- productName = invoiceItemAndAssocProduct.productName;
- quantity = quantity.add(invoiceItemAndAssocProduct.quantity);
- commissionAmount = commissionAmount.add(invoiceItemAndAssocProduct.termAmount.multiply(invoiceItemAndAssocProduct.quantity));
- termAmount = termAmount.add(invoiceItemAndAssocProduct.termAmount);
- partyIdTermAmountMap.partyId = invoiceItemAndAssocProduct.partyIdFrom;
- partyIdTermAmountMap.termAmount = invoiceItemAndAssocProduct.termAmount;
- partyIdTermAmountKey = invoiceItemAndAssocProduct.partyIdFrom + invoiceItemAndAssocProduct.termAmount;
+ partyIdTermAmountMap = [:]
+ partyIdTermAmountKey = null
+ assocProductId = invoiceItemAndAssocProduct.productId
+ productName = invoiceItemAndAssocProduct.productName
+ quantity = quantity.add(invoiceItemAndAssocProduct.quantity)
+ commissionAmount = commissionAmount.add(invoiceItemAndAssocProduct.termAmount.multiply(invoiceItemAndAssocProduct.quantity))
+ termAmount = termAmount.add(invoiceItemAndAssocProduct.termAmount)
+ partyIdTermAmountMap.partyId = invoiceItemAndAssocProduct.partyIdFrom
+ partyIdTermAmountMap.termAmount = invoiceItemAndAssocProduct.termAmount
+ partyIdTermAmountKey = invoiceItemAndAssocProduct.partyIdFrom + invoiceItemAndAssocProduct.termAmount
if (!salesAgentAndTermAmtMap.containsKey(partyIdTermAmountKey)) {
- salesAgentAndTermAmtMap.put(partyIdTermAmountKey, partyIdTermAmountMap);
+ salesAgentAndTermAmtMap.put(partyIdTermAmountKey, partyIdTermAmountMap)
}
- salesInvoiceIds.add(invoiceItemAndAssocProduct.invoiceIdFrom);
- invoiceItemProductAmount = invoiceItemAndAssocProduct.amount;
+ salesInvoiceIds.add(invoiceItemAndAssocProduct.invoiceIdFrom)
+ invoiceItemProductAmount = invoiceItemAndAssocProduct.amount
}
}
- commissionReportMap.productId = assocProductId;
- commissionReportMap.productName = productName;
- commissionReportMap.quantity = quantity;
- commissionReportMap.salesAgentAndTermAmtMap = salesAgentAndTermAmtMap;
- commissionReportMap.commissionAmount = commissionAmount;
- commissionReportMap.netSale = invoiceItemProductAmount.multiply(quantity);
- commissionReportMap.salesInvoiceIds = salesInvoiceIds;
- commissionReportMap.numberOfOrders = salesInvoiceIds.size();
- commissionReportList.add(commissionReportMap);
- totalQuantity = totalQuantity.add(quantity);
- totalNumberOfOrders = totalNumberOfOrders.add(salesInvoiceIds.size());
- totalCommissionAmount = totalCommissionAmount.add(commissionAmount);
- totalNetSales = totalNetSales.add(invoiceItemProductAmount.multiply(quantity));
+ commissionReportMap.productId = assocProductId
+ commissionReportMap.productName = productName
+ commissionReportMap.quantity = quantity
+ commissionReportMap.salesAgentAndTermAmtMap = salesAgentAndTermAmtMap
+ commissionReportMap.commissionAmount = commissionAmount
+ commissionReportMap.netSale = invoiceItemProductAmount.multiply(quantity)
+ commissionReportMap.salesInvoiceIds = salesInvoiceIds
+ commissionReportMap.numberOfOrders = salesInvoiceIds.size()
+ commissionReportList.add(commissionReportMap)
+ totalQuantity = totalQuantity.add(quantity)
+ totalNumberOfOrders = totalNumberOfOrders.add(salesInvoiceIds.size())
+ totalCommissionAmount = totalCommissionAmount.add(commissionAmount)
+ totalNetSales = totalNetSales.add(invoiceItemProductAmount.multiply(quantity))
}
}
- context.commissionReportList = commissionReportList;
- context.totalQuantity = totalQuantity;
- context.totalNumberOfOrders = totalNumberOfOrders;
- context.totalCommissionAmount = totalCommissionAmount;
- context.totalNetSales = totalNetSales;
+ context.commissionReportList = commissionReportList
+ context.totalQuantity = totalQuantity
+ context.totalNumberOfOrders = totalNumberOfOrders
+ context.totalCommissionAmount = totalCommissionAmount
+ context.totalNetSales = totalNetSales
}
diff --git a/applications/accounting/groovyScripts/ap/invoices/CommissionRun.groovy b/applications/accounting/groovyScripts/ap/invoices/CommissionRun.groovy
index 08e73ef903..0898d4ef8e 100644
--- a/applications/accounting/groovyScripts/ap/invoices/CommissionRun.groovy
+++ b/applications/accounting/groovyScripts/ap/invoices/CommissionRun.groovy
@@ -17,31 +17,31 @@
* under the License.
*/
-import java.sql.Timestamp;
-import org.apache.ofbiz.entity.condition.EntityCondition;
-import org.apache.ofbiz.entity.condition.EntityOperator;
+import java.sql.Timestamp
+import org.apache.ofbiz.entity.condition.EntityCondition
+import org.apache.ofbiz.entity.condition.EntityOperator
-fromDate = parameters.fromDate;
-thruDate = parameters.thruDate;
+fromDate = parameters.fromDate
+thruDate = parameters.thruDate
if (fromDate) {
- List invoiceCond = [];
- invoiceCond.add(EntityCondition.makeCondition("invoiceTypeId", EntityOperator.EQUALS, parameters.invoiceTypeId));
- invoiceCond.add(EntityCondition.makeCondition("statusId", EntityOperator.EQUALS, parameters.statusId));
- invoiceCond.add(EntityCondition.makeCondition("invoiceDate", EntityOperator.GREATER_THAN_EQUAL_TO, Timestamp.valueOf(fromDate)));
- invoiceCond.add(EntityCondition.makeCondition("invoiceRoleTypeId", EntityOperator.EQUALS, "SALES_REP"));
+ List invoiceCond = []
+ invoiceCond.add(EntityCondition.makeCondition("invoiceTypeId", EntityOperator.EQUALS, parameters.invoiceTypeId))
+ invoiceCond.add(EntityCondition.makeCondition("statusId", EntityOperator.EQUALS, parameters.statusId))
+ invoiceCond.add(EntityCondition.makeCondition("invoiceDate", EntityOperator.GREATER_THAN_EQUAL_TO, Timestamp.valueOf(fromDate)))
+ invoiceCond.add(EntityCondition.makeCondition("invoiceRoleTypeId", EntityOperator.EQUALS, "SALES_REP"))
if (thruDate) {
- invoiceCond.add(EntityCondition.makeCondition("invoiceDate", EntityOperator.LESS_THAN_EQUAL_TO, Timestamp.valueOf(thruDate)));
+ invoiceCond.add(EntityCondition.makeCondition("invoiceDate", EntityOperator.LESS_THAN_EQUAL_TO, Timestamp.valueOf(thruDate)))
}
if (context.salesRepPartyList) {
- invoiceCond.add(EntityCondition.makeCondition("invoiceRolePartyId", EntityOperator.IN, context.salesRepPartyList));
+ invoiceCond.add(EntityCondition.makeCondition("invoiceRolePartyId", EntityOperator.IN, context.salesRepPartyList))
}
- invoiceList = from("InvoiceAndRole").where(invoiceCond).queryList();
+ invoiceList = from("InvoiceAndRole").where(invoiceCond).queryList()
- List invoices = [];
+ List invoices = []
if (invoiceList) {
- resultMap = runService('getInvoicesFilterByAssocType', [invoiceItemAssocTypeId : "COMMISSION_INVOICE", invoiceList : invoiceList, userLogin : userLogin]);
- invoices = resultMap.filteredInvoiceList;
- context.invoices = invoices;
+ resultMap = runService('getInvoicesFilterByAssocType', [invoiceItemAssocTypeId : "COMMISSION_INVOICE", invoiceList : invoiceList, userLogin : userLogin])
+ invoices = resultMap.filteredInvoiceList
+ context.invoices = invoices
}
}
diff --git a/applications/accounting/groovyScripts/ar/BatchPayments.groovy b/applications/accounting/groovyScripts/ar/BatchPayments.groovy
index caf6afc571..4f8cc4a8c9 100644
--- a/applications/accounting/groovyScripts/ar/BatchPayments.groovy
+++ b/applications/accounting/groovyScripts/ar/BatchPayments.groovy
@@ -25,59 +25,59 @@ import org.apache.ofbiz.entity.condition.EntityOperator
import org.apache.ofbiz.entity.util.EntityUtil
if ("Y".equals(parameters.noConditionFind)) {
- List paymentCond = [];
- payments = [];
- finAccountId = parameters.finAccountId;
- context.finAccountId = parameters.finAccountId;
+ List paymentCond = []
+ payments = []
+ finAccountId = parameters.finAccountId
+ context.finAccountId = parameters.finAccountId
paymentStatusCond = EntityCondition.makeCondition([EntityCondition.makeCondition("statusId", EntityOperator.EQUALS, "PMNT_RECEIVED"),
- EntityCondition.makeCondition("statusId", EntityOperator.EQUALS, "PMNT_SENT")], EntityOperator.OR);
- paymentCond.add(paymentStatusCond);
+ EntityCondition.makeCondition("statusId", EntityOperator.EQUALS, "PMNT_SENT")], EntityOperator.OR)
+ paymentCond.add(paymentStatusCond)
if (paymentMethodTypeId) {
- paymentCond.add(EntityCondition.makeCondition("paymentMethodTypeId", EntityOperator.EQUALS, paymentMethodTypeId));
+ paymentCond.add(EntityCondition.makeCondition("paymentMethodTypeId", EntityOperator.EQUALS, paymentMethodTypeId))
}
if (fromDate) {
- paymentCond.add(EntityCondition.makeCondition("effectiveDate", EntityOperator.GREATER_THAN_EQUAL_TO, fromDate));
+ paymentCond.add(EntityCondition.makeCondition("effectiveDate", EntityOperator.GREATER_THAN_EQUAL_TO, fromDate))
}
if (thruDate) {
- paymentCond.add(EntityCondition.makeCondition("effectiveDate", EntityOperator.LESS_THAN_EQUAL_TO, thruDate));
+ paymentCond.add(EntityCondition.makeCondition("effectiveDate", EntityOperator.LESS_THAN_EQUAL_TO, thruDate))
}
if (partyIdFrom) {
- paymentCond.add(EntityCondition.makeCondition("partyIdFrom", EntityOperator.EQUALS, partyIdFrom));
+ paymentCond.add(EntityCondition.makeCondition("partyIdFrom", EntityOperator.EQUALS, partyIdFrom))
}
if (finAccountId) {
- finAccountTransList = from("FinAccountTrans").where("finAccountId", finAccountId).queryList();
+ finAccountTransList = from("FinAccountTrans").where("finAccountId", finAccountId).queryList()
if (finAccountTransList) {
- finAccountTransIds = EntityUtil.getFieldListFromEntityList(finAccountTransList, "finAccountTransId", true);
- paymentCond.add(EntityCondition.makeCondition("finAccountTransId", EntityOperator.IN, finAccountTransIds));
- payments = from("PaymentAndTypePartyNameView").where(paymentCond).queryList();
+ finAccountTransIds = EntityUtil.getFieldListFromEntityList(finAccountTransList, "finAccountTransId", true)
+ paymentCond.add(EntityCondition.makeCondition("finAccountTransId", EntityOperator.IN, finAccountTransIds))
+ payments = from("PaymentAndTypePartyNameView").where(paymentCond).queryList()
}
} else {
- paymentCond.add(EntityCondition.makeCondition("finAccountTransId", EntityOperator.EQUALS, null));
- payments = from("PaymentAndTypePartyNameView").where(paymentCond).queryList();
+ paymentCond.add(EntityCondition.makeCondition("finAccountTransId", EntityOperator.EQUALS, null))
+ payments = from("PaymentAndTypePartyNameView").where(paymentCond).queryList()
}
- paymentListWithCreditCard = [];
- paymentListWithoutCreditCard = [];
+ paymentListWithCreditCard = []
+ paymentListWithoutCreditCard = []
if (payments) {
payments.each { payment ->
- isReceipt = UtilAccounting.isReceipt(payment);
+ isReceipt = UtilAccounting.isReceipt(payment)
if (isReceipt) {
- paymentGroupMembers = from("PaymentGroupMember").where("paymentId", payment.paymentId).filterByDate().queryList();
+ paymentGroupMembers = from("PaymentGroupMember").where("paymentId", payment.paymentId).filterByDate().queryList()
if (!paymentGroupMembers) {
if (cardType && payment.paymentMethodId) {
- creditCard = from("CreditCard").where("paymentMethodId", payment.paymentMethodId).queryOne();
+ creditCard = from("CreditCard").where("paymentMethodId", payment.paymentMethodId).queryOne()
if (creditCard.cardType == cardType) {
- paymentListWithCreditCard.add(payment);
+ paymentListWithCreditCard.add(payment)
}
} else if (UtilValidate.isEmpty(cardType)) {
- paymentListWithoutCreditCard.add(payment);
+ paymentListWithoutCreditCard.add(payment)
}
}
}
}
if (paymentListWithCreditCard) {
- context.paymentList = paymentListWithCreditCard;
+ context.paymentList = paymentListWithCreditCard
} else {
- context.paymentList = paymentListWithoutCreditCard;
+ context.paymentList = paymentListWithoutCreditCard
}
}
}
diff --git a/applications/accounting/groovyScripts/chartofaccounts/TaxAuthorityGlAccounts.groovy b/applications/accounting/groovyScripts/chartofaccounts/TaxAuthorityGlAccounts.groovy
index ba4d77f7d0..7e49d420df 100644
--- a/applications/accounting/groovyScripts/chartofaccounts/TaxAuthorityGlAccounts.groovy
+++ b/applications/accounting/groovyScripts/chartofaccounts/TaxAuthorityGlAccounts.groovy
@@ -17,7 +17,7 @@
* under the License.
*/
-taxAuthorities = from('TaxAuthority').orderBy("taxAuthGeoId", "taxAuthPartyId").queryList();
+taxAuthorities = from('TaxAuthority').orderBy("taxAuthGeoId", "taxAuthPartyId").queryList()
context.taxAuthorityHavingNoGlAccountList = taxAuthorities.findAll { taxAuthority ->
!taxAuthority.getRelated('TaxAuthorityGlAccount', [organizationPartyId : parameters.get('ApplicationDecorator|organizationPartyId')], null, false)
diff --git a/applications/accounting/groovyScripts/fixedasset/FixedAssetGeoLocation.groovy b/applications/accounting/groovyScripts/fixedasset/FixedAssetGeoLocation.groovy
index 8d7123a6ae..80cfd42cf9 100644
--- a/applications/accounting/groovyScripts/fixedasset/FixedAssetGeoLocation.groovy
+++ b/applications/accounting/groovyScripts/fixedasset/FixedAssetGeoLocation.groovy
@@ -22,22 +22,22 @@ import org.apache.ofbiz.base.util.UtilMisc
import org.apache.ofbiz.base.util.UtilProperties
import org.apache.ofbiz.common.geo.GeoWorker
-uiLabelMap = UtilProperties.getResourceBundleMap("AccountingUiLabels", locale);
+uiLabelMap = UtilProperties.getResourceBundleMap("AccountingUiLabels", locale)
if (fixedAsset) {
- latestGeoPoint = GeoWorker.findLatestGeoPoint(delegator, "FixedAssetAndGeoPoint", "fixedAssetId", fixedAssetId, null, null);
+ latestGeoPoint = GeoWorker.findLatestGeoPoint(delegator, "FixedAssetAndGeoPoint", "fixedAssetId", fixedAssetId, null, null)
if (latestGeoPoint) {
- context.latestGeoPoint = latestGeoPoint;
+ context.latestGeoPoint = latestGeoPoint
if (latestGeoPoint.containsKey("latitude") && latestGeoPoint.containsKey("longitude")) {
List geoPoints = UtilMisc.toList(UtilMisc.toMap("lat", latestGeoPoint.latitude, "lon", latestGeoPoint.longitude, "fixedAssetId", fixedAssetId,
- "link", UtilMisc.toMap("url", "EditFixedAsset?fixedAssetId="+ fixedAssetId, "label", uiLabelMap.AccountingFixedAsset + " " + fixedAsset.fixedAssetName)));
+ "link", UtilMisc.toMap("url", "EditFixedAsset?fixedAssetId="+ fixedAssetId, "label", uiLabelMap.AccountingFixedAsset + " " + fixedAsset.fixedAssetName)))
- Map geoChart = UtilMisc.toMap("width", "500px", "height", "450px", "controlUI" , "small", "dataSourceId", latestGeoPoint.dataSourceId, "points", geoPoints);
- context.geoChart = geoChart;
+ Map geoChart = UtilMisc.toMap("width", "500px", "height", "450px", "controlUI" , "small", "dataSourceId", latestGeoPoint.dataSourceId, "points", geoPoints)
+ context.geoChart = geoChart
}
if (latestGeoPoint.elevationUomId) {
elevationUom = from('Uom').where('uomId', latestGeoPoint.elevationUomId).queryOne()
- context.elevationUomAbbr = elevationUom.abbreviation;
+ context.elevationUomAbbr = elevationUom.abbreviation
}
}
}
diff --git a/applications/accounting/groovyScripts/invoice/CreateApplicationList.groovy b/applications/accounting/groovyScripts/invoice/CreateApplicationList.groovy
index 0d35b90ecc..153733e221 100644
--- a/applications/accounting/groovyScripts/invoice/CreateApplicationList.groovy
+++ b/applications/accounting/groovyScripts/invoice/CreateApplicationList.groovy
@@ -23,49 +23,49 @@ import org.apache.ofbiz.accounting.invoice.InvoiceWorker
import java.text.NumberFormat
// @param GenericValue invoice - The Invoice entity to find payment applications for
-if (!invoice) return;
+if (!invoice) return
-invoiceApplications = []; // to pass back to the screen with payment applications added
+invoiceApplications = [] // to pass back to the screen with payment applications added
// retrieve related applications with null itemnumber
-invoiceAppls = invoice.getRelated("PaymentApplication", [invoiceItemSeqId : null], null, false);
+invoiceAppls = invoice.getRelated("PaymentApplication", [invoiceItemSeqId : null], null, false)
invoiceAppls.each { invoiceAppl ->
- itemmap = [:];
- itemmap.invoiceId = invoiceAppl.invoiceId;
- itemmap.invoiceItemSeqId = invoiceAppl.invoiceItemSeqId;
- itemmap.total = InvoiceWorker.getInvoiceTotal(invoice);
- itemmap.paymentApplicationId = invoiceAppl.paymentApplicationId;
- itemmap.paymentId = invoiceAppl.paymentId;
- itemmap.billingAccountId = invoiceAppl.billingAccountId;
- itemmap.taxAuthGeoId = invoiceAppl.taxAuthGeoId;
- itemmap.amountToApply = invoiceAppl.amountApplied;
- itemmap.amountApplied = invoiceAppl.amountApplied;
- invoiceApplications.add(itemmap);
+ itemmap = [:]
+ itemmap.invoiceId = invoiceAppl.invoiceId
+ itemmap.invoiceItemSeqId = invoiceAppl.invoiceItemSeqId
+ itemmap.total = InvoiceWorker.getInvoiceTotal(invoice)
+ itemmap.paymentApplicationId = invoiceAppl.paymentApplicationId
+ itemmap.paymentId = invoiceAppl.paymentId
+ itemmap.billingAccountId = invoiceAppl.billingAccountId
+ itemmap.taxAuthGeoId = invoiceAppl.taxAuthGeoId
+ itemmap.amountToApply = invoiceAppl.amountApplied
+ itemmap.amountApplied = invoiceAppl.amountApplied
+ invoiceApplications.add(itemmap)
}
// retrieve related applications with an existing itemnumber
invoice.getRelated("InvoiceItem", null, null, false).each { item ->
- BigDecimal itemTotal = null;
+ BigDecimal itemTotal = null
if (item.amount != null) {
if (!item.quantity) {
- itemTotal = item.getBigDecimal("amount");
+ itemTotal = item.getBigDecimal("amount")
} else {
- itemTotal = item.getBigDecimal("amount").multiply(item.getBigDecimal("quantity"));
+ itemTotal = item.getBigDecimal("amount").multiply(item.getBigDecimal("quantity"))
}
}
// get relation payment applications for every item(can be more than 1 per item number)
item.getRelated("PaymentApplication", null, null, false).each { paymentApplication ->
- itemmap = [:];
- itemmap.putAll(item);
- itemmap.total = NumberFormat.getInstance(locale).format(itemTotal);
- itemmap.paymentApplicationId = paymentApplication.paymentApplicationId;
- itemmap.paymentId = paymentApplication.paymentId;
- itemmap.toPaymentId = paymentApplication.toPaymentId;
- itemmap.amountApplied = paymentApplication.getBigDecimal("amountApplied");
- itemmap.amountToApply = paymentApplication.getBigDecimal("amountApplied");
- itemmap.billingAccountId = paymentApplication.billingAccountId;
- itemmap.taxAuthGeoId = paymentApplication.taxAuthGeoId;
- invoiceApplications.add(itemmap);
+ itemmap = [:]
+ itemmap.putAll(item)
+ itemmap.total = NumberFormat.getInstance(locale).format(itemTotal)
+ itemmap.paymentApplicationId = paymentApplication.paymentApplicationId
+ itemmap.paymentId = paymentApplication.paymentId
+ itemmap.toPaymentId = paymentApplication.toPaymentId
+ itemmap.amountApplied = paymentApplication.getBigDecimal("amountApplied")
+ itemmap.amountToApply = paymentApplication.getBigDecimal("amountApplied")
+ itemmap.billingAccountId = paymentApplication.billingAccountId
+ itemmap.taxAuthGeoId = paymentApplication.taxAuthGeoId
+ invoiceApplications.add(itemmap)
}
}
-if (invoiceApplications) context.invoiceApplications = invoiceApplications;
+if (invoiceApplications) context.invoiceApplications = invoiceApplications
diff --git a/applications/accounting/groovyScripts/invoice/EditInvoice.groovy b/applications/accounting/groovyScripts/invoice/EditInvoice.groovy
index 32d6392b44..e1ae904d79 100644
--- a/applications/accounting/groovyScripts/invoice/EditInvoice.groovy
+++ b/applications/accounting/groovyScripts/invoice/EditInvoice.groovy
@@ -23,136 +23,136 @@ import org.apache.ofbiz.base.util.UtilNumber
import java.text.DateFormat
-invoiceId = parameters.get("invoiceId");
+invoiceId = parameters.get("invoiceId")
-invoice = from('Invoice').where('invoiceId', invoiceId).queryOne();
-context.invoice = invoice;
+invoice = from('Invoice').where('invoiceId', invoiceId).queryOne()
+context.invoice = invoice
-currency = parameters.currency; // allow the display of the invoice in the original currency, the default is to display the invoice in the default currency
-BigDecimal conversionRate = new BigDecimal("1");
-decimals = UtilNumber.getBigDecimalScale("invoice.decimals");
-rounding = UtilNumber.getBigDecimalRoundingMode("invoice.rounding");
+currency = parameters.currency // allow the display of the invoice in the original currency, the default is to display the invoice in the default currency
+BigDecimal conversionRate = new BigDecimal("1")
+decimals = UtilNumber.getBigDecimalScale("invoice.decimals")
+rounding = UtilNumber.getBigDecimalRoundingMode("invoice.rounding")
if (invoice) {
// each invoice of course has two billing addresses, but the one that is relevant for purchase invoices is the PAYMENT_LOCATION of the invoice
// (ie Accounts Payable address for the supplier), while the right one for sales invoices is the BILLING_LOCATION (ie Accounts Receivable or
// home of the customer.)
if ("PURCHASE_INVOICE".equals(invoice.invoiceTypeId)) {
- billingAddress = InvoiceWorker.getSendFromAddress(invoice);
+ billingAddress = InvoiceWorker.getSendFromAddress(invoice)
} else {
- billingAddress = InvoiceWorker.getBillToAddress(invoice);
+ billingAddress = InvoiceWorker.getBillToAddress(invoice)
}
if (billingAddress) {
- context.billingAddress = billingAddress;
+ context.billingAddress = billingAddress
}
- billToParty = InvoiceWorker.getBillToParty(invoice);
- context.billToParty = billToParty;
- sendingParty = InvoiceWorker.getSendFromParty(invoice);
- context.sendingParty = sendingParty;
+ billToParty = InvoiceWorker.getBillToParty(invoice)
+ context.billToParty = billToParty
+ sendingParty = InvoiceWorker.getSendFromParty(invoice)
+ context.sendingParty = sendingParty
if (currency && !invoice.getString("currencyUomId").equals(currency)) {
- conversionRate = InvoiceWorker.getInvoiceCurrencyConversionRate(invoice);
- invoice.currencyUomId = currency;
- invoice.invoiceMessage = " converted from original with a rate of: " + conversionRate.setScale(8, rounding);
+ conversionRate = InvoiceWorker.getInvoiceCurrencyConversionRate(invoice)
+ invoice.currencyUomId = currency
+ invoice.invoiceMessage = " converted from original with a rate of: " + conversionRate.setScale(8, rounding)
}
- invoiceItems = invoice.getRelated("InvoiceItem", null, ["invoiceItemSeqId"], false);
- invoiceItemsConv = [];
- vatTaxesByType = [:];
+ invoiceItems = invoice.getRelated("InvoiceItem", null, ["invoiceItemSeqId"], false)
+ invoiceItemsConv = []
+ vatTaxesByType = [:]
invoiceItems.each { invoiceItem ->
- invoiceItem.amount = invoiceItem.getBigDecimal("amount").multiply(conversionRate).setScale(decimals, rounding);
- invoiceItemsConv.add(invoiceItem);
+ invoiceItem.amount = invoiceItem.getBigDecimal("amount").multiply(conversionRate).setScale(decimals, rounding)
+ invoiceItemsConv.add(invoiceItem)
// get party tax id for VAT taxes: they are required in invoices by EU
// also create a map with tax grand total amount by VAT tax: it is also required in invoices by UE
- taxRate = invoiceItem.getRelatedOne("TaxAuthorityRateProduct", false);
+ taxRate = invoiceItem.getRelatedOne("TaxAuthorityRateProduct", false)
if (taxRate && "VAT_TAX".equals(taxRate.taxAuthorityRateTypeId)) {
taxInfo = from("PartyTaxAuthInfo")
.where('partyId', billToParty.partyId, 'taxAuthGeoId', taxRate.taxAuthGeoId, 'taxAuthPartyId', taxRate.taxAuthPartyId)
.filterByDate(invoice.invoiceDate)
- .queryFirst();
+ .queryFirst()
if (taxInfo) {
- context.billToPartyTaxId = taxInfo.partyTaxId;
+ context.billToPartyTaxId = taxInfo.partyTaxId
}
taxInfo = from("PartyTaxAuthInfo")
.where('partyId', sendingParty.partyId, 'taxAuthGeoId', taxRate.taxAuthGeoId, 'taxAuthPartyId', taxRate.taxAuthPartyId)
.filterByDate(invoice.invoiceDate)
- .queryFirst();
+ .queryFirst()
if (taxInfo) {
- context.sendingPartyTaxId = taxInfo.partyTaxId;
+ context.sendingPartyTaxId = taxInfo.partyTaxId
}
- vatTaxesByTypeAmount = vatTaxesByType[taxRate.taxAuthorityRateSeqId];
+ vatTaxesByTypeAmount = vatTaxesByType[taxRate.taxAuthorityRateSeqId]
if (!vatTaxesByTypeAmount) {
- vatTaxesByTypeAmount = 0.0;
+ vatTaxesByTypeAmount = 0.0
}
- vatTaxesByType.put(taxRate.taxAuthorityRateSeqId, vatTaxesByTypeAmount + invoiceItem.amount);
+ vatTaxesByType.put(taxRate.taxAuthorityRateSeqId, vatTaxesByTypeAmount + invoiceItem.amount)
}
}
- context.vatTaxesByType = vatTaxesByType;
- context.vatTaxIds = vatTaxesByType.keySet().asList();
+ context.vatTaxesByType = vatTaxesByType
+ context.vatTaxIds = vatTaxesByType.keySet().asList()
- context.invoiceItems = invoiceItemsConv;
+ context.invoiceItems = invoiceItemsConv
- invoiceTotal = InvoiceWorker.getInvoiceTotal(invoice).multiply(conversionRate).setScale(decimals, rounding);
- invoiceNoTaxTotal = InvoiceWorker.getInvoiceNoTaxTotal(invoice).multiply(conversionRate).setScale(decimals, rounding);
- context.invoiceTotal = invoiceTotal;
- context.invoiceNoTaxTotal = invoiceNoTaxTotal;
+ invoiceTotal = InvoiceWorker.getInvoiceTotal(invoice).multiply(conversionRate).setScale(decimals, rounding)
+ invoiceNoTaxTotal = InvoiceWorker.getInvoiceNoTaxTotal(invoice).multiply(conversionRate).setScale(decimals, rounding)
+ context.invoiceTotal = invoiceTotal
+ context.invoiceNoTaxTotal = invoiceNoTaxTotal
//*________________this snippet was added for adding Tax ID in invoice header if needed _________________
- sendingTaxInfos = sendingParty.getRelated("PartyTaxAuthInfo", null, null, false);
- billingTaxInfos = billToParty.getRelated("PartyTaxAuthInfo", null, null, false);
- sendingPartyTaxId = null;
- billToPartyTaxId = null;
+ sendingTaxInfos = sendingParty.getRelated("PartyTaxAuthInfo", null, null, false)
+ billingTaxInfos = billToParty.getRelated("PartyTaxAuthInfo", null, null, false)
+ sendingPartyTaxId = null
+ billToPartyTaxId = null
if (billingAddress) {
sendingTaxInfos.eachWithIndex { sendingTaxInfo, i ->
if (sendingTaxInfo.taxAuthGeoId.equals(billingAddress.countryGeoId)) {
- sendingPartyTaxId = sendingTaxInfos[i-1].partyTaxId;
+ sendingPartyTaxId = sendingTaxInfos[i-1].partyTaxId
}
}
billingTaxInfos.eachWithIndex { billingTaxInfo, i ->
if (billingTaxInfo.taxAuthGeoId.equals(billingAddress.countryGeoId)) {
- billToPartyTaxId = billingTaxInfos[i-1].partyTaxId;
+ billToPartyTaxId = billingTaxInfos[i-1].partyTaxId
}
}
}
if (sendingPartyTaxId) {
- context.sendingPartyTaxId = sendingPartyTaxId;
+ context.sendingPartyTaxId = sendingPartyTaxId
}
if (billToPartyTaxId && !context.billToPartyTaxId) {
- context.billToPartyTaxId = billToPartyTaxId;
+ context.billToPartyTaxId = billToPartyTaxId
}
//________________this snippet was added for adding Tax ID in invoice header if needed _________________*/
- terms = invoice.getRelated("InvoiceTerm", null, null, false);
- context.terms = terms;
+ terms = invoice.getRelated("InvoiceTerm", null, null, false)
+ context.terms = terms
- paymentAppls = from("PaymentApplication").where('invoiceId', invoiceId).queryList();
- context.payments = paymentAppls;
+ paymentAppls = from("PaymentApplication").where('invoiceId', invoiceId).queryList()
+ context.payments = paymentAppls
- orderItemBillings = from("OrderItemBilling").where('invoiceId', invoiceId).orderBy('orderId').queryList();
- orders = new LinkedHashSet();
+ orderItemBillings = from("OrderItemBilling").where('invoiceId', invoiceId).orderBy('orderId').queryList()
+ orders = new LinkedHashSet()
orderItemBillings.each { orderIb ->
- orders.add(orderIb.orderId);
+ orders.add(orderIb.orderId)
}
- context.orders = orders;
+ context.orders = orders
- invoiceStatus = invoice.getRelatedOne("StatusItem", false);
- context.invoiceStatus = invoiceStatus;
+ invoiceStatus = invoice.getRelatedOne("StatusItem", false)
+ context.invoiceStatus = invoiceStatus
- edit = parameters.editInvoice;
+ edit = parameters.editInvoice
if ("true".equalsIgnoreCase(edit)) {
- invoiceItemTypes = from("InvoiceItemType").queryList();
- context.invoiceItemTypes = invoiceItemTypes;
- context.editInvoice = true;
+ invoiceItemTypes = from("InvoiceItemType").queryList()
+ context.invoiceItemTypes = invoiceItemTypes
+ context.editInvoice = true
}
// format the date
if (invoice.invoiceDate) {
- invoiceDate = DateFormat.getDateInstance(DateFormat.LONG).format(invoice.invoiceDate);
- context.invoiceDate = invoiceDate;
+ invoiceDate = DateFormat.getDateInstance(DateFormat.LONG).format(invoice.invoiceDate)
+ context.invoiceDate = invoiceDate
} else {
- context.invoiceDate = "N/A";
+ context.invoiceDate = "N/A"
}
}
diff --git a/applications/accounting/groovyScripts/invoice/GetAccountOrganizationAndClass.groovy b/applications/accounting/groovyScripts/invoice/GetAccountOrganizationAndClass.groovy
index 38fb30ba8a..510b3b33dd 100644
--- a/applications/accounting/groovyScripts/invoice/GetAccountOrganizationAndClass.groovy
+++ b/applications/accounting/groovyScripts/invoice/GetAccountOrganizationAndClass.groovy
@@ -21,10 +21,10 @@
import org.apache.ofbiz.entity.condition.EntityConditionBuilder
import org.apache.ofbiz.entity.util.EntityUtil
-exprBldr = new EntityConditionBuilder();
-invoice = context.invoice;
-if (!invoice) return;
-glAccountOrganizationAndClassList = null;
+exprBldr = new EntityConditionBuilder()
+invoice = context.invoice
+if (!invoice) return
+glAccountOrganizationAndClassList = null
if ("SALES_INVOICE".equals(invoice.invoiceTypeId)) {
itemTypesCond = exprBldr.OR() {
EQUALS(invoiceItemTypeId: "SINVOICE_ADJ")
@@ -34,8 +34,8 @@ if ("SALES_INVOICE".equals(invoice.invoiceTypeId)) {
EQUALS(invoiceItemTypeId: "INV_PROD_ITEM")
EQUALS(parentTypeId: "INV_PROD_ITEM")
}
- invoiceItemTypes = from("InvoiceItemType").where(itemTypesCond).orderBy(["parentTypeId", "invoiceItemTypeId"]).queryList();
- glAccountOrganizationAndClassList = from("GlAccountOrganizationAndClass").where('organizationPartyId', invoice.partyIdFrom).queryList();
+ invoiceItemTypes = from("InvoiceItemType").where(itemTypesCond).orderBy(["parentTypeId", "invoiceItemTypeId"]).queryList()
+ glAccountOrganizationAndClassList = from("GlAccountOrganizationAndClass").where('organizationPartyId', invoice.partyIdFrom).queryList()
} else if ("PURCHASE_INVOICE".equals(invoice.invoiceTypeId)) {
itemTypesCond = exprBldr.OR() {
EQUALS(invoiceItemTypeId: "PINVOICE_ADJ")
@@ -45,8 +45,8 @@ if ("SALES_INVOICE".equals(invoice.invoiceTypeId)) {
EQUALS(invoiceItemTypeId: "PINV_PROD_ITEM")
EQUALS(parentTypeId: "PINV_PROD_ITEM")
}
- invoiceItemTypes = from("InvoiceItemType").where(itemTypesCond).orderBy(["parentTypeId", "invoiceItemTypeId"]).queryList();
- glAccountOrganizationAndClassList = from("GlAccountOrganizationAndClass").where('organizationPartyId', invoice.partyId).queryList();
+ invoiceItemTypes = from("InvoiceItemType").where(itemTypesCond).orderBy(["parentTypeId", "invoiceItemTypeId"]).queryList()
+ glAccountOrganizationAndClassList = from("GlAccountOrganizationAndClass").where('organizationPartyId', invoice.partyId).queryList()
} else if ("PAYROL_INVOICE".equals(invoice.invoiceTypeId)) {
itemTypesCond = exprBldr.OR() {
EQUALS(invoiceItemTypeId: "PAYROL_EARN_HOURS")
@@ -56,8 +56,8 @@ if ("SALES_INVOICE".equals(invoice.invoiceTypeId)) {
EQUALS(invoiceItemTypeId: "PAYROL_TAXES")
EQUALS(parentTypeId: "PAYROL_TAXES")
}
- invoiceItemTypes = from("InvoiceItemType").where(itemTypesCond).orderBy(["parentTypeId", "invoiceItemTypeId"]).queryList();
- glAccountOrganizationAndClassList = from("GlAccountOrganizationAndClass").where('organizationPartyId', invoice.partyId).queryList();
+ invoiceItemTypes = from("InvoiceItemType").where(itemTypesCond).orderBy(["parentTypeId", "invoiceItemTypeId"]).queryList()
+ glAccountOrganizationAndClassList = from("GlAccountOrganizationAndClass").where('organizationPartyId', invoice.partyId).queryList()
} else if ("COMMISSION_INVOICE".equals(invoice.invoiceTypeId)) {
itemTypesCond = exprBldr.OR() {
EQUALS(invoiceItemTypeId: "COMM_INV_ITEM")
@@ -65,12 +65,12 @@ if ("SALES_INVOICE".equals(invoice.invoiceTypeId)) {
EQUALS(invoiceItemTypeId: "COMM_INV_ADJ")
EQUALS(parentTypeId: "COMM_INV_ADJ")
}
- invoiceItemTypes = from("InvoiceItemType").where(itemTypesCond).orderBy(["parentTypeId", "invoiceItemTypeId"]).queryList();
- glAccountOrganizationAndClassList = from("GlAccountOrganizationAndClass").where('organizationPartyId', invoice.partyId).queryList();
+ invoiceItemTypes = from("InvoiceItemType").where(itemTypesCond).orderBy(["parentTypeId", "invoiceItemTypeId"]).queryList()
+ glAccountOrganizationAndClassList = from("GlAccountOrganizationAndClass").where('organizationPartyId', invoice.partyId).queryList()
} else {
- map = from("InvoiceItemTypeMap").where('invoiceTypeId', invoice.invoiceTypeId).cache(true).queryList();
- invoiceItemTypes = EntityUtil.getRelated("InvoiceItemType", null, map, false);
+ map = from("InvoiceItemTypeMap").where('invoiceTypeId', invoice.invoiceTypeId).cache(true).queryList()
+ invoiceItemTypes = EntityUtil.getRelated("InvoiceItemType", null, map, false)
}
-context.invoiceItemTypes = invoiceItemTypes;
+context.invoiceItemTypes = invoiceItemTypes
-context.glAccountOrganizationAndClassList = glAccountOrganizationAndClassList;
+context.glAccountOrganizationAndClassList = glAccountOrganizationAndClassList
diff --git a/applications/accounting/groovyScripts/invoice/InvoiceReport.groovy b/applications/accounting/groovyScripts/invoice/InvoiceReport.groovy
index eedac7459c..b1fbd1bda5 100644
--- a/applications/accounting/groovyScripts/invoice/InvoiceReport.groovy
+++ b/applications/accounting/groovyScripts/invoice/InvoiceReport.groovy
@@ -21,7 +21,7 @@
import org.apache.ofbiz.base.util.UtilDateTime
import org.apache.ofbiz.entity.condition.EntityConditionBuilder
-exprBldr = new org.apache.ofbiz.entity.condition.EntityConditionBuilder();
+exprBldr = new org.apache.ofbiz.entity.condition.EntityConditionBuilder()
if (invoiceTypeId) {
expr = exprBldr.AND() {
@@ -33,29 +33,29 @@ if (invoiceTypeId) {
} else if ("SALES_INVOICE".equals(invoiceTypeId)) {
invoiceStatusesCondition = exprBldr.IN(statusId: ["INVOICE_SENT", "INVOICE_APPROVED", "INVOICE_READY"])
}
- expr = exprBldr.AND([expr, invoiceStatusesCondition]);
+ expr = exprBldr.AND([expr, invoiceStatusesCondition])
- PastDueInvoices = from("Invoice").where(expr).orderBy("dueDate DESC").queryList();
+ PastDueInvoices = from("Invoice").where(expr).orderBy("dueDate DESC").queryList()
if (PastDueInvoices) {
- invoiceIds = PastDueInvoices.invoiceId;
- totalAmount = runService('getInvoiceRunningTotal', [invoiceIds: invoiceIds, organizationPartyId: organizationPartyId]);
+ invoiceIds = PastDueInvoices.invoiceId
+ totalAmount = runService('getInvoiceRunningTotal', [invoiceIds: invoiceIds, organizationPartyId: organizationPartyId])
if (totalAmount) {
- context.PastDueInvoicestotalAmount = totalAmount.invoiceRunningTotal;
+ context.PastDueInvoicestotalAmount = totalAmount.invoiceRunningTotal
}
- context.PastDueInvoices = PastDueInvoices;
+ context.PastDueInvoices = PastDueInvoices
}
invoicesCond = exprBldr.AND(invoiceStatusesCondition) {
EQUALS(invoiceTypeId: invoiceTypeId)
GREATER_THAN_EQUAL_TO(dueDate: UtilDateTime.nowTimestamp())
}
- InvoicesDueSoon = from("Invoice").where(invoicesCond).orderBy("dueDate ASC").maxRows(10).queryList();
+ InvoicesDueSoon = from("Invoice").where(invoicesCond).orderBy("dueDate ASC").maxRows(10).queryList()
if (InvoicesDueSoon) {
- invoiceIds = InvoicesDueSoon.invoiceId;
- totalAmount = runService('getInvoiceRunningTotal', [invoiceIds: invoiceIds, organizationPartyId: organizationPartyId]);
+ invoiceIds = InvoicesDueSoon.invoiceId
+ totalAmount = runService('getInvoiceRunningTotal', [invoiceIds: invoiceIds, organizationPartyId: organizationPartyId])
if (totalAmount) {
- context.InvoicesDueSoonTotalAmount = totalAmount.invoiceRunningTotal;
+ context.InvoicesDueSoonTotalAmount = totalAmount.invoiceRunningTotal
}
- context.InvoicesDueSoon = InvoicesDueSoon;
+ context.InvoicesDueSoon = InvoicesDueSoon
}
}
diff --git a/applications/accounting/groovyScripts/invoice/ListNotAppliedPayments.groovy b/applications/accounting/groovyScripts/invoice/ListNotAppliedPayments.groovy
index da8b533ec4..f470660f1a 100644
--- a/applications/accounting/groovyScripts/invoice/ListNotAppliedPayments.groovy
+++ b/applications/accounting/groovyScripts/invoice/ListNotAppliedPayments.groovy
@@ -23,13 +23,13 @@ import org.apache.ofbiz.accounting.payment.PaymentWorker
import org.apache.ofbiz.base.util.UtilNumber
import org.apache.ofbiz.entity.condition.EntityConditionBuilder
-invoiceId = parameters.invoiceId;
-invoice = from("Invoice").where(invoiceId : invoiceId).queryOne();
+invoiceId = parameters.invoiceId
+invoice = from("Invoice").where(invoiceId : invoiceId).queryOne()
-decimals = UtilNumber.getBigDecimalScale("invoice.decimals");
-rounding = UtilNumber.getBigDecimalRoundingMode("invoice.rounding");
+decimals = UtilNumber.getBigDecimalScale("invoice.decimals")
+rounding = UtilNumber.getBigDecimalRoundingMode("invoice.rounding")
-exprBldr = new EntityConditionBuilder();
+exprBldr = new EntityConditionBuilder()
preCurrencyCond = exprBldr.AND() {
EQUALS(partyIdTo: invoice.partyIdFrom)
EQUALS(partyIdFrom: invoice.partyId)
@@ -44,40 +44,40 @@ topCondActual = exprBldr.AND(preCurrencyCond) {
EQUALS(actualCurrencyUomId: invoice.currencyUomId)
}
-payments = from("Payment").where(topCond).orderBy("effectiveDate").queryList();
-context.payments = getPayments(payments, false);
-payments = from("Payment").where(topCondActual).orderBy("effectiveDate").queryList();
-context.paymentsActualCurrency = getPayments(payments, true);
+payments = from("Payment").where(topCond).orderBy("effectiveDate").queryList()
+context.payments = getPayments(payments, false)
+payments = from("Payment").where(topCondActual).orderBy("effectiveDate").queryList()
+context.paymentsActualCurrency = getPayments(payments, true)
List getPayments(List payments, boolean actual) {
if (payments) {
- paymentList = []; // to pass back to the screeen list of unapplied payments
- invoiceApplied = InvoiceWorker.getInvoiceApplied(invoice);
- invoiceAmount = InvoiceWorker.getInvoiceTotal(invoice);
- invoiceToApply = InvoiceWorker.getInvoiceNotApplied(invoice);
+ paymentList = [] // to pass back to the screeen list of unapplied payments
+ invoiceApplied = InvoiceWorker.getInvoiceApplied(invoice)
+ invoiceAmount = InvoiceWorker.getInvoiceTotal(invoice)
+ invoiceToApply = InvoiceWorker.getInvoiceNotApplied(invoice)
payments.each { payment ->
- paymentMap = [:];
- paymentApplied = PaymentWorker.getPaymentApplied(payment, true);
+ paymentMap = [:]
+ paymentApplied = PaymentWorker.getPaymentApplied(payment, true)
if (actual) {
- paymentMap.amount = payment.actualCurrencyAmount;
- paymentMap.currencyUomId = payment.actualCurrencyUomId;
- paymentToApply = payment.getBigDecimal("actualCurrencyAmount")?.setScale(decimals,rounding)?.subtract(paymentApplied);
+ paymentMap.amount = payment.actualCurrencyAmount
+ paymentMap.currencyUomId = payment.actualCurrencyUomId
+ paymentToApply = payment.getBigDecimal("actualCurrencyAmount")?.setScale(decimals,rounding)?.subtract(paymentApplied)
} else {
- paymentMap.amount = payment.amount;
- paymentMap.currencyUomId = payment.currencyUomId;
- paymentToApply = payment.getBigDecimal("amount")?.setScale(decimals,rounding)?.subtract(paymentApplied);
+ paymentMap.amount = payment.amount
+ paymentMap.currencyUomId = payment.currencyUomId
+ paymentToApply = payment.getBigDecimal("amount")?.setScale(decimals,rounding)?.subtract(paymentApplied)
}
if (paymentToApply?.signum() == 1) {
- paymentMap.paymentId = payment.paymentId;
- paymentMap.effectiveDate = payment.effectiveDate;
+ paymentMap.paymentId = payment.paymentId
+ paymentMap.effectiveDate = payment.effectiveDate
if (paymentToApply.compareTo(invoiceToApply) < 0 ) {
- paymentMap.amountToApply = paymentToApply;
+ paymentMap.amountToApply = paymentToApply
} else {
- paymentMap.amountToApply = invoiceToApply;
+ paymentMap.amountToApply = invoiceToApply
}
- paymentList.add(paymentMap);
+ paymentList.add(paymentMap)
}
}
- return paymentList;
+ return paymentList
}
}
diff --git a/applications/accounting/groovyScripts/invoice/PrintInvoices.groovy b/applications/accounting/groovyScripts/invoice/PrintInvoices.groovy
index bfdbd24152..adabf305d3 100644
--- a/applications/accounting/groovyScripts/invoice/PrintInvoices.groovy
+++ b/applications/accounting/groovyScripts/invoice/PrintInvoices.groovy
@@ -23,111 +23,111 @@ import org.apache.ofbiz.base.util.UtilNumber
import java.text.DateFormat
-invoiceDetailList = [];
+invoiceDetailList = []
invoiceIds.each { invoiceId ->
- invoicesMap = [:];
- invoice = from("Invoice").where('invoiceId', invoiceId).queryOne();
- invoicesMap.invoice = invoice;
+ invoicesMap = [:]
+ invoice = from("Invoice").where('invoiceId', invoiceId).queryOne()
+ invoicesMap.invoice = invoice
- currency = parameters.currency; // allow the display of the invoice in the original currency, the default is to display the invoice in the default currency
- BigDecimal conversionRate = new BigDecimal("1");
- ZERO = BigDecimal.ZERO;
- decimals = UtilNumber.getBigDecimalScale("invoice.decimals");
- rounding = UtilNumber.getBigDecimalRoundingMode("invoice.rounding");
+ currency = parameters.currency // allow the display of the invoice in the original currency, the default is to display the invoice in the default currency
+ BigDecimal conversionRate = new BigDecimal("1")
+ ZERO = BigDecimal.ZERO
+ decimals = UtilNumber.getBigDecimalScale("invoice.decimals")
+ rounding = UtilNumber.getBigDecimalRoundingMode("invoice.rounding")
if (invoice) {
if (currency && !invoice.getString("currencyUomId").equals(currency)) {
- conversionRate = InvoiceWorker.getInvoiceCurrencyConversionRate(invoice);
- invoice.currencyUomId = currency;
- invoice.invoiceMessage = " converted from original with a rate of: " + conversionRate.setScale(8, rounding);
+ conversionRate = InvoiceWorker.getInvoiceCurrencyConversionRate(invoice)
+ invoice.currencyUomId = currency
+ invoice.invoiceMessage = " converted from original with a rate of: " + conversionRate.setScale(8, rounding)
}
- invoiceItems = invoice.getRelated("InvoiceItem", null, ["invoiceItemSeqId"], false);
- invoiceItemsConv = [];
+ invoiceItems = invoice.getRelated("InvoiceItem", null, ["invoiceItemSeqId"], false)
+ invoiceItemsConv = []
invoiceItems.each { invoiceItem ->
if (invoiceItem.amount) {
- invoiceItem.amount = invoiceItem.getBigDecimal("amount").multiply(conversionRate).setScale(decimals, rounding);
- invoiceItemsConv.add(invoiceItem);
+ invoiceItem.amount = invoiceItem.getBigDecimal("amount").multiply(conversionRate).setScale(decimals, rounding)
+ invoiceItemsConv.add(invoiceItem)
}
}
- invoicesMap.invoiceItems = invoiceItemsConv;
+ invoicesMap.invoiceItems = invoiceItemsConv
- invoiceTotal = InvoiceWorker.getInvoiceTotal(invoice).multiply(conversionRate).setScale(decimals, rounding);
- invoiceNoTaxTotal = InvoiceWorker.getInvoiceNoTaxTotal(invoice).multiply(conversionRate).setScale(decimals, rounding);
- invoicesMap.invoiceTotal = invoiceTotal;
- invoicesMap.invoiceNoTaxTotal = invoiceNoTaxTotal;
+ invoiceTotal = InvoiceWorker.getInvoiceTotal(invoice).multiply(conversionRate).setScale(decimals, rounding)
+ invoiceNoTaxTotal = InvoiceWorker.getInvoiceNoTaxTotal(invoice).multiply(conversionRate).setScale(decimals, rounding)
+ invoicesMap.invoiceTotal = invoiceTotal
+ invoicesMap.invoiceNoTaxTotal = invoiceNoTaxTotal
if ("PURCHASE_INVOICE".equals(invoice.invoiceTypeId)) {
- billingAddress = InvoiceWorker.getSendFromAddress(invoice);
+ billingAddress = InvoiceWorker.getSendFromAddress(invoice)
} else {
- billingAddress = InvoiceWorker.getBillToAddress(invoice);
+ billingAddress = InvoiceWorker.getBillToAddress(invoice)
}
if (billingAddress) {
- invoicesMap.billingAddress = billingAddress;
+ invoicesMap.billingAddress = billingAddress
}
- billToParty = InvoiceWorker.getBillToParty(invoice);
- invoicesMap.billToParty = billToParty;
- sendingParty = InvoiceWorker.getSendFromParty(invoice);
- invoicesMap.sendingParty = sendingParty;
+ billToParty = InvoiceWorker.getBillToParty(invoice)
+ invoicesMap.billToParty = billToParty
+ sendingParty = InvoiceWorker.getSendFromParty(invoice)
+ invoicesMap.sendingParty = sendingParty
// This snippet was added for adding Tax ID in invoice header if needed
- sendingTaxInfos = sendingParty.getRelated("PartyTaxAuthInfo", null, null, false);
- billingTaxInfos = billToParty.getRelated("PartyTaxAuthInfo", null, null, false);
- sendingPartyTaxId = null;
- billToPartyTaxId = null;
+ sendingTaxInfos = sendingParty.getRelated("PartyTaxAuthInfo", null, null, false)
+ billingTaxInfos = billToParty.getRelated("PartyTaxAuthInfo", null, null, false)
+ sendingPartyTaxId = null
+ billToPartyTaxId = null
if (billingAddress) {
sendingTaxInfos.eachWithIndex { sendingTaxInfo, i ->
if (sendingTaxInfo.taxAuthGeoId.equals(billingAddress.countryGeoId)) {
- sendingPartyTaxId = sendingTaxInfos[i-1].partyTaxId;
+ sendingPartyTaxId = sendingTaxInfos[i-1].partyTaxId
}
}
billingTaxInfos.eachWithIndex { billingTaxInfo, i ->
if (billingTaxInfo.taxAuthGeoId.equals(billingAddress.countryGeoId)) {
- billToPartyTaxId = billingTaxInfos[i-1].partyTaxId;
+ billToPartyTaxId = billingTaxInfos[i-1].partyTaxId
}
}
}
if (sendingPartyTaxId) {
- invoicesMap.sendingPartyTaxId = sendingPartyTaxId;
+ invoicesMap.sendingPartyTaxId = sendingPartyTaxId
}
if (billToPartyTaxId) {
- invoicesMap.billToPartyTaxId = billToPartyTaxId;
+ invoicesMap.billToPartyTaxId = billToPartyTaxId
}
- terms = invoice.getRelated("InvoiceTerm", null, null, false);
- invoicesMap.terms = terms;
+ terms = invoice.getRelated("InvoiceTerm", null, null, false)
+ invoicesMap.terms = terms
- paymentAppls = from("PaymentApplication").where('invoiceId', invoiceId).queryList();
- invoicesMap.payments = paymentAppls;
+ paymentAppls = from("PaymentApplication").where('invoiceId', invoiceId).queryList()
+ invoicesMap.payments = paymentAppls
- orderItemBillings = from("OrderItemBilling").where('invoiceId', invoiceId).orderBy("orderId").queryList();
- orders = new LinkedHashSet();
+ orderItemBillings = from("OrderItemBilling").where('invoiceId', invoiceId).orderBy("orderId").queryList()
+ orders = new LinkedHashSet()
orderItemBillings.each { orderIb ->
- orders.add(orderIb.orderId);
+ orders.add(orderIb.orderId)
}
- invoicesMap.orders = orders;
+ invoicesMap.orders = orders
- invoiceStatus = invoice.getRelatedOne("StatusItem", false);
- invoicesMap.invoiceStatus = invoiceStatus;
+ invoiceStatus = invoice.getRelatedOne("StatusItem", false)
+ invoicesMap.invoiceStatus = invoiceStatus
- edit = parameters.editInvoice;
+ edit = parameters.editInvoice
if ("true".equalsIgnoreCase(edit)) {
- invoiceItemTypes = from("InvoiceItemType").queryList();
- invoicesMap.invoiceItemTypes = invoiceItemTypes;
- invoicesMap.editInvoice = true;
+ invoiceItemTypes = from("InvoiceItemType").queryList()
+ invoicesMap.invoiceItemTypes = invoiceItemTypes
+ invoicesMap.editInvoice = true
}
// format the date
if (invoice.invoiceDate) {
- invoiceDate = DateFormat.getDateInstance(DateFormat.LONG).format(invoice.invoiceDate);
- invoicesMap.invoiceDate = invoiceDate;
+ invoiceDate = DateFormat.getDateInstance(DateFormat.LONG).format(invoice.invoiceDate)
+ invoicesMap.invoiceDate = invoiceDate
} else {
- invoicesMap.invoiceDate = "N/A";
+ invoicesMap.invoiceDate = "N/A"
}
}
- invoiceDetailList.add(invoicesMap);
+ invoiceDetailList.add(invoicesMap)
}
-context.invoiceDetailList = invoiceDetailList;
+context.invoiceDetailList = invoiceDetailList
diff --git a/applications/accounting/groovyScripts/order/BillingAccountOrders.groovy b/applications/accounting/groovyScripts/order/BillingAccountOrders.groovy
index 7777c8c3da..01bf1e653d 100644
--- a/applications/accounting/groovyScripts/order/BillingAccountOrders.groovy
+++ b/applications/accounting/groovyScripts/order/BillingAccountOrders.groovy
@@ -18,20 +18,20 @@
*/
if (billingAccountId) {
- orderPaymentPreferencesList = [];
- orderList = from("OrderHeader").where('billingAccountId', billingAccountId).queryList();
+ orderPaymentPreferencesList = []
+ orderList = from("OrderHeader").where('billingAccountId', billingAccountId).queryList()
if (orderList) {
orderList.each { orderHeader ->
- orderId = orderHeader.orderId;
- orderBillingAcc = from("OrderHeaderAndPaymentPref").where("orderId", orderId).queryFirst();
- orderBillingAccMap = [:];
+ orderId = orderHeader.orderId
+ orderBillingAcc = from("OrderHeaderAndPaymentPref").where("orderId", orderId).queryFirst()
+ orderBillingAccMap = [:]
if (orderBillingAcc.paymentMethodTypeId.equals("EXT_BILLACT") && orderBillingAcc.paymentStatusId.equals("PAYMENT_NOT_RECEIVED")) {
- orderBillingAccMap.putAll(orderBillingAcc);
- orderId = orderBillingAcc.orderId;
- orderBillingAccMap.orderId = orderId;
+ orderBillingAccMap.putAll(orderBillingAcc)
+ orderId = orderBillingAcc.orderId
+ orderBillingAccMap.orderId = orderId
}
- orderPaymentPreferencesList.add(orderBillingAccMap);
+ orderPaymentPreferencesList.add(orderBillingAccMap)
}
- context.orderPaymentPreferencesList = orderPaymentPreferencesList;
+ context.orderPaymentPreferencesList = orderPaymentPreferencesList
}
}
diff --git a/applications/accounting/groovyScripts/payment/BillingAccounts.groovy b/applications/accounting/groovyScripts/payment/BillingAccounts.groovy
index 1dbd0e5d09..3d78f51439 100644
--- a/applications/accounting/groovyScripts/payment/BillingAccounts.groovy
+++ b/applications/accounting/groovyScripts/payment/BillingAccounts.groovy
@@ -17,14 +17,14 @@
* under the License.
*/
-import org.apache.ofbiz.accounting.payment.BillingAccountWorker;
+import org.apache.ofbiz.accounting.payment.BillingAccountWorker
-partyId = parameters.partyId;
-currencyUomId = null;
-billingAccounts = [];
+partyId = parameters.partyId
+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);
+ if (billingAccountAndRoles) currencyUomId = billingAccountAndRoles.first().accountCurrencyUomId
+ if (currencyUomId) billingAccounts = BillingAccountWorker.makePartyBillingAccountList(userLogin, currencyUomId, partyId, delegator, dispatcher)
}
-context.billingAccounts = billingAccounts;
+context.billingAccounts = billingAccounts
diff --git a/applications/accounting/groovyScripts/payment/DepositWithdrawPayments.groovy b/applications/accounting/groovyScripts/payment/DepositWithdrawPayments.groovy
index fba5570576..86c3ae20c4 100644
--- a/applications/accounting/groovyScripts/payment/DepositWithdrawPayments.groovy
+++ b/applications/accounting/groovyScripts/payment/DepositWithdrawPayments.groovy
@@ -23,47 +23,47 @@ import org.apache.ofbiz.entity.condition.EntityOperator
import org.apache.ofbiz.entity.util.EntityUtil
if ("Y".equals(parameters.noConditionFind)) {
- List exprListForParameters = [];
+ List exprListForParameters = []
- finAccountRoles = from("FinAccountRole").where("finAccountId", finAccountId, "roleTypeId", "DIVISION").filterByDate().queryList();
- finAccountPartyIds = EntityUtil.getFieldListFromEntityList(finAccountRoles, "partyId", true);
- finAccountPartyIds.add(organizationPartyId);
+ finAccountRoles = from("FinAccountRole").where("finAccountId", finAccountId, "roleTypeId", "DIVISION").filterByDate().queryList()
+ finAccountPartyIds = EntityUtil.getFieldListFromEntityList(finAccountRoles, "partyId", true)
+ finAccountPartyIds.add(organizationPartyId)
partyCond = EntityCondition.makeCondition([EntityCondition.makeCondition("partyIdTo", EntityOperator.IN, finAccountPartyIds),
- EntityCondition.makeCondition("partyIdFrom", EntityOperator.IN, finAccountPartyIds)], EntityOperator.OR);
+ EntityCondition.makeCondition("partyIdFrom", EntityOperator.IN, finAccountPartyIds)], EntityOperator.OR)
statusCond = EntityCondition.makeCondition([EntityCondition.makeCondition("statusId", EntityOperator.EQUALS, "PMNT_RECEIVED"),
- EntityCondition.makeCondition("statusId", EntityOperator.EQUALS, "PMNT_SENT")], EntityOperator.OR);
+ EntityCondition.makeCondition("statusId", EntityOperator.EQUALS, "PMNT_SENT")], EntityOperator.OR)
if (paymentMethodTypeId) {
- exprListForParameters.add(EntityCondition.makeCondition("paymentMethodTypeId", EntityOperator.EQUALS, paymentMethodTypeId));
+ exprListForParameters.add(EntityCondition.makeCondition("paymentMethodTypeId", EntityOperator.EQUALS, paymentMethodTypeId))
}
if (fromDate) {
- exprListForParameters.add(EntityCondition.makeCondition("effectiveDate", EntityOperator.GREATER_THAN_EQUAL_TO, fromDate));
+ exprListForParameters.add(EntityCondition.makeCondition("effectiveDate", EntityOperator.GREATER_THAN_EQUAL_TO, fromDate))
}
if (thruDate) {
- exprListForParameters.add(EntityCondition.makeCondition("effectiveDate", EntityOperator.LESS_THAN_EQUAL_TO, thruDate));
+ exprListForParameters.add(EntityCondition.makeCondition("effectiveDate", EntityOperator.LESS_THAN_EQUAL_TO, thruDate))
}
if (partyIdFrom) {
- exprListForParameters.add(EntityCondition.makeCondition("partyIdFrom", EntityOperator.EQUALS, partyIdFrom));
+ exprListForParameters.add(EntityCondition.makeCondition("partyIdFrom", EntityOperator.EQUALS, partyIdFrom))
}
- exprListForParameters.add(EntityCondition.makeCondition("finAccountTransId", EntityOperator.EQUALS, null));
- paramCond = EntityCondition.makeCondition(exprListForParameters, EntityOperator.AND);
- combinedPaymentCond = EntityCondition.makeCondition([partyCond, statusCond, paramCond], EntityOperator.AND);
- payments = from("PaymentAndTypePartyNameView").where(combinedPaymentCond).queryList();
- paymentListWithCreditCard = [];
- paymentListWithoutCreditCard = [];
+ exprListForParameters.add(EntityCondition.makeCondition("finAccountTransId", EntityOperator.EQUALS, null))
+ paramCond = EntityCondition.makeCondition(exprListForParameters, EntityOperator.AND)
+ combinedPaymentCond = EntityCondition.makeCondition([partyCond, statusCond, paramCond], EntityOperator.AND)
+ payments = from("PaymentAndTypePartyNameView").where(combinedPaymentCond).queryList()
+ paymentListWithCreditCard = []
+ paymentListWithoutCreditCard = []
payments.each { payment ->
if (cardType && payment.paymentMethodId) {
- creditCard = from("CreditCard").where('paymentMethodId', payment.paymentMethodId).queryOne();
+ creditCard = from("CreditCard").where('paymentMethodId', payment.paymentMethodId).queryOne()
if (creditCard.cardType == cardType) {
- paymentListWithCreditCard.add(payment);
+ paymentListWithCreditCard.add(payment)
}
} else if (UtilValidate.isEmpty(cardType)) {
- paymentListWithoutCreditCard.add(payment);
+ paymentListWithoutCreditCard.add(payment)
}
}
if (paymentListWithCreditCard) {
- context.paymentList = paymentListWithCreditCard;
+ context.paymentList = paymentListWithCreditCard
} else {
- context.paymentList = paymentListWithoutCreditCard;
+ context.paymentList = paymentListWithoutCreditCard
}
}
diff --git a/applications/accounting/groovyScripts/payment/FindInvoicesByDueDate.groovy b/applications/accounting/groovyScripts/payment/FindInvoicesByDueDate.groovy
index 9f2e2c1019..f1f6ba6f0f 100644
--- a/applications/accounting/groovyScripts/payment/FindInvoicesByDueDate.groovy
+++ b/applications/accounting/groovyScripts/payment/FindInvoicesByDueDate.groovy
@@ -20,7 +20,7 @@
context.invoicePaymentInfoList = []
if (parameters.invoiceTypeId) { // it's not the initialisation but a real search request
- serviceCtx = dispatcher.getDispatchContext().makeValidContext("getInvoicePaymentInfoListByDueDateOffset", "IN", parameters);
+ serviceCtx = dispatcher.getDispatchContext().makeValidContext("getInvoicePaymentInfoListByDueDateOffset", "IN", parameters)
result = runService("getInvoicePaymentInfoListByDueDateOffset", serviceCtx)
context.invoicePaymentInfoList = result.invoicePaymentInfoList
}
diff --git a/applications/accounting/groovyScripts/payment/ListNotAppliedInvoices.groovy b/applications/accounting/groovyScripts/payment/ListNotAppliedInvoices.groovy
index 0d9ae9fa6d..95e7f8ec43 100644
--- a/applications/accounting/groovyScripts/payment/ListNotAppliedInvoices.groovy
+++ b/applications/accounting/groovyScripts/payment/ListNotAppliedInvoices.groovy
@@ -25,69 +25,69 @@ import org.apache.ofbiz.base.util.collections.*
import org.apache.ofbiz.entity.condition.EntityCondition
import org.apache.ofbiz.entity.condition.EntityOperator
-paymentId = parameters.paymentId;
-payment = from("Payment").where("paymentId", paymentId).queryOne();
+paymentId = parameters.paymentId
+payment = from("Payment").where("paymentId", paymentId).queryOne()
-decimals = UtilNumber.getBigDecimalScale("invoice.decimals");
-rounding = UtilNumber.getBigDecimalRoundingMode("invoice.rounding");
+decimals = UtilNumber.getBigDecimalScale("invoice.decimals")
+rounding = UtilNumber.getBigDecimalRoundingMode("invoice.rounding")
exprList = [EntityCondition.makeCondition("partyId", EntityOperator.EQUALS, payment.partyIdFrom),
- EntityCondition.makeCondition("partyIdFrom", EntityOperator.EQUALS, payment.partyIdTo)];
-partyCond = EntityCondition.makeCondition(exprList, EntityOperator.AND);
+ EntityCondition.makeCondition("partyIdFrom", EntityOperator.EQUALS, payment.partyIdTo)]
+partyCond = EntityCondition.makeCondition(exprList, EntityOperator.AND)
exprList1 = [EntityCondition.makeCondition("statusId", EntityOperator.EQUALS, "INVOICE_APPROVED"),
EntityCondition.makeCondition("statusId", EntityOperator.EQUALS, "INVOICE_SENT"),
EntityCondition.makeCondition("statusId", EntityOperator.EQUALS, "INVOICE_READY"),
- EntityCondition.makeCondition("statusId", EntityOperator.EQUALS, "INVOICE_RECEIVED")];
-statusCond = EntityCondition.makeCondition(exprList1, EntityOperator.OR);
+ EntityCondition.makeCondition("statusId", EntityOperator.EQUALS, "INVOICE_RECEIVED")]
+statusCond = EntityCondition.makeCondition(exprList1, EntityOperator.OR)
-currCond = EntityCondition.makeCondition("currencyUomId", EntityOperator.EQUALS, payment.currencyUomId);
-actualCurrCond = EntityCondition.makeCondition("currencyUomId", EntityOperator.EQUALS, payment.actualCurrencyUomId);
+currCond = EntityCondition.makeCondition("currencyUomId", EntityOperator.EQUALS, payment.currencyUomId)
+actualCurrCond = EntityCondition.makeCondition("currencyUomId", EntityOperator.EQUALS, payment.actualCurrencyUomId)
-topCond = EntityCondition.makeCondition([partyCond, statusCond, currCond], EntityOperator.AND);
-topCondActual = EntityCondition.makeCondition([partyCond, statusCond, actualCurrCond], EntityOperator.AND);
+topCond = EntityCondition.makeCondition([partyCond, statusCond, currCond], EntityOperator.AND)
+topCondActual = EntityCondition.makeCondition([partyCond, statusCond, actualCurrCond], EntityOperator.AND)
//retrieve invoices for the related parties which have not been (fully) applied yet and which have the same currency as the payment
invoices = select("invoiceId", "invoiceTypeId", "currencyUomId", "description", "invoiceDate")
.from("Invoice")
.where(topCond)
.orderBy("invoiceDate")
- .queryList();
-context.invoices = getInvoices(invoices, false);
+ .queryList()
+context.invoices = getInvoices(invoices, false)
//retrieve invoices for the related parties which have not been (fully) applied yet and which have the same originalCurrency as the payment
invoices = select("invoiceId", "invoiceTypeId", "currencyUomId", "description", "invoiceDate")
.from("Invoice")
.where(topCondActual)
.orderBy("invoiceDate")
- .queryList();
-context.invoicesOtherCurrency = getInvoices(invoices, true);
+ .queryList()
+context.invoicesOtherCurrency = getInvoices(invoices, true)
List getInvoices(List invoices, boolean actual) {
if (invoices) {
- invoicesList = []; // to pass back to the screeen list of unapplied invoices
- paymentApplied = PaymentWorker.getPaymentApplied(payment);
- paymentToApply = payment.getBigDecimal("amount").setScale(decimals,rounding).subtract(paymentApplied);
+ invoicesList = [] // to pass back to the screeen list of unapplied invoices
+ paymentApplied = PaymentWorker.getPaymentApplied(payment)
+ paymentToApply = payment.getBigDecimal("amount").setScale(decimals,rounding).subtract(paymentApplied)
if (actual && payment.actualCurrencyAmount) {
- paymentToApply = payment.getBigDecimal("actualCurrencyAmount").setScale(decimals,rounding).subtract(paymentApplied);
+ paymentToApply = payment.getBigDecimal("actualCurrencyAmount").setScale(decimals,rounding).subtract(paymentApplied)
}
invoices.each { invoice ->
- invoiceAmount = InvoiceWorker.getInvoiceTotal(invoice).setScale(decimals,rounding);
- invoiceApplied = InvoiceWorker.getInvoiceApplied(invoice).setScale(decimals,rounding);
- invoiceToApply = invoiceAmount.subtract(invoiceApplied);
+ invoiceAmount = InvoiceWorker.getInvoiceTotal(invoice).setScale(decimals,rounding)
+ invoiceApplied = InvoiceWorker.getInvoiceApplied(invoice).setScale(decimals,rounding)
+ invoiceToApply = invoiceAmount.subtract(invoiceApplied)
if (invoiceToApply.signum() == 1) {
- invoiceMap = [:];
- invoiceMap.putAll(invoice);
- invoiceMap.amount = invoiceAmount;
- invoiceMap.description = invoice.description;
- invoiceMap.amountApplied = invoiceApplied;
+ invoiceMap = [:]
+ invoiceMap.putAll(invoice)
+ invoiceMap.amount = invoiceAmount
+ invoiceMap.description = invoice.description
+ invoiceMap.amountApplied = invoiceApplied
if (paymentToApply.compareTo(invoiceToApply) < 0 ) {
- invoiceMap.amountToApply = paymentToApply;
+ invoiceMap.amountToApply = paymentToApply
} else {
- invoiceMap.amountToApply = invoiceToApply;
+ invoiceMap.amountToApply = invoiceToApply
}
- invoicesList.add(invoiceMap);
+ invoicesList.add(invoiceMap)
}
}
- return invoicesList;
+ return invoicesList
}
}
diff --git a/applications/accounting/groovyScripts/payment/ListNotAppliedPayments.groovy b/applications/accounting/groovyScripts/payment/ListNotAppliedPayments.groovy
index 9bdb398782..f157b32cfb 100644
--- a/applications/accounting/groovyScripts/payment/ListNotAppliedPayments.groovy
+++ b/applications/accounting/groovyScripts/payment/ListNotAppliedPayments.groovy
@@ -23,59 +23,59 @@ import org.apache.ofbiz.base.util.UtilNumber
import org.apache.ofbiz.entity.condition.EntityCondition
import org.apache.ofbiz.entity.condition.EntityOperator
-basePaymentId = parameters.paymentId;
-basePayment = from("Payment").where("paymentId", basePaymentId).queryOne();
+basePaymentId = parameters.paymentId
+basePayment = from("Payment").where("paymentId", basePaymentId).queryOne()
-decimals = UtilNumber.getBigDecimalScale("invoice.decimals");
-rounding = UtilNumber.getBigDecimalRoundingMode("invoice.rounding");
+decimals = UtilNumber.getBigDecimalScale("invoice.decimals")
+rounding = UtilNumber.getBigDecimalRoundingMode("invoice.rounding")
-paymentsMapList = []; // to pass back to the screeen list of unapplied payments
+paymentsMapList = [] // to pass back to the screeen list of unapplied payments
// retrieve payments for the related parties which have not been (fully) applied yet
-List payments = null;
-exprList = [];
-expr = EntityCondition.makeCondition("partyIdTo", EntityOperator.EQUALS, basePayment.getString("partyIdFrom"));
-exprList.add(expr);
-expr = EntityCondition.makeCondition("partyIdFrom", EntityOperator.EQUALS, basePayment.getString("partyIdTo"));
-exprList.add(expr);
-expr = EntityCondition.makeCondition("paymentId", EntityOperator.NOT_EQUAL, basePayment.getString("paymentId"));
-exprList.add(expr);
+List payments = null
+exprList = []
+expr = EntityCondition.makeCondition("partyIdTo", EntityOperator.EQUALS, basePayment.getString("partyIdFrom"))
+exprList.add(expr)
+expr = EntityCondition.makeCondition("partyIdFrom", EntityOperator.EQUALS, basePayment.getString("partyIdTo"))
+exprList.add(expr)
+expr = EntityCondition.makeCondition("paymentId", EntityOperator.NOT_EQUAL, basePayment.getString("paymentId"))
+exprList.add(expr)
// only payments with received and sent
-exprListStatus = [];
-expr = EntityCondition.makeCondition("statusId", EntityOperator.EQUALS, "PMNT_RECEIVED");
-exprListStatus.add(expr);
-expr = EntityCondition.makeCondition("statusId", EntityOperator.EQUALS, "PMNT_SENT");
-exprListStatus.add(expr);
-orCond = EntityCondition.makeCondition(exprListStatus, EntityOperator.OR);
-exprList.add(orCond);
+exprListStatus = []
+expr = EntityCondition.makeCondition("statusId", EntityOperator.EQUALS, "PMNT_RECEIVED")
+exprListStatus.add(expr)
+expr = EntityCondition.makeCondition("statusId", EntityOperator.EQUALS, "PMNT_SENT")
+exprListStatus.add(expr)
+orCond = EntityCondition.makeCondition(exprListStatus, EntityOperator.OR)
+exprList.add(orCond)
-topCond = EntityCondition.makeCondition(exprList, EntityOperator.AND);
+topCond = EntityCondition.makeCondition(exprList, EntityOperator.AND)
payments = from("Payment").where(topCond).orderBy("effectiveDate").queryList()
if (payments) {
- basePaymentApplied = PaymentWorker.getPaymentApplied(basePayment);
- basePaymentAmount = basePayment.getBigDecimal("amount");
- basePaymentToApply = basePaymentAmount.subtract(basePaymentApplied);
+ basePaymentApplied = PaymentWorker.getPaymentApplied(basePayment)
+ basePaymentAmount = basePayment.getBigDecimal("amount")
+ basePaymentToApply = basePaymentAmount.subtract(basePaymentApplied)
payments.each { payment ->
if (PaymentWorker.getPaymentNotApplied(payment).signum() == 1) { // positiv not applied amount?
// yes, put in the map
- paymentMap = [:];
- paymentMap.paymentId = basePaymentId;
- paymentMap.toPaymentId = payment.paymentId;
- paymentMap.currencyUomId = payment.currencyUomId;
- paymentMap.effectiveDate = payment.effectiveDate.toString().substring(0,10); // list as YYYY-MM-DD
- paymentMap.amount = payment.getBigDecimal("amount");
- paymentMap.amountApplied = PaymentWorker.getPaymentApplied(payment);
- paymentToApply = PaymentWorker.getPaymentNotApplied(payment);
+ paymentMap = [:]
+ paymentMap.paymentId = basePaymentId
+ paymentMap.toPaymentId = payment.paymentId
+ paymentMap.currencyUomId = payment.currencyUomId
+ paymentMap.effectiveDate = payment.effectiveDate.toString().substring(0,10) // list as YYYY-MM-DD
+ paymentMap.amount = payment.getBigDecimal("amount")
+ paymentMap.amountApplied = PaymentWorker.getPaymentApplied(payment)
+ paymentToApply = PaymentWorker.getPaymentNotApplied(payment)
if (paymentToApply.compareTo(basePaymentToApply) < 0 ) {
- paymentMap.amountToApply = paymentToApply;
+ paymentMap.amountToApply = paymentToApply
} else {
- paymentMap.amountToApply = basePaymentToApply;
+ paymentMap.amountToApply = basePaymentToApply
}
- paymentsMapList.add(paymentMap);
+ paymentsMapList.add(paymentMap)
}
}
}
-context.payments = paymentsMapList;
+context.payments = paymentsMapList
diff --git a/applications/accounting/groovyScripts/payment/ManualTx.groovy b/applications/accounting/groovyScripts/payment/ManualTx.groovy
index 39cf5578ed..74d92a1c99 100644
--- a/applications/accounting/groovyScripts/payment/ManualTx.groovy
+++ b/applications/accounting/groovyScripts/payment/ManualTx.groovy
@@ -18,71 +18,71 @@
*/
// stores
-productStores = from("ProductStore").orderBy("storeName").cache(true).queryList();
-context.productStores = productStores;
+productStores = from("ProductStore").orderBy("storeName").cache(true).queryList()
+context.productStores = productStores
// current store
-productStoreId = parameters.productStoreId;
+productStoreId = parameters.productStoreId
if (productStoreId) {
- productStore = from("ProductStore").where("productStoreId", productStoreId).queryOne();
- context.currentStore = productStore;
+ productStore = from("ProductStore").where("productStoreId", productStoreId).queryOne()
+ context.currentStore = productStore
}
// payment settings
-paymentSettings = from("Enumeration").where("enumTypeId", "PRDS_PAYSVC").orderBy("sequenceId").queryList();
-context.paymentSettings = paymentSettings;
+paymentSettings = from("Enumeration").where("enumTypeId", "PRDS_PAYSVC").orderBy("sequenceId").queryList()
+context.paymentSettings = paymentSettings
// payment method (for auto-fill)
-paymentMethodId = parameters.paymentMethodId;
-context.paymentMethodId = paymentMethodId;
+paymentMethodId = parameters.paymentMethodId
+context.paymentMethodId = paymentMethodId
// payment method type
-paymentMethodTypeId = parameters.paymentMethodTypeId;
-context.paymentMethodTypeId = paymentMethodTypeId;
+paymentMethodTypeId = parameters.paymentMethodTypeId
+context.paymentMethodTypeId = paymentMethodTypeId
// service type (transaction type)
-txType = parameters.transactionType;
-context.txType = txType;
+txType = parameters.transactionType
+context.txType = txType
if (txType) {
- currentTx = from("Enumeration").where("enumId", txType).queryOne();
- context.currentTx = currentTx;
+ currentTx = from("Enumeration").where("enumId", txType).queryOne()
+ context.currentTx = currentTx
}
if (paymentMethodId) {
- paymentMethod = from("PaymentMethod").where("paymentMethodId", paymentMethodId).queryOne();
+ paymentMethod = from("PaymentMethod").where("paymentMethodId", paymentMethodId).queryOne()
if (paymentMethod) {
// payment method type
- paymentMethodTypeId = paymentMethod.paymentMethodTypeId;
+ paymentMethodTypeId = paymentMethod.paymentMethodTypeId
// party information
- party = paymentMethod.getRelatedOne("Party", false);
+ party = paymentMethod.getRelatedOne("Party", false)
if (party && "PERSON".equals(party.partyTypeId)) {
- person = party.getRelatedOne("Person", false);
- context.person = person;
+ person = party.getRelatedOne("Person", false)
+ context.person = person
} else if (party && "PARTY_GROUP".equals(party.partyTypeId)) {
- partyGroup = party.getRelatedOne("PartyGroup", false);
- context.partyGroup = partyGroup;
+ partyGroup = party.getRelatedOne("PartyGroup", false)
+ context.partyGroup = partyGroup
}
// method info + address
- creditCard = paymentMethod.getRelatedOne("CreditCard", false);
- context.put("creditCard", creditCard);
+ creditCard = paymentMethod.getRelatedOne("CreditCard", false)
+ context.put("creditCard", creditCard)
if (creditCard) {
- postalAddress = creditCard.getRelatedOne("PostalAddress", false);
- context.postalFields = postalAddress;
+ postalAddress = creditCard.getRelatedOne("PostalAddress", false)
+ context.postalFields = postalAddress
}
- giftCard = paymentMethod.getRelatedOne("GiftCard", false);
- context.giftCard = giftCard;
+ giftCard = paymentMethod.getRelatedOne("GiftCard", false)
+ context.giftCard = giftCard
// todo add support for eft account
}
}
if (paymentMethodTypeId) {
- paymentMethodType = from("PaymentMethodType").where("paymentMethodTypeId", paymentMethodTypeId).queryOne();
- context.paymentMethodType = paymentMethodType;
- context.paymentMethodTypeId = paymentMethodTypeId;
+ paymentMethodType = from("PaymentMethodType").where("paymentMethodTypeId", paymentMethodTypeId).queryOne()
+ context.paymentMethodType = paymentMethodType
+ context.paymentMethodTypeId = paymentMethodTypeId
}
-context.showToolTip = "true";
+context.showToolTip = "true"
diff --git a/applications/accounting/groovyScripts/payment/PrintChecks.groovy b/applications/accounting/groovyScripts/payment/PrintChecks.groovy
index 0e8bae0df6..f962123519 100644
--- a/applications/accounting/groovyScripts/payment/PrintChecks.groovy
+++ b/applications/accounting/groovyScripts/payment/PrintChecks.groovy
@@ -22,42 +22,42 @@ import org.apache.ofbiz.base.util.UtilHttp
import org.apache.ofbiz.base.util.UtilNumber
// rounding mode
-decimals = UtilNumber.getBigDecimalScale("invoice.decimals");
-rounding = UtilNumber.getBigDecimalRoundingMode("invoice.rounding");
-context.decimals = decimals;
-context.rounding = rounding;
+decimals = UtilNumber.getBigDecimalScale("invoice.decimals")
+rounding = UtilNumber.getBigDecimalRoundingMode("invoice.rounding")
+context.decimals = decimals
+context.rounding = rounding
// list of payments
-payments = [];
+payments = []
// first ensure ability to print
-security = request.getAttribute("security");
-context.put("security", security);
+security = request.getAttribute("security")
+context.put("security", security)
if (!security.hasEntityPermission("ACCOUNTING", "_PRINT_CHECKS", session)) {
- context.payments = payments; // if no permission, just pass an empty list for now
- return;
+ context.payments = payments // if no permission, just pass an empty list for now
+ return
}
// in the case of a single payment, the paymentId will be supplied
-paymentId = context.paymentId;
+paymentId = context.paymentId
if (paymentId) {
- payment = from("Payment").where("paymentId", paymentId).queryOne();
- if (payment) payments.add(payment);
- context.payments = payments;
- return;
+ payment = from("Payment").where("paymentId", paymentId).queryOne()
+ if (payment) payments.add(payment)
+ context.payments = payments
+ return
}
// in the case of a multi form, parse the multi data and get all of the selected payments
-selected = UtilHttp.parseMultiFormData(parameters);
+selected = UtilHttp.parseMultiFormData(parameters)
selected.each { row ->
- payment = from("Payment").where("paymentId", row.paymentId).queryOne();
+ payment = from("Payment").where("paymentId", row.paymentId).queryOne()
if (payment) {
- payments.add(payment);
+ payments.add(payment)
}
}
-paymentGroupMembers = from("PaymentGroupMember").where("paymentGroupId", parameters.paymentGroupId).filterByDate().queryList();
+paymentGroupMembers = from("PaymentGroupMember").where("paymentGroupId", parameters.paymentGroupId).filterByDate().queryList()
//in the case of a multiple payments, paymentId List is supplied.
paymentGroupMembers.each { paymentGropupMember->
- payments.add(paymentGropupMember.getRelatedOne("Payment", false));
+ payments.add(paymentGropupMember.getRelatedOne("Payment", false))
}
-context.payments = payments;
+context.payments = payments
diff --git a/applications/accounting/groovyScripts/period/EditCustomTimePeriod.groovy b/applications/accounting/groovyScripts/period/EditCustomTimePeriod.groovy
index d81945e5dd..1b7d49eb62 100644
--- a/applications/accounting/groovyScripts/period/EditCustomTimePeriod.groovy
+++ b/applications/accounting/groovyScripts/period/EditCustomTimePeriod.groovy
@@ -17,54 +17,54 @@
* under the License.
*/
-findOrganizationPartyId = parameters.findOrganizationPartyId;
+findOrganizationPartyId = parameters.findOrganizationPartyId
if (findOrganizationPartyId) {
- context.findOrganizationPartyId = findOrganizationPartyId;
+ context.findOrganizationPartyId = findOrganizationPartyId
}
-currentCustomTimePeriodId = parameters.currentCustomTimePeriodId;
+currentCustomTimePeriodId = parameters.currentCustomTimePeriodId
if (currentCustomTimePeriodId) {
- context.currentCustomTimePeriodId = currentCustomTimePeriodId;
+ context.currentCustomTimePeriodId = currentCustomTimePeriodId
}
-currentCustomTimePeriod = currentCustomTimePeriodId ? from("CustomTimePeriod").where("customTimePeriodId", currentCustomTimePeriodId).queryOne() : null;
+currentCustomTimePeriod = currentCustomTimePeriodId ? from("CustomTimePeriod").where("customTimePeriodId", currentCustomTimePeriodId).queryOne() : null
if (currentCustomTimePeriod) {
- context.currentCustomTimePeriod = currentCustomTimePeriod;
+ context.currentCustomTimePeriod = currentCustomTimePeriod
}
-currentPeriodType = currentCustomTimePeriod ? currentCustomTimePeriod.getRelatedOne("PeriodType", true) : null;
+currentPeriodType = currentCustomTimePeriod ? currentCustomTimePeriod.getRelatedOne("PeriodType", true) : null
if (currentPeriodType) {
- context.currentPeriodType = currentPeriodType;
+ context.currentPeriodType = currentPeriodType
}
-findMap = [ : ];
-if (findOrganizationPartyId) findMap.organizationPartyId = findOrganizationPartyId;
-if (currentCustomTimePeriodId) findMap.parentPeriodId = currentCustomTimePeriodId;
+findMap = [ : ]
+if (findOrganizationPartyId) findMap.organizationPartyId = findOrganizationPartyId
+if (currentCustomTimePeriodId) findMap.parentPeriodId = currentCustomTimePeriodId
-customTimePeriods = from("CustomTimePeriod").where(findMap).orderBy(["periodTypeId", "periodNum", "fromDate"]).queryList();
-context.customTimePeriods = customTimePeriods;
+customTimePeriods = from("CustomTimePeriod").where(findMap).orderBy(["periodTypeId", "periodNum", "fromDate"]).queryList()
+context.customTimePeriods = customTimePeriods
-allCustomTimePeriods = from("CustomTimePeriod").orderBy(["organizationPartyId", "parentPeriodId", "periodTypeId", "periodNum", "fromDate"]).queryList();
-context.allCustomTimePeriods = allCustomTimePeriods;
+allCustomTimePeriods = from("CustomTimePeriod").orderBy(["organizationPartyId", "parentPeriodId", "periodTypeId", "periodNum", "fromDate"]).queryList()
+context.allCustomTimePeriods = allCustomTimePeriods
-periodTypes = from("PeriodType").orderBy("description").cache(true).queryList();
-context.periodTypes = periodTypes;
+periodTypes = from("PeriodType").orderBy("description").cache(true).queryList()
+context.periodTypes = periodTypes
-newPeriodTypeId = "FISCAL_YEAR";
+newPeriodTypeId = "FISCAL_YEAR"
if ("FISCAL_YEAR".equals(currentCustomTimePeriod?.periodTypeId)) {
- newPeriodTypeId = "FISCAL_QUARTER";
+ newPeriodTypeId = "FISCAL_QUARTER"
}
if ("FISCAL_QUARTER".equals(currentCustomTimePeriod?.periodTypeId)) {
- newPeriodTypeId = "FISCAL_MONTH";
+ newPeriodTypeId = "FISCAL_MONTH"
}
if ("FISCAL_MONTH".equals(currentCustomTimePeriod?.periodTypeId)) {
- newPeriodTypeId = "FISCAL_WEEK";
+ newPeriodTypeId = "FISCAL_WEEK"
}
if ("FISCAL_BIWEEK".equals(currentCustomTimePeriod?.periodTypeId)) {
- newPeriodTypeId = "FISCAL_WEEK";
+ newPeriodTypeId = "FISCAL_WEEK"
}
if ("FISCAL_WEEK".equals(currentCustomTimePeriod?.periodTypeId)) {
- newPeriodTypeId = "";
+ newPeriodTypeId = ""
}
-context.newPeriodTypeId = newPeriodTypeId;
+context.newPeriodTypeId = newPeriodTypeId
diff --git a/applications/accounting/groovyScripts/reports/BalanceSheet.groovy b/applications/accounting/groovyScripts/reports/BalanceSheet.groovy
index 90a0280e42..a2dd416c7c 100644
--- a/applications/accounting/groovyScripts/reports/BalanceSheet.groovy
+++ b/applications/accounting/groovyScripts/reports/BalanceSheet.groovy
@@ -29,405 +29,405 @@ import org.apache.ofbiz.party.party.PartyWorker
import java.sql.Timestamp
-uiLabelMap = UtilProperties.getResourceBundleMap("AccountingUiLabels", locale);
+uiLabelMap = UtilProperties.getResourceBundleMap("AccountingUiLabels", locale)
if (!thruDate) {
- thruDate = UtilDateTime.nowTimestamp();
+ thruDate = UtilDateTime.nowTimestamp()
}
if (!glFiscalTypeId) {
- return;
+ return
}
organizationPartyId =null
if(context.organizationPartyId) {
- organizationPartyId = context.organizationPartyId;
+ organizationPartyId = context.organizationPartyId
} else {
organizationPartyId = parameters.get('ApplicationDecorator|organizationPartyId')
}
// Setup the divisions for which the report is executed
-List partyIds = PartyWorker.getAssociatedPartyIdsByRelationshipType(delegator, organizationPartyId, 'GROUP_ROLLUP');
-partyIds.add(organizationPartyId);
+List partyIds = PartyWorker.getAssociatedPartyIdsByRelationshipType(delegator, organizationPartyId, 'GROUP_ROLLUP')
+partyIds.add(organizationPartyId)
// Get the group of account classes that will be used to position accounts in the proper section of the financial statement
-GenericValue assetGlAccountClass = from("GlAccountClass").where("glAccountClassId", "ASSET").cache(true).queryOne();
-List assetAccountClassIds = UtilAccounting.getDescendantGlAccountClassIds(assetGlAccountClass);
-GenericValue contraAssetGlAccountClass = from("GlAccountClass").where("glAccountClassId", "CONTRA_ASSET").cache(true).queryOne();
-List contraAssetAccountClassIds = UtilAccounting.getDescendantGlAccountClassIds(contraAssetGlAccountClass);
-GenericValue liabilityGlAccountClass = from("GlAccountClass").where("glAccountClassId", "LIABILITY").cache(true).queryOne();
-List liabilityAccountClassIds = UtilAccounting.getDescendantGlAccountClassIds(liabilityGlAccountClass);
-GenericValue equityGlAccountClass = from("GlAccountClass").where("glAccountClassId", "EQUITY").cache(true).queryOne();
-List equityAccountClassIds = UtilAccounting.getDescendantGlAccountClassIds(equityGlAccountClass);
-GenericValue currentAssetGlAccountClass = from("GlAccountClass").where("glAccountClassId", "CURRENT_ASSET").cache(true).queryOne();
-List currentAssetAccountClassIds = UtilAccounting.getDescendantGlAccountClassIds(currentAssetGlAccountClass);
-GenericValue longtermAssetGlAccountClass = from("GlAccountClass").where("glAccountClassId", "LONGTERM_ASSET").cache(true).queryOne();
-List longtermAssetAccountClassIds = UtilAccounting.getDescendantGlAccountClassIds(longtermAssetGlAccountClass);
-GenericValue currentLiabilityGlAccountClass = from("GlAccountClass").where("glAccountClassId", "CURRENT_LIABILITY").cache(true).queryOne();
-List currentLiabilityAccountClassIds = UtilAccounting.getDescendantGlAccountClassIds(currentLiabilityGlAccountClass);
-GenericValue accumDepreciationGlAccountClass = from("GlAccountClass").where("glAccountClassId", "ACCUM_DEPRECIATION").cache(true).queryOne();
-List accumDepreciationAccountClassIds = UtilAccounting.getDescendantGlAccountClassIds(accumDepreciationGlAccountClass);
-GenericValue accumAmortizationGlAccountClass = from("GlAccountClass").where("glAccountClassId", "ACCUM_AMORTIZATION").cache(true).queryOne();
-List accumAmortizationAccountClassIds = UtilAccounting.getDescendantGlAccountClassIds(accumAmortizationGlAccountClass);
+GenericValue assetGlAccountClass = from("GlAccountClass").where("glAccountClassId", "ASSET").cache(true).queryOne()
+List assetAccountClassIds = UtilAccounting.getDescendantGlAccountClassIds(assetGlAccountClass)
+GenericValue contraAssetGlAccountClass = from("GlAccountClass").where("glAccountClassId", "CONTRA_ASSET").cache(true).queryOne()
+List contraAssetAccountClassIds = UtilAccounting.getDescendantGlAccountClassIds(contraAssetGlAccountClass)
+GenericValue liabilityGlAccountClass = from("GlAccountClass").where("glAccountClassId", "LIABILITY").cache(true).queryOne()
+List liabilityAccountClassIds = UtilAccounting.getDescendantGlAccountClassIds(liabilityGlAccountClass)
+GenericValue equityGlAccountClass = from("GlAccountClass").where("glAccountClassId", "EQUITY").cache(true).queryOne()
+List equityAccountClassIds = UtilAccounting.getDescendantGlAccountClassIds(equityGlAccountClass)
+GenericValue currentAssetGlAccountClass = from("GlAccountClass").where("glAccountClassId", "CURRENT_ASSET").cache(true).queryOne()
+List currentAssetAccountClassIds = UtilAccounting.getDescendantGlAccountClassIds(currentAssetGlAccountClass)
+GenericValue longtermAssetGlAccountClass = from("GlAccountClass").where("glAccountClassId", "LONGTERM_ASSET").cache(true).queryOne()
+List longtermAssetAccountClassIds = UtilAccounting.getDescendantGlAccountClassIds(longtermAssetGlAccountClass)
+GenericValue currentLiabilityGlAccountClass = from("GlAccountClass").where("glAccountClassId", "CURRENT_LIABILITY").cache(true).queryOne()
+List currentLiabilityAccountClassIds = UtilAccounting.getDescendantGlAccountClassIds(currentLiabilityGlAccountClass)
+GenericValue accumDepreciationGlAccountClass = from("GlAccountClass").where("glAccountClassId", "ACCUM_DEPRECIATION").cache(true).queryOne()
+List accumDepreciationAccountClassIds = UtilAccounting.getDescendantGlAccountClassIds(accumDepreciationGlAccountClass)
+GenericValue accumAmortizationGlAccountClass = from("GlAccountClass").where("glAccountClassId", "ACCUM_AMORTIZATION").cache(true).queryOne()
+List accumAmortizationAccountClassIds = UtilAccounting.getDescendantGlAccountClassIds(accumAmortizationGlAccountClass)
// Find the last closed time period to get the fromDate for the transactions in the current period and the ending balances of the last closed period
-Map lastClosedTimePeriodResult = runService('findLastClosedDate', ["organizationPartyId": organizationPartyId, "findDate": thruDate,"userLogin": userLogin]);
-Timestamp fromDate = (Timestamp)lastClosedTimePeriodResult.lastClosedDate;
+Map lastClosedTimePeriodResult = runService('findLastClosedDate', ["organizationPartyId": organizationPartyId, "findDate": thruDate,"userLogin": userLogin])
+Timestamp fromDate = (Timestamp)lastClosedTimePeriodResult.lastClosedDate
if (!fromDate) {
- return;
+ return
}
-GenericValue lastClosedTimePeriod = (GenericValue)lastClosedTimePeriodResult.lastClosedTimePeriod;
+GenericValue lastClosedTimePeriod = (GenericValue)lastClosedTimePeriodResult.lastClosedTimePeriod
// Get the opening balances of all the accounts
-Map assetOpeningBalances = [:];
-Map contraAssetOpeningBalances = [:];
-Map currentAssetOpeningBalances = [:];
-Map longtermAssetOpeningBalances = [:];
-Map liabilityOpeningBalances = [:];
-Map currentLiabilityOpeningBalances = [:];
-Map equityOpeningBalances = [:];
+Map assetOpeningBalances = [:]
+Map contraAssetOpeningBalances = [:]
+Map currentAssetOpeningBalances = [:]
+Map longtermAssetOpeningBalances = [:]
+Map liabilityOpeningBalances = [:]
+Map currentLiabilityOpeningBalances = [:]
+Map equityOpeningBalances = [:]
if (lastClosedTimePeriod) {
- List timePeriodAndExprs = [];
- timePeriodAndExprs.add(EntityCondition.makeCondition("organizationPartyId", EntityOperator.IN, partyIds));
- timePeriodAndExprs.add(EntityCondition.makeCondition("glAccountClassId", EntityOperator.IN, assetAccountClassIds));
- timePeriodAndExprs.add(EntityCondition.makeCondition("endingBalance", EntityOperator.NOT_EQUAL, BigDecimal.ZERO));
- timePeriodAndExprs.add(EntityCondition.makeCondition("customTimePeriodId", EntityOperator.EQUALS, lastClosedTimePeriod.customTimePeriodId));
- List lastTimePeriodHistories = from("GlAccountAndHistory").where(timePeriodAndExprs).queryList();
+ List timePeriodAndExprs = []
+ timePeriodAndExprs.add(EntityCondition.makeCondition("organizationPartyId", EntityOperator.IN, partyIds))
+ timePeriodAndExprs.add(EntityCondition.makeCondition("glAccountClassId", EntityOperator.IN, assetAccountClassIds))
+ timePeriodAndExprs.add(EntityCondition.makeCondition("endingBalance", EntityOperator.NOT_EQUAL, BigDecimal.ZERO))
+ timePeriodAndExprs.add(EntityCondition.makeCondition("customTimePeriodId", EntityOperator.EQUALS, lastClosedTimePeriod.customTimePeriodId))
+ List lastTimePeriodHistories = from("GlAccountAndHistory").where(timePeriodAndExprs).queryList()
lastTimePeriodHistories.each { lastTimePeriodHistory ->
- Map accountMap = UtilMisc.toMap("glAccountId", lastTimePeriodHistory.glAccountId, "accountCode", lastTimePeriodHistory.accountCode, "accountName", lastTimePeriodHistory.accountName, "balance", lastTimePeriodHistory.getBigDecimal("endingBalance"), "D", lastTimePeriodHistory.getBigDecimal("postedDebits"), "C", lastTimePeriodHistory.getBigDecimal("postedCredits"));
- assetOpeningBalances.put(lastTimePeriodHistory.glAccountId, accountMap);
+ Map accountMap = UtilMisc.toMap("glAccountId", lastTimePeriodHistory.glAccountId, "accountCode", lastTimePeriodHistory.accountCode, "accountName", lastTimePeriodHistory.accountName, "balance", lastTimePeriodHistory.getBigDecimal("endingBalance"), "D", lastTimePeriodHistory.getBigDecimal("postedDebits"), "C", lastTimePeriodHistory.getBigDecimal("postedCredits"))
+ assetOpeningBalances.put(lastTimePeriodHistory.glAccountId, accountMap)
}
- timePeriodAndExprs = [];
- timePeriodAndExprs.add(EntityCondition.makeCondition("organizationPartyId", EntityOperator.IN, partyIds));
- timePeriodAndExprs.add(EntityCondition.makeCondition("glAccountClassId", EntityOperator.IN, contraAssetAccountClassIds));
- timePeriodAndExprs.add(EntityCondition.makeCondition("endingBalance", EntityOperator.NOT_EQUAL, BigDecimal.ZERO));
- timePeriodAndExprs.add(EntityCondition.makeCondition("customTimePeriodId", EntityOperator.EQUALS, lastClosedTimePeriod.customTimePeriodId));
- lastTimePeriodHistories = from("GlAccountAndHistory").where(timePeriodAndExprs).queryList();
+ timePeriodAndExprs = []
+ timePeriodAndExprs.add(EntityCondition.makeCondition("organizationPartyId", EntityOperator.IN, partyIds))
+ timePeriodAndExprs.add(EntityCondition.makeCondition("glAccountClassId", EntityOperator.IN, contraAssetAccountClassIds))
+ timePeriodAndExprs.add(EntityCondition.makeCondition("endingBalance", EntityOperator.NOT_EQUAL, BigDecimal.ZERO))
+ timePeriodAndExprs.add(EntityCondition.makeCondition("customTimePeriodId", EntityOperator.EQUALS, lastClosedTimePeriod.customTimePeriodId))
+ lastTimePeriodHistories = from("GlAccountAndHistory").where(timePeriodAndExprs).queryList()
lastTimePeriodHistories.each { lastTimePeriodHistory ->
- Map accountMap = UtilMisc.toMap("glAccountId", lastTimePeriodHistory.glAccountId, "accountCode", lastTimePeriodHistory.accountCode, "accountName", lastTimePeriodHistory.accountName, "balance", lastTimePeriodHistory.getBigDecimal("endingBalance"), "D", lastTimePeriodHistory.getBigDecimal("postedDebits"), "C", lastTimePeriodHistory.getBigDecimal("postedCredits"));
- contraAssetOpeningBalances.put(lastTimePeriodHistory.glAccountId, accountMap);
+ Map accountMap = UtilMisc.toMap("glAccountId", lastTimePeriodHistory.glAccountId, "accountCode", lastTimePeriodHistory.accountCode, "accountName", lastTimePeriodHistory.accountName, "balance", lastTimePeriodHistory.getBigDecimal("endingBalance"), "D", lastTimePeriodHistory.getBigDecimal("postedDebits"), "C", lastTimePeriodHistory.getBigDecimal("postedCredits"))
+ contraAssetOpeningBalances.put(lastTimePeriodHistory.glAccountId, accountMap)
}
- timePeriodAndExprs = [];
- timePeriodAndExprs.add(EntityCondition.makeCondition("organizationPartyId", EntityOperator.IN, partyIds));
- timePeriodAndExprs.add(EntityCondition.makeCondition("glAccountClassId", EntityOperator.IN, liabilityAccountClassIds));
- timePeriodAndExprs.add(EntityCondition.makeCondition("endingBalance", EntityOperator.NOT_EQUAL, BigDecimal.ZERO));
- timePeriodAndExprs.add(EntityCondition.makeCondition("customTimePeriodId", EntityOperator.EQUALS, lastClosedTimePeriod.customTimePeriodId));
- lastTimePeriodHistories = from("GlAccountAndHistory").where(timePeriodAndExprs).queryList();
+ timePeriodAndExprs = []
+ timePeriodAndExprs.add(EntityCondition.makeCondition("organizationPartyId", EntityOperator.IN, partyIds))
+ timePeriodAndExprs.add(EntityCondition.makeCondition("glAccountClassId", EntityOperator.IN, liabilityAccountClassIds))
+ timePeriodAndExprs.add(EntityCondition.makeCondition("endingBalance", EntityOperator.NOT_EQUAL, BigDecimal.ZERO))
+ timePeriodAndExprs.add(EntityCondition.makeCondition("customTimePeriodId", EntityOperator.EQUALS, lastClosedTimePeriod.customTimePeriodId))
+ lastTimePeriodHistories = from("GlAccountAndHistory").where(timePeriodAndExprs).queryList()
lastTimePeriodHistories.each { lastTimePeriodHistory ->
- Map accountMap = UtilMisc.toMap("glAccountId", lastTimePeriodHistory.glAccountId, "accountCode", lastTimePeriodHistory.accountCode, "accountName", lastTimePeriodHistory.accountName, "balance", lastTimePeriodHistory.getBigDecimal("endingBalance"), "D", lastTimePeriodHistory.getBigDecimal("postedDebits"), "C", lastTimePeriodHistory.getBigDecimal("postedCredits"));
- liabilityOpeningBalances.put(lastTimePeriodHistory.glAccountId, accountMap);
+ Map accountMap = UtilMisc.toMap("glAccountId", lastTimePeriodHistory.glAccountId, "accountCode", lastTimePeriodHistory.accountCode, "accountName", lastTimePeriodHistory.accountName, "balance", lastTimePeriodHistory.getBigDecimal("endingBalance"), "D", lastTimePeriodHistory.getBigDecimal("postedDebits"), "C", lastTimePeriodHistory.getBigDecimal("postedCredits"))
+ liabilityOpeningBalances.put(lastTimePeriodHistory.glAccountId, accountMap)
}
- timePeriodAndExprs = [];
- timePeriodAndExprs.add(EntityCondition.makeCondition("organizationPartyId", EntityOperator.IN, partyIds));
- timePeriodAndExprs.add(EntityCondition.makeCondition("glAccountClassId", EntityOperator.IN, equityAccountClassIds));
- timePeriodAndExprs.add(EntityCondition.makeCondition("endingBalance", EntityOperator.NOT_EQUAL, BigDecimal.ZERO));
- timePeriodAndExprs.add(EntityCondition.makeCondition("customTimePeriodId", EntityOperator.EQUALS, lastClosedTimePeriod.customTimePeriodId));
- lastTimePeriodHistories = from("GlAccountAndHistory").where(timePeriodAndExprs).queryList();
+ timePeriodAndExprs = []
+ timePeriodAndExprs.add(EntityCondition.makeCondition("organizationPartyId", EntityOperator.IN, partyIds))
+ timePeriodAndExprs.add(EntityCondition.makeCondition("glAccountClassId", EntityOperator.IN, equityAccountClassIds))
+ timePeriodAndExprs.add(EntityCondition.makeCondition("endingBalance", EntityOperator.NOT_EQUAL, BigDecimal.ZERO))
+ timePeriodAndExprs.add(EntityCondition.makeCondition("customTimePeriodId", EntityOperator.EQUALS, lastClosedTimePeriod.customTimePeriodId))
+ lastTimePeriodHistories = from("GlAccountAndHistory").where(timePeriodAndExprs).queryList()
lastTimePeriodHistories.each { lastTimePeriodHistory ->
- Map accountMap = UtilMisc.toMap("glAccountId", lastTimePeriodHistory.glAccountId, "accountCode", lastTimePeriodHistory.accountCode, "accountName", lastTimePeriodHistory.accountName, "balance", lastTimePeriodHistory.getBigDecimal("endingBalance"), "D", lastTimePeriodHistory.getBigDecimal("postedDebits"), "C", lastTimePeriodHistory.getBigDecimal("postedCredits"));
- equityOpeningBalances.put(lastTimePeriodHistory.glAccountId, accountMap);
+ Map accountMap = UtilMisc.toMap("glAccountId", lastTimePeriodHistory.glAccountId, "accountCode", lastTimePeriodHistory.accountCode, "accountName", lastTimePeriodHistory.accountName, "balance", lastTimePeriodHistory.getBigDecimal("endingBalance"), "D", lastTimePeriodHistory.getBigDecimal("postedDebits"), "C", lastTimePeriodHistory.getBigDecimal("postedCredits"))
+ equityOpeningBalances.put(lastTimePeriodHistory.glAccountId, accountMap)
}
- timePeriodAndExprs = [];
- timePeriodAndExprs.add(EntityCondition.makeCondition("organizationPartyId", EntityOperator.IN, partyIds));
- timePeriodAndExprs.add(EntityCondition.makeCondition("glAccountClassId", EntityOperator.IN, currentAssetAccountClassIds));
- timePeriodAndExprs.add(EntityCondition.makeCondition("endingBalance", EntityOperator.NOT_EQUAL, BigDecimal.ZERO));
- timePeriodAndExprs.add(EntityCondition.makeCondition("customTimePeriodId", EntityOperator.EQUALS, lastClosedTimePeriod.customTimePeriodId));
- lastTimePeriodHistories = from("GlAccountAndHistory").where(timePeriodAndExprs).queryList();
+ timePeriodAndExprs = []
+ timePeriodAndExprs.add(EntityCondition.makeCondition("organizationPartyId", EntityOperator.IN, partyIds))
+ timePeriodAndExprs.add(EntityCondition.makeCondition("glAccountClassId", EntityOperator.IN, currentAssetAccountClassIds))
+ timePeriodAndExprs.add(EntityCondition.makeCondition("endingBalance", EntityOperator.NOT_EQUAL, BigDecimal.ZERO))
+ timePeriodAndExprs.add(EntityCondition.makeCondition("customTimePeriodId", EntityOperator.EQUALS, lastClosedTimePeriod.customTimePeriodId))
+ lastTimePeriodHistories = from("GlAccountAndHistory").where(timePeriodAndExprs).queryList()
lastTimePeriodHistories.each { lastTimePeriodHistory ->
- Map accountMap = UtilMisc.toMap("glAccountId", lastTimePeriodHistory.glAccountId, "accountCode", lastTimePeriodHistory.accountCode, "accountName", lastTimePeriodHistory.accountName, "balance", lastTimePeriodHistory.getBigDecimal("endingBalance"), "D", lastTimePeriodHistory.getBigDecimal("postedDebits"), "C", lastTimePeriodHistory.getBigDecimal("postedCredits"));
- currentAssetOpeningBalances.put(lastTimePeriodHistory.glAccountId, accountMap);
+ Map accountMap = UtilMisc.toMap("glAccountId", lastTimePeriodHistory.glAccountId, "accountCode", lastTimePeriodHistory.accountCode, "accountName", lastTimePeriodHistory.accountName, "balance", lastTimePeriodHistory.getBigDecimal("endingBalance"), "D", lastTimePeriodHistory.getBigDecimal("postedDebits"), "C", lastTimePeriodHistory.getBigDecimal("postedCredits"))
+ currentAssetOpeningBalances.put(lastTimePeriodHistory.glAccountId, accountMap)
}
- timePeriodAndExprs = [];
- timePeriodAndExprs.add(EntityCondition.makeCondition("organizationPartyId", EntityOperator.IN, partyIds));
- timePeriodAndExprs.add(EntityCondition.makeCondition("glAccountClassId", EntityOperator.IN, longtermAssetAccountClassIds));
- timePeriodAndExprs.add(EntityCondition.makeCondition("endingBalance", EntityOperator.NOT_EQUAL, BigDecimal.ZERO));
- timePeriodAndExprs.add(EntityCondition.makeCondition("customTimePeriodId", EntityOperator.EQUALS, lastClosedTimePeriod.customTimePeriodId));
- lastTimePeriodHistories = from("GlAccountAndHistory").where(timePeriodAndExprs).queryList();
+ timePeriodAndExprs = []
+ timePeriodAndExprs.add(EntityCondition.makeCondition("organizationPartyId", EntityOperator.IN, partyIds))
+ timePeriodAndExprs.add(EntityCondition.makeCondition("glAccountClassId", EntityOperator.IN, longtermAssetAccountClassIds))
+ timePeriodAndExprs.add(EntityCondition.makeCondition("endingBalance", EntityOperator.NOT_EQUAL, BigDecimal.ZERO))
+ timePeriodAndExprs.add(EntityCondition.makeCondition("customTimePeriodId", EntityOperator.EQUALS, lastClosedTimePeriod.customTimePeriodId))
+ lastTimePeriodHistories = from("GlAccountAndHistory").where(timePeriodAndExprs).queryList()
lastTimePeriodHistories.each { lastTimePeriodHistory ->
- Map accountMap = UtilMisc.toMap("glAccountId", lastTimePeriodHistory.glAccountId, "accountCode", lastTimePeriodHistory.accountCode, "accountName", lastTimePeriodHistory.accountName, "balance", lastTimePeriodHistory.getBigDecimal("endingBalance"), "D", lastTimePeriodHistory.getBigDecimal("postedDebits"), "C", lastTimePeriodHistory.getBigDecimal("postedCredits"));
- longtermAssetOpeningBalances.put(lastTimePeriodHistory.glAccountId, accountMap);
+ Map accountMap = UtilMisc.toMap("glAccountId", lastTimePeriodHistory.glAccountId, "accountCode", lastTimePeriodHistory.accountCode, "accountName", lastTimePeriodHistory.accountName, "balance", lastTimePeriodHistory.getBigDecimal("endingBalance"), "D", lastTimePeriodHistory.getBigDecimal("postedDebits"), "C", lastTimePeriodHistory.getBigDecimal("postedCredits"))
+ longtermAssetOpeningBalances.put(lastTimePeriodHistory.glAccountId, accountMap)
}
- timePeriodAndExprs = [];
- timePeriodAndExprs.add(EntityCondition.makeCondition("organizationPartyId", EntityOperator.IN, partyIds));
- timePeriodAndExprs.add(EntityCondition.makeCondition("glAccountClassId", EntityOperator.IN, currentLiabilityAccountClassIds));
- timePeriodAndExprs.add(EntityCondition.makeCondition("endingBalance", EntityOperator.NOT_EQUAL, BigDecimal.ZERO));
- timePeriodAndExprs.add(EntityCondition.makeCondition("customTimePeriodId", EntityOperator.EQUALS, lastClosedTimePeriod.customTimePeriodId));
- lastTimePeriodHistories = from("GlAccountAndHistory").where(timePeriodAndExprs).queryList();
+ timePeriodAndExprs = []
+ timePeriodAndExprs.add(EntityCondition.makeCondition("organizationPartyId", EntityOperator.IN, partyIds))
+ timePeriodAndExprs.add(EntityCondition.makeCondition("glAccountClassId", EntityOperator.IN, currentLiabilityAccountClassIds))
+ timePeriodAndExprs.add(EntityCondition.makeCondition("endingBalance", EntityOperator.NOT_EQUAL, BigDecimal.ZERO))
+ timePeriodAndExprs.add(EntityCondition.makeCondition("customTimePeriodId", EntityOperator.EQUALS, lastClosedTimePeriod.customTimePeriodId))
+ lastTimePeriodHistories = from("GlAccountAndHistory").where(timePeriodAndExprs).queryList()
lastTimePeriodHistories.each { lastTimePeriodHistory ->
- Map accountMap = UtilMisc.toMap("glAccountId", lastTimePeriodHistory.glAccountId, "accountCode", lastTimePeriodHistory.accountCode, "accountName", lastTimePeriodHistory.accountName, "balance", lastTimePeriodHistory.getBigDecimal("endingBalance"), "D", lastTimePeriodHistory.getBigDecimal("postedDebits"), "C", lastTimePeriodHistory.getBigDecimal("postedCredits"));
- currentLiabilityOpeningBalances.put(lastTimePeriodHistory.glAccountId, accountMap);
+ Map accountMap = UtilMisc.toMap("glAccountId", lastTimePeriodHistory.glAccountId, "accountCode", lastTimePeriodHistory.accountCode, "accountName", lastTimePeriodHistory.accountName, "balance", lastTimePeriodHistory.getBigDecimal("endingBalance"), "D", lastTimePeriodHistory.getBigDecimal("postedDebits"), "C", lastTimePeriodHistory.getBigDecimal("postedCredits"))
+ currentLiabilityOpeningBalances.put(lastTimePeriodHistory.glAccountId, accountMap)
}
}
-List balanceTotalList = [];
+List balanceTotalList = []
-List mainAndExprs = [];
-mainAndExprs.add(EntityCondition.makeCondition("organizationPartyId", EntityOperator.IN, partyIds));
-mainAndExprs.add(EntityCondition.makeCondition("isPosted", EntityOperator.EQUALS, "Y"));
-mainAndExprs.add(EntityCondition.makeCondition("glFiscalTypeId", EntityOperator.EQUALS, glFiscalTypeId));
-mainAndExprs.add(EntityCondition.makeCondition("acctgTransTypeId", EntityOperator.NOT_EQUAL, "PERIOD_CLOSING"));
-mainAndExprs.add(EntityCondition.makeCondition("transactionDate", EntityOperator.GREATER_THAN_EQUAL_TO, fromDate));
-mainAndExprs.add(EntityCondition.makeCondition("transactionDate", EntityOperator.LESS_THAN, thruDate));
+List mainAndExprs = []
+mainAndExprs.add(EntityCondition.makeCondition("organizationPartyId", EntityOperator.IN, partyIds))
+mainAndExprs.add(EntityCondition.makeCondition("isPosted", EntityOperator.EQUALS, "Y"))
+mainAndExprs.add(EntityCondition.makeCondition("glFiscalTypeId", EntityOperator.EQUALS, glFiscalTypeId))
+mainAndExprs.add(EntityCondition.makeCondition("acctgTransTypeId", EntityOperator.NOT_EQUAL, "PERIOD_CLOSING"))
+mainAndExprs.add(EntityCondition.makeCondition("transactionDate", EntityOperator.GREATER_THAN_EQUAL_TO, fromDate))
+mainAndExprs.add(EntityCondition.makeCondition("transactionDate", EntityOperator.LESS_THAN, thruDate))
// ASSETS
// account balances
-accountBalanceList = [];
-transactionTotals = [];
-balanceTotal = BigDecimal.ZERO;
-List assetAndExprs = mainAndExprs as LinkedList;
-assetAndExprs.add(EntityCondition.makeCondition("glAccountClassId", EntityOperator.IN, assetAccountClassIds));
-transactionTotals = select("glAccountId", "accountName", "accountCode", "debitCreditFlag", "amount").from("AcctgTransEntrySums").where(assetAndExprs).orderBy("glAccountId").queryList();
-transactionTotalsMap = [:];
-transactionTotalsMap.putAll(assetOpeningBalances);
+accountBalanceList = []
+transactionTotals = []
+balanceTotal = BigDecimal.ZERO
+List assetAndExprs = mainAndExprs as LinkedList
+assetAndExprs.add(EntityCondition.makeCondition("glAccountClassId", EntityOperator.IN, assetAccountClassIds))
+transactionTotals = select("glAccountId", "accountName", "accountCode", "debitCreditFlag", "amount").from("AcctgTransEntrySums").where(assetAndExprs).orderBy("glAccountId").queryList()
+transactionTotalsMap = [:]
+transactionTotalsMap.putAll(assetOpeningBalances)
transactionTotals.each { transactionTotal ->
- Map accountMap = (Map)transactionTotalsMap.get(transactionTotal.glAccountId);
+ Map accountMap = (Map)transactionTotalsMap.get(transactionTotal.glAccountId)
if (!accountMap) {
- accountMap = UtilMisc.makeMapWritable(transactionTotal);
- accountMap.remove("debitCreditFlag");
- accountMap.remove("amount");
- accountMap.put("D", BigDecimal.ZERO);
- accountMap.put("C", BigDecimal.ZERO);
- accountMap.put("balance", BigDecimal.ZERO);
+ accountMap = UtilMisc.makeMapWritable(transactionTotal)
+ accountMap.remove("debitCreditFlag")
+ accountMap.remove("amount")
+ accountMap.put("D", BigDecimal.ZERO)
+ accountMap.put("C", BigDecimal.ZERO)
+ accountMap.put("balance", BigDecimal.ZERO)
}
- UtilMisc.addToBigDecimalInMap(accountMap, transactionTotal.debitCreditFlag, transactionTotal.amount);
- BigDecimal debitAmount = (BigDecimal)accountMap.get("D");
- BigDecimal creditAmount = (BigDecimal)accountMap.get("C");
+ UtilMisc.addToBigDecimalInMap(accountMap, transactionTotal.debitCreditFlag, transactionTotal.amount)
+ BigDecimal debitAmount = (BigDecimal)accountMap.get("D")
+ BigDecimal creditAmount = (BigDecimal)accountMap.get("C")
// assets are accounts of class DEBIT: the balance is given by debits minus credits
- BigDecimal balance = debitAmount.subtract(creditAmount);
- accountMap.put("balance", balance);
- transactionTotalsMap.put(transactionTotal.glAccountId, accountMap);
+ BigDecimal balance = debitAmount.subtract(creditAmount)
+ accountMap.put("balance", balance)
+ transactionTotalsMap.put(transactionTotal.glAccountId, accountMap)
}
-accountBalanceList = UtilMisc.sortMaps(transactionTotalsMap.values().asList(), UtilMisc.toList("accountCode"));
+accountBalanceList = UtilMisc.sortMaps(transactionTotalsMap.values().asList(), UtilMisc.toList("accountCode"))
accountBalanceList.each { accountBalance ->
- balanceTotal = balanceTotal + accountBalance.balance;
+ balanceTotal = balanceTotal + accountBalance.balance
}
-context.assetAccountBalanceList = accountBalanceList;
-context.assetAccountBalanceList.add(UtilMisc.toMap("accountName", uiLabelMap.AccountingTotalAssets, "balance", balanceTotal));
-context.assetBalanceTotal = balanceTotal;
+context.assetAccountBalanceList = accountBalanceList
+context.assetAccountBalanceList.add(UtilMisc.toMap("accountName", uiLabelMap.AccountingTotalAssets, "balance", balanceTotal))
+context.assetBalanceTotal = balanceTotal
// CURRENT ASSETS
// account balances
-accountBalanceList = [];
-transactionTotals = [];
-balanceTotal = BigDecimal.ZERO;
-List currentAssetAndExprs = mainAndExprs as LinkedList;
-currentAssetAndExprs.add(EntityCondition.makeCondition("glAccountClassId", EntityOperator.IN, currentAssetAccountClassIds));
-transactionTotals = select("glAccountId", "accountName", "accountCode", "debitCreditFlag", "amount").from("AcctgTransEntrySums").where(currentAssetAndExprs).orderBy("glAccountId").queryList();
-transactionTotalsMap = [:];
-transactionTotalsMap.putAll(currentAssetOpeningBalances);
+accountBalanceList = []
+transactionTotals = []
+balanceTotal = BigDecimal.ZERO
+List currentAssetAndExprs = mainAndExprs as LinkedList
+currentAssetAndExprs.add(EntityCondition.makeCondition("glAccountClassId", EntityOperator.IN, currentAssetAccountClassIds))
+transactionTotals = select("glAccountId", "accountName", "accountCode", "debitCreditFlag", "amount").from("AcctgTransEntrySums").where(currentAssetAndExprs).orderBy("glAccountId").queryList()
+transactionTotalsMap = [:]
+transactionTotalsMap.putAll(currentAssetOpeningBalances)
transactionTotals.each { transactionTotal ->
- Map accountMap = (Map)transactionTotalsMap.get(transactionTotal.glAccountId);
+ Map accountMap = (Map)transactionTotalsMap.get(transactionTotal.glAccountId)
if (!accountMap) {
- accountMap = UtilMisc.makeMapWritable(transactionTotal);
- accountMap.remove("debitCreditFlag");
- accountMap.remove("amount");
- accountMap.put("D", BigDecimal.ZERO);
- accountMap.put("C", BigDecimal.ZERO);
- accountMap.put("balance", BigDecimal.ZERO);
+ accountMap = UtilMisc.makeMapWritable(transactionTotal)
+ accountMap.remove("debitCreditFlag")
+ accountMap.remove("amount")
+ accountMap.put("D", BigDecimal.ZERO)
+ accountMap.put("C", BigDecimal.ZERO)
+ accountMap.put("balance", BigDecimal.ZERO)
}
- UtilMisc.addToBigDecimalInMap(accountMap, transactionTotal.debitCreditFlag, transactionTotal.amount);
- BigDecimal debitAmount = (BigDecimal)accountMap.get("D");
- BigDecimal creditAmount = (BigDecimal)accountMap.get("C");
+ UtilMisc.addToBigDecimalInMap(accountMap, transactionTotal.debitCreditFlag, transactionTotal.amount)
+ BigDecimal debitAmount = (BigDecimal)accountMap.get("D")
+ BigDecimal creditAmount = (BigDecimal)accountMap.get("C")
// assets are accounts of class DEBIT: the balance is given by debits minus credits
- BigDecimal balance = debitAmount.subtract(creditAmount);
- accountMap.put("balance", balance);
- transactionTotalsMap.put(transactionTotal.glAccountId, accountMap);
+ BigDecimal balance = debitAmount.subtract(creditAmount)
+ accountMap.put("balance", balance)
+ transactionTotalsMap.put(transactionTotal.glAccountId, accountMap)
}
-accountBalanceList = UtilMisc.sortMaps(transactionTotalsMap.values().asList(), UtilMisc.toList("accountCode"));
+accountBalanceList = UtilMisc.sortMaps(transactionTotalsMap.values().asList(), UtilMisc.toList("accountCode"))
accountBalanceList.each { accountBalance ->
- balanceTotal = balanceTotal + accountBalance.balance;
+ balanceTotal = balanceTotal + accountBalance.balance
}
-context.currentAssetBalanceTotal = balanceTotal;
-balanceTotalList.add(UtilMisc.toMap("totalName", "AccountingCurrentAssets", "balance", balanceTotal));
+context.currentAssetBalanceTotal = balanceTotal
+balanceTotalList.add(UtilMisc.toMap("totalName", "AccountingCurrentAssets", "balance", balanceTotal))
// LONGTERM ASSETS
// account balances
-accountBalanceList = [];
-transactionTotals = [];
-balanceTotal = BigDecimal.ZERO;
-List longtermAssetAndExprs = mainAndExprs as LinkedList;
-longtermAssetAndExprs.add(EntityCondition.makeCondition("glAccountClassId", EntityOperator.IN, longtermAssetAccountClassIds));
-transactionTotals = select("glAccountId", "accountName", "accountCode", "debitCreditFlag", "amount").from("AcctgTransEntrySums").where(longtermAssetAndExprs).orderBy("glAccountId").queryList();
-transactionTotalsMap = [:];
-transactionTotalsMap.putAll(longtermAssetOpeningBalances);
+accountBalanceList = []
+transactionTotals = []
+balanceTotal = BigDecimal.ZERO
+List longtermAssetAndExprs = mainAndExprs as LinkedList
+longtermAssetAndExprs.add(EntityCondition.makeCondition("glAccountClassId", EntityOperator.IN, longtermAssetAccountClassIds))
+transactionTotals = select("glAccountId", "accountName", "accountCode", "debitCreditFlag", "amount").from("AcctgTransEntrySums").where(longtermAssetAndExprs).orderBy("glAccountId").queryList()
+transactionTotalsMap = [:]
+transactionTotalsMap.putAll(longtermAssetOpeningBalances)
transactionTotals.each { transactionTotal ->
- Map accountMap = (Map)transactionTotalsMap.get(transactionTotal.glAccountId);
+ Map accountMap = (Map)transactionTotalsMap.get(transactionTotal.glAccountId)
if (!accountMap) {
- accountMap = UtilMisc.makeMapWritable(transactionTotal);
- accountMap.remove("debitCreditFlag");
- accountMap.remove("amount");
- accountMap.put("D", BigDecimal.ZERO);
- accountMap.put("C", BigDecimal.ZERO);
- accountMap.put("balance", BigDecimal.ZERO);
+ accountMap = UtilMisc.makeMapWritable(transactionTotal)
+ accountMap.remove("debitCreditFlag")
+ accountMap.remove("amount")
+ accountMap.put("D", BigDecimal.ZERO)
+ accountMap.put("C", BigDecimal.ZERO)
+ accountMap.put("balance", BigDecimal.ZERO)
}
- UtilMisc.addToBigDecimalInMap(accountMap, transactionTotal.debitCreditFlag, transactionTotal.amount);
- BigDecimal debitAmount = (BigDecimal)accountMap.get("D");
- BigDecimal creditAmount = (BigDecimal)accountMap.get("C");
+ UtilMisc.addToBigDecimalInMap(accountMap, transactionTotal.debitCreditFlag, transactionTotal.amount)
+ BigDecimal debitAmount = (BigDecimal)accountMap.get("D")
+ BigDecimal creditAmount = (BigDecimal)accountMap.get("C")
// assets are accounts of class DEBIT: the balance is given by debits minus credits
- BigDecimal balance = debitAmount.subtract(creditAmount);
- accountMap.put("balance", balance);
- transactionTotalsMap.put(transactionTotal.glAccountId, accountMap);
+ BigDecimal balance = debitAmount.subtract(creditAmount)
+ accountMap.put("balance", balance)
+ transactionTotalsMap.put(transactionTotal.glAccountId, accountMap)
}
-accountBalanceList = UtilMisc.sortMaps(transactionTotalsMap.values().asList(), UtilMisc.toList("accountCode"));
+accountBalanceList = UtilMisc.sortMaps(transactionTotalsMap.values().asList(), UtilMisc.toList("accountCode"))
accountBalanceList.each { accountBalance ->
- balanceTotal = balanceTotal + accountBalance.balance;
+ balanceTotal = balanceTotal + accountBalance.balance
}
-context.longtermAssetBalanceTotal = balanceTotal;
-balanceTotalList.add(UtilMisc.toMap("totalName", "AccountingLongTermAssets", "balance", balanceTotal));
+context.longtermAssetBalanceTotal = balanceTotal
+balanceTotalList.add(UtilMisc.toMap("totalName", "AccountingLongTermAssets", "balance", balanceTotal))
// CONTRA ASSETS
// account balances
-accountBalanceList = [];
-transactionTotals = [];
-balanceTotal = BigDecimal.ZERO;
-List contraAssetAndExprs = mainAndExprs as LinkedList;
-contraAssetAndExprs.add(EntityCondition.makeCondition("glAccountClassId", EntityOperator.IN, contraAssetAccountClassIds));
-transactionTotals = select("glAccountId", "accountName", "accountCode", "debitCreditFlag", "amount").from("AcctgTransEntrySums").where(contraAssetAndExprs).orderBy("glAccountId").queryList();
+accountBalanceList = []
+transactionTotals = []
+balanceTotal = BigDecimal.ZERO
+List contraAssetAndExprs = mainAndExprs as LinkedList
+contraAssetAndExprs.add(EntityCondition.makeCondition("glAccountClassId", EntityOperator.IN, contraAssetAccountClassIds))
+transactionTotals = select("glAccountId", "accountName", "accountCode", "debitCreditFlag", "amount").from("AcctgTransEntrySums").where(contraAssetAndExprs).orderBy("glAccountId").queryList()
-transactionTotalsMap = [:];
-transactionTotalsMap.putAll(contraAssetOpeningBalances);
+transactionTotalsMap = [:]
+transactionTotalsMap.putAll(contraAssetOpeningBalances)
transactionTotals.each { transactionTotal ->
- Map accountMap = (Map)transactionTotalsMap.get(transactionTotal.glAccountId);
+ Map accountMap = (Map)transactionTotalsMap.get(transactionTotal.glAccountId)
if (!accountMap) {
- accountMap = UtilMisc.makeMapWritable(transactionTotal);
- accountMap.remove("debitCreditFlag");
- accountMap.remove("amount");
- accountMap.put("D", BigDecimal.ZERO);
- accountMap.put("C", BigDecimal.ZERO);
- accountMap.put("balance", BigDecimal.ZERO);
+ accountMap = UtilMisc.makeMapWritable(transactionTotal)
+ accountMap.remove("debitCreditFlag")
+ accountMap.remove("amount")
+ accountMap.put("D", BigDecimal.ZERO)
+ accountMap.put("C", BigDecimal.ZERO)
+ accountMap.put("balance", BigDecimal.ZERO)
}
- UtilMisc.addToBigDecimalInMap(accountMap, transactionTotal.debitCreditFlag, transactionTotal.amount);
- BigDecimal debitAmount = (BigDecimal)accountMap.get("D");
- BigDecimal creditAmount = (BigDecimal)accountMap.get("C");
+ UtilMisc.addToBigDecimalInMap(accountMap, transactionTotal.debitCreditFlag, transactionTotal.amount)
+ BigDecimal debitAmount = (BigDecimal)accountMap.get("D")
+ BigDecimal creditAmount = (BigDecimal)accountMap.get("C")
// contra assets are accounts of class CREDIT: the balance is given by credits minus debits
- BigDecimal balance = debitAmount.subtract(creditAmount);
- accountMap.put("balance", balance);
- transactionTotalsMap.put(transactionTotal.glAccountId, accountMap);
+ BigDecimal balance = debitAmount.subtract(creditAmount)
+ accountMap.put("balance", balance)
+ transactionTotalsMap.put(transactionTotal.glAccountId, accountMap)
}
-accountBalanceList = UtilMisc.sortMaps(transactionTotalsMap.values().asList(), UtilMisc.toList("accountCode"));
+accountBalanceList = UtilMisc.sortMaps(transactionTotalsMap.values().asList(), UtilMisc.toList("accountCode"))
accountBalanceList.each { accountBalance ->
- balanceTotal = balanceTotal + accountBalance.balance;
+ balanceTotal = balanceTotal + accountBalance.balance
}
-context.assetAccountBalanceList.addAll(accountBalanceList);
-context.assetAccountBalanceList.add(UtilMisc.toMap("accountName", uiLabelMap.AccountingTotalAccumulatedDepreciation, "balance", balanceTotal));
-context.contraAssetBalanceTotal = balanceTotal;
-balanceTotalList.add(UtilMisc.toMap("totalName", "AccountingTotalAccumulatedDepreciation", "balance", balanceTotal));
-balanceTotalList.add(UtilMisc.toMap("totalName", "AccountingTotalAssets", "balance", (context.currentAssetBalanceTotal + context.longtermAssetBalanceTotal + balanceTotal)));
+context.assetAccountBalanceList.addAll(accountBalanceList)
+context.assetAccountBalanceList.add(UtilMisc.toMap("accountName", uiLabelMap.AccountingTotalAccumulatedDepreciation, "balance", balanceTotal))
+context.contraAssetBalanceTotal = balanceTotal
+balanceTotalList.add(UtilMisc.toMap("totalName", "AccountingTotalAccumulatedDepreciation", "balance", balanceTotal))
+balanceTotalList.add(UtilMisc.toMap("totalName", "AccountingTotalAssets", "balance", (context.currentAssetBalanceTotal + context.longtermAssetBalanceTotal + balanceTotal)))
// LIABILITY
// account balances
-accountBalanceList = [];
-transactionTotals = [];
-balanceTotal = BigDecimal.ZERO;
-List liabilityAndExprs = mainAndExprs as LinkedList;
-liabilityAndExprs.add(EntityCondition.makeCondition("glAccountClassId", EntityOperator.IN, liabilityAccountClassIds));
-transactionTotals = select("glAccountId", "accountName", "accountCode", "debitCreditFlag", "amount").from("AcctgTransEntrySums").where(liabilityAndExprs).orderBy("glAccountId").queryList();
-transactionTotalsMap = [:];
-transactionTotalsMap.putAll(liabilityOpeningBalances);
+accountBalanceList = []
+transactionTotals = []
+balanceTotal = BigDecimal.ZERO
+List liabilityAndExprs = mainAndExprs as LinkedList
+liabilityAndExprs.add(EntityCondition.makeCondition("glAccountClassId", EntityOperator.IN, liabilityAccountClassIds))
+transactionTotals = select("glAccountId", "accountName", "accountCode", "debitCreditFlag", "amount").from("AcctgTransEntrySums").where(liabilityAndExprs).orderBy("glAccountId").queryList()
+transactionTotalsMap = [:]
+transactionTotalsMap.putAll(liabilityOpeningBalances)
transactionTotals.each { transactionTotal ->
- Map accountMap = (Map)transactionTotalsMap.get(transactionTotal.glAccountId);
+ Map accountMap = (Map)transactionTotalsMap.get(transactionTotal.glAccountId)
if (!accountMap) {
- accountMap = UtilMisc.makeMapWritable(transactionTotal);
- accountMap.remove("debitCreditFlag");
- accountMap.remove("amount");
- accountMap.put("D", BigDecimal.ZERO);
- accountMap.put("C", BigDecimal.ZERO);
- accountMap.put("balance", BigDecimal.ZERO);
+ accountMap = UtilMisc.makeMapWritable(transactionTotal)
+ accountMap.remove("debitCreditFlag")
+ accountMap.remove("amount")
+ accountMap.put("D", BigDecimal.ZERO)
+ accountMap.put("C", BigDecimal.ZERO)
+ accountMap.put("balance", BigDecimal.ZERO)
}
- UtilMisc.addToBigDecimalInMap(accountMap, transactionTotal.debitCreditFlag, transactionTotal.amount);
- BigDecimal debitAmount = (BigDecimal)accountMap.get("D");
- BigDecimal creditAmount = (BigDecimal)accountMap.get("C");
+ UtilMisc.addToBigDecimalInMap(accountMap, transactionTotal.debitCreditFlag, transactionTotal.amount)
+ BigDecimal debitAmount = (BigDecimal)accountMap.get("D")
+ BigDecimal creditAmount = (BigDecimal)accountMap.get("C")
// liabilities are accounts of class CREDIT: the balance is given by credits minus debits
- BigDecimal balance = creditAmount.subtract(debitAmount);
- accountMap.put("balance", balance);
- transactionTotalsMap.put(transactionTotal.glAccountId, accountMap);
+ BigDecimal balance = creditAmount.subtract(debitAmount)
+ accountMap.put("balance", balance)
+ transactionTotalsMap.put(transactionTotal.glAccountId, accountMap)
}
-accountBalanceList = UtilMisc.sortMaps(transactionTotalsMap.values().asList(), UtilMisc.toList("accountCode"));
+accountBalanceList = UtilMisc.sortMaps(transactionTotalsMap.values().asList(), UtilMisc.toList("accountCode"))
accountBalanceList.each { accountBalance ->
- balanceTotal = balanceTotal + accountBalance.balance;
+ balanceTotal = balanceTotal + accountBalance.balance
}
-context.liabilityAccountBalanceList = accountBalanceList;
-context.liabilityAccountBalanceList.add(UtilMisc.toMap("accountName", uiLabelMap.AccountingTotalLiabilities, "balance", balanceTotal));
-context.liabilityBalanceTotal = balanceTotal;
+context.liabilityAccountBalanceList = accountBalanceList
+context.liabilityAccountBalanceList.add(UtilMisc.toMap("accountName", uiLabelMap.AccountingTotalLiabilities, "balance", balanceTotal))
+context.liabilityBalanceTotal = balanceTotal
// CURRENT LIABILITY
// account balances
-accountBalanceList = [];
-transactionTotals = [];
-balanceTotal = BigDecimal.ZERO;
-List currentLiabilityAndExprs = mainAndExprs as LinkedList;
-currentLiabilityAndExprs.add(EntityCondition.makeCondition("glAccountClassId", EntityOperator.IN, currentLiabilityAccountClassIds));
-transactionTotals = select("glAccountId", "accountName", "accountCode", "debitCreditFlag", "amount").from("AcctgTransEntrySums").where(currentLiabilityAndExprs).orderBy("glAccountId").queryList();
-transactionTotalsMap = [:];
-transactionTotalsMap.putAll(currentLiabilityOpeningBalances);
+accountBalanceList = []
+transactionTotals = []
+balanceTotal = BigDecimal.ZERO
+List currentLiabilityAndExprs = mainAndExprs as LinkedList
+currentLiabilityAndExprs.add(EntityCondition.makeCondition("glAccountClassId", EntityOperator.IN, currentLiabilityAccountClassIds))
+transactionTotals = select("glAccountId", "accountName", "accountCode", "debitCreditFlag", "amount").from("AcctgTransEntrySums").where(currentLiabilityAndExprs).orderBy("glAccountId").queryList()
+transactionTotalsMap = [:]
+transactionTotalsMap.putAll(currentLiabilityOpeningBalances)
transactionTotals.each { transactionTotal ->
- Map accountMap = (Map)transactionTotalsMap.get(transactionTotal.glAccountId);
+ Map accountMap = (Map)transactionTotalsMap.get(transactionTotal.glAccountId)
if (!accountMap) {
- accountMap = UtilMisc.makeMapWritable(transactionTotal);
- accountMap.remove("debitCreditFlag");
- accountMap.remove("amount");
- accountMap.put("D", BigDecimal.ZERO);
- accountMap.put("C", BigDecimal.ZERO);
- accountMap.put("balance", BigDecimal.ZERO);
+ accountMap = UtilMisc.makeMapWritable(transactionTotal)
+ accountMap.remove("debitCreditFlag")
+ accountMap.remove("amount")
+ accountMap.put("D", BigDecimal.ZERO)
+ accountMap.put("C", BigDecimal.ZERO)
+ accountMap.put("balance", BigDecimal.ZERO)
}
- UtilMisc.addToBigDecimalInMap(accountMap, transactionTotal.debitCreditFlag, transactionTotal.amount);
- BigDecimal debitAmount = (BigDecimal)accountMap.get("D");
- BigDecimal creditAmount = (BigDecimal)accountMap.get("C");
+ UtilMisc.addToBigDecimalInMap(accountMap, transactionTotal.debitCreditFlag, transactionTotal.amount)
+ BigDecimal debitAmount = (BigDecimal)accountMap.get("D")
+ BigDecimal creditAmount = (BigDecimal)accountMap.get("C")
// liabilities are accounts of class CREDIT: the balance is given by credits minus debits
- BigDecimal balance = creditAmount.subtract(debitAmount);
- accountMap.put("balance", balance);
- transactionTotalsMap.put(transactionTotal.glAccountId, accountMap);
+ BigDecimal balance = creditAmount.subtract(debitAmount)
+ accountMap.put("balance", balance)
+ transactionTotalsMap.put(transactionTotal.glAccountId, accountMap)
}
-accountBalanceList = UtilMisc.sortMaps(transactionTotalsMap.values().asList(), UtilMisc.toList("accountCode"));
+accountBalanceList = UtilMisc.sortMaps(transactionTotalsMap.values().asList(), UtilMisc.toList("accountCode"))
accountBalanceList.each { accountBalance ->
- balanceTotal = balanceTotal + accountBalance.balance;
+ balanceTotal = balanceTotal + accountBalance.balance
}
-context.currentLiabilityBalanceTotal = balanceTotal;
-balanceTotalList.add(UtilMisc.toMap("totalName", "AccountingCurrentLiabilities", "balance", balanceTotal));
+context.currentLiabilityBalanceTotal = balanceTotal
+balanceTotalList.add(UtilMisc.toMap("totalName", "AccountingCurrentLiabilities", "balance", balanceTotal))
// EQUITY
// account balances
-accountBalanceList = [];
-transactionTotals = [];
-balanceTotal = BigDecimal.ZERO;
-List equityAndExprs = mainAndExprs as LinkedList;
-equityAndExprs.add(EntityCondition.makeCondition("glAccountClassId", EntityOperator.IN, equityAccountClassIds));
-transactionTotals = select("glAccountId", "accountName", "accountCode", "debitCreditFlag", "amount").from("AcctgTransEntrySums").where(equityAndExprs).orderBy("glAccountId").queryList();
-transactionTotalsMap = [:];
-transactionTotalsMap.putAll(equityOpeningBalances);
+accountBalanceList = []
+transactionTotals = []
+balanceTotal = BigDecimal.ZERO
+List equityAndExprs = mainAndExprs as LinkedList
+equityAndExprs.add(EntityCondition.makeCondition("glAccountClassId", EntityOperator.IN, equityAccountClassIds))
+transactionTotals = select("glAccountId", "accountName", "accountCode", "debitCreditFlag", "amount").from("AcctgTransEntrySums").where(equityAndExprs).orderBy("glAccountId").queryList()
+transactionTotalsMap = [:]
+transactionTotalsMap.putAll(equityOpeningBalances)
transactionTotals.each { transactionTotal ->
- Map accountMap = (Map)transactionTotalsMap.get(transactionTotal.glAccountId);
+ Map accountMap = (Map)transactionTotalsMap.get(transactionTotal.glAccountId)
if (!accountMap) {
- accountMap = UtilMisc.makeMapWritable(transactionTotal);
- accountMap.remove("debitCreditFlag");
- accountMap.remove("amount");
- accountMap.put("D", BigDecimal.ZERO);
- accountMap.put("C", BigDecimal.ZERO);
- accountMap.put("balance", BigDecimal.ZERO);
+ accountMap = UtilMisc.makeMapWritable(transactionTotal)
+ accountMap.remove("debitCreditFlag")
+ accountMap.remove("amount")
+ accountMap.put("D", BigDecimal.ZERO)
+ accountMap.put("C", BigDecimal.ZERO)
+ accountMap.put("balance", BigDecimal.ZERO)
}
- UtilMisc.addToBigDecimalInMap(accountMap, transactionTotal.debitCreditFlag, transactionTotal.amount);
- BigDecimal debitAmount = (BigDecimal)accountMap.get("D");
- BigDecimal creditAmount = (BigDecimal)accountMap.get("C");
+ UtilMisc.addToBigDecimalInMap(accountMap, transactionTotal.debitCreditFlag, transactionTotal.amount)
+ BigDecimal debitAmount = (BigDecimal)accountMap.get("D")
+ BigDecimal creditAmount = (BigDecimal)accountMap.get("C")
// equities are accounts of class CREDIT: the balance is given by credits minus debits
- BigDecimal balance = creditAmount.subtract(debitAmount);
- accountMap.put("balance", balance);
- transactionTotalsMap.put(transactionTotal.glAccountId, accountMap);
+ BigDecimal balance = creditAmount.subtract(debitAmount)
+ accountMap.put("balance", balance)
+ transactionTotalsMap.put(transactionTotal.glAccountId, accountMap)
}
// Add the "retained earnings" account
-Map netIncomeResult = runService('prepareIncomeStatement', ["organizationPartyId": organizationPartyId, "glFiscalTypeId": glFiscalTypeId, "fromDate": fromDate, "thruDate": thruDate, "userLogin": userLogin]);
-BigDecimal netIncome = (BigDecimal)netIncomeResult.totalNetIncome;
-GenericValue retainedEarningsAccount = from("GlAccountTypeDefault").where("glAccountTypeId", "RETAINED_EARNINGS", "organizationPartyId", organizationPartyId).cache(true).queryOne();
+Map netIncomeResult = runService('prepareIncomeStatement', ["organizationPartyId": organizationPartyId, "glFiscalTypeId": glFiscalTypeId, "fromDate": fromDate, "thruDate": thruDate, "userLogin": userLogin])
+BigDecimal netIncome = (BigDecimal)netIncomeResult.totalNetIncome
+GenericValue retainedEarningsAccount = from("GlAccountTypeDefault").where("glAccountTypeId", "RETAINED_EARNINGS", "organizationPartyId", organizationPartyId).cache(true).queryOne()
if (retainedEarningsAccount) {
- GenericValue retainedEarningsGlAccount = retainedEarningsAccount.getRelatedOne("GlAccount", false);
- transactionTotalsMap.put(retainedEarningsGlAccount.glAccountId, UtilMisc.toMap("glAccountId", retainedEarningsGlAccount.glAccountId,"accountName", retainedEarningsGlAccount.accountName, "accountCode", retainedEarningsGlAccount.accountCode, "balance", netIncome));
+ GenericValue retainedEarningsGlAccount = retainedEarningsAccount.getRelatedOne("GlAccount", false)
+ transactionTotalsMap.put(retainedEarningsGlAccount.glAccountId, UtilMisc.toMap("glAccountId", retainedEarningsGlAccount.glAccountId,"accountName", retainedEarningsGlAccount.accountName, "accountCode", retainedEarningsGlAccount.accountCode, "balance", netIncome))
}
-accountBalanceList = UtilMisc.sortMaps(transactionTotalsMap.values().asList(), UtilMisc.toList("accountCode"));
+accountBalanceList = UtilMisc.sortMaps(transactionTotalsMap.values().asList(), UtilMisc.toList("accountCode"))
accountBalanceList.each { accountBalance ->
- balanceTotal = balanceTotal + accountBalance.balance;
+ balanceTotal = balanceTotal + accountBalance.balance
}
-context.equityAccountBalanceList = accountBalanceList;
-context.equityAccountBalanceList.add(UtilMisc.toMap("accountName", uiLabelMap.AccountingTotalEquities, "balance", balanceTotal));
-context.equityBalanceTotal = balanceTotal;
+context.equityAccountBalanceList = accountBalanceList
+context.equityAccountBalanceList.add(UtilMisc.toMap("accountName", uiLabelMap.AccountingTotalEquities, "balance", balanceTotal))
+context.equityBalanceTotal = balanceTotal
context.liabilityEquityBalanceTotal = context.liabilityBalanceTotal + context.equityBalanceTotal
-balanceTotalList.add(UtilMisc.toMap("totalName", "AccountingEquities", "balance", context.equityBalanceTotal));
-balanceTotalList.add(UtilMisc.toMap("totalName", "AccountingTotalLiabilitiesAndEquities", "balance", context.liabilityEquityBalanceTotal));
+balanceTotalList.add(UtilMisc.toMap("totalName", "AccountingEquities", "balance", context.equityBalanceTotal))
+balanceTotalList.add(UtilMisc.toMap("totalName", "AccountingTotalLiabilitiesAndEquities", "balance", context.liabilityEquityBalanceTotal))
-context.balanceTotalList = balanceTotalList;
+context.balanceTotalList = balanceTotalList
diff --git a/applications/accounting/groovyScripts/reports/CashFlowStatement.groovy b/applications/accounting/groovyScripts/reports/CashFlowStatement.groovy
index 3e1dad64f9..b649489fb9 100644
--- a/applications/accounting/groovyScripts/reports/CashFlowStatement.groovy
+++ b/applications/accounting/groovyScripts/reports/CashFlowStatement.groovy
@@ -30,193 +30,193 @@ import org.apache.ofbiz.party.party.PartyWorker
import java.sql.Timestamp
if (!fromDate) {
- return;
+ return
}
if (!thruDate) {
- thruDate = UtilDateTime.nowTimestamp();
+ thruDate = UtilDateTime.nowTimestamp()
}
if (!parameters.glFiscalTypeId) {
- parameters.glFiscalTypeId = "ACTUAL";
+ parameters.glFiscalTypeId = "ACTUAL"
}
-uiLabelMap = UtilProperties.getResourceBundleMap("AccountingUiLabels", locale);
-parametersFromDate = fromDate;
+uiLabelMap = UtilProperties.getResourceBundleMap("AccountingUiLabels", locale)
+parametersFromDate = fromDate
// Setup the divisions for which the report is executed
-List partyIds = PartyWorker.getAssociatedPartyIdsByRelationshipType(delegator, parameters.get('ApplicationDecorator|organizationPartyId'), 'GROUP_ROLLUP');
-partyIds.add(parameters.get('ApplicationDecorator|organizationPartyId'));
+List partyIds = PartyWorker.getAssociatedPartyIdsByRelationshipType(delegator, parameters.get('ApplicationDecorator|organizationPartyId'), 'GROUP_ROLLUP')
+partyIds.add(parameters.get('ApplicationDecorator|organizationPartyId'))
// Get the group of account classes that will be used to position accounts in the proper section of the Cash Flow statement
-GenericValue glAccountClass = from("GlAccountClass").where("glAccountClassId", "CASH_EQUIVALENT").cache(true).queryOne();
-List glAccountClassIds = UtilAccounting.getDescendantGlAccountClassIds(glAccountClass);
+GenericValue glAccountClass = from("GlAccountClass").where("glAccountClassId", "CASH_EQUIVALENT").cache(true).queryOne()
+List glAccountClassIds = UtilAccounting.getDescendantGlAccountClassIds(glAccountClass)
-List cashFlowBalanceTotalList = [];
+List cashFlowBalanceTotalList = []
// Find the last closed time period to get the fromDate for the transactions in the current period and the ending balances of the last closed period
-Map lastClosedTimePeriodResult = runService('findLastClosedDate', ["organizationPartyId":parameters.get('ApplicationDecorator|organizationPartyId'), "findDate": parametersFromDate,"userLogin":userLogin]);
-Timestamp periodClosingFromDate = (Timestamp)lastClosedTimePeriodResult.lastClosedDate;
+Map lastClosedTimePeriodResult = runService('findLastClosedDate', ["organizationPartyId":parameters.get('ApplicationDecorator|organizationPartyId'), "findDate": parametersFromDate,"userLogin":userLogin])
+Timestamp periodClosingFromDate = (Timestamp)lastClosedTimePeriodResult.lastClosedDate
if (!periodClosingFromDate) {
- return;
+ return
}
-GenericValue lastClosedTimePeriod = (GenericValue)lastClosedTimePeriodResult.lastClosedTimePeriod;
+GenericValue lastClosedTimePeriod = (GenericValue)lastClosedTimePeriodResult.lastClosedTimePeriod
// Get the opening balances of Cash Account
-Map openingCashBalances = [:];
+Map openingCashBalances = [:]
if (lastClosedTimePeriod) {
- List timePeriodAndExprs = [];
- timePeriodAndExprs.add(EntityCondition.makeCondition("organizationPartyId", EntityOperator.IN, partyIds));
- timePeriodAndExprs.add(EntityCondition.makeCondition("glAccountClassId", EntityOperator.IN, glAccountClassIds));
- timePeriodAndExprs.add(EntityCondition.makeCondition("endingBalance", EntityOperator.NOT_EQUAL, BigDecimal.ZERO));
- timePeriodAndExprs.add(EntityCondition.makeCondition("customTimePeriodId", EntityOperator.EQUALS, lastClosedTimePeriod.customTimePeriodId));
- List lastTimePeriodHistories = from("GlAccountAndHistory").where(timePeriodAndExprs).queryList();
+ List timePeriodAndExprs = []
+ timePeriodAndExprs.add(EntityCondition.makeCondition("organizationPartyId", EntityOperator.IN, partyIds))
+ timePeriodAndExprs.add(EntityCondition.makeCondition("glAccountClassId", EntityOperator.IN, glAccountClassIds))
+ timePeriodAndExprs.add(EntityCondition.makeCondition("endingBalance", EntityOperator.NOT_EQUAL, BigDecimal.ZERO))
+ timePeriodAndExprs.add(EntityCondition.makeCondition("customTimePeriodId", EntityOperator.EQUALS, lastClosedTimePeriod.customTimePeriodId))
+ List lastTimePeriodHistories = from("GlAccountAndHistory").where(timePeriodAndExprs).queryList()
lastTimePeriodHistories.each { lastTimePeriodHistory ->
- Map accountMap = ["glAccountId":lastTimePeriodHistory.glAccountId, "accountCode":lastTimePeriodHistory.accountCode, "accountName":lastTimePeriodHistory.accountName, "balance":lastTimePeriodHistory.getBigDecimal("endingBalance"), "D":lastTimePeriodHistory.getBigDecimal("postedDebits"), "C":lastTimePeriodHistory.getBigDecimal("postedCredits")];
- openingCashBalances.(lastTimePeriodHistory.glAccountId) = accountMap;
+ Map accountMap = ["glAccountId":lastTimePeriodHistory.glAccountId, "accountCode":lastTimePeriodHistory.accountCode, "accountName":lastTimePeriodHistory.accountName, "balance":lastTimePeriodHistory.getBigDecimal("endingBalance"), "D":lastTimePeriodHistory.getBigDecimal("postedDebits"), "C":lastTimePeriodHistory.getBigDecimal("postedCredits")]
+ openingCashBalances.(lastTimePeriodHistory.glAccountId) = accountMap
}
}
-List mainAndExprs = [];
-mainAndExprs.add(EntityCondition.makeCondition("organizationPartyId", EntityOperator.IN, partyIds));
-mainAndExprs.add(EntityCondition.makeCondition("isPosted", EntityOperator.EQUALS, "Y"));
-mainAndExprs.add(EntityCondition.makeCondition("glFiscalTypeId", EntityOperator.EQUALS, parameters.glFiscalTypeId));
-mainAndExprs.add(EntityCondition.makeCondition("glAccountClassId", EntityOperator.IN, glAccountClassIds));
+List mainAndExprs = []
+mainAndExprs.add(EntityCondition.makeCondition("organizationPartyId", EntityOperator.IN, partyIds))
+mainAndExprs.add(EntityCondition.makeCondition("isPosted", EntityOperator.EQUALS, "Y"))
+mainAndExprs.add(EntityCondition.makeCondition("glFiscalTypeId", EntityOperator.EQUALS, parameters.glFiscalTypeId))
+mainAndExprs.add(EntityCondition.makeCondition("glAccountClassId", EntityOperator.IN, glAccountClassIds))
// All GlAccount's transactions (from last closing period to parameter's fromDate)
-accountBalanceList = [];
-transactionTotals = [];
-balanceTotal = BigDecimal.ZERO;
-List openingCashBalanceAndExprs = mainAndExprs as LinkedList;
-openingCashBalanceAndExprs.add(EntityCondition.makeCondition("transactionDate", EntityOperator.GREATER_THAN_EQUAL_TO, periodClosingFromDate));
-openingCashBalanceAndExprs.add(EntityCondition.makeCondition("transactionDate", EntityOperator.LESS_THAN, parametersFromDate));
-transactionTotals = select("glAccountId", "accountName", "accountCode", "debitCreditFlag", "amount").from("AcctgTransEntrySums").where(openingCashBalanceAndExprs).orderBy("glAccountId").queryList();
-transactionTotalsMap = [:];
-transactionTotalsMap.putAll(openingCashBalances);
+accountBalanceList = []
+transactionTotals = []
+balanceTotal = BigDecimal.ZERO
+List openingCashBalanceAndExprs = mainAndExprs as LinkedList
+openingCashBalanceAndExprs.add(EntityCondition.makeCondition("transactionDate", EntityOperator.GREATER_THAN_EQUAL_TO, periodClosingFromDate))
+openingCashBalanceAndExprs.add(EntityCondition.makeCondition("transactionDate", EntityOperator.LESS_THAN, parametersFromDate))
+transactionTotals = select("glAccountId", "accountName", "accountCode", "debitCreditFlag", "amount").from("AcctgTransEntrySums").where(openingCashBalanceAndExprs).orderBy("glAccountId").queryList()
+transactionTotalsMap = [:]
+transactionTotalsMap.putAll(openingCashBalances)
transactionTotals.each { transactionTotal ->
- Map accountMap = (Map)transactionTotalsMap.get(transactionTotal.glAccountId);
+ Map accountMap = (Map)transactionTotalsMap.get(transactionTotal.glAccountId)
if (!accountMap) {
- accountMap = UtilMisc.makeMapWritable(transactionTotal);
- accountMap.remove("debitCreditFlag");
- accountMap.remove("amount");
- accountMap.D = BigDecimal.ZERO;
- accountMap.C = BigDecimal.ZERO;
- accountMap.balance = BigDecimal.ZERO;
+ accountMap = UtilMisc.makeMapWritable(transactionTotal)
+ accountMap.remove("debitCreditFlag")
+ accountMap.remove("amount")
+ accountMap.D = BigDecimal.ZERO
+ accountMap.C = BigDecimal.ZERO
+ accountMap.balance = BigDecimal.ZERO
}
if (accountMap.debitCreditFlag && accountMap.amount) {
- accountMap.remove("debitCreditFlag");
- accountMap.remove("amount");
+ accountMap.remove("debitCreditFlag")
+ accountMap.remove("amount")
}
if (transactionTotal.debitCreditFlag == "C") {
- accountMap.C = ((BigDecimal)accountMap.get("C")).add(transactionTotal.amount);
- accountMap.balance = (accountMap.balance).subtract(transactionTotal.amount);
+ accountMap.C = ((BigDecimal)accountMap.get("C")).add(transactionTotal.amount)
+ accountMap.balance = (accountMap.balance).subtract(transactionTotal.amount)
} else {
- accountMap.D = ((BigDecimal)accountMap.get("D")).add(transactionTotal.amount);
- accountMap.balance = (accountMap.balance).add(transactionTotal.amount);
+ accountMap.D = ((BigDecimal)accountMap.get("D")).add(transactionTotal.amount)
+ accountMap.balance = (accountMap.balance).add(transactionTotal.amount)
}
- transactionTotalsMap.put(transactionTotal.glAccountId, accountMap);
+ transactionTotalsMap.put(transactionTotal.glAccountId, accountMap)
}
-glAccountIdList = [];
-accountBalanceList = UtilMisc.sortMaps(transactionTotalsMap.values().asList(), UtilMisc.toList("accountCode"));
+glAccountIdList = []
+accountBalanceList = UtilMisc.sortMaps(transactionTotalsMap.values().asList(), UtilMisc.toList("accountCode"))
accountBalanceList.each { accountBalance ->
- balanceTotal = balanceTotal.add(accountBalance.balance);
+ balanceTotal = balanceTotal.add(accountBalance.balance)
}
-openingCashBalanceTotal = balanceTotal;
-context.openingCashBalanceList = accountBalanceList;
-cashFlowBalanceTotalList.add("totalName":"AccountingOpeningCashBalance", "balance":balanceTotal);
-openingTransactionKeySet = transactionTotalsMap.keySet();
+openingCashBalanceTotal = balanceTotal
+context.openingCashBalanceList = accountBalanceList
+cashFlowBalanceTotalList.add("totalName":"AccountingOpeningCashBalance", "balance":balanceTotal)
+openingTransactionKeySet = transactionTotalsMap.keySet()
// PERIOD CASH BALANCE
// GlAccounts from parameter's fromDate to parameter's thruDate.
-accountBalanceList = [];
-transactionTotals = [];
-balanceTotal = BigDecimal.ZERO;
-List periodCashBalanceAndExprs = mainAndExprs as LinkedList;
-periodCashBalanceAndExprs.add(EntityCondition.makeCondition("transactionDate", EntityOperator.GREATER_THAN_EQUAL_TO, parametersFromDate));
-periodCashBalanceAndExprs.add(EntityCondition.makeCondition("transactionDate", EntityOperator.LESS_THAN, thruDate));
-transactionTotals = select("glAccountId", "accountName", "accountCode", "debitCreditFlag", "amount").from("AcctgTransEntrySums").where(periodCashBalanceAndExprs).orderBy("glAccountId").queryList();
+accountBalanceList = []
+transactionTotals = []
+balanceTotal = BigDecimal.ZERO
+List periodCashBalanceAndExprs = mainAndExprs as LinkedList
+periodCashBalanceAndExprs.add(EntityCondition.makeCondition("transactionDate", EntityOperator.GREATER_THAN_EQUAL_TO, parametersFromDate))
+periodCashBalanceAndExprs.add(EntityCondition.makeCondition("transactionDate", EntityOperator.LESS_THAN, thruDate))
+transactionTotals = select("glAccountId", "accountName", "accountCode", "debitCreditFlag", "amount").from("AcctgTransEntrySums").where(periodCashBalanceAndExprs).orderBy("glAccountId").queryList()
if (transactionTotals) {
- Map transactionTotalsMap = [:];
- balanceTotalCredit = BigDecimal.ZERO;
- balanceTotalDebit = BigDecimal.ZERO;
+ Map transactionTotalsMap = [:]
+ balanceTotalCredit = BigDecimal.ZERO
+ balanceTotalDebit = BigDecimal.ZERO
transactionTotals.each { transactionTotal ->
- Map accountMap = (Map)transactionTotalsMap.get(transactionTotal.glAccountId);
+ Map accountMap = (Map)transactionTotalsMap.get(transactionTotal.glAccountId)
if (!accountMap) {
- accountMap = UtilMisc.makeMapWritable(transactionTotal);
- accountMap.remove("debitCreditFlag");
- accountMap.remove("amount");
- accountMap.D = BigDecimal.ZERO;
- accountMap.C = BigDecimal.ZERO;
- accountMap.balance = BigDecimal.ZERO;
+ accountMap = UtilMisc.makeMapWritable(transactionTotal)
+ accountMap.remove("debitCreditFlag")
+ accountMap.remove("amount")
+ accountMap.D = BigDecimal.ZERO
+ accountMap.C = BigDecimal.ZERO
+ accountMap.balance = BigDecimal.ZERO
}
- UtilMisc.addToBigDecimalInMap(accountMap, transactionTotal.debitCreditFlag, transactionTotal.amount);
+ UtilMisc.addToBigDecimalInMap(accountMap, transactionTotal.debitCreditFlag, transactionTotal.amount)
if ("D".equals(transactionTotal.debitCreditFlag)) {
- balanceTotalDebit = balanceTotalDebit.add(transactionTotal.amount);
+ balanceTotalDebit = balanceTotalDebit.add(transactionTotal.amount)
} else {
- balanceTotalCredit = balanceTotalCredit.add(transactionTotal.amount);
+ balanceTotalCredit = balanceTotalCredit.add(transactionTotal.amount)
}
- BigDecimal debitAmount = (BigDecimal)accountMap.D;
- BigDecimal creditAmount = (BigDecimal)accountMap.C;
- BigDecimal balance = debitAmount.subtract(creditAmount);
- accountMap.balance = balance;
- transactionTotalsMap.(transactionTotal.glAccountId) = accountMap;
+ BigDecimal debitAmount = (BigDecimal)accountMap.D
+ BigDecimal creditAmount = (BigDecimal)accountMap.C
+ BigDecimal balance = debitAmount.subtract(creditAmount)
+ accountMap.balance = balance
+ transactionTotalsMap.(transactionTotal.glAccountId) = accountMap
}
- accountBalanceList = UtilMisc.sortMaps(transactionTotalsMap.values().asList(), UtilMisc.toList("accountCode"));
- balanceTotal = balanceTotalDebit.subtract(balanceTotalCredit);
+ accountBalanceList = UtilMisc.sortMaps(transactionTotalsMap.values().asList(), UtilMisc.toList("accountCode"))
+ balanceTotal = balanceTotalDebit.subtract(balanceTotalCredit)
}
-periodCashBalanceTotal = balanceTotal;
-context.periodCashBalanceList = accountBalanceList;
-context.periodCashBalanceList.add("accountName":uiLabelMap.AccountingTotalPeriodCashBalance, "balance":balanceTotal);
-cashFlowBalanceTotalList.add("totalName":"AccountingPeriodCashBalance", "balance":balanceTotal);
+periodCashBalanceTotal = balanceTotal
+context.periodCashBalanceList = accountBalanceList
+context.periodCashBalanceList.add("accountName":uiLabelMap.AccountingTotalPeriodCashBalance, "balance":balanceTotal)
+cashFlowBalanceTotalList.add("totalName":"AccountingPeriodCashBalance", "balance":balanceTotal)
// CLOSING BALANCE
// GlAccounts from parameter's fromDate to parameter's thruDate.
-accountBalanceList = [];
-balanceTotal = BigDecimal.ZERO;
-List transactionTotals = [];
-transactionTotals.addAll(new LinkedList(context.openingCashBalanceList));
-transactionTotals.addAll(new LinkedList(context.periodCashBalanceList));
-transactionTotals = UtilMisc.sortMaps(transactionTotals, UtilMisc.toList("accountCode"));
-closingTransactionKeySet = [];
+accountBalanceList = []
+balanceTotal = BigDecimal.ZERO
+List transactionTotals = []
+transactionTotals.addAll(new LinkedList(context.openingCashBalanceList))
+transactionTotals.addAll(new LinkedList(context.periodCashBalanceList))
+transactionTotals = UtilMisc.sortMaps(transactionTotals, UtilMisc.toList("accountCode"))
+closingTransactionKeySet = []
if (transactionTotals) {
- Map transactionTotalsMap = [:];
- balanceTotalCredit = BigDecimal.ZERO;
- balanceTotalDebit = BigDecimal.ZERO;
+ Map transactionTotalsMap = [:]
+ balanceTotalCredit = BigDecimal.ZERO
+ balanceTotalDebit = BigDecimal.ZERO
transactionTotals.each { transactionTotal ->
if (transactionTotal.D != null) {
if (transactionTotalsMap.(transactionTotal.glAccountId)) {
- totalDebitBalance = (transactionTotal.D).add(transactionTotalsMap.(transactionTotal.glAccountId).D);
- totalCreditBalance = (transactionTotal.C).add(transactionTotalsMap.(transactionTotal.glAccountId).C);
+ totalDebitBalance = (transactionTotal.D).add(transactionTotalsMap.(transactionTotal.glAccountId).D)
+ totalCreditBalance = (transactionTotal.C).add(transactionTotalsMap.(transactionTotal.glAccountId).C)
if (transactionTotalsMap.(transactionTotal.glAccountId).D == 0 && transactionTotalsMap.(transactionTotal.glAccountId).C == 0) {
- transactionTotalsMap.(transactionTotal.glAccountId).balance = (transactionTotal.balance).add(transactionTotalsMap.(transactionTotal.glAccountId).balance);
+ transactionTotalsMap.(transactionTotal.glAccountId).balance = (transactionTotal.balance).add(transactionTotalsMap.(transactionTotal.glAccountId).balance)
} else {
- transactionTotalsMap.(transactionTotal.glAccountId).D = totalDebitBalance;
- transactionTotalsMap.(transactionTotal.glAccountId).C = totalCreditBalance;
- transactionTotalsMap.(transactionTotal.glAccountId).balance = totalDebitBalance.subtract(totalCreditBalance);
+ transactionTotalsMap.(transactionTotal.glAccountId).D = totalDebitBalance
+ transactionTotalsMap.(transactionTotal.glAccountId).C = totalCreditBalance
+ transactionTotalsMap.(transactionTotal.glAccountId).balance = totalDebitBalance.subtract(totalCreditBalance)
}
} else {
- transactionTotalsMap.(transactionTotal.glAccountId) = transactionTotal;
+ transactionTotalsMap.(transactionTotal.glAccountId) = transactionTotal
}
- accountBalanceList = UtilMisc.sortMaps(transactionTotalsMap.values().asList(), UtilMisc.toList("accountCode"));
+ accountBalanceList = UtilMisc.sortMaps(transactionTotalsMap.values().asList(), UtilMisc.toList("accountCode"))
}
}
- closingTransactionKeySet = transactionTotalsMap.keySet();
+ closingTransactionKeySet = transactionTotalsMap.keySet()
}
accountBalanceList.each { accountBalance ->
- balanceTotal = balanceTotal.add(accountBalance.balance);
+ balanceTotal = balanceTotal.add(accountBalance.balance)
}
-context.closingCashBalanceList = accountBalanceList;
-context.closingCashBalanceList.add("accountName":uiLabelMap.AccountingTotalClosingCashBalance, "balance":balanceTotal);
+context.closingCashBalanceList = accountBalanceList
+context.closingCashBalanceList.add("accountName":uiLabelMap.AccountingTotalClosingCashBalance, "balance":balanceTotal)
// Get differences of glAccount in closing and opening list and then add difference to opening list.
if (closingTransactionKeySet) {
- closingTransactionKeySet.removeAll(openingTransactionKeySet);
+ closingTransactionKeySet.removeAll(openingTransactionKeySet)
closingTransactionKeySet.each { closingTransactionKey ->
- glAccount = from("GlAccount").where("glAccountId", closingTransactionKey).cache(true).queryOne();
- context.openingCashBalanceList.add(["glAccountId":glAccount.glAccountId, "accountName":glAccount.accountName, accountCode:glAccount.accountCode, balance:BigDecimal.ZERO, D:BigDecimal.ZERO, C:BigDecimal.ZERO]);
+ glAccount = from("GlAccount").where("glAccountId", closingTransactionKey).cache(true).queryOne()
+ context.openingCashBalanceList.add(["glAccountId":glAccount.glAccountId, "accountName":glAccount.accountName, accountCode:glAccount.accountCode, balance:BigDecimal.ZERO, D:BigDecimal.ZERO, C:BigDecimal.ZERO])
}
}
-context.openingCashBalanceList.add(["accountName":uiLabelMap.AccountingTotalOpeningCashBalance, "balance":openingCashBalanceTotal]);
+context.openingCashBalanceList.add(["accountName":uiLabelMap.AccountingTotalOpeningCashBalance, "balance":openingCashBalanceTotal])
// CASH FLOW STATEMENT ENDING BALANCE
// ENDING BALANCE = OPENING CASH BALANCE + PERIOD CASH BALANCE
-endingCashBalanceTotal = openingCashBalanceTotal.add(periodCashBalanceTotal);
-cashFlowBalanceTotalList.add("totalName":"AccountingEndingCashBalance", "balance":endingCashBalanceTotal);
-context.cashFlowBalanceTotalList = cashFlowBalanceTotalList;
+endingCashBalanceTotal = openingCashBalanceTotal.add(periodCashBalanceTotal)
+cashFlowBalanceTotalList.add("totalName":"AccountingEndingCashBalance", "balance":endingCashBalanceTotal)
+context.cashFlowBalanceTotalList = cashFlowBalanceTotalList
diff --git a/applications/accounting/groovyScripts/reports/ComparativeBalanceSheet.groovy b/applications/accounting/groovyScripts/reports/ComparativeBalanceSheet.groovy
index 4f163d3562..2574dc4191 100644
--- a/applications/accounting/groovyScripts/reports/ComparativeBalanceSheet.groovy
+++ b/applications/accounting/groovyScripts/reports/ComparativeBalanceSheet.groovy
@@ -17,68 +17,68 @@
* under the License.
*/
-import org.apache.ofbiz.base.util.UtilMisc;
+import org.apache.ofbiz.base.util.UtilMisc
-assetAccountBalanceMap = [:];
-assetAccountBalanceList = [];
+assetAccountBalanceMap = [:]
+assetAccountBalanceList = []
assetAccountBalanceList1.each { accountBalance ->
- assetAccountBalanceMap.put(accountBalance.glAccountId, UtilMisc.toMap("glAccountId", accountBalance.glAccountId, "accountCode", accountBalance.accountCode, "accountName", accountBalance.accountName, "balance1", accountBalance.balance, "balance2", BigDecimal.ZERO));
+ assetAccountBalanceMap.put(accountBalance.glAccountId, UtilMisc.toMap("glAccountId", accountBalance.glAccountId, "accountCode", accountBalance.accountCode, "accountName", accountBalance.accountName, "balance1", accountBalance.balance, "balance2", BigDecimal.ZERO))
}
assetAccountBalanceList2.each { accountBalance ->
- Map assetAccount = (Map)assetAccountBalanceMap.get(accountBalance.glAccountId);
+ Map assetAccount = (Map)assetAccountBalanceMap.get(accountBalance.glAccountId)
if (!assetAccount) {
- assetAccountBalanceMap.put(accountBalance.glAccountId, UtilMisc.toMap("glAccountId", accountBalance.glAccountId, "accountCode", accountBalance.accountCode, "accountName", accountBalance.accountName, "balance2", accountBalance.balance, "balance1", BigDecimal.ZERO));
+ assetAccountBalanceMap.put(accountBalance.glAccountId, UtilMisc.toMap("glAccountId", accountBalance.glAccountId, "accountCode", accountBalance.accountCode, "accountName", accountBalance.accountName, "balance2", accountBalance.balance, "balance1", BigDecimal.ZERO))
} else {
- assetAccount.put("balance2", accountBalance.balance);
+ assetAccount.put("balance2", accountBalance.balance)
}
}
-assetAccountBalanceList = UtilMisc.sortMaps(assetAccountBalanceMap.values().asList(), UtilMisc.toList("accountCode"));
-context.assetAccountBalanceList = assetAccountBalanceList;
+assetAccountBalanceList = UtilMisc.sortMaps(assetAccountBalanceMap.values().asList(), UtilMisc.toList("accountCode"))
+context.assetAccountBalanceList = assetAccountBalanceList
-liabilityAccountBalanceMap = [:];
-liabilityAccountBalanceList = [];
+liabilityAccountBalanceMap = [:]
+liabilityAccountBalanceList = []
liabilityAccountBalanceList1.each { accountBalance ->
- liabilityAccountBalanceMap.put(accountBalance.glAccountId, UtilMisc.toMap("glAccountId", accountBalance.glAccountId, "accountCode", accountBalance.accountCode, "accountName", accountBalance.accountName, "balance1", accountBalance.balance, "balance2", BigDecimal.ZERO));
+ liabilityAccountBalanceMap.put(accountBalance.glAccountId, UtilMisc.toMap("glAccountId", accountBalance.glAccountId, "accountCode", accountBalance.accountCode, "accountName", accountBalance.accountName, "balance1", accountBalance.balance, "balance2", BigDecimal.ZERO))
}
liabilityAccountBalanceList2.each { accountBalance ->
- Map assetAccount = (Map)liabilityAccountBalanceMap.get(accountBalance.glAccountId);
+ Map assetAccount = (Map)liabilityAccountBalanceMap.get(accountBalance.glAccountId)
if (!assetAccount) {
- liabilityAccountBalanceMap.put(accountBalance.glAccountId, UtilMisc.toMap("glAccountId", accountBalance.glAccountId, "accountCode", accountBalance.accountCode, "accountName", accountBalance.accountName, "balance2", accountBalance.balance, "balance1", BigDecimal.ZERO));
+ liabilityAccountBalanceMap.put(accountBalance.glAccountId, UtilMisc.toMap("glAccountId", accountBalance.glAccountId, "accountCode", accountBalance.accountCode, "accountName", accountBalance.accountName, "balance2", accountBalance.balance, "balance1", BigDecimal.ZERO))
} else {
- assetAccount.put("balance2", accountBalance.balance);
+ assetAccount.put("balance2", accountBalance.balance)
}
}
-liabilityAccountBalanceList = UtilMisc.sortMaps(liabilityAccountBalanceMap.values().asList(), UtilMisc.toList("accountCode"));
-context.liabilityAccountBalanceList = liabilityAccountBalanceList;
+liabilityAccountBalanceList = UtilMisc.sortMaps(liabilityAccountBalanceMap.values().asList(), UtilMisc.toList("accountCode"))
+context.liabilityAccountBalanceList = liabilityAccountBalanceList
-equityAccountBalanceMap = [:];
-equityAccountBalanceList = [];
+equityAccountBalanceMap = [:]
+equityAccountBalanceList = []
equityAccountBalanceList1.each { accountBalance ->
- equityAccountBalanceMap.put(accountBalance.glAccountId, UtilMisc.toMap("glAccountId", accountBalance.glAccountId, "accountCode", accountBalance.accountCode, "accountName", accountBalance.accountName, "balance1", accountBalance.balance, "balance2", BigDecimal.ZERO));
+ equityAccountBalanceMap.put(accountBalance.glAccountId, UtilMisc.toMap("glAccountId", accountBalance.glAccountId, "accountCode", accountBalance.accountCode, "accountName", accountBalance.accountName, "balance1", accountBalance.balance, "balance2", BigDecimal.ZERO))
}
equityAccountBalanceList2.each { accountBalance ->
- Map assetAccount = (Map)equityAccountBalanceMap.get(accountBalance.glAccountId);
+ Map assetAccount = (Map)equityAccountBalanceMap.get(accountBalance.glAccountId)
if (!assetAccount) {
- equityAccountBalanceMap.put(accountBalance.glAccountId, UtilMisc.toMap("glAccountId", accountBalance.glAccountId, "accountCode", accountBalance.accountCode, "accountName", accountBalance.accountName, "balance2", accountBalance.balance, "balance1", BigDecimal.ZERO));
+ equityAccountBalanceMap.put(accountBalance.glAccountId, UtilMisc.toMap("glAccountId", accountBalance.glAccountId, "accountCode", accountBalance.accountCode, "accountName", accountBalance.accountName, "balance2", accountBalance.balance, "balance1", BigDecimal.ZERO))
} else {
- assetAccount.put("balance2", accountBalance.balance);
+ assetAccount.put("balance2", accountBalance.balance)
}
}
-equityAccountBalanceList = UtilMisc.sortMaps(equityAccountBalanceMap.values().asList(), UtilMisc.toList("accountCode"));
-context.equityAccountBalanceList = equityAccountBalanceList;
+equityAccountBalanceList = UtilMisc.sortMaps(equityAccountBalanceMap.values().asList(), UtilMisc.toList("accountCode"))
+context.equityAccountBalanceList = equityAccountBalanceList
-balanceTotalMap = [:];
-balanceTotalList = [];
+balanceTotalMap = [:]
+balanceTotalList = []
balanceTotalList1.each { accountBalance ->
- balanceTotalMap.put(accountBalance.totalName, UtilMisc.toMap("totalName", accountBalance.totalName, "balance1", accountBalance.balance, "balance2", BigDecimal.ZERO));
+ balanceTotalMap.put(accountBalance.totalName, UtilMisc.toMap("totalName", accountBalance.totalName, "balance1", accountBalance.balance, "balance2", BigDecimal.ZERO))
}
balanceTotalList2.each { accountBalance ->
- Map assetAccount = (Map)balanceTotalMap.get(accountBalance.totalName);
+ Map assetAccount = (Map)balanceTotalMap.get(accountBalance.totalName)
if (!assetAccount) {
- balanceTotalMap.put(accountBalance.totalName, UtilMisc.toMap("totalName", accountBalance.totalName, "balance2", accountBalance.balance, "balance1", BigDecimal.ZERO));
+ balanceTotalMap.put(accountBalance.totalName, UtilMisc.toMap("totalName", accountBalance.totalName, "balance2", accountBalance.balance, "balance1", BigDecimal.ZERO))
} else {
- assetAccount.put("balance2", accountBalance.balance);
+ assetAccount.put("balance2", accountBalance.balance)
}
}
-balanceTotalList = balanceTotalMap.values().asList();
-context.balanceTotalList = balanceTotalList;
+balanceTotalList = balanceTotalMap.values().asList()
+context.balanceTotalList = balanceTotalList
diff --git a/applications/accounting/groovyScripts/reports/ComparativeCashFlowStatement.groovy b/applications/accounting/groovyScripts/reports/ComparativeCashFlowStatement.groovy
index cc91db515e..672b18ead9 100644
--- a/applications/accounting/groovyScripts/reports/ComparativeCashFlowStatement.groovy
+++ b/applications/accounting/groovyScripts/reports/ComparativeCashFlowStatement.groovy
@@ -17,71 +17,71 @@
* under the License.
*/
-import org.apache.ofbiz.base.util.UtilMisc;
+import org.apache.ofbiz.base.util.UtilMisc
-openingCashBalanceMap = [:];
-openingCashBalanceList = [];
+openingCashBalanceMap = [:]
+openingCashBalanceList = []
openingCashBalanceList1.each { accountBalance ->
- openingCashBalanceMap.put(accountBalance.glAccountId, UtilMisc.toMap("glAccountId", accountBalance.glAccountId, "accountCode", accountBalance.accountCode, "accountName", accountBalance.accountName, "balance1", accountBalance.balance, "balance2", BigDecimal.ZERO));
+ openingCashBalanceMap.put(accountBalance.glAccountId, UtilMisc.toMap("glAccountId", accountBalance.glAccountId, "accountCode", accountBalance.accountCode, "accountName", accountBalance.accountName, "balance1", accountBalance.balance, "balance2", BigDecimal.ZERO))
}
openingCashBalanceList2.each { accountBalance ->
- Map openingCashAccount = (Map)openingCashBalanceMap.get(accountBalance.glAccountId);
+ Map openingCashAccount = (Map)openingCashBalanceMap.get(accountBalance.glAccountId)
if (!openingCashAccount) {
- openingCashBalanceMap.put(accountBalance.glAccountId, UtilMisc.toMap("glAccountId", accountBalance.glAccountId, "accountCode", accountBalance.accountCode, "accountName", accountBalance.accountName, "balance2", accountBalance.balance, "balance1", BigDecimal.ZERO));
+ openingCashBalanceMap.put(accountBalance.glAccountId, UtilMisc.toMap("glAccountId", accountBalance.glAccountId, "accountCode", accountBalance.accountCode, "accountName", accountBalance.accountName, "balance2", accountBalance.balance, "balance1", BigDecimal.ZERO))
} else {
- openingCashAccount.put("balance2", accountBalance.balance);
+ openingCashAccount.put("balance2", accountBalance.balance)
}
}
-openingCashBalanceList = UtilMisc.sortMaps(openingCashBalanceMap.values().asList(), UtilMisc.toList("accountCode"));
-context.openingCashBalanceList = openingCashBalanceList;
+openingCashBalanceList = UtilMisc.sortMaps(openingCashBalanceMap.values().asList(), UtilMisc.toList("accountCode"))
+context.openingCashBalanceList = openingCashBalanceList
-periodCashBalanceMap = [:];
-periodCashBalanceList = [];
+periodCashBalanceMap = [:]
+periodCashBalanceList = []
periodCashBalanceList1.each { accountBalance ->
- periodCashBalanceMap.put(accountBalance.glAccountId, UtilMisc.toMap("glAccountId", accountBalance.glAccountId, "accountCode", accountBalance.accountCode, "accountName", accountBalance.accountName, "balance1", accountBalance.balance, "balance2", BigDecimal.ZERO, "D1", accountBalance.D, "C1", accountBalance.C, "D2", BigDecimal.ZERO, "C2", BigDecimal.ZERO));
+ periodCashBalanceMap.put(accountBalance.glAccountId, UtilMisc.toMap("glAccountId", accountBalance.glAccountId, "accountCode", accountBalance.accountCode, "accountName", accountBalance.accountName, "balance1", accountBalance.balance, "balance2", BigDecimal.ZERO, "D1", accountBalance.D, "C1", accountBalance.C, "D2", BigDecimal.ZERO, "C2", BigDecimal.ZERO))
}
periodCashBalanceList2.each { accountBalance ->
- Map periodCashAccount = (Map)periodCashBalanceMap.get(accountBalance.glAccountId);
+ Map periodCashAccount = (Map)periodCashBalanceMap.get(accountBalance.glAccountId)
if (!periodCashAccount) {
- periodCashBalanceMap.put(accountBalance.glAccountId, UtilMisc.toMap("glAccountId", accountBalance.glAccountId, "accountCode", accountBalance.accountCode, "accountName", accountBalance.accountName, "balance2", accountBalance.balance, "balance1", BigDecimal.ZERO, "D2", accountBalance.D, "C2", accountBalance.C, "D1", BigDecimal.ZERO, "C1", BigDecimal.ZERO));
+ periodCashBalanceMap.put(accountBalance.glAccountId, UtilMisc.toMap("glAccountId", accountBalance.glAccountId, "accountCode", accountBalance.accountCode, "accountName", accountBalance.accountName, "balance2", accountBalance.balance, "balance1", BigDecimal.ZERO, "D2", accountBalance.D, "C2", accountBalance.C, "D1", BigDecimal.ZERO, "C1", BigDecimal.ZERO))
} else {
- periodCashAccount.put("balance2", accountBalance.balance);
- periodCashAccount.put("D2", accountBalance.D);
- periodCashAccount.put("C2", accountBalance.C);
+ periodCashAccount.put("balance2", accountBalance.balance)
+ periodCashAccount.put("D2", accountBalance.D)
+ periodCashAccount.put("C2", accountBalance.C)
}
}
-periodCashBalanceList = UtilMisc.sortMaps(periodCashBalanceMap.values().asList(), UtilMisc.toList("accountCode"));
+periodCashBalanceList = UtilMisc.sortMaps(periodCashBalanceMap.values().asList(), UtilMisc.toList("accountCode"))
-context.periodCashBalanceList = periodCashBalanceList;
-closingCashBalanceMap = [:];
-closingCashBalanceList = [];
+context.periodCashBalanceList = periodCashBalanceList
+closingCashBalanceMap = [:]
+closingCashBalanceList = []
closingCashBalanceList1.each { accountBalance ->
- closingCashBalanceMap.put(accountBalance.glAccountId, UtilMisc.toMap("glAccountId", accountBalance.glAccountId, "accountCode", accountBalance.accountCode, "accountName", accountBalance.accountName, "balance1", accountBalance.balance, "balance2", BigDecimal.ZERO));
+ closingCashBalanceMap.put(accountBalance.glAccountId, UtilMisc.toMap("glAccountId", accountBalance.glAccountId, "accountCode", accountBalance.accountCode, "accountName", accountBalance.accountName, "balance1", accountBalance.balance, "balance2", BigDecimal.ZERO))
}
closingCashBalanceList2.each { accountBalance ->
- Map closingCashAccount = (Map)closingCashBalanceMap.get(accountBalance.glAccountId);
+ Map closingCashAccount = (Map)closingCashBalanceMap.get(accountBalance.glAccountId)
if (!closingCashAccount) {
- closingCashBalanceMap.put(accountBalance.glAccountId, UtilMisc.toMap("glAccountId", accountBalance.glAccountId, "accountCode", accountBalance.accountCode, "accountName", accountBalance.accountName, "balance2", accountBalance.balance, "balance1", BigDecimal.ZERO));
+ closingCashBalanceMap.put(accountBalance.glAccountId, UtilMisc.toMap("glAccountId", accountBalance.glAccountId, "accountCode", accountBalance.accountCode, "accountName", accountBalance.accountName, "balance2", accountBalance.balance, "balance1", BigDecimal.ZERO))
} else {
- closingCashAccount.put("balance2", accountBalance.balance);
+ closingCashAccount.put("balance2", accountBalance.balance)
}
}
-closingCashBalanceList = UtilMisc.sortMaps(closingCashBalanceMap.values().asList(), UtilMisc.toList("accountCode"));
-context.closingCashBalanceList = closingCashBalanceList;
+closingCashBalanceList = UtilMisc.sortMaps(closingCashBalanceMap.values().asList(), UtilMisc.toList("accountCode"))
+context.closingCashBalanceList = closingCashBalanceList
-balanceTotalMap = [:];
-cashFlowBalanceTotalList = [];
+balanceTotalMap = [:]
+cashFlowBalanceTotalList = []
cashFlowBalanceTotalList1.each { accountBalance ->
- balanceTotalMap.put(accountBalance.totalName, UtilMisc.toMap("totalName", accountBalance.totalName, "balance1", accountBalance.balance, "balance2", BigDecimal.ZERO));
+ balanceTotalMap.put(accountBalance.totalName, UtilMisc.toMap("totalName", accountBalance.totalName, "balance1", accountBalance.balance, "balance2", BigDecimal.ZERO))
}
cashFlowBalanceTotalList2.each { accountBalance ->
- Map cashFlowBalanceAccount = (Map)balanceTotalMap.get(accountBalance.totalName);
+ Map cashFlowBalanceAccount = (Map)balanceTotalMap.get(accountBalance.totalName)
if (!cashFlowBalanceAccount) {
- balanceTotalMap.put(accountBalance.totalName, UtilMisc.toMap("totalName", accountBalance.totalName, "balance2", accountBalance.balance, "balance1", BigDecimal.ZERO));
+ balanceTotalMap.put(accountBalance.totalName, UtilMisc.toMap("totalName", accountBalance.totalName, "balance2", accountBalance.balance, "balance1", BigDecimal.ZERO))
} else {
- cashFlowBalanceAccount.put("balance2", accountBalance.balance);
+ cashFlowBalanceAccount.put("balance2", accountBalance.balance)
}
}
-cashFlowBalanceTotalList = balanceTotalMap.values().asList();
-context.cashFlowBalanceTotalList = cashFlowBalanceTotalList;
+cashFlowBalanceTotalList = balanceTotalMap.values().asList()
+context.cashFlowBalanceTotalList = cashFlowBalanceTotalList
diff --git a/applications/accounting/groovyScripts/reports/ComparativeIncomeStatement.groovy b/applications/accounting/groovyScripts/reports/ComparativeIncomeStatement.groovy
index e72a60cd9a..97b88a28c5 100644
--- a/applications/accounting/groovyScripts/reports/ComparativeIncomeStatement.groovy
+++ b/applications/accounting/groovyScripts/reports/ComparativeIncomeStatement.groovy
@@ -17,68 +17,68 @@
* under the License.
*/
-import org.apache.ofbiz.base.util.UtilMisc;
+import org.apache.ofbiz.base.util.UtilMisc
-revenueAccountBalanceMap = [:];
-revenueAccountBalanceList = [];
+revenueAccountBalanceMap = [:]
+revenueAccountBalanceList = []
revenueAccountBalanceList1.each { accountBalance ->
- revenueAccountBalanceMap.put(accountBalance.glAccountId, UtilMisc.toMap("glAccountId", accountBalance.glAccountId, "accountCode", accountBalance.accountCode, "accountName", accountBalance.accountName, "balance1", accountBalance.balance, "balance2", BigDecimal.ZERO));
+ revenueAccountBalanceMap.put(accountBalance.glAccountId, UtilMisc.toMap("glAccountId", accountBalance.glAccountId, "accountCode", accountBalance.accountCode, "accountName", accountBalance.accountName, "balance1", accountBalance.balance, "balance2", BigDecimal.ZERO))
}
revenueAccountBalanceList2.each { accountBalance ->
- Map assetAccount = (Map)revenueAccountBalanceMap.get(accountBalance.glAccountId);
+ Map assetAccount = (Map)revenueAccountBalanceMap.get(accountBalance.glAccountId)
if (!assetAccount) {
- revenueAccountBalanceMap.put(accountBalance.glAccountId, UtilMisc.toMap("glAccountId", accountBalance.glAccountId, "accountCode", accountBalance.accountCode, "accountName", accountBalance.accountName, "balance2", accountBalance.balance, "balance1", BigDecimal.ZERO));
+ revenueAccountBalanceMap.put(accountBalance.glAccountId, UtilMisc.toMap("glAccountId", accountBalance.glAccountId, "accountCode", accountBalance.accountCode, "accountName", accountBalance.accountName, "balance2", accountBalance.balance, "balance1", BigDecimal.ZERO))
} else {
- assetAccount.put("balance2", accountBalance.balance);
+ assetAccount.put("balance2", accountBalance.balance)
}
}
-revenueAccountBalanceList = UtilMisc.sortMaps(revenueAccountBalanceMap.values().asList(), UtilMisc.toList("accountCode"));
-context.revenueAccountBalanceList = revenueAccountBalanceList;
+revenueAccountBalanceList = UtilMisc.sortMaps(revenueAccountBalanceMap.values().asList(), UtilMisc.toList("accountCode"))
+context.revenueAccountBalanceList = revenueAccountBalanceList
-expenseAccountBalanceMap = [:];
-expenseAccountBalanceList = [];
+expenseAccountBalanceMap = [:]
+expenseAccountBalanceList = []
expenseAccountBalanceList1.each { accountBalance ->
- expenseAccountBalanceMap.put(accountBalance.glAccountId, UtilMisc.toMap("glAccountId", accountBalance.glAccountId, "accountCode", accountBalance.accountCode, "accountName", accountBalance.accountName, "balance1", accountBalance.balance, "balance2", BigDecimal.ZERO));
+ expenseAccountBalanceMap.put(accountBalance.glAccountId, UtilMisc.toMap("glAccountId", accountBalance.glAccountId, "accountCode", accountBalance.accountCode, "accountName", accountBalance.accountName, "balance1", accountBalance.balance, "balance2", BigDecimal.ZERO))
}
expenseAccountBalanceList2.each { accountBalance ->
- Map assetAccount = (Map)expenseAccountBalanceMap.get(accountBalance.glAccountId);
+ Map assetAccount = (Map)expenseAccountBalanceMap.get(accountBalance.glAccountId)
if (!assetAccount) {
- expenseAccountBalanceMap.put(accountBalance.glAccountId, UtilMisc.toMap("glAccountId", accountBalance.glAccountId, "accountCode", accountBalance.accountCode, "accountName", accountBalance.accountName, "balance2", accountBalance.balance, "balance1", BigDecimal.ZERO));
+ expenseAccountBalanceMap.put(accountBalance.glAccountId, UtilMisc.toMap("glAccountId", accountBalance.glAccountId, "accountCode", accountBalance.accountCode, "accountName", accountBalance.accountName, "balance2", accountBalance.balance, "balance1", BigDecimal.ZERO))
} else {
- assetAccount.put("balance2", accountBalance.balance);
+ assetAccount.put("balance2", accountBalance.balance)
}
}
-expenseAccountBalanceList = UtilMisc.sortMaps(expenseAccountBalanceMap.values().asList(), UtilMisc.toList("accountCode"));
-context.expenseAccountBalanceList = expenseAccountBalanceList;
+expenseAccountBalanceList = UtilMisc.sortMaps(expenseAccountBalanceMap.values().asList(), UtilMisc.toList("accountCode"))
+context.expenseAccountBalanceList = expenseAccountBalanceList
-incomeAccountBalanceMap = [:];
-incomeAccountBalanceList = [];
+incomeAccountBalanceMap = [:]
+incomeAccountBalanceList = []
incomeAccountBalanceList1.each { accountBalance ->
- incomeAccountBalanceMap.put(accountBalance.glAccountId, UtilMisc.toMap("glAccountId", accountBalance.glAccountId, "accountCode", accountBalance.accountCode, "accountName", accountBalance.accountName, "balance1", accountBalance.balance, "balance2", BigDecimal.ZERO));
+ incomeAccountBalanceMap.put(accountBalance.glAccountId, UtilMisc.toMap("glAccountId", accountBalance.glAccountId, "accountCode", accountBalance.accountCode, "accountName", accountBalance.accountName, "balance1", accountBalance.balance, "balance2", BigDecimal.ZERO))
}
incomeAccountBalanceList2.each { accountBalance ->
- Map assetAccount = (Map)incomeAccountBalanceMap.get(accountBalance.glAccountId);
+ Map assetAccount = (Map)incomeAccountBalanceMap.get(accountBalance.glAccountId)
if (!assetAccount) {
- incomeAccountBalanceMap.put(accountBalance.glAccountId, UtilMisc.toMap("glAccountId", accountBalance.glAccountId, "accountCode", accountBalance.accountCode, "accountName", accountBalance.accountName, "balance2", accountBalance.balance, "balance1", BigDecimal.ZERO));
+ incomeAccountBalanceMap.put(accountBalance.glAccountId, UtilMisc.toMap("glAccountId", accountBalance.glAccountId, "accountCode", accountBalance.accountCode, "accountName", accountBalance.accountName, "balance2", accountBalance.balance, "balance1", BigDecimal.ZERO))
} else {
- assetAccount.put("balance2", accountBalance.balance);
+ assetAccount.put("balance2", accountBalance.balance)
}
}
-incomeAccountBalanceList = UtilMisc.sortMaps(incomeAccountBalanceMap.values().asList(), UtilMisc.toList("accountCode"));
-context.incomeAccountBalanceList = incomeAccountBalanceList;
+incomeAccountBalanceList = UtilMisc.sortMaps(incomeAccountBalanceMap.values().asList(), UtilMisc.toList("accountCode"))
+context.incomeAccountBalanceList = incomeAccountBalanceList
-balanceTotalMap = [:];
-balanceTotalList = [];
+balanceTotalMap = [:]
+balanceTotalList = []
balanceTotalList1.each { accountBalance ->
- balanceTotalMap.put(accountBalance.totalName, UtilMisc.toMap("totalName", accountBalance.totalName, "balance1", accountBalance.balance, "balance2", BigDecimal.ZERO));
+ balanceTotalMap.put(accountBalance.totalName, UtilMisc.toMap("totalName", accountBalance.totalName, "balance1", accountBalance.balance, "balance2", BigDecimal.ZERO))
}
balanceTotalList2.each { accountBalance ->
- Map assetAccount = (Map)balanceTotalMap.get(accountBalance.totalName);
+ Map assetAccount = (Map)balanceTotalMap.get(accountBalance.totalName)
if (!assetAccount) {
- balanceTotalMap.put(accountBalance.totalName, UtilMisc.toMap("totalName", accountBalance.totalName, "balance2", accountBalance.balance, "balance1", BigDecimal.ZERO));
+ balanceTotalMap.put(accountBalance.totalName, UtilMisc.toMap("totalName", accountBalance.totalName, "balance2", accountBalance.balance, "balance1", BigDecimal.ZERO))
} else {
- assetAccount.put("balance2", accountBalance.balance);
+ assetAccount.put("balance2", accountBalance.balance)
}
}
-balanceTotalList = balanceTotalMap.values().asList();
-context.balanceTotalList = balanceTotalList;
+balanceTotalList = balanceTotalMap.values().asList()
+context.balanceTotalList = balanceTotalList
diff --git a/applications/accounting/groovyScripts/reports/CostCenters.groovy b/applications/accounting/groovyScripts/reports/CostCenters.groovy
index 1958a2b4fb..c58a6cdcb3 100644
--- a/applications/accounting/groovyScripts/reports/CostCenters.groovy
+++ b/applications/accounting/groovyScripts/reports/CostCenters.groovy
@@ -24,52 +24,52 @@ import org.apache.ofbiz.entity.condition.EntityCondition
import org.apache.ofbiz.entity.condition.EntityOperator
if (!fromDate) {
- return;
+ return
}
if (!thruDate) {
- thruDate = UtilDateTime.nowTimestamp();
+ thruDate = UtilDateTime.nowTimestamp()
}
if (!parameters.glFiscalTypeId) {
- parameters.glFiscalTypeId = "ACTUAL";
+ parameters.glFiscalTypeId = "ACTUAL"
}
// POSTED
// Posted transactions totals and grand totals
-postedTotalDebit = BigDecimal.ZERO;
-postedTotalCredit = BigDecimal.ZERO;
-andExprs = [];
-andExprs.add(EntityCondition.makeCondition("organizationPartyId", EntityOperator.IN, partyIds));
-andExprs.add(EntityCondition.makeCondition("isPosted", EntityOperator.EQUALS, "Y"));
-andExprs.add(EntityCondition.makeCondition("glFiscalTypeId", EntityOperator.EQUALS, parameters.glFiscalTypeId));
-andExprs.add(EntityCondition.makeCondition("transactionDate", EntityOperator.GREATER_THAN_EQUAL_TO, fromDate));
-andExprs.add(EntityCondition.makeCondition("transactionDate", EntityOperator.LESS_THAN_EQUAL_TO, thruDate));
-andCond = EntityCondition.makeCondition(andExprs, EntityOperator.AND);
-List postedTransactionTotals = select("glAccountId", "accountName", "accountCode", "debitCreditFlag", "amount").from("AcctgTransEntrySums").where(andCond).orderBy("glAccountId").queryList();
+postedTotalDebit = BigDecimal.ZERO
+postedTotalCredit = BigDecimal.ZERO
+andExprs = []
+andExprs.add(EntityCondition.makeCondition("organizationPartyId", EntityOperator.IN, partyIds))
+andExprs.add(EntityCondition.makeCondition("isPosted", EntityOperator.EQUALS, "Y"))
+andExprs.add(EntityCondition.makeCondition("glFiscalTypeId", EntityOperator.EQUALS, parameters.glFiscalTypeId))
+andExprs.add(EntityCondition.makeCondition("transactionDate", EntityOperator.GREATER_THAN_EQUAL_TO, fromDate))
+andExprs.add(EntityCondition.makeCondition("transactionDate", EntityOperator.LESS_THAN_EQUAL_TO, thruDate))
+andCond = EntityCondition.makeCondition(andExprs, EntityOperator.AND)
+List postedTransactionTotals = select("glAccountId", "accountName", "accountCode", "debitCreditFlag", "amount").from("AcctgTransEntrySums").where(andCond).orderBy("glAccountId").queryList()
if (postedTransactionTotals) {
- glAccountCategories = from("GlAccountCategory").where("glAccountCategoryTypeId", "COST_CENTER").orderBy("glAccountCategoryId").queryList();
- context.glAccountCategories = glAccountCategories;
+ glAccountCategories = from("GlAccountCategory").where("glAccountCategoryTypeId", "COST_CENTER").orderBy("glAccountCategoryId").queryList()
+ context.glAccountCategories = glAccountCategories
Map postedTransactionTotalsMap = [:]
postedTransactionTotals.each { postedTransactionTotal ->
- Map accountMap = (Map)postedTransactionTotalsMap.get(postedTransactionTotal.glAccountId);
+ Map accountMap = (Map)postedTransactionTotalsMap.get(postedTransactionTotal.glAccountId)
if (!accountMap) {
- accountMap = UtilMisc.makeMapWritable(postedTransactionTotal);
- accountMap.put("D", BigDecimal.ZERO);
- accountMap.put("C", BigDecimal.ZERO);
+ accountMap = UtilMisc.makeMapWritable(postedTransactionTotal)
+ accountMap.put("D", BigDecimal.ZERO)
+ accountMap.put("C", BigDecimal.ZERO)
}
- UtilMisc.addToBigDecimalInMap(accountMap, postedTransactionTotal.debitCreditFlag, postedTransactionTotal.amount);
- postedTransactionTotalsMap.put(postedTransactionTotal.glAccountId, accountMap);
- BigDecimal debitAmount = (BigDecimal)accountMap.get("D");
- BigDecimal creditAmount = (BigDecimal)accountMap.get("C");
- BigDecimal balance = debitAmount.subtract(creditAmount);
- accountMap.put("balance", balance);
+ UtilMisc.addToBigDecimalInMap(accountMap, postedTransactionTotal.debitCreditFlag, postedTransactionTotal.amount)
+ postedTransactionTotalsMap.put(postedTransactionTotal.glAccountId, accountMap)
+ BigDecimal debitAmount = (BigDecimal)accountMap.get("D")
+ BigDecimal creditAmount = (BigDecimal)accountMap.get("C")
+ BigDecimal balance = debitAmount.subtract(creditAmount)
+ accountMap.put("balance", balance)
glAccountCategories.each { glAccountCategory ->
- glAccountCategoryMember = from("GlAccountCategoryMember").where("glAccountCategoryId", glAccountCategory.glAccountCategoryId, "glAccountId", postedTransactionTotal.glAccountId).orderBy("glAccountCategoryId").filterByDate().queryFirst();
+ glAccountCategoryMember = from("GlAccountCategoryMember").where("glAccountCategoryId", glAccountCategory.glAccountCategoryId, "glAccountId", postedTransactionTotal.glAccountId).orderBy("glAccountCategoryId").filterByDate().queryFirst()
if (glAccountCategoryMember) {
- BigDecimal glAccountCategorySharePercentage = glAccountCategoryMember.amountPercentage;
+ BigDecimal glAccountCategorySharePercentage = glAccountCategoryMember.amountPercentage
if (glAccountCategorySharePercentage && glAccountCategorySharePercentage != BigDecimal.ZERO ) {
- glAccountCategoryShareFraction = glAccountCategorySharePercentage.divide(new BigDecimal("100.00"));
- BigDecimal glAccountCategoryShare = balance.multiply(glAccountCategoryShareFraction);
- accountMap.put(glAccountCategory.glAccountCategoryId,glAccountCategoryShare);
+ glAccountCategoryShareFraction = glAccountCategorySharePercentage.divide(new BigDecimal("100.00"))
+ BigDecimal glAccountCategoryShare = balance.multiply(glAccountCategoryShareFraction)
+ accountMap.put(glAccountCategory.glAccountCategoryId,glAccountCategoryShare)
}
}
}
diff --git a/applications/accounting/groovyScripts/reports/GlAccountTrialBalance.groovy b/applications/accounting/groovyScripts/reports/GlAccountTrialBalance.groovy
index 182d4e15aa..53d05c6872 100644
--- a/applications/accounting/groovyScripts/reports/GlAccountTrialBalance.groovy
+++ b/applications/accounting/groovyScripts/reports/GlAccountTrialBalance.groovy
@@ -25,79 +25,79 @@ import org.apache.ofbiz.base.util.UtilValidate
import java.sql.Timestamp
if (parameters.get('ApplicationDecorator|organizationPartyId')) {
- onlyIncludePeriodTypeIdList = [];
- onlyIncludePeriodTypeIdList.add("FISCAL_YEAR");
- customTimePeriodResults = runService('findCustomTimePeriods', [findDate : UtilDateTime.nowTimestamp(), organizationPartyId : parameters.get('ApplicationDecorator|organizationPartyId'), onlyIncludePeriodTypeIdList : onlyIncludePeriodTypeIdList, userLogin : userLogin]);
- customTimePeriodList = customTimePeriodResults.customTimePeriodList;
+ onlyIncludePeriodTypeIdList = []
+ onlyIncludePeriodTypeIdList.add("FISCAL_YEAR")
+ customTimePeriodResults = runService('findCustomTimePeriods', [findDate : UtilDateTime.nowTimestamp(), organizationPartyId : parameters.get('ApplicationDecorator|organizationPartyId'), onlyIncludePeriodTypeIdList : onlyIncludePeriodTypeIdList, userLogin : userLogin])
+ customTimePeriodList = customTimePeriodResults.customTimePeriodList
if (UtilValidate.isNotEmpty(customTimePeriodList)) {
- context.timePeriod = customTimePeriodList.first().customTimePeriodId;
+ context.timePeriod = customTimePeriodList.first().customTimePeriodId
}
- decimals = UtilNumber.getBigDecimalScale("ledger.decimals");
- rounding = UtilNumber.getBigDecimalRoundingMode("ledger.rounding");
- context.currentOrganization = from("PartyNameView").where("partyId", parameters.get('ApplicationDecorator|organizationPartyId')).queryOne();
+ decimals = UtilNumber.getBigDecimalScale("ledger.decimals")
+ rounding = UtilNumber.getBigDecimalRoundingMode("ledger.rounding")
+ context.currentOrganization = from("PartyNameView").where("partyId", parameters.get('ApplicationDecorator|organizationPartyId')).queryOne()
if (parameters.glAccountId) {
- glAccount = from("GlAccount").where("glAccountId", parameters.glAccountId).queryOne();
- isDebitAccount = UtilAccounting.isDebitAccount(glAccount);
- context.isDebitAccount = isDebitAccount;
- context.glAccount = glAccount;
+ glAccount = from("GlAccount").where("glAccountId", parameters.glAccountId).queryOne()
+ isDebitAccount = UtilAccounting.isDebitAccount(glAccount)
+ context.isDebitAccount = isDebitAccount
+ context.glAccount = glAccount
}
- currentTimePeriod = null;
- BigDecimal balanceOfTheAcctgForYear = BigDecimal.ZERO;
+ currentTimePeriod = null
+ BigDecimal balanceOfTheAcctgForYear = BigDecimal.ZERO
if (parameters.timePeriod) {
- currentTimePeriod = from("CustomTimePeriod").where("customTimePeriodId", parameters.timePeriod).queryOne();
- previousTimePeriodResult = runService('getPreviousTimePeriod', [customTimePeriodId : parameters.timePeriod, userLogin : userLogin]);
- previousTimePeriod = previousTimePeriodResult.previousTimePeriod;
+ currentTimePeriod = from("CustomTimePeriod").where("customTimePeriodId", parameters.timePeriod).queryOne()
+ previousTimePeriodResult = runService('getPreviousTimePeriod', [customTimePeriodId : parameters.timePeriod, userLogin : userLogin])
+ previousTimePeriod = previousTimePeriodResult.previousTimePeriod
if (UtilValidate.isNotEmpty(previousTimePeriod)) {
- glAccountHistory = from("GlAccountHistory").where("customTimePeriodId", previousTimePeriod.customTimePeriodId, "glAccountId", parameters.glAccountId, "organizationPartyId", parameters.get('ApplicationDecorator|organizationPartyId')).queryOne();
+ glAccountHistory = from("GlAccountHistory").where("customTimePeriodId", previousTimePeriod.customTimePeriodId, "glAccountId", parameters.glAccountId, "organizationPartyId", parameters.get('ApplicationDecorator|organizationPartyId')).queryOne()
if (glAccountHistory && glAccountHistory.endingBalance != null) {
- context.openingBalance = glAccountHistory.endingBalance;
- balanceOfTheAcctgForYear = glAccountHistory.endingBalance;
+ context.openingBalance = glAccountHistory.endingBalance
+ balanceOfTheAcctgForYear = glAccountHistory.endingBalance
} else {
- context.openingBalance = BigDecimal.ZERO;
+ context.openingBalance = BigDecimal.ZERO
}
}
}
if (currentTimePeriod) {
- context.currentTimePeriod = currentTimePeriod;
- customTimePeriodStartDate = UtilDateTime.getMonthStart(UtilDateTime.toTimestamp(currentTimePeriod.fromDate), timeZone, locale);
- customTimePeriodEndDate = UtilDateTime.getMonthEnd(UtilDateTime.toTimestamp(currentTimePeriod.fromDate), timeZone, locale);
+ context.currentTimePeriod = currentTimePeriod
+ customTimePeriodStartDate = UtilDateTime.getMonthStart(UtilDateTime.toTimestamp(currentTimePeriod.fromDate), timeZone, locale)
+ customTimePeriodEndDate = UtilDateTime.getMonthEnd(UtilDateTime.toTimestamp(currentTimePeriod.fromDate), timeZone, locale)
- Calendar calendarTimePeriodStartDate = UtilDateTime.toCalendar(customTimePeriodStartDate);
- glAcctgTrialBalanceList = [];
- BigDecimal totalOfYearToDateDebit = BigDecimal.ZERO;
- BigDecimal totalOfYearToDateCredit = BigDecimal.ZERO;
- isPosted = parameters.isPosted;
+ Calendar calendarTimePeriodStartDate = UtilDateTime.toCalendar(customTimePeriodStartDate)
+ glAcctgTrialBalanceList = []
+ BigDecimal totalOfYearToDateDebit = BigDecimal.ZERO
+ BigDecimal totalOfYearToDateCredit = BigDecimal.ZERO
+ isPosted = parameters.isPosted
while (customTimePeriodEndDate <= currentTimePeriod.thruDate) {
if ("ALL".equals(isPosted)) {
- isPosted = "";
+ isPosted = ""
}
acctgTransEntriesAndTransTotal = runService('getAcctgTransEntriesAndTransTotal',
- [customTimePeriodStartDate : customTimePeriodStartDate, customTimePeriodEndDate : customTimePeriodEndDate, organizationPartyId : parameters.get('ApplicationDecorator|organizationPartyId'), glAccountId : parameters.glAccountId, isPosted : isPosted, userLogin : userLogin]);
- totalOfYearToDateDebit = totalOfYearToDateDebit + acctgTransEntriesAndTransTotal.debitTotal;
- acctgTransEntriesAndTransTotal.totalOfYearToDateDebit = totalOfYearToDateDebit.setScale(decimals, rounding);
- totalOfYearToDateCredit = totalOfYearToDateCredit + acctgTransEntriesAndTransTotal.creditTotal;
- acctgTransEntriesAndTransTotal.totalOfYearToDateCredit = totalOfYearToDateCredit.setScale(decimals, rounding);
+ [customTimePeriodStartDate : customTimePeriodStartDate, customTimePeriodEndDate : customTimePeriodEndDate, organizationPartyId : parameters.get('ApplicationDecorator|organizationPartyId'), glAccountId : parameters.glAccountId, isPosted : isPosted, userLogin : userLogin])
+ totalOfYearToDateDebit = totalOfYearToDateDebit + acctgTransEntriesAndTransTotal.debitTotal
+ acctgTransEntriesAndTransTotal.totalOfYearToDateDebit = totalOfYearToDateDebit.setScale(decimals, rounding)
+ totalOfYearToDateCredit = totalOfYearToDateCredit + acctgTransEntriesAndTransTotal.creditTotal
+ acctgTransEntriesAndTransTotal.totalOfYearToDateCredit = totalOfYearToDateCredit.setScale(decimals, rounding)
if (isDebitAccount) {
- acctgTransEntriesAndTransTotal.balance = acctgTransEntriesAndTransTotal.debitCreditDifference;
+ acctgTransEntriesAndTransTotal.balance = acctgTransEntriesAndTransTotal.debitCreditDifference
} else {
- acctgTransEntriesAndTransTotal.balance = -1 * acctgTransEntriesAndTransTotal.debitCreditDifference;
+ acctgTransEntriesAndTransTotal.balance = -1 * acctgTransEntriesAndTransTotal.debitCreditDifference
}
- balanceOfTheAcctgForYear = balanceOfTheAcctgForYear + acctgTransEntriesAndTransTotal.balance;
- acctgTransEntriesAndTransTotal.balanceOfTheAcctgForYear = balanceOfTheAcctgForYear.setScale(decimals, rounding);
+ balanceOfTheAcctgForYear = balanceOfTheAcctgForYear + acctgTransEntriesAndTransTotal.balance
+ acctgTransEntriesAndTransTotal.balanceOfTheAcctgForYear = balanceOfTheAcctgForYear.setScale(decimals, rounding)
- glAcctgTrialBalanceList.add(acctgTransEntriesAndTransTotal);
+ glAcctgTrialBalanceList.add(acctgTransEntriesAndTransTotal)
- calendarTimePeriodStartDate.add(Calendar.MONTH, 1);
- Timestamp retStampStartDate = new Timestamp(calendarTimePeriodStartDate.getTimeInMillis());
- retStampStartDate.setNanos(0);
- customTimePeriodStartDate = retStampStartDate;
- customTimePeriodEndDate = UtilDateTime.getMonthEnd(UtilDateTime.toTimestamp(retStampStartDate), timeZone, locale);
+ calendarTimePeriodStartDate.add(Calendar.MONTH, 1)
+ Timestamp retStampStartDate = new Timestamp(calendarTimePeriodStartDate.getTimeInMillis())
+ retStampStartDate.setNanos(0)
+ customTimePeriodStartDate = retStampStartDate
+ customTimePeriodEndDate = UtilDateTime.getMonthEnd(UtilDateTime.toTimestamp(retStampStartDate), timeZone, locale)
}
- context.glAcctgTrialBalanceList = glAcctgTrialBalanceList;
+ context.glAcctgTrialBalanceList = glAcctgTrialBalanceList
}
}
diff --git a/applications/accounting/groovyScripts/reports/IncomeStatement.groovy b/applications/accounting/groovyScripts/reports/IncomeStatement.groovy
index 17ad600153..58e1fa6901 100644
--- a/applications/accounting/groovyScripts/reports/IncomeStatement.groovy
+++ b/applications/accounting/groovyScripts/reports/IncomeStatement.groovy
@@ -17,372 +17,372 @@
* under the License.
*/
-import org.apache.ofbiz.base.util.UtilDateTime;
-import org.apache.ofbiz.base.util.UtilMisc;
-import org.apache.ofbiz.entity.GenericValue;
-import org.apache.ofbiz.entity.condition.EntityCondition;
-import org.apache.ofbiz.entity.condition.EntityOperator;
-import org.apache.ofbiz.accounting.util.UtilAccounting;
-import org.apache.ofbiz.party.party.PartyWorker;
+import org.apache.ofbiz.base.util.UtilDateTime
+import org.apache.ofbiz.base.util.UtilMisc
+import org.apache.ofbiz.entity.GenericValue
+import org.apache.ofbiz.entity.condition.EntityCondition
+import org.apache.ofbiz.entity.condition.EntityOperator
+import org.apache.ofbiz.accounting.util.UtilAccounting
+import org.apache.ofbiz.party.party.PartyWorker
if (!fromDate) {
- return;
+ return
}
if (!thruDate) {
- thruDate = UtilDateTime.nowTimestamp();
+ thruDate = UtilDateTime.nowTimestamp()
}
if (!glFiscalTypeId) {
- return;
+ return
}
organizationPartyId =null
if(context.organizationPartyId) {
- organizationPartyId = context.organizationPartyId;
+ organizationPartyId = context.organizationPartyId
} else {
organizationPartyId = parameters.get('ApplicationDecorator|organizationPartyId')
}
// Setup the divisions for which the report is executed
-List partyIds = PartyWorker.getAssociatedPartyIdsByRelationshipType(delegator, organizationPartyId, 'GROUP_ROLLUP');
-partyIds.add(organizationPartyId);
+List partyIds = PartyWorker.getAssociatedPartyIdsByRelationshipType(delegator, organizationPartyId, 'GROUP_ROLLUP')
+partyIds.add(organizationPartyId)
// Get the group of account classes that will be used to position accounts in the proper section of the financial statement
-GenericValue revenueGlAccountClass = from("GlAccountClass").where("glAccountClassId", "REVENUE").cache(true).queryOne();
-List revenueAccountClassIds = UtilAccounting.getDescendantGlAccountClassIds(revenueGlAccountClass);
-GenericValue contraRevenueGlAccountClass = from("GlAccountClass").where("glAccountClassId", "CONTRA_REVENUE").cache(true).queryOne();
-List contraRevenueAccountClassIds = UtilAccounting.getDescendantGlAccountClassIds(contraRevenueGlAccountClass);
-GenericValue incomeGlAccountClass = from("GlAccountClass").where("glAccountClassId", "INCOME").cache(true).queryOne();
-List incomeAccountClassIds = UtilAccounting.getDescendantGlAccountClassIds(incomeGlAccountClass);
-GenericValue expenseGlAccountClass = from("GlAccountClass").where("glAccountClassId", "EXPENSE").cache(true).queryOne();
-List expenseAccountClassIds = UtilAccounting.getDescendantGlAccountClassIds(expenseGlAccountClass);
-GenericValue cogsExpenseGlAccountClass = from("GlAccountClass").where("glAccountClassId", "COGS_EXPENSE").cache(true).queryOne();
-List cogsExpenseAccountClassIds = UtilAccounting.getDescendantGlAccountClassIds(cogsExpenseGlAccountClass);
-GenericValue sgaExpenseGlAccountClass = from("GlAccountClass").where("glAccountClassId", "SGA_EXPENSE").cache(true).queryOne();
-List sgaExpenseAccountClassIds = UtilAccounting.getDescendantGlAccountClassIds(sgaExpenseGlAccountClass);
-GenericValue depreciationGlAccountClass = from("GlAccountClass").where("glAccountClassId", "DEPRECIATION").cache(true).queryOne();
-List depreciationAccountClassIds = UtilAccounting.getDescendantGlAccountClassIds(depreciationGlAccountClass);
+GenericValue revenueGlAccountClass = from("GlAccountClass").where("glAccountClassId", "REVENUE").cache(true).queryOne()
+List revenueAccountClassIds = UtilAccounting.getDescendantGlAccountClassIds(revenueGlAccountClass)
+GenericValue contraRevenueGlAccountClass = from("GlAccountClass").where("glAccountClassId", "CONTRA_REVENUE").cache(true).queryOne()
+List contraRevenueAccountClassIds = UtilAccounting.getDescendantGlAccountClassIds(contraRevenueGlAccountClass)
+GenericValue incomeGlAccountClass = from("GlAccountClass").where("glAccountClassId", "INCOME").cache(true).queryOne()
+List incomeAccountClassIds = UtilAccounting.getDescendantGlAccountClassIds(incomeGlAccountClass)
+GenericValue expenseGlAccountClass = from("GlAccountClass").where("glAccountClassId", "EXPENSE").cache(true).queryOne()
+List expenseAccountClassIds = UtilAccounting.getDescendantGlAccountClassIds(expenseGlAccountClass)
+GenericValue cogsExpenseGlAccountClass = from("GlAccountClass").where("glAccountClassId", "COGS_EXPENSE").cache(true).queryOne()
+List cogsExpenseAccountClassIds = UtilAccounting.getDescendantGlAccountClassIds(cogsExpenseGlAccountClass)
+GenericValue sgaExpenseGlAccountClass = from("GlAccountClass").where("glAccountClassId", "SGA_EXPENSE").cache(true).queryOne()
+List sgaExpenseAccountClassIds = UtilAccounting.getDescendantGlAccountClassIds(sgaExpenseGlAccountClass)
+GenericValue depreciationGlAccountClass = from("GlAccountClass").where("glAccountClassId", "DEPRECIATION").cache(true).queryOne()
+List depreciationAccountClassIds = UtilAccounting.getDescendantGlAccountClassIds(depreciationGlAccountClass)
-List mainAndExprs = [];
-mainAndExprs.add(EntityCondition.makeCondition("organizationPartyId", EntityOperator.IN, partyIds));
-mainAndExprs.add(EntityCondition.makeCondition("isPosted", EntityOperator.EQUALS, "Y"));
-mainAndExprs.add(EntityCondition.makeCondition("glFiscalTypeId", EntityOperator.EQUALS, glFiscalTypeId));
-mainAndExprs.add(EntityCondition.makeCondition("acctgTransTypeId", EntityOperator.NOT_EQUAL, "PERIOD_CLOSING"));
-mainAndExprs.add(EntityCondition.makeCondition("transactionDate", EntityOperator.GREATER_THAN_EQUAL_TO, fromDate));
-mainAndExprs.add(EntityCondition.makeCondition("transactionDate", EntityOperator.LESS_THAN, thruDate));
+List mainAndExprs = []
+mainAndExprs.add(EntityCondition.makeCondition("organizationPartyId", EntityOperator.IN, partyIds))
+mainAndExprs.add(EntityCondition.makeCondition("isPosted", EntityOperator.EQUALS, "Y"))
+mainAndExprs.add(EntityCondition.makeCondition("glFiscalTypeId", EntityOperator.EQUALS, glFiscalTypeId))
+mainAndExprs.add(EntityCondition.makeCondition("acctgTransTypeId", EntityOperator.NOT_EQUAL, "PERIOD_CLOSING"))
+mainAndExprs.add(EntityCondition.makeCondition("transactionDate", EntityOperator.GREATER_THAN_EQUAL_TO, fromDate))
+mainAndExprs.add(EntityCondition.makeCondition("transactionDate", EntityOperator.LESS_THAN, thruDate))
-List balanceTotalList = [];
+List balanceTotalList = []
// REVENUE
// account balances
-accountBalanceList = [];
-transactionTotals = [];
-balanceTotal = BigDecimal.ZERO;
-List revenueAndExprs = mainAndExprs as LinkedList;
-revenueAndExprs.add(EntityCondition.makeCondition("glAccountClassId", EntityOperator.IN, revenueAccountClassIds));
-transactionTotals = select("glAccountId", "accountName", "accountCode", "debitCreditFlag", "amount").from("AcctgTransEntrySums").where(revenueAndExprs).orderBy("glAccountId").queryList();
+accountBalanceList = []
+transactionTotals = []
+balanceTotal = BigDecimal.ZERO
+List revenueAndExprs = mainAndExprs as LinkedList
+revenueAndExprs.add(EntityCondition.makeCondition("glAccountClassId", EntityOperator.IN, revenueAccountClassIds))
+transactionTotals = select("glAccountId", "accountName", "accountCode", "debitCreditFlag", "amount").from("AcctgTransEntrySums").where(revenueAndExprs).orderBy("glAccountId").queryList()
if (transactionTotals) {
- Map transactionTotalsMap = [:];
- balanceTotalCredit = BigDecimal.ZERO;
- balanceTotalDebit = BigDecimal.ZERO;
+ Map transactionTotalsMap = [:]
+ balanceTotalCredit = BigDecimal.ZERO
+ balanceTotalDebit = BigDecimal.ZERO
transactionTotals.each { transactionTotal ->
- Map accountMap = (Map)transactionTotalsMap.get(transactionTotal.glAccountId);
+ Map accountMap = (Map)transactionTotalsMap.get(transactionTotal.glAccountId)
if (!accountMap) {
- accountMap = UtilMisc.makeMapWritable(transactionTotal);
- accountMap.remove("debitCreditFlag");
- accountMap.remove("amount");
- accountMap.put("D", BigDecimal.ZERO);
- accountMap.put("C", BigDecimal.ZERO);
- accountMap.put("balance", BigDecimal.ZERO);
+ accountMap = UtilMisc.makeMapWritable(transactionTotal)
+ accountMap.remove("debitCreditFlag")
+ accountMap.remove("amount")
+ accountMap.put("D", BigDecimal.ZERO)
+ accountMap.put("C", BigDecimal.ZERO)
+ accountMap.put("balance", BigDecimal.ZERO)
}
- UtilMisc.addToBigDecimalInMap(accountMap, transactionTotal.debitCreditFlag, transactionTotal.amount);
+ UtilMisc.addToBigDecimalInMap(accountMap, transactionTotal.debitCreditFlag, transactionTotal.amount)
if ("D".equals(transactionTotal.debitCreditFlag)) {
- balanceTotalDebit = balanceTotalDebit.add(transactionTotal.amount);
+ balanceTotalDebit = balanceTotalDebit.add(transactionTotal.amount)
} else {
- balanceTotalCredit = balanceTotalCredit.add(transactionTotal.amount);
+ balanceTotalCredit = balanceTotalCredit.add(transactionTotal.amount)
}
- BigDecimal debitAmount = (BigDecimal)accountMap.get("D");
- BigDecimal creditAmount = (BigDecimal)accountMap.get("C");
+ BigDecimal debitAmount = (BigDecimal)accountMap.get("D")
+ BigDecimal creditAmount = (BigDecimal)accountMap.get("C")
// revenues are accounts of class CREDIT: the balance is given by credits minus debits
- BigDecimal balance = creditAmount.subtract(debitAmount);
- accountMap.put("balance", balance);
- transactionTotalsMap.put(transactionTotal.glAccountId, accountMap);
+ BigDecimal balance = creditAmount.subtract(debitAmount)
+ accountMap.put("balance", balance)
+ transactionTotalsMap.put(transactionTotal.glAccountId, accountMap)
}
- accountBalanceList = UtilMisc.sortMaps(transactionTotalsMap.values().asList(), UtilMisc.toList("accountCode"));
+ accountBalanceList = UtilMisc.sortMaps(transactionTotalsMap.values().asList(), UtilMisc.toList("accountCode"))
// revenues are accounts of class CREDIT: the balance is given by credits minus debits
- balanceTotal = balanceTotalCredit.subtract(balanceTotalDebit);
+ balanceTotal = balanceTotalCredit.subtract(balanceTotalDebit)
}
-context.revenueAccountBalanceList = accountBalanceList;
-context.revenueAccountBalanceList.add(UtilMisc.toMap("accountName", "TOTAL REVENUES", "balance", balanceTotal));
-context.revenueBalanceTotal = balanceTotal;
+context.revenueAccountBalanceList = accountBalanceList
+context.revenueAccountBalanceList.add(UtilMisc.toMap("accountName", "TOTAL REVENUES", "balance", balanceTotal))
+context.revenueBalanceTotal = balanceTotal
// CONTRA REVENUE
// account balances
-accountBalanceList = [];
-transactionTotals = [];
-balanceTotal = BigDecimal.ZERO;
-List contraRevenueAndExprs = mainAndExprs as LinkedList;
-contraRevenueAndExprs.add(EntityCondition.makeCondition("glAccountClassId", EntityOperator.IN, contraRevenueAccountClassIds));
-transactionTotals = select("glAccountId", "accountName", "accountCode", "debitCreditFlag", "amount").from("AcctgTransEntrySums").where(contraRevenueAndExprs).orderBy("glAccountId").queryList();
+accountBalanceList = []
+transactionTotals = []
+balanceTotal = BigDecimal.ZERO
+List contraRevenueAndExprs = mainAndExprs as LinkedList
+contraRevenueAndExprs.add(EntityCondition.makeCondition("glAccountClassId", EntityOperator.IN, contraRevenueAccountClassIds))
+transactionTotals = select("glAccountId", "accountName", "accountCode", "debitCreditFlag", "amount").from("AcctgTransEntrySums").where(contraRevenueAndExprs).orderBy("glAccountId").queryList()
if (transactionTotals) {
- Map transactionTotalsMap = [:];
- balanceTotalCredit = BigDecimal.ZERO;
- balanceTotalDebit = BigDecimal.ZERO;
+ Map transactionTotalsMap = [:]
+ balanceTotalCredit = BigDecimal.ZERO
+ balanceTotalDebit = BigDecimal.ZERO
transactionTotals.each { transactionTotal ->
- Map accountMap = (Map)transactionTotalsMap.get(transactionTotal.glAccountId);
+ Map accountMap = (Map)transactionTotalsMap.get(transactionTotal.glAccountId)
if (!accountMap) {
- accountMap = UtilMisc.makeMapWritable(transactionTotal);
- accountMap.remove("debitCreditFlag");
- accountMap.remove("amount");
- accountMap.put("D", BigDecimal.ZERO);
- accountMap.put("C", BigDecimal.ZERO);
- accountMap.put("balance", BigDecimal.ZERO);
+ accountMap = UtilMisc.makeMapWritable(transactionTotal)
+ accountMap.remove("debitCreditFlag")
+ accountMap.remove("amount")
+ accountMap.put("D", BigDecimal.ZERO)
+ accountMap.put("C", BigDecimal.ZERO)
+ accountMap.put("balance", BigDecimal.ZERO)
}
- UtilMisc.addToBigDecimalInMap(accountMap, transactionTotal.debitCreditFlag, transactionTotal.amount);
+ UtilMisc.addToBigDecimalInMap(accountMap, transactionTotal.debitCreditFlag, transactionTotal.amount)
if ("D".equals(transactionTotal.debitCreditFlag)) {
- balanceTotalDebit = balanceTotalDebit.add(transactionTotal.amount);
+ balanceTotalDebit = balanceTotalDebit.add(transactionTotal.amount)
} else {
- balanceTotalCredit = balanceTotalCredit.add(transactionTotal.amount);
+ balanceTotalCredit = balanceTotalCredit.add(transactionTotal.amount)
}
- BigDecimal debitAmount = (BigDecimal)accountMap.get("D");
- BigDecimal creditAmount = (BigDecimal)accountMap.get("C");
+ BigDecimal debitAmount = (BigDecimal)accountMap.get("D")
+ BigDecimal creditAmount = (BigDecimal)accountMap.get("C")
// contra revenues are accounts of class DEBIT: the balance is given by debits minus credits
- BigDecimal balance = debitAmount.subtract(creditAmount);
- accountMap.put("balance", balance);
- transactionTotalsMap.put(transactionTotal.glAccountId, accountMap);
+ BigDecimal balance = debitAmount.subtract(creditAmount)
+ accountMap.put("balance", balance)
+ transactionTotalsMap.put(transactionTotal.glAccountId, accountMap)
}
- accountBalanceList = UtilMisc.sortMaps(transactionTotalsMap.values().asList(), UtilMisc.toList("accountCode"));
+ accountBalanceList = UtilMisc.sortMaps(transactionTotalsMap.values().asList(), UtilMisc.toList("accountCode"))
// contra revenues are accounts of class DEBIT: the balance is given by debits minus credits
- balanceTotal = balanceTotalDebit.subtract(balanceTotalCredit);
+ balanceTotal = balanceTotalDebit.subtract(balanceTotalCredit)
}
-context.contraRevenueBalanceTotal = balanceTotal;
-balanceTotalList.add(UtilMisc.toMap("totalName", "TOTAL CONTRA REVENUE", "balance", balanceTotal));
+context.contraRevenueBalanceTotal = balanceTotal
+balanceTotalList.add(UtilMisc.toMap("totalName", "TOTAL CONTRA REVENUE", "balance", balanceTotal))
// EXPENSE
// account balances
-accountBalanceList = [];
-transactionTotals = [];
-balanceTotal = BigDecimal.ZERO;
-List expenseAndExprs = mainAndExprs as LinkedList;
-expenseAndExprs.add(EntityCondition.makeCondition("glAccountClassId", EntityOperator.IN, expenseAccountClassIds));
-transactionTotals = select("glAccountId", "accountName", "accountCode", "debitCreditFlag", "amount").from("AcctgTransEntrySums").where(expenseAndExprs).queryList();
+accountBalanceList = []
+transactionTotals = []
+balanceTotal = BigDecimal.ZERO
+List expenseAndExprs = mainAndExprs as LinkedList
+expenseAndExprs.add(EntityCondition.makeCondition("glAccountClassId", EntityOperator.IN, expenseAccountClassIds))
+transactionTotals = select("glAccountId", "accountName", "accountCode", "debitCreditFlag", "amount").from("AcctgTransEntrySums").where(expenseAndExprs).queryList()
if (transactionTotals) {
- Map transactionTotalsMap = [:];
- balanceTotalCredit = BigDecimal.ZERO;
- balanceTotalDebit = BigDecimal.ZERO;
+ Map transactionTotalsMap = [:]
+ balanceTotalCredit = BigDecimal.ZERO
+ balanceTotalDebit = BigDecimal.ZERO
transactionTotals.each { transactionTotal ->
- Map accountMap = (Map)transactionTotalsMap.get(transactionTotal.glAccountId);
+ Map accountMap = (Map)transactionTotalsMap.get(transactionTotal.glAccountId)
if (!accountMap) {
- accountMap = UtilMisc.makeMapWritable(transactionTotal);
- accountMap.remove("debitCreditFlag");
- accountMap.remove("amount");
- accountMap.put("D", BigDecimal.ZERO);
- accountMap.put("C", BigDecimal.ZERO);
- accountMap.put("balance", BigDecimal.ZERO);
+ accountMap = UtilMisc.makeMapWritable(transactionTotal)
+ accountMap.remove("debitCreditFlag")
+ accountMap.remove("amount")
+ accountMap.put("D", BigDecimal.ZERO)
+ accountMap.put("C", BigDecimal.ZERO)
+ accountMap.put("balance", BigDecimal.ZERO)
}
- UtilMisc.addToBigDecimalInMap(accountMap, transactionTotal.debitCreditFlag, transactionTotal.amount);
+ UtilMisc.addToBigDecimalInMap(accountMap, transactionTotal.debitCreditFlag, transactionTotal.amount)
if ("D".equals(transactionTotal.debitCreditFlag)) {
- balanceTotalDebit = balanceTotalDebit.add(transactionTotal.amount);
+ balanceTotalDebit = balanceTotalDebit.add(transactionTotal.amount)
} else {
- balanceTotalCredit = balanceTotalCredit.add(transactionTotal.amount);
+ balanceTotalCredit = balanceTotalCredit.add(transactionTotal.amount)
}
- BigDecimal debitAmount = (BigDecimal)accountMap.get("D");
- BigDecimal creditAmount = (BigDecimal)accountMap.get("C");
+ BigDecimal debitAmount = (BigDecimal)accountMap.get("D")
+ BigDecimal creditAmount = (BigDecimal)accountMap.get("C")
// expenses are accounts of class DEBIT: the balance is given by debits minus credits
- BigDecimal balance = debitAmount.subtract(creditAmount);
- accountMap.put("balance", balance);
- transactionTotalsMap.put(transactionTotal.glAccountId, accountMap);
+ BigDecimal balance = debitAmount.subtract(creditAmount)
+ accountMap.put("balance", balance)
+ transactionTotalsMap.put(transactionTotal.glAccountId, accountMap)
}
- accountBalanceList = UtilMisc.sortMaps(transactionTotalsMap.values().asList(), UtilMisc.toList("accountCode"));
+ accountBalanceList = UtilMisc.sortMaps(transactionTotalsMap.values().asList(), UtilMisc.toList("accountCode"))
// expenses are accounts of class DEBIT: the balance is given by debits minus credits
- balanceTotal = balanceTotalDebit.subtract(balanceTotalCredit);
+ balanceTotal = balanceTotalDebit.subtract(balanceTotalCredit)
}
-context.expenseAccountBalanceList = accountBalanceList;
-context.expenseAccountBalanceList.add(UtilMisc.toMap("accountName", "TOTAL EXPENSES", "balance", balanceTotal));
-context.expenseBalanceTotal = balanceTotal;
+context.expenseAccountBalanceList = accountBalanceList
+context.expenseAccountBalanceList.add(UtilMisc.toMap("accountName", "TOTAL EXPENSES", "balance", balanceTotal))
+context.expenseBalanceTotal = balanceTotal
// COST OF GOODS SOLD (COGS_EXPENSE)
// account balances
-accountBalanceList = [];
-transactionTotals = [];
-balanceTotal = BigDecimal.ZERO;
-List cogsExpenseAndExprs = mainAndExprs as LinkedList;
-cogsExpenseAndExprs.add(EntityCondition.makeCondition("glAccountClassId", EntityOperator.IN, cogsExpenseAccountClassIds));
-transactionTotals = select("glAccountId", "accountName", "accountCode", "debitCreditFlag", "amount").from("AcctgTransEntrySums").where(cogsExpenseAndExprs).orderBy("glAccountId").queryList();
+accountBalanceList = []
+transactionTotals = []
+balanceTotal = BigDecimal.ZERO
+List cogsExpenseAndExprs = mainAndExprs as LinkedList
+cogsExpenseAndExprs.add(EntityCondition.makeCondition("glAccountClassId", EntityOperator.IN, cogsExpenseAccountClassIds))
+transactionTotals = select("glAccountId", "accountName", "accountCode", "debitCreditFlag", "amount").from("AcctgTransEntrySums").where(cogsExpenseAndExprs).orderBy("glAccountId").queryList()
if (transactionTotals) {
- Map transactionTotalsMap = [:];
- balanceTotalCredit = BigDecimal.ZERO;
- balanceTotalDebit = BigDecimal.ZERO;
+ Map transactionTotalsMap = [:]
+ balanceTotalCredit = BigDecimal.ZERO
+ balanceTotalDebit = BigDecimal.ZERO
transactionTotals.each { transactionTotal ->
- Map accountMap = (Map)transactionTotalsMap.get(transactionTotal.glAccountId);
+ Map accountMap = (Map)transactionTotalsMap.get(transactionTotal.glAccountId)
if (!accountMap) {
- accountMap = UtilMisc.makeMapWritable(transactionTotal);
- accountMap.remove("debitCreditFlag");
- accountMap.remove("amount");
- accountMap.put("D", BigDecimal.ZERO);
- accountMap.put("C", BigDecimal.ZERO);
- accountMap.put("balance", BigDecimal.ZERO);
+ accountMap = UtilMisc.makeMapWritable(transactionTotal)
+ accountMap.remove("debitCreditFlag")
+ accountMap.remove("amount")
+ accountMap.put("D", BigDecimal.ZERO)
+ accountMap.put("C", BigDecimal.ZERO)
+ accountMap.put("balance", BigDecimal.ZERO)
}
- UtilMisc.addToBigDecimalInMap(accountMap, transactionTotal.debitCreditFlag, transactionTotal.amount);
+ UtilMisc.addToBigDecimalInMap(accountMap, transactionTotal.debitCreditFlag, transactionTotal.amount)
if ("D".equals(transactionTotal.debitCreditFlag)) {
- balanceTotalDebit = balanceTotalDebit.add(transactionTotal.amount);
+ balanceTotalDebit = balanceTotalDebit.add(transactionTotal.amount)
} else {
- balanceTotalCredit = balanceTotalCredit.add(transactionTotal.amount);
+ balanceTotalCredit = balanceTotalCredit.add(transactionTotal.amount)
}
- BigDecimal debitAmount = (BigDecimal)accountMap.get("D");
- BigDecimal creditAmount = (BigDecimal)accountMap.get("C");
+ BigDecimal debitAmount = (BigDecimal)accountMap.get("D")
+ BigDecimal creditAmount = (BigDecimal)accountMap.get("C")
// expenses are accounts of class DEBIT: the balance is given by debits minus credits
- BigDecimal balance = debitAmount.subtract(creditAmount);
- accountMap.put("balance", balance);
- transactionTotalsMap.put(transactionTotal.glAccountId, accountMap);
+ BigDecimal balance = debitAmount.subtract(creditAmount)
+ accountMap.put("balance", balance)
+ transactionTotalsMap.put(transactionTotal.glAccountId, accountMap)
}
- accountBalanceList = UtilMisc.sortMaps(transactionTotalsMap.values().asList(), UtilMisc.toList("accountCode"));
+ accountBalanceList = UtilMisc.sortMaps(transactionTotalsMap.values().asList(), UtilMisc.toList("accountCode"))
// expenses are accounts of class DEBIT: the balance is given by debits minus credits
- balanceTotal = balanceTotalDebit.subtract(balanceTotalCredit);
+ balanceTotal = balanceTotalDebit.subtract(balanceTotalCredit)
}
-context.cogsExpense = balanceTotal;
-balanceTotalList.add(UtilMisc.toMap("totalName", "AccountingCostOfGoodsSold", "balance", balanceTotal));
+context.cogsExpense = balanceTotal
+balanceTotalList.add(UtilMisc.toMap("totalName", "AccountingCostOfGoodsSold", "balance", balanceTotal))
// OPERATING EXPENSES (SGA_EXPENSE)
// account balances
-accountBalanceList = [];
-transactionTotals = [];
-balanceTotal = BigDecimal.ZERO;
-List sgaExpenseAndExprs = mainAndExprs as LinkedList;
-sgaExpenseAndExprs.add(EntityCondition.makeCondition("glAccountClassId", EntityOperator.IN, sgaExpenseAccountClassIds));
-transactionTotals = select("glAccountId", "accountName", "accountCode", "debitCreditFlag", "amount").from("AcctgTransEntrySums").where(sgaExpenseAndExprs).orderBy("glAccountId").queryList();
+accountBalanceList = []
+transactionTotals = []
+balanceTotal = BigDecimal.ZERO
+List sgaExpenseAndExprs = mainAndExprs as LinkedList
+sgaExpenseAndExprs.add(EntityCondition.makeCondition("glAccountClassId", EntityOperator.IN, sgaExpenseAccountClassIds))
+transactionTotals = select("glAccountId", "accountName", "accountCode", "debitCreditFlag", "amount").from("AcctgTransEntrySums").where(sgaExpenseAndExprs).orderBy("glAccountId").queryList()
if (transactionTotals) {
- Map transactionTotalsMap = [:];
- balanceTotalCredit = BigDecimal.ZERO;
- balanceTotalDebit = BigDecimal.ZERO;
+ Map transactionTotalsMap = [:]
+ balanceTotalCredit = BigDecimal.ZERO
+ balanceTotalDebit = BigDecimal.ZERO
transactionTotals.each { transactionTotal ->
- Map accountMap = (Map)transactionTotalsMap.get(transactionTotal.glAccountId);
+ Map accountMap = (Map)transactionTotalsMap.get(transactionTotal.glAccountId)
if (!accountMap) {
- accountMap = UtilMisc.makeMapWritable(transactionTotal);
- accountMap.remove("debitCreditFlag");
- accountMap.remove("amount");
- accountMap.put("D", BigDecimal.ZERO);
- accountMap.put("C", BigDecimal.ZERO);
- accountMap.put("balance", BigDecimal.ZERO);
+ accountMap = UtilMisc.makeMapWritable(transactionTotal)
+ accountMap.remove("debitCreditFlag")
+ accountMap.remove("amount")
+ accountMap.put("D", BigDecimal.ZERO)
+ accountMap.put("C", BigDecimal.ZERO)
+ accountMap.put("balance", BigDecimal.ZERO)
}
- UtilMisc.addToBigDecimalInMap(accountMap, transactionTotal.debitCreditFlag, transactionTotal.amount);
+ UtilMisc.addToBigDecimalInMap(accountMap, transactionTotal.debitCreditFlag, transactionTotal.amount)
if ("D".equals(transactionTotal.debitCreditFlag)) {
- balanceTotalDebit = balanceTotalDebit.add(transactionTotal.amount);
+ balanceTotalDebit = balanceTotalDebit.add(transactionTotal.amount)
} else {
- balanceTotalCredit = balanceTotalCredit.add(transactionTotal.amount);
+ balanceTotalCredit = balanceTotalCredit.add(transactionTotal.amount)
}
- BigDecimal debitAmount = (BigDecimal)accountMap.get("D");
- BigDecimal creditAmount = (BigDecimal)accountMap.get("C");
+ BigDecimal debitAmount = (BigDecimal)accountMap.get("D")
+ BigDecimal creditAmount = (BigDecimal)accountMap.get("C")
// expenses are accounts of class DEBIT: the balance is given by debits minus credits
- BigDecimal balance = debitAmount.subtract(creditAmount);
- accountMap.put("balance", balance);
- transactionTotalsMap.put(transactionTotal.glAccountId, accountMap);
+ BigDecimal balance = debitAmount.subtract(creditAmount)
+ accountMap.put("balance", balance)
+ transactionTotalsMap.put(transactionTotal.glAccountId, accountMap)
}
- accountBalanceList = UtilMisc.sortMaps(transactionTotalsMap.values().asList(), UtilMisc.toList("accountCode"));
+ accountBalanceList = UtilMisc.sortMaps(transactionTotalsMap.values().asList(), UtilMisc.toList("accountCode"))
// expenses are accounts of class DEBIT: the balance is given by debits minus credits
- balanceTotal = balanceTotalDebit.subtract(balanceTotalCredit);
+ balanceTotal = balanceTotalDebit.subtract(balanceTotalCredit)
}
-sgaExpense = balanceTotal;
+sgaExpense = balanceTotal
//DEPRECIATION (DEPRECIATION)
//account balances
-accountBalanceList = [];
-transactionTotals = [];
-balanceTotal = BigDecimal.ZERO;
-List depreciationAndExprs = mainAndExprs as LinkedList;
-depreciationAndExprs.add(EntityCondition.makeCondition("glAccountClassId", EntityOperator.IN, depreciationAccountClassIds));
-transactionTotals = select("glAccountId", "accountName", "accountCode", "debitCreditFlag", "amount").from("AcctgTransEntrySums").where(depreciationAndExprs).orderBy("glAccountId").queryList();
+accountBalanceList = []
+transactionTotals = []
+balanceTotal = BigDecimal.ZERO
+List depreciationAndExprs = mainAndExprs as LinkedList
+depreciationAndExprs.add(EntityCondition.makeCondition("glAccountClassId", EntityOperator.IN, depreciationAccountClassIds))
+transactionTotals = select("glAccountId", "accountName", "accountCode", "debitCreditFlag", "amount").from("AcctgTransEntrySums").where(depreciationAndExprs).orderBy("glAccountId").queryList()
if (transactionTotals) {
-Map transactionTotalsMap = [:];
-balanceTotalCredit = BigDecimal.ZERO;
-balanceTotalDebit = BigDecimal.ZERO;
+Map transactionTotalsMap = [:]
+balanceTotalCredit = BigDecimal.ZERO
+balanceTotalDebit = BigDecimal.ZERO
transactionTotals.each { transactionTotal ->
- Map accountMap = (Map)transactionTotalsMap.get(transactionTotal.glAccountId);
+ Map accountMap = (Map)transactionTotalsMap.get(transactionTotal.glAccountId)
if (!accountMap) {
- accountMap = UtilMisc.makeMapWritable(transactionTotal);
- accountMap.remove("debitCreditFlag");
- accountMap.remove("amount");
- accountMap.put("D", BigDecimal.ZERO);
- accountMap.put("C", BigDecimal.ZERO);
- accountMap.put("balance", BigDecimal.ZERO);
+ accountMap = UtilMisc.makeMapWritable(transactionTotal)
+ accountMap.remove("debitCreditFlag")
+ accountMap.remove("amount")
+ accountMap.put("D", BigDecimal.ZERO)
+ accountMap.put("C", BigDecimal.ZERO)
+ accountMap.put("balance", BigDecimal.ZERO)
}
- UtilMisc.addToBigDecimalInMap(accountMap, transactionTotal.debitCreditFlag, transactionTotal.amount);
+ UtilMisc.addToBigDecimalInMap(accountMap, transactionTotal.debitCreditFlag, transactionTotal.amount)
if ("D".equals(transactionTotal.debitCreditFlag)) {
- balanceTotalDebit = balanceTotalDebit.add(transactionTotal.amount);
+ balanceTotalDebit = balanceTotalDebit.add(transactionTotal.amount)
} else {
- balanceTotalCredit = balanceTotalCredit.add(transactionTotal.amount);
+ balanceTotalCredit = balanceTotalCredit.add(transactionTotal.amount)
}
- BigDecimal debitAmount = (BigDecimal)accountMap.get("D");
- BigDecimal creditAmount = (BigDecimal)accountMap.get("C");
+ BigDecimal debitAmount = (BigDecimal)accountMap.get("D")
+ BigDecimal creditAmount = (BigDecimal)accountMap.get("C")
// expenses are accounts of class DEBIT: the balance is given by debits minus credits
- BigDecimal balance = debitAmount.subtract(creditAmount);
- accountMap.put("balance", balance);
- transactionTotalsMap.put(transactionTotal.glAccountId, accountMap);
+ BigDecimal balance = debitAmount.subtract(creditAmount)
+ accountMap.put("balance", balance)
+ transactionTotalsMap.put(transactionTotal.glAccountId, accountMap)
}
-accountBalanceList = UtilMisc.sortMaps(transactionTotalsMap.values().asList(), UtilMisc.toList("accountCode"));
+accountBalanceList = UtilMisc.sortMaps(transactionTotalsMap.values().asList(), UtilMisc.toList("accountCode"))
// expenses are accounts of class DEBIT: the balance is given by debits minus credits
-balanceTotal = balanceTotalDebit.subtract(balanceTotalCredit);
+balanceTotal = balanceTotalDebit.subtract(balanceTotalCredit)
}
-depreciation = balanceTotal;
+depreciation = balanceTotal
// INCOME
// account balances
-accountBalanceList = [];
-transactionTotals = [];
-balanceTotal = BigDecimal.ZERO;
-List incomeAndExprs = mainAndExprs as LinkedList;
-incomeAndExprs.add(EntityCondition.makeCondition("glAccountClassId", EntityOperator.IN, incomeAccountClassIds));
-transactionTotals = select("glAccountId", "accountName", "accountCode", "debitCreditFlag", "amount").from("AcctgTransEntrySums").where(incomeAndExprs).orderBy("glAccountId").queryList();
+accountBalanceList = []
+transactionTotals = []
+balanceTotal = BigDecimal.ZERO
+List incomeAndExprs = mainAndExprs as LinkedList
+incomeAndExprs.add(EntityCondition.makeCondition("glAccountClassId", EntityOperator.IN, incomeAccountClassIds))
+transactionTotals = select("glAccountId", "accountName", "accountCode", "debitCreditFlag", "amount").from("AcctgTransEntrySums").where(incomeAndExprs).orderBy("glAccountId").queryList()
if (transactionTotals) {
- Map transactionTotalsMap = [:];
- balanceTotalCredit = BigDecimal.ZERO;
- balanceTotalDebit = BigDecimal.ZERO;
+ Map transactionTotalsMap = [:]
+ balanceTotalCredit = BigDecimal.ZERO
+ balanceTotalDebit = BigDecimal.ZERO
transactionTotals.each { transactionTotal ->
- Map accountMap = (Map)transactionTotalsMap.get(transactionTotal.glAccountId);
+ Map accountMap = (Map)transactionTotalsMap.get(transactionTotal.glAccountId)
if (!accountMap) {
- accountMap = UtilMisc.makeMapWritable(transactionTotal);
- accountMap.remove("debitCreditFlag");
- accountMap.remove("amount");
- accountMap.put("D", BigDecimal.ZERO);
- accountMap.put("C", BigDecimal.ZERO);
- accountMap.put("balance", BigDecimal.ZERO);
+ accountMap = UtilMisc.makeMapWritable(transactionTotal)
+ accountMap.remove("debitCreditFlag")
+ accountMap.remove("amount")
+ accountMap.put("D", BigDecimal.ZERO)
+ accountMap.put("C", BigDecimal.ZERO)
+ accountMap.put("balance", BigDecimal.ZERO)
}
- UtilMisc.addToBigDecimalInMap(accountMap, transactionTotal.debitCreditFlag, transactionTotal.amount);
+ UtilMisc.addToBigDecimalInMap(accountMap, transactionTotal.debitCreditFlag, transactionTotal.amount)
if ("D".equals(transactionTotal.debitCreditFlag)) {
- balanceTotalDebit = balanceTotalDebit.add(transactionTotal.amount);
+ balanceTotalDebit = balanceTotalDebit.add(transactionTotal.amount)
} else {
- balanceTotalCredit = balanceTotalCredit.add(transactionTotal.amount);
+ balanceTotalCredit = balanceTotalCredit.add(transactionTotal.amount)
}
- BigDecimal debitAmount = (BigDecimal)accountMap.get("D");
- BigDecimal creditAmount = (BigDecimal)accountMap.get("C");
+ BigDecimal debitAmount = (BigDecimal)accountMap.get("D")
+ BigDecimal creditAmount = (BigDecimal)accountMap.get("C")
// income are accounts of class CREDIT: the balance is given by credits minus debits
- BigDecimal balance = creditAmount.subtract(debitAmount);
- accountMap.put("balance", balance);
- transactionTotalsMap.put(transactionTotal.glAccountId, accountMap);
+ BigDecimal balance = creditAmount.subtract(debitAmount)
+ accountMap.put("balance", balance)
+ transactionTotalsMap.put(transactionTotal.glAccountId, accountMap)
}
- accountBalanceList = UtilMisc.sortMaps(transactionTotalsMap.values().asList(), UtilMisc.toList("accountCode"));
+ accountBalanceList = UtilMisc.sortMaps(transactionTotalsMap.values().asList(), UtilMisc.toList("accountCode"))
// incomes are accounts of class CREDIT: the balance is given by credits minus debits
- balanceTotal = balanceTotalCredit.subtract(balanceTotalDebit);
+ balanceTotal = balanceTotalCredit.subtract(balanceTotalDebit)
}
-context.incomeAccountBalanceList = accountBalanceList;
-context.incomeAccountBalanceList.add(UtilMisc.toMap("accountName", "TOTAL INCOME", "balance", balanceTotal));
-context.incomeBalanceTotal = balanceTotal;
+context.incomeAccountBalanceList = accountBalanceList
+context.incomeAccountBalanceList.add(UtilMisc.toMap("accountName", "TOTAL INCOME", "balance", balanceTotal))
+context.incomeBalanceTotal = balanceTotal
// NET SALES = REVENUES - CONTRA REVENUES
-context.netSales = (context.revenueBalanceTotal).subtract(context.contraRevenueBalanceTotal);
-balanceTotalList.add(UtilMisc.toMap("totalName", "AccountingTotalNetSales", "balance", context.netSales));
+context.netSales = (context.revenueBalanceTotal).subtract(context.contraRevenueBalanceTotal)
+balanceTotalList.add(UtilMisc.toMap("totalName", "AccountingTotalNetSales", "balance", context.netSales))
// GROSS MARGIN = NET SALES - COSTS OF GOODS SOLD
-context.grossMargin = (context.netSales).subtract(context.cogsExpense);
-balanceTotalList.add(UtilMisc.toMap("totalName", "AccountingGrossMargin", "balance", context.grossMargin));
+context.grossMargin = (context.netSales).subtract(context.cogsExpense)
+balanceTotalList.add(UtilMisc.toMap("totalName", "AccountingGrossMargin", "balance", context.grossMargin))
// OPERATING EXPENSES
-context.sgaExpense = sgaExpense;
-balanceTotalList.add(UtilMisc.toMap("totalName", "AccountingOperatingExpenses", "balance", context.sgaExpense));
+context.sgaExpense = sgaExpense
+balanceTotalList.add(UtilMisc.toMap("totalName", "AccountingOperatingExpenses", "balance", context.sgaExpense))
// DEPRECIATION
-context.depreciation = depreciation;
-balanceTotalList.add(UtilMisc.toMap("totalName", "AccountingDepreciation", "balance", context.depreciation));
+context.depreciation = depreciation
+balanceTotalList.add(UtilMisc.toMap("totalName", "AccountingDepreciation", "balance", context.depreciation))
// INCOME FROM OPERATIONS = GROSS MARGIN - OPERATING EXPENSES
-context.incomeFromOperations = (context.grossMargin).subtract(context.sgaExpense);
-balanceTotalList.add(UtilMisc.toMap("totalName", "AccountingIncomeFromOperations", "balance", context.incomeFromOperations));
+context.incomeFromOperations = (context.grossMargin).subtract(context.sgaExpense)
+balanceTotalList.add(UtilMisc.toMap("totalName", "AccountingIncomeFromOperations", "balance", context.incomeFromOperations))
// NET INCOME
-context.netIncome = (context.netSales).add(context.incomeBalanceTotal).subtract(context.expenseBalanceTotal);
-balanceTotalList.add(UtilMisc.toMap("totalName", "AccountingNetIncome", "balance", context.netIncome));
+context.netIncome = (context.netSales).add(context.incomeBalanceTotal).subtract(context.expenseBalanceTotal)
+balanceTotalList.add(UtilMisc.toMap("totalName", "AccountingNetIncome", "balance", context.netIncome))
-context.balanceTotalList = balanceTotalList;
+context.balanceTotalList = balanceTotalList
diff --git a/applications/accounting/groovyScripts/reports/MonthSelection.groovy b/applications/accounting/groovyScripts/reports/MonthSelection.groovy
index 7dfb489e1b..e7a7158bb6 100644
--- a/applications/accounting/groovyScripts/reports/MonthSelection.groovy
+++ b/applications/accounting/groovyScripts/reports/MonthSelection.groovy
@@ -17,13 +17,13 @@
* under the License.
*/
-import org.apache.ofbiz.base.util.UtilDateTime;
-import org.apache.ofbiz.service.calendar.ExpressionUiHelper;
+import org.apache.ofbiz.base.util.UtilDateTime
+import org.apache.ofbiz.service.calendar.ExpressionUiHelper
if (parameters.selectedMonth) {
- selectedMonth = Integer.valueOf(parameters.selectedMonth);
- selectedMonthDate = UtilDateTime.toTimestamp((selectedMonth + 1), 1, UtilDateTime.getYear(UtilDateTime.nowTimestamp(), timeZone, locale), 0, 0, 0);
- context.fromDate = UtilDateTime.getMonthStart(selectedMonthDate, timeZone, locale);
- context.thruDate = UtilDateTime.getMonthEnd(selectedMonthDate, timeZone, locale);
+ selectedMonth = Integer.valueOf(parameters.selectedMonth)
+ selectedMonthDate = UtilDateTime.toTimestamp((selectedMonth + 1), 1, UtilDateTime.getYear(UtilDateTime.nowTimestamp(), timeZone, locale), 0, 0, 0)
+ context.fromDate = UtilDateTime.getMonthStart(selectedMonthDate, timeZone, locale)
+ context.thruDate = UtilDateTime.getMonthEnd(selectedMonthDate, timeZone, locale)
}
-context.monthList = ExpressionUiHelper.getMonthValueList(locale);
+context.monthList = ExpressionUiHelper.getMonthValueList(locale)
diff --git a/applications/accounting/groovyScripts/reports/SalesInvoiceByProductCategorySummary.groovy b/applications/accounting/groovyScripts/reports/SalesInvoiceByProductCategorySummary.groovy
index 39ce4776cf..250090a88d 100644
--- a/applications/accounting/groovyScripts/reports/SalesInvoiceByProductCategorySummary.groovy
+++ b/applications/accounting/groovyScripts/reports/SalesInvoiceByProductCategorySummary.groovy
@@ -28,137 +28,137 @@ import org.apache.ofbiz.entity.condition.EntityOperator
//TODO:
// get products and categories under the root category
-productMemberList = from("ProductCategoryMember").where("productCategoryId", rootProductCategoryId).orderBy("sequenceNum").queryList();
-categoryRollupList = from("ProductCategoryRollup").where("parentProductCategoryId", rootProductCategoryId).orderBy("sequenceNum").queryList();
+productMemberList = from("ProductCategoryMember").where("productCategoryId", rootProductCategoryId).orderBy("sequenceNum").queryList()
+categoryRollupList = from("ProductCategoryRollup").where("parentProductCategoryId", rootProductCategoryId).orderBy("sequenceNum").queryList()
// for use in the queries
-productIdSet = [];
-productCategoryIdSet = [];
+productIdSet = []
+productCategoryIdSet = []
// for use in the templates
-productList = [];
-productCategoryList = [];
+productList = []
+productCategoryList = []
productMemberList.each { productMember ->
if (!productIdSet.contains(productMember.productId)) {
- productList.add(productMember.getRelatedOne("Product", true));
+ productList.add(productMember.getRelatedOne("Product", true))
}
- productIdSet.add(productMember.productId);
+ productIdSet.add(productMember.productId)
}
categoryRollupList.each { categoryRollup ->
if (!productCategoryIdSet.contains(categoryRollup.productCategoryId)) {
- productCategoryList.add(categoryRollup.getRelatedOne("CurrentProductCategory", true));
+ productCategoryList.add(categoryRollup.getRelatedOne("CurrentProductCategory", true))
}
- productCategoryIdSet.add(categoryRollup.productCategoryId);
+ productCategoryIdSet.add(categoryRollup.productCategoryId)
}
//NOTE: tax, etc also have productId on them, so restrict by type INV_PROD_ITEM, INV_FPROD_ITEM, INV_DPROD_ITEM, others?
-baseProductAndExprs = [];
-baseProductAndExprs.add(EntityCondition.makeCondition("invoiceTypeId", EntityOperator.EQUALS, "SALES_INVOICE"));
-baseProductAndExprs.add(EntityCondition.makeCondition("invoiceItemTypeId", EntityOperator.IN, ["INV_PROD_ITEM", "INV_FPROD_ITEM", "INV_DPROD_ITEM"]));
-baseProductAndExprs.add(EntityCondition.makeCondition("statusId", EntityOperator.IN, ["INVOICE_READY", "INVOICE_PAID"]));
-if (organizationPartyId) baseProductAndExprs.add(EntityCondition.makeCondition("partyIdFrom", EntityOperator.EQUALS, organizationPartyId));
-if (currencyUomId) baseProductAndExprs.add(EntityCondition.makeCondition("currencyUomId", EntityOperator.EQUALS, currencyUomId));
+baseProductAndExprs = []
+baseProductAndExprs.add(EntityCondition.makeCondition("invoiceTypeId", EntityOperator.EQUALS, "SALES_INVOICE"))
+baseProductAndExprs.add(EntityCondition.makeCondition("invoiceItemTypeId", EntityOperator.IN, ["INV_PROD_ITEM", "INV_FPROD_ITEM", "INV_DPROD_ITEM"]))
+baseProductAndExprs.add(EntityCondition.makeCondition("statusId", EntityOperator.IN, ["INVOICE_READY", "INVOICE_PAID"]))
+if (organizationPartyId) baseProductAndExprs.add(EntityCondition.makeCondition("partyIdFrom", EntityOperator.EQUALS, organizationPartyId))
+if (currencyUomId) baseProductAndExprs.add(EntityCondition.makeCondition("currencyUomId", EntityOperator.EQUALS, currencyUomId))
-baseCategoryAndExprs = [];
-baseCategoryAndExprs.add(EntityCondition.makeCondition("invoiceTypeId", EntityOperator.EQUALS, "SALES_INVOICE"));
-baseCategoryAndExprs.add(EntityCondition.makeCondition("invoiceItemTypeId", EntityOperator.IN, ["INV_PROD_ITEM", "INV_FPROD_ITEM", "INV_DPROD_ITEM"]));
-baseCategoryAndExprs.add(EntityCondition.makeCondition("statusId", EntityOperator.IN, ["INVOICE_READY", "INVOICE_PAID"]));
-if (productCategoryIdSet) baseCategoryAndExprs.add(EntityCondition.makeCondition("productCategoryId", EntityOperator.IN, productCategoryIdSet));
-if (productIdSet) baseCategoryAndExprs.add(EntityCondition.makeCondition("productId", EntityOperator.NOT_IN, productIdSet));
-if (organizationPartyId) baseCategoryAndExprs.add(EntityCondition.makeCondition("partyIdFrom", EntityOperator.EQUALS, organizationPartyId));
-if (currencyUomId) baseCategoryAndExprs.add(EntityCondition.makeCondition("currencyUomId", EntityOperator.EQUALS, currencyUomId));
+baseCategoryAndExprs = []
+baseCategoryAndExprs.add(EntityCondition.makeCondition("invoiceTypeId", EntityOperator.EQUALS, "SALES_INVOICE"))
+baseCategoryAndExprs.add(EntityCondition.makeCondition("invoiceItemTypeId", EntityOperator.IN, ["INV_PROD_ITEM", "INV_FPROD_ITEM", "INV_DPROD_ITEM"]))
+baseCategoryAndExprs.add(EntityCondition.makeCondition("statusId", EntityOperator.IN, ["INVOICE_READY", "INVOICE_PAID"]))
+if (productCategoryIdSet) baseCategoryAndExprs.add(EntityCondition.makeCondition("productCategoryId", EntityOperator.IN, productCategoryIdSet))
+if (productIdSet) baseCategoryAndExprs.add(EntityCondition.makeCondition("productId", EntityOperator.NOT_IN, productIdSet))
+if (organizationPartyId) baseCategoryAndExprs.add(EntityCondition.makeCondition("partyIdFrom", EntityOperator.EQUALS, organizationPartyId))
+if (currencyUomId) baseCategoryAndExprs.add(EntityCondition.makeCondition("currencyUomId", EntityOperator.EQUALS, currencyUomId))
// get the Calendar object for the current month (specifed by month, year Integer values in the context)
-monthCal = Calendar.getInstance();
-monthCal.set(Calendar.YEAR, year);
-monthCal.set(Calendar.MONTH, (month - 1));
+monthCal = Calendar.getInstance()
+monthCal.set(Calendar.YEAR, year)
+monthCal.set(Calendar.MONTH, (month - 1))
-nextMonthCal = Calendar.getInstance();
-nextMonthCal.setTimeInMillis(monthCal.getTimeInMillis());
-nextMonthCal.add(Calendar.MONTH, 1);
+nextMonthCal = Calendar.getInstance()
+nextMonthCal.setTimeInMillis(monthCal.getTimeInMillis())
+nextMonthCal.add(Calendar.MONTH, 1)
// iterate through the days and do the queries
-productResultMapByDayList = [];
-productNullResultByDayList = [];
-categoryResultMapByDayList = [];
+productResultMapByDayList = []
+productNullResultByDayList = []
+categoryResultMapByDayList = []
-monthProductResultMap = [:];
-monthCategoryResultMap = [:];
-monthProductNullResult = [:];
+monthProductResultMap = [:]
+monthCategoryResultMap = [:]
+monthProductNullResult = [:]
-daysInMonth = monthCal.getActualMaximum(Calendar.DAY_OF_MONTH);
+daysInMonth = monthCal.getActualMaximum(Calendar.DAY_OF_MONTH)
for (int currentDay = 0; currentDay <= daysInMonth; currentDay++) {
- currentDayCal = Calendar.getInstance();
- currentDayCal.setTimeInMillis(monthCal.getTimeInMillis());
- currentDayCal.set(Calendar.DAY_OF_MONTH, currentDay);
- currentDayBegin = new java.sql.Timestamp(currentDayCal.getTimeInMillis());
- currentDayCal.add(Calendar.DAY_OF_MONTH, 1);
- nextDayBegin = new java.sql.Timestamp(currentDayCal.getTimeInMillis());
+ currentDayCal = Calendar.getInstance()
+ currentDayCal.setTimeInMillis(monthCal.getTimeInMillis())
+ currentDayCal.set(Calendar.DAY_OF_MONTH, currentDay)
+ currentDayBegin = new java.sql.Timestamp(currentDayCal.getTimeInMillis())
+ currentDayCal.add(Calendar.DAY_OF_MONTH, 1)
+ nextDayBegin = new java.sql.Timestamp(currentDayCal.getTimeInMillis())
// do the product find
- productAndExprs = [];
- productAndExprs.addAll(baseProductAndExprs);
- if (productIdSet) productAndExprs.add(EntityCondition.makeCondition("productId", EntityOperator.IN, productIdSet));
- productAndExprs.add(EntityCondition.makeCondition("invoiceDate", EntityOperator.GREATER_THAN_EQUAL_TO, currentDayBegin));
- productAndExprs.add(EntityCondition.makeCondition("invoiceDate", EntityOperator.LESS_THAN, nextDayBegin));
+ productAndExprs = []
+ productAndExprs.addAll(baseProductAndExprs)
+ if (productIdSet) productAndExprs.add(EntityCondition.makeCondition("productId", EntityOperator.IN, productIdSet))
+ productAndExprs.add(EntityCondition.makeCondition("invoiceDate", EntityOperator.GREATER_THAN_EQUAL_TO, currentDayBegin))
+ productAndExprs.add(EntityCondition.makeCondition("invoiceDate", EntityOperator.LESS_THAN, nextDayBegin))
- productResultListIterator = select("productId", "quantityTotal", "amountTotal").from("InvoiceItemProductSummary").where(productAndExprs).cursorScrollInsensitive().cache(true).queryIterator();
- productResultMap = [:];
+ productResultListIterator = select("productId", "quantityTotal", "amountTotal").from("InvoiceItemProductSummary").where(productAndExprs).cursorScrollInsensitive().cache(true).queryIterator()
+ productResultMap = [:]
while ((productResult = productResultListIterator.next())) {
- productResultMap[productResult.productId] = productResult;
- monthProductResult = UtilMisc.getMapFromMap(monthProductResultMap, productResult.productId);
- UtilMisc.addToBigDecimalInMap(monthProductResult, "quantityTotal", productResult.getBigDecimal("quantityTotal"));
- UtilMisc.addToBigDecimalInMap(monthProductResult, "amountTotal", productResult.getBigDecimal("amountTotal"));
+ productResultMap[productResult.productId] = productResult
+ monthProductResult = UtilMisc.getMapFromMap(monthProductResultMap, productResult.productId)
+ UtilMisc.addToBigDecimalInMap(monthProductResult, "quantityTotal", productResult.getBigDecimal("quantityTotal"))
+ UtilMisc.addToBigDecimalInMap(monthProductResult, "amountTotal", productResult.getBigDecimal("amountTotal"))
}
- productResultListIterator.close();
- productResultMapByDayList.add(productResultMap);
+ productResultListIterator.close()
+ productResultMapByDayList.add(productResultMap)
// do the category find
- categoryAndExprs = [];
- categoryAndExprs.addAll(baseCategoryAndExprs);
- categoryAndExprs.add(EntityCondition.makeCondition("invoiceDate", EntityOperator.GREATER_THAN_EQUAL_TO, currentDayBegin));
- categoryAndExprs.add(EntityCondition.makeCondition("invoiceDate", EntityOperator.LESS_THAN, nextDayBegin));
+ categoryAndExprs = []
+ categoryAndExprs.addAll(baseCategoryAndExprs)
+ categoryAndExprs.add(EntityCondition.makeCondition("invoiceDate", EntityOperator.GREATER_THAN_EQUAL_TO, currentDayBegin))
+ categoryAndExprs.add(EntityCondition.makeCondition("invoiceDate", EntityOperator.LESS_THAN, nextDayBegin))
- categoryResultListIterator = select("productCategoryId", "quantityTotal", "amountTotal").from("InvoiceItemCategorySummary").where(categoryAndExprs).cursorScrollInsensitive().cache(true).queryIterator();
- categoryResultMap = [:];
+ categoryResultListIterator = select("productCategoryId", "quantityTotal", "amountTotal").from("InvoiceItemCategorySummary").where(categoryAndExprs).cursorScrollInsensitive().cache(true).queryIterator()
+ categoryResultMap = [:]
while ((categoryResult = categoryResultListIterator.next())) {
- categoryResultMap[categoryResult.productCategoryId] = categoryResult;
- monthCategoryResult = UtilMisc.getMapFromMap(monthCategoryResultMap, categoryResult.productCategoryId);
- UtilMisc.addToBigDecimalInMap(monthCategoryResult, "quantityTotal", categoryResult.getBigDecimal("quantityTotal"));
- UtilMisc.addToBigDecimalInMap(monthCategoryResult, "amountTotal", categoryResult.getBigDecimal("amountTotal"));
+ categoryResultMap[categoryResult.productCategoryId] = categoryResult
+ monthCategoryResult = UtilMisc.getMapFromMap(monthCategoryResultMap, categoryResult.productCategoryId)
+ UtilMisc.addToBigDecimalInMap(monthCategoryResult, "quantityTotal", categoryResult.getBigDecimal("quantityTotal"))
+ UtilMisc.addToBigDecimalInMap(monthCategoryResult, "amountTotal", categoryResult.getBigDecimal("amountTotal"))
}
- categoryResultListIterator.close();
- categoryResultMapByDayList.add(categoryResultMap);
+ categoryResultListIterator.close()
+ categoryResultMapByDayList.add(categoryResultMap)
// do a find for InvoiceItem with a null productId
- productNullAndExprs = [];
- productNullAndExprs.addAll(baseProductAndExprs);
- productNullAndExprs.add(EntityCondition.makeCondition("productId", EntityOperator.EQUALS, null));
- productNullAndExprs.add(EntityCondition.makeCondition("invoiceDate", EntityOperator.GREATER_THAN_EQUAL_TO, currentDayBegin));
- productNullAndExprs.add(EntityCondition.makeCondition("invoiceDate", EntityOperator.LESS_THAN, nextDayBegin));
- productNullResultListIterator = select("productId", "quantityTotal", "amountTotal").from("InvoiceItemProductSummary").where(productNullAndExprs).cursorScrollInsensitive().cache(true).queryIterator();
+ productNullAndExprs = []
+ productNullAndExprs.addAll(baseProductAndExprs)
+ productNullAndExprs.add(EntityCondition.makeCondition("productId", EntityOperator.EQUALS, null))
+ productNullAndExprs.add(EntityCondition.makeCondition("invoiceDate", EntityOperator.GREATER_THAN_EQUAL_TO, currentDayBegin))
+ productNullAndExprs.add(EntityCondition.makeCondition("invoiceDate", EntityOperator.LESS_THAN, nextDayBegin))
+ productNullResultListIterator = select("productId", "quantityTotal", "amountTotal").from("InvoiceItemProductSummary").where(productNullAndExprs).cursorScrollInsensitive().cache(true).queryIterator()
// should just be 1 result
- productNullResult = productNullResultListIterator.next();
- productNullResultListIterator.close();
+ productNullResult = productNullResultListIterator.next()
+ productNullResultListIterator.close()
if (productNullResult) {
- productNullResultByDayList.add(productNullResult);
- UtilMisc.addToBigDecimalInMap(monthProductNullResult, "quantityTotal", productNullResult.getBigDecimal("quantityTotal"));
- UtilMisc.addToBigDecimalInMap(monthProductNullResult, "amountTotal", productNullResult.getBigDecimal("amountTotal"));
+ productNullResultByDayList.add(productNullResult)
+ UtilMisc.addToBigDecimalInMap(monthProductNullResult, "quantityTotal", productNullResult.getBigDecimal("quantityTotal"))
+ UtilMisc.addToBigDecimalInMap(monthProductNullResult, "amountTotal", productNullResult.getBigDecimal("amountTotal"))
} else {
// no result, add an empty Map place holder
- productNullResultByDayList.add([:]);
+ productNullResultByDayList.add([:])
}
}
-context.productResultMapByDayList = productResultMapByDayList;
-context.productNullResultByDayList = productNullResultByDayList;
-context.categoryResultMapByDayList = categoryResultMapByDayList;
+context.productResultMapByDayList = productResultMapByDayList
+context.productNullResultByDayList = productNullResultByDayList
+context.categoryResultMapByDayList = categoryResultMapByDayList
-context.monthProductResultMap = monthProductResultMap;
-context.monthCategoryResultMap = monthCategoryResultMap;
-context.monthProductNullResult = monthProductNullResult;
+context.monthProductResultMap = monthProductResultMap
+context.monthCategoryResultMap = monthCategoryResultMap
+context.monthProductNullResult = monthProductNullResult
-context.productCategoryList = productCategoryList;
-context.productList = productList;
+context.productCategoryList = productCategoryList
+context.productList = productList
diff --git a/applications/accounting/groovyScripts/reports/TransactionTotals.groovy b/applications/accounting/groovyScripts/reports/TransactionTotals.groovy
index 8d2a9eb263..bc1d496584 100644
--- a/applications/accounting/groovyScripts/reports/TransactionTotals.groovy
+++ b/applications/accounting/groovyScripts/reports/TransactionTotals.groovy
@@ -28,294 +28,294 @@ import org.apache.ofbiz.entity.condition.EntityOperator
import java.sql.Timestamp
if (!fromDate) {
- return;
+ return
}
if (!thruDate) {
- thruDate = UtilDateTime.nowTimestamp();
+ thruDate = UtilDateTime.nowTimestamp()
}
if (!glFiscalTypeId) {
- return;
+ return
}
// Find the last closed time period to get the fromDate for the transactions in the current period and the ending balances of the last closed period
-Map lastClosedTimePeriodResult = runService('findLastClosedDate', ["organizationPartyId": parameters.get('ApplicationDecorator|organizationPartyId'), "findDate": fromDate,"userLogin": userLogin]);
-Timestamp lastClosedDate = (Timestamp)lastClosedTimePeriodResult.lastClosedDate;
-GenericValue lastClosedTimePeriod = null;
+Map lastClosedTimePeriodResult = runService('findLastClosedDate', ["organizationPartyId": parameters.get('ApplicationDecorator|organizationPartyId'), "findDate": fromDate,"userLogin": userLogin])
+Timestamp lastClosedDate = (Timestamp)lastClosedTimePeriodResult.lastClosedDate
+GenericValue lastClosedTimePeriod = null
if (lastClosedDate) {
- lastClosedTimePeriod = (GenericValue)lastClosedTimePeriodResult.lastClosedTimePeriod;
+ lastClosedTimePeriod = (GenericValue)lastClosedTimePeriodResult.lastClosedTimePeriod
}
// POSTED
// Posted transactions totals and grand totals
-postedTotals = [];
-postedTotalDebit = BigDecimal.ZERO;
-postedTotalCredit = BigDecimal.ZERO;
-andExprs = [];
-andExprs.add(EntityCondition.makeCondition("organizationPartyId", EntityOperator.IN, partyIds));
-andExprs.add(EntityCondition.makeCondition("isPosted", EntityOperator.EQUALS, "Y"));
-andExprs.add(EntityCondition.makeCondition("glFiscalTypeId", EntityOperator.EQUALS, glFiscalTypeId));
-andExprs.add(EntityCondition.makeCondition("transactionDate", EntityOperator.GREATER_THAN_EQUAL_TO, fromDate));
-andExprs.add(EntityCondition.makeCondition("transactionDate", EntityOperator.LESS_THAN_EQUAL_TO, thruDate));
-List postedTransactionTotals = select("glAccountId", "accountName", "accountCode", "debitCreditFlag", "amount").from("AcctgTransEntrySums").where(andExprs).orderBy("glAccountId").queryList();
+postedTotals = []
+postedTotalDebit = BigDecimal.ZERO
+postedTotalCredit = BigDecimal.ZERO
+andExprs = []
+andExprs.add(EntityCondition.makeCondition("organizationPartyId", EntityOperator.IN, partyIds))
+andExprs.add(EntityCondition.makeCondition("isPosted", EntityOperator.EQUALS, "Y"))
+andExprs.add(EntityCondition.makeCondition("glFiscalTypeId", EntityOperator.EQUALS, glFiscalTypeId))
+andExprs.add(EntityCondition.makeCondition("transactionDate", EntityOperator.GREATER_THAN_EQUAL_TO, fromDate))
+andExprs.add(EntityCondition.makeCondition("transactionDate", EntityOperator.LESS_THAN_EQUAL_TO, thruDate))
+List postedTransactionTotals = select("glAccountId", "accountName", "accountCode", "debitCreditFlag", "amount").from("AcctgTransEntrySums").where(andExprs).orderBy("glAccountId").queryList()
if (postedTransactionTotals) {
Map postedTransactionTotalsMap = [:]
postedTransactionTotals.each { postedTransactionTotal ->
- Map accountMap = (Map)postedTransactionTotalsMap.get(postedTransactionTotal.glAccountId);
+ Map accountMap = (Map)postedTransactionTotalsMap.get(postedTransactionTotal.glAccountId)
if (!accountMap) {
- GenericValue glAccount = from("GlAccount").where("glAccountId", postedTransactionTotal.glAccountId).cache(true).queryOne();
+ GenericValue glAccount = from("GlAccount").where("glAccountId", postedTransactionTotal.glAccountId).cache(true).queryOne()
if (glAccount) {
- boolean isDebitAccount = UtilAccounting.isDebitAccount(glAccount);
+ boolean isDebitAccount = UtilAccounting.isDebitAccount(glAccount)
// Get the opening balances at the end of the last closed time period
if (UtilAccounting.isAssetAccount(glAccount) || UtilAccounting.isLiabilityAccount(glAccount) || UtilAccounting.isEquityAccount(glAccount)) {
if (lastClosedTimePeriod) {
- lastTimePeriodHistory = from("GlAccountAndHistory").where("organizationPartyId", parameters.get('ApplicationDecorator|organizationPartyId'), "glAccountId", postedTransactionTotal.glAccountId, "customTimePeriodId", lastClosedTimePeriod.customTimePeriodId).queryFirst();
+ lastTimePeriodHistory = from("GlAccountAndHistory").where("organizationPartyId", parameters.get('ApplicationDecorator|organizationPartyId'), "glAccountId", postedTransactionTotal.glAccountId, "customTimePeriodId", lastClosedTimePeriod.customTimePeriodId).queryFirst()
if (lastTimePeriodHistory) {
- accountMap = UtilMisc.toMap("glAccountId", lastTimePeriodHistory.glAccountId, "accountCode", lastTimePeriodHistory.accountCode, "accountName", lastTimePeriodHistory.accountName, "balance", lastTimePeriodHistory.getBigDecimal("endingBalance"), "openingD", lastTimePeriodHistory.getBigDecimal("postedDebits"), "openingC", lastTimePeriodHistory.getBigDecimal("postedCredits"), "D", BigDecimal.ZERO, "C", BigDecimal.ZERO);
+ accountMap = UtilMisc.toMap("glAccountId", lastTimePeriodHistory.glAccountId, "accountCode", lastTimePeriodHistory.accountCode, "accountName", lastTimePeriodHistory.accountName, "balance", lastTimePeriodHistory.getBigDecimal("endingBalance"), "openingD", lastTimePeriodHistory.getBigDecimal("postedDebits"), "openingC", lastTimePeriodHistory.getBigDecimal("postedCredits"), "D", BigDecimal.ZERO, "C", BigDecimal.ZERO)
}
}
}
}
if (!accountMap) {
- accountMap = UtilMisc.makeMapWritable(postedTransactionTotal);
- accountMap.put("openingD", BigDecimal.ZERO);
- accountMap.put("openingC", BigDecimal.ZERO);
- accountMap.put("D", BigDecimal.ZERO);
- accountMap.put("C", BigDecimal.ZERO);
- accountMap.put("balance", BigDecimal.ZERO);
+ accountMap = UtilMisc.makeMapWritable(postedTransactionTotal)
+ accountMap.put("openingD", BigDecimal.ZERO)
+ accountMap.put("openingC", BigDecimal.ZERO)
+ accountMap.put("D", BigDecimal.ZERO)
+ accountMap.put("C", BigDecimal.ZERO)
+ accountMap.put("balance", BigDecimal.ZERO)
}
//
- List mainAndExprs = [];
- mainAndExprs.add(EntityCondition.makeCondition("organizationPartyId", EntityOperator.IN, partyIds));
- mainAndExprs.add(EntityCondition.makeCondition("isPosted", EntityOperator.EQUALS, "Y"));
- mainAndExprs.add(EntityCondition.makeCondition("glAccountId", EntityOperator.EQUALS, postedTransactionTotal.glAccountId));
- mainAndExprs.add(EntityCondition.makeCondition("glFiscalTypeId", EntityOperator.EQUALS, glFiscalTypeId));
- mainAndExprs.add(EntityCondition.makeCondition("acctgTransTypeId", EntityOperator.NOT_EQUAL, "PERIOD_CLOSING"));
- mainAndExprs.add(EntityCondition.makeCondition("transactionDate", EntityOperator.GREATER_THAN_EQUAL_TO, lastClosedDate));
- mainAndExprs.add(EntityCondition.makeCondition("transactionDate", EntityOperator.LESS_THAN, fromDate));
- transactionTotals = select("glAccountId", "accountName", "accountCode", "debitCreditFlag", "amount").from("AcctgTransEntrySums").where(mainAndExprs).orderBy("glAccountId").queryList();
+ List mainAndExprs = []
+ mainAndExprs.add(EntityCondition.makeCondition("organizationPartyId", EntityOperator.IN, partyIds))
+ mainAndExprs.add(EntityCondition.makeCondition("isPosted", EntityOperator.EQUALS, "Y"))
+ mainAndExprs.add(EntityCondition.makeCondition("glAccountId", EntityOperator.EQUALS, postedTransactionTotal.glAccountId))
+ mainAndExprs.add(EntityCondition.makeCondition("glFiscalTypeId", EntityOperator.EQUALS, glFiscalTypeId))
+ mainAndExprs.add(EntityCondition.makeCondition("acctgTransTypeId", EntityOperator.NOT_EQUAL, "PERIOD_CLOSING"))
+ mainAndExprs.add(EntityCondition.makeCondition("transactionDate", EntityOperator.GREATER_THAN_EQUAL_TO, lastClosedDate))
+ mainAndExprs.add(EntityCondition.makeCondition("transactionDate", EntityOperator.LESS_THAN, fromDate))
+ transactionTotals = select("glAccountId", "accountName", "accountCode", "debitCreditFlag", "amount").from("AcctgTransEntrySums").where(mainAndExprs).orderBy("glAccountId").queryList()
transactionTotals.each { transactionTotal ->
- UtilMisc.addToBigDecimalInMap(accountMap, "opening" + transactionTotal.debitCreditFlag, transactionTotal.amount);
+ UtilMisc.addToBigDecimalInMap(accountMap, "opening" + transactionTotal.debitCreditFlag, transactionTotal.amount)
}
}
- UtilMisc.addToBigDecimalInMap(accountMap, postedTransactionTotal.debitCreditFlag, postedTransactionTotal.amount);
- postedTransactionTotalsMap.put(postedTransactionTotal.glAccountId, accountMap);
+ UtilMisc.addToBigDecimalInMap(accountMap, postedTransactionTotal.debitCreditFlag, postedTransactionTotal.amount)
+ postedTransactionTotalsMap.put(postedTransactionTotal.glAccountId, accountMap)
}
- postedTotals = postedTransactionTotalsMap.values().asList();
+ postedTotals = postedTransactionTotalsMap.values().asList()
}
// Posted grand total for Debits
-andExprs = [];
-andExprs.add(EntityCondition.makeCondition("organizationPartyId", EntityOperator.IN, partyIds));
-andExprs.add(EntityCondition.makeCondition("isPosted", EntityOperator.EQUALS, "Y"));
-andExprs.add(EntityCondition.makeCondition("glFiscalTypeId", EntityOperator.EQUALS, glFiscalTypeId));
-andExprs.add(EntityCondition.makeCondition("debitCreditFlag", EntityOperator.EQUALS, "D"));
-andExprs.add(EntityCondition.makeCondition("transactionDate", EntityOperator.GREATER_THAN_EQUAL_TO, fromDate));
-andExprs.add(EntityCondition.makeCondition("transactionDate", EntityOperator.LESS_THAN_EQUAL_TO, thruDate));
-List postedDebitTransactionTotals = select("amount").from("AcctgTransEntrySums").where(andExprs).queryList();
+andExprs = []
+andExprs.add(EntityCondition.makeCondition("organizationPartyId", EntityOperator.IN, partyIds))
+andExprs.add(EntityCondition.makeCondition("isPosted", EntityOperator.EQUALS, "Y"))
+andExprs.add(EntityCondition.makeCondition("glFiscalTypeId", EntityOperator.EQUALS, glFiscalTypeId))
+andExprs.add(EntityCondition.makeCondition("debitCreditFlag", EntityOperator.EQUALS, "D"))
+andExprs.add(EntityCondition.makeCondition("transactionDate", EntityOperator.GREATER_THAN_EQUAL_TO, fromDate))
+andExprs.add(EntityCondition.makeCondition("transactionDate", EntityOperator.LESS_THAN_EQUAL_TO, thruDate))
+List postedDebitTransactionTotals = select("amount").from("AcctgTransEntrySums").where(andExprs).queryList()
if (postedDebitTransactionTotals) {
- postedDebitTransactionTotal = postedDebitTransactionTotals.first();
+ postedDebitTransactionTotal = postedDebitTransactionTotals.first()
if (postedDebitTransactionTotal && postedDebitTransactionTotal.amount) {
- postedTotalDebit = postedDebitTransactionTotal.amount;
+ postedTotalDebit = postedDebitTransactionTotal.amount
}
}
// Posted grand total for Credits
-andExprs = [];
-andExprs.add(EntityCondition.makeCondition("organizationPartyId", EntityOperator.IN, partyIds));
-andExprs.add(EntityCondition.makeCondition("isPosted", EntityOperator.EQUALS, "Y"));
-andExprs.add(EntityCondition.makeCondition("glFiscalTypeId", EntityOperator.EQUALS, glFiscalTypeId));
-andExprs.add(EntityCondition.makeCondition("debitCreditFlag", EntityOperator.EQUALS, "C"));
-andExprs.add(EntityCondition.makeCondition("transactionDate", EntityOperator.GREATER_THAN_EQUAL_TO, fromDate));
-andExprs.add(EntityCondition.makeCondition("transactionDate", EntityOperator.LESS_THAN_EQUAL_TO, thruDate));
-List postedCreditTransactionTotals = select("amount").from("AcctgTransEntrySums").where(andExprs).queryList();
+andExprs = []
+andExprs.add(EntityCondition.makeCondition("organizationPartyId", EntityOperator.IN, partyIds))
+andExprs.add(EntityCondition.makeCondition("isPosted", EntityOperator.EQUALS, "Y"))
+andExprs.add(EntityCondition.makeCondition("glFiscalTypeId", EntityOperator.EQUALS, glFiscalTypeId))
+andExprs.add(EntityCondition.makeCondition("debitCreditFlag", EntityOperator.EQUALS, "C"))
+andExprs.add(EntityCondition.makeCondition("transactionDate", EntityOperator.GREATER_THAN_EQUAL_TO, fromDate))
+andExprs.add(EntityCondition.makeCondition("transactionDate", EntityOperator.LESS_THAN_EQUAL_TO, thruDate))
+List postedCreditTransactionTotals = select("amount").from("AcctgTransEntrySums").where(andExprs).queryList()
if (postedCreditTransactionTotals) {
- postedCreditTransactionTotal = postedCreditTransactionTotals.first();
+ postedCreditTransactionTotal = postedCreditTransactionTotals.first()
if (postedCreditTransactionTotal && postedCreditTransactionTotal.amount) {
- postedTotalCredit = postedCreditTransactionTotal.amount;
+ postedTotalCredit = postedCreditTransactionTotal.amount
}
}
-postedTotals.add(["D":postedTotalDebit, "C":postedTotalCredit]);
-context.postedTransactionTotals = postedTotals;
+postedTotals.add(["D":postedTotalDebit, "C":postedTotalCredit])
+context.postedTransactionTotals = postedTotals
// UNPOSTED
// Unposted transactions totals and grand totals
-unpostedTotals = [];
-unpostedTotalDebit = BigDecimal.ZERO;
-unpostedTotalCredit = BigDecimal.ZERO;
-andExprs = [];
-andExprs.add(EntityCondition.makeCondition("organizationPartyId", EntityOperator.IN, partyIds));
-andExprs.add(EntityCondition.makeCondition("isPosted", EntityOperator.EQUALS, "N"));
-andExprs.add(EntityCondition.makeCondition("glFiscalTypeId", EntityOperator.EQUALS, glFiscalTypeId));
-andExprs.add(EntityCondition.makeCondition("transactionDate", EntityOperator.GREATER_THAN_EQUAL_TO, fromDate));
-andExprs.add(EntityCondition.makeCondition("transactionDate", EntityOperator.LESS_THAN_EQUAL_TO, thruDate));
-andCond = EntityCondition.makeCondition(andExprs, EntityOperator.AND);
-List unpostedTransactionTotals = select("glAccountId", "accountName", "accountCode", "debitCreditFlag", "amount").from("AcctgTransEntrySums").where(andExprs).orderBy("glAccountId").queryList();
+unpostedTotals = []
+unpostedTotalDebit = BigDecimal.ZERO
+unpostedTotalCredit = BigDecimal.ZERO
+andExprs = []
+andExprs.add(EntityCondition.makeCondition("organizationPartyId", EntityOperator.IN, partyIds))
+andExprs.add(EntityCondition.makeCondition("isPosted", EntityOperator.EQUALS, "N"))
+andExprs.add(EntityCondition.makeCondition("glFiscalTypeId", EntityOperator.EQUALS, glFiscalTypeId))
+andExprs.add(EntityCondition.makeCondition("transactionDate", EntityOperator.GREATER_THAN_EQUAL_TO, fromDate))
+andExprs.add(EntityCondition.makeCondition("transactionDate", EntityOperator.LESS_THAN_EQUAL_TO, thruDate))
+andCond = EntityCondition.makeCondition(andExprs, EntityOperator.AND)
+List unpostedTransactionTotals = select("glAccountId", "accountName", "accountCode", "debitCreditFlag", "amount").from("AcctgTransEntrySums").where(andExprs).orderBy("glAccountId").queryList()
if (unpostedTransactionTotals) {
Map unpostedTransactionTotalsMap = [:]
unpostedTransactionTotals.each { unpostedTransactionTotal ->
- Map accountMap = (Map)unpostedTransactionTotalsMap.get(unpostedTransactionTotal.glAccountId);
+ Map accountMap = (Map)unpostedTransactionTotalsMap.get(unpostedTransactionTotal.glAccountId)
if (!accountMap) {
- GenericValue glAccount = from("GlAccount").where("glAccountId", unpostedTransactionTotal.glAccountId).cache(true).queryOne();
+ GenericValue glAccount = from("GlAccount").where("glAccountId", unpostedTransactionTotal.glAccountId).cache(true).queryOne()
if (glAccount) {
- boolean isDebitAccount = UtilAccounting.isDebitAccount(glAccount);
+ boolean isDebitAccount = UtilAccounting.isDebitAccount(glAccount)
// Get the opening balances at the end of the last closed time period
if (UtilAccounting.isAssetAccount(glAccount) || UtilAccounting.isLiabilityAccount(glAccount) || UtilAccounting.isEquityAccount(glAccount)) {
if (lastClosedTimePeriod) {
- lastTimePeriodHistory = from("GlAccountAndHistory").where("organizationPartyId", parameters.get('ApplicationDecorator|organizationPartyId'), "glAccountId", unpostedTransactionTotal.glAccountId, "customTimePeriodId", lastClosedTimePeriod.customTimePeriodId).queryFirst();
+ lastTimePeriodHistory = from("GlAccountAndHistory").where("organizationPartyId", parameters.get('ApplicationDecorator|organizationPartyId'), "glAccountId", unpostedTransactionTotal.glAccountId, "customTimePeriodId", lastClosedTimePeriod.customTimePeriodId).queryFirst()
if (lastTimePeriodHistory) {
- accountMap = UtilMisc.toMap("glAccountId", lastTimePeriodHistory.glAccountId, "accountCode", lastTimePeriodHistory.accountCode, "accountName", lastTimePeriodHistory.accountName, "balance", lastTimePeriodHistory.getBigDecimal("endingBalance"), "openingD", lastTimePeriodHistory.getBigDecimal("postedDebits"), "openingC", lastTimePeriodHistory.getBigDecimal("postedCredits"), "D", BigDecimal.ZERO, "C", BigDecimal.ZERO);
+ accountMap = UtilMisc.toMap("glAccountId", lastTimePeriodHistory.glAccountId, "accountCode", lastTimePeriodHistory.accountCode, "accountName", lastTimePeriodHistory.accountName, "balance", lastTimePeriodHistory.getBigDecimal("endingBalance"), "openingD", lastTimePeriodHistory.getBigDecimal("postedDebits"), "openingC", lastTimePeriodHistory.getBigDecimal("postedCredits"), "D", BigDecimal.ZERO, "C", BigDecimal.ZERO)
}
}
}
}
if (!accountMap) {
- accountMap = UtilMisc.makeMapWritable(unpostedTransactionTotal);
- accountMap.put("openingD", BigDecimal.ZERO);
- accountMap.put("openingC", BigDecimal.ZERO);
- accountMap.put("D", BigDecimal.ZERO);
- accountMap.put("C", BigDecimal.ZERO);
- accountMap.put("balance", BigDecimal.ZERO);
+ accountMap = UtilMisc.makeMapWritable(unpostedTransactionTotal)
+ accountMap.put("openingD", BigDecimal.ZERO)
+ accountMap.put("openingC", BigDecimal.ZERO)
+ accountMap.put("D", BigDecimal.ZERO)
+ accountMap.put("C", BigDecimal.ZERO)
+ accountMap.put("balance", BigDecimal.ZERO)
}
//
- List mainAndExprs = [];
- mainAndExprs.add(EntityCondition.makeCondition("organizationPartyId", EntityOperator.IN, partyIds));
- mainAndExprs.add(EntityCondition.makeCondition("isPosted", EntityOperator.EQUALS, "N"));
- mainAndExprs.add(EntityCondition.makeCondition("glAccountId", EntityOperator.EQUALS, unpostedTransactionTotal.glAccountId));
- mainAndExprs.add(EntityCondition.makeCondition("glFiscalTypeId", EntityOperator.EQUALS, glFiscalTypeId));
- mainAndExprs.add(EntityCondition.makeCondition("acctgTransTypeId", EntityOperator.NOT_EQUAL, "PERIOD_CLOSING"));
- mainAndExprs.add(EntityCondition.makeCondition("transactionDate", EntityOperator.GREATER_THAN_EQUAL_TO, lastClosedDate));
- mainAndExprs.add(EntityCondition.makeCondition("transactionDate", EntityOperator.LESS_THAN, fromDate));
- transactionTotals = select("glAccountId", "accountName", "accountCode", "debitCreditFlag", "amount").from("AcctgTransEntrySums").where(mainAndExprs).orderBy("glAccountId").queryList();
+ List mainAndExprs = []
+ mainAndExprs.add(EntityCondition.makeCondition("organizationPartyId", EntityOperator.IN, partyIds))
+ mainAndExprs.add(EntityCondition.makeCondition("isPosted", EntityOperator.EQUALS, "N"))
+ mainAndExprs.add(EntityCondition.makeCondition("glAccountId", EntityOperator.EQUALS, unpostedTransactionTotal.glAccountId))
+ mainAndExprs.add(EntityCondition.makeCondition("glFiscalTypeId", EntityOperator.EQUALS, glFiscalTypeId))
+ mainAndExprs.add(EntityCondition.makeCondition("acctgTransTypeId", EntityOperator.NOT_EQUAL, "PERIOD_CLOSING"))
+ mainAndExprs.add(EntityCondition.makeCondition("transactionDate", EntityOperator.GREATER_THAN_EQUAL_TO, lastClosedDate))
+ mainAndExprs.add(EntityCondition.makeCondition("transactionDate", EntityOperator.LESS_THAN, fromDate))
+ transactionTotals = select("glAccountId", "accountName", "accountCode", "debitCreditFlag", "amount").from("AcctgTransEntrySums").where(mainAndExprs).orderBy("glAccountId").queryList()
transactionTotals.each { transactionTotal ->
- UtilMisc.addToBigDecimalInMap(accountMap, "opening" + transactionTotal.debitCreditFlag, transactionTotal.amount);
+ UtilMisc.addToBigDecimalInMap(accountMap, "opening" + transactionTotal.debitCreditFlag, transactionTotal.amount)
}
}
- UtilMisc.addToBigDecimalInMap(accountMap, unpostedTransactionTotal.debitCreditFlag, unpostedTransactionTotal.amount);
- unpostedTransactionTotalsMap.put(unpostedTransactionTotal.glAccountId, accountMap);
+ UtilMisc.addToBigDecimalInMap(accountMap, unpostedTransactionTotal.debitCreditFlag, unpostedTransactionTotal.amount)
+ unpostedTransactionTotalsMap.put(unpostedTransactionTotal.glAccountId, accountMap)
}
- unpostedTotals = unpostedTransactionTotalsMap.values().asList();
+ unpostedTotals = unpostedTransactionTotalsMap.values().asList()
}
// Unposted grand total for Debits
-andExprs = [];
-andExprs.add(EntityCondition.makeCondition("organizationPartyId", EntityOperator.IN, partyIds));
-andExprs.add(EntityCondition.makeCondition("isPosted", EntityOperator.EQUALS, "N"));
-andExprs.add(EntityCondition.makeCondition("glFiscalTypeId", EntityOperator.EQUALS, glFiscalTypeId));
-andExprs.add(EntityCondition.makeCondition("debitCreditFlag", EntityOperator.EQUALS, "D"));
-andExprs.add(EntityCondition.makeCondition("transactionDate", EntityOperator.GREATER_THAN_EQUAL_TO, fromDate));
-andExprs.add(EntityCondition.makeCondition("transactionDate", EntityOperator.LESS_THAN_EQUAL_TO, thruDate));
-List unpostedDebitTransactionTotals = select("amount").from("AcctgTransEntrySums").where(andExprs).queryList();
+andExprs = []
+andExprs.add(EntityCondition.makeCondition("organizationPartyId", EntityOperator.IN, partyIds))
+andExprs.add(EntityCondition.makeCondition("isPosted", EntityOperator.EQUALS, "N"))
+andExprs.add(EntityCondition.makeCondition("glFiscalTypeId", EntityOperator.EQUALS, glFiscalTypeId))
+andExprs.add(EntityCondition.makeCondition("debitCreditFlag", EntityOperator.EQUALS, "D"))
+andExprs.add(EntityCondition.makeCondition("transactionDate", EntityOperator.GREATER_THAN_EQUAL_TO, fromDate))
+andExprs.add(EntityCondition.makeCondition("transactionDate", EntityOperator.LESS_THAN_EQUAL_TO, thruDate))
+List unpostedDebitTransactionTotals = select("amount").from("AcctgTransEntrySums").where(andExprs).queryList()
if (unpostedDebitTransactionTotals) {
- unpostedDebitTransactionTotal = unpostedDebitTransactionTotals.first();
+ unpostedDebitTransactionTotal = unpostedDebitTransactionTotals.first()
if (unpostedDebitTransactionTotal && unpostedDebitTransactionTotal.amount) {
- unpostedTotalDebit = unpostedDebitTransactionTotal.amount;
+ unpostedTotalDebit = unpostedDebitTransactionTotal.amount
}
}
// Unposted grand total for Credits
-andExprs = [];
-andExprs.add(EntityCondition.makeCondition("organizationPartyId", EntityOperator.IN, partyIds));
-andExprs.add(EntityCondition.makeCondition("isPosted", EntityOperator.EQUALS, "N"));
-andExprs.add(EntityCondition.makeCondition("glFiscalTypeId", EntityOperator.EQUALS, glFiscalTypeId));
-andExprs.add(EntityCondition.makeCondition("debitCreditFlag", EntityOperator.EQUALS, "C"));
-andExprs.add(EntityCondition.makeCondition("transactionDate", EntityOperator.GREATER_THAN_EQUAL_TO, fromDate));
-andExprs.add(EntityCondition.makeCondition("transactionDate", EntityOperator.LESS_THAN_EQUAL_TO, thruDate));
-andCond = EntityCondition.makeCondition(andExprs, EntityOperator.AND);
-List unpostedCreditTransactionTotals = select("amount").from("AcctgTransEntrySums").where(andExprs).queryList();
+andExprs = []
+andExprs.add(EntityCondition.makeCondition("organizationPartyId", EntityOperator.IN, partyIds))
+andExprs.add(EntityCondition.makeCondition("isPosted", EntityOperator.EQUALS, "N"))
+andExprs.add(EntityCondition.makeCondition("glFiscalTypeId", EntityOperator.EQUALS, glFiscalTypeId))
+andExprs.add(EntityCondition.makeCondition("debitCreditFlag", EntityOperator.EQUALS, "C"))
+andExprs.add(EntityCondition.makeCondition("transactionDate", EntityOperator.GREATER_THAN_EQUAL_TO, fromDate))
+andExprs.add(EntityCondition.makeCondition("transactionDate", EntityOperator.LESS_THAN_EQUAL_TO, thruDate))
+andCond = EntityCondition.makeCondition(andExprs, EntityOperator.AND)
+List unpostedCreditTransactionTotals = select("amount").from("AcctgTransEntrySums").where(andExprs).queryList()
if (unpostedCreditTransactionTotals) {
- unpostedCreditTransactionTotal = unpostedCreditTransactionTotals.first();
+ unpostedCreditTransactionTotal = unpostedCreditTransactionTotals.first()
if (unpostedCreditTransactionTotal && unpostedCreditTransactionTotal.amount) {
- unpostedTotalCredit = unpostedCreditTransactionTotal.amount;
+ unpostedTotalCredit = unpostedCreditTransactionTotal.amount
}
}
-unpostedTotals.add(["D":unpostedTotalDebit, "C":unpostedTotalCredit]);
-context.unpostedTransactionTotals = unpostedTotals;
+unpostedTotals.add(["D":unpostedTotalDebit, "C":unpostedTotalCredit])
+context.unpostedTransactionTotals = unpostedTotals
// POSTED AND UNPOSTED
// Posted and unposted transactions totals and grand totals
-allTotals = [];
-allTotalDebit = BigDecimal.ZERO;
-allTotalCredit = BigDecimal.ZERO;
-andExprs = [];
-andExprs.add(EntityCondition.makeCondition("organizationPartyId", EntityOperator.IN, partyIds));
-andExprs.add(EntityCondition.makeCondition("glFiscalTypeId", EntityOperator.EQUALS, glFiscalTypeId));
-andExprs.add(EntityCondition.makeCondition("transactionDate", EntityOperator.GREATER_THAN_EQUAL_TO, fromDate));
-andExprs.add(EntityCondition.makeCondition("transactionDate", EntityOperator.LESS_THAN_EQUAL_TO, thruDate));
-andCond = EntityCondition.makeCondition(andExprs, EntityOperator.AND);
-List allTransactionTotals = select("glAccountId", "accountName", "accountCode", "debitCreditFlag", "amount").from("AcctgTransEntrySums").where(andExprs).orderBy("glAccountId").queryList();
+allTotals = []
+allTotalDebit = BigDecimal.ZERO
+allTotalCredit = BigDecimal.ZERO
+andExprs = []
+andExprs.add(EntityCondition.makeCondition("organizationPartyId", EntityOperator.IN, partyIds))
+andExprs.add(EntityCondition.makeCondition("glFiscalTypeId", EntityOperator.EQUALS, glFiscalTypeId))
+andExprs.add(EntityCondition.makeCondition("transactionDate", EntityOperator.GREATER_THAN_EQUAL_TO, fromDate))
+andExprs.add(EntityCondition.makeCondition("transactionDate", EntityOperator.LESS_THAN_EQUAL_TO, thruDate))
+andCond = EntityCondition.makeCondition(andExprs, EntityOperator.AND)
+List allTransactionTotals = select("glAccountId", "accountName", "accountCode", "debitCreditFlag", "amount").from("AcctgTransEntrySums").where(andExprs).orderBy("glAccountId").queryList()
if (allTransactionTotals) {
Map allTransactionTotalsMap = [:]
allTransactionTotals.each { allTransactionTotal ->
- Map accountMap = (Map)allTransactionTotalsMap.get(allTransactionTotal.glAccountId);
+ Map accountMap = (Map)allTransactionTotalsMap.get(allTransactionTotal.glAccountId)
if (!accountMap) {
- GenericValue glAccount = from("GlAccount").where("glAccountId", allTransactionTotal.glAccountId).cache(true).queryOne();
+ GenericValue glAccount = from("GlAccount").where("glAccountId", allTransactionTotal.glAccountId).cache(true).queryOne()
if (glAccount) {
- boolean isDebitAccount = UtilAccounting.isDebitAccount(glAccount);
+ boolean isDebitAccount = UtilAccounting.isDebitAccount(glAccount)
// Get the opening balances at the end of the last closed time period
if (UtilAccounting.isAssetAccount(glAccount) || UtilAccounting.isLiabilityAccount(glAccount) || UtilAccounting.isEquityAccount(glAccount)) {
if (lastClosedTimePeriod) {
- List timePeriodAndExprs = [];
- timePeriodAndExprs.add(EntityCondition.makeCondition("organizationPartyId", EntityOperator.EQUALS, parameters.get('ApplicationDecorator|organizationPartyId')));
- timePeriodAndExprs.add(EntityCondition.makeCondition("glAccountId", EntityOperator.EQUALS, allTransactionTotal.glAccountId));
- timePeriodAndExprs.add(EntityCondition.makeCondition("customTimePeriodId", EntityOperator.EQUALS, lastClosedTimePeriod.customTimePeriodId));
- lastTimePeriodHistory = from("GlAccountAndHistory").where(timePeriodAndExprs).queryFirst();
+ List timePeriodAndExprs = []
+ timePeriodAndExprs.add(EntityCondition.makeCondition("organizationPartyId", EntityOperator.EQUALS, parameters.get('ApplicationDecorator|organizationPartyId')))
+ timePeriodAndExprs.add(EntityCondition.makeCondition("glAccountId", EntityOperator.EQUALS, allTransactionTotal.glAccountId))
+ timePeriodAndExprs.add(EntityCondition.makeCondition("customTimePeriodId", EntityOperator.EQUALS, lastClosedTimePeriod.customTimePeriodId))
+ lastTimePeriodHistory = from("GlAccountAndHistory").where(timePeriodAndExprs).queryFirst()
if (lastTimePeriodHistory) {
- accountMap = UtilMisc.toMap("glAccountId", lastTimePeriodHistory.glAccountId, "accountCode", lastTimePeriodHistory.accountCode, "accountName", lastTimePeriodHistory.accountName, "balance", lastTimePeriodHistory.getBigDecimal("endingBalance"), "openingD", lastTimePeriodHistory.getBigDecimal("postedDebits"), "openingC", lastTimePeriodHistory.getBigDecimal("postedCredits"), "D", BigDecimal.ZERO, "C", BigDecimal.ZERO);
+ accountMap = UtilMisc.toMap("glAccountId", lastTimePeriodHistory.glAccountId, "accountCode", lastTimePeriodHistory.accountCode, "accountName", lastTimePeriodHistory.accountName, "balance", lastTimePeriodHistory.getBigDecimal("endingBalance"), "openingD", lastTimePeriodHistory.getBigDecimal("postedDebits"), "openingC", lastTimePeriodHistory.getBigDecimal("postedCredits"), "D", BigDecimal.ZERO, "C", BigDecimal.ZERO)
}
}
}
}
if (!accountMap) {
- accountMap = UtilMisc.makeMapWritable(allTransactionTotal);
- accountMap.put("openingD", BigDecimal.ZERO);
- accountMap.put("openingC", BigDecimal.ZERO);
- accountMap.put("D", BigDecimal.ZERO);
- accountMap.put("C", BigDecimal.ZERO);
- accountMap.put("balance", BigDecimal.ZERO);
+ accountMap = UtilMisc.makeMapWritable(allTransactionTotal)
+ accountMap.put("openingD", BigDecimal.ZERO)
+ accountMap.put("openingC", BigDecimal.ZERO)
+ accountMap.put("D", BigDecimal.ZERO)
+ accountMap.put("C", BigDecimal.ZERO)
+ accountMap.put("balance", BigDecimal.ZERO)
}
//
- List mainAndExprs = [];
- mainAndExprs.add(EntityCondition.makeCondition("organizationPartyId", EntityOperator.IN, partyIds));
- mainAndExprs.add(EntityCondition.makeCondition("isPosted", EntityOperator.EQUALS, "N"));
- mainAndExprs.add(EntityCondition.makeCondition("glAccountId", EntityOperator.EQUALS, allTransactionTotal.glAccountId));
- mainAndExprs.add(EntityCondition.makeCondition("glFiscalTypeId", EntityOperator.EQUALS, glFiscalTypeId));
- mainAndExprs.add(EntityCondition.makeCondition("acctgTransTypeId", EntityOperator.NOT_EQUAL, "PERIOD_CLOSING"));
- mainAndExprs.add(EntityCondition.makeCondition("transactionDate", EntityOperator.GREATER_THAN_EQUAL_TO, lastClosedDate));
- mainAndExprs.add(EntityCondition.makeCondition("transactionDate", EntityOperator.LESS_THAN, fromDate));
- transactionTotals = select("glAccountId", "accountName", "accountCode", "debitCreditFlag", "amount").from("AcctgTransEntrySums").where(mainAndExprs).orderBy("glAccountId").queryList();
+ List mainAndExprs = []
+ mainAndExprs.add(EntityCondition.makeCondition("organizationPartyId", EntityOperator.IN, partyIds))
+ mainAndExprs.add(EntityCondition.makeCondition("isPosted", EntityOperator.EQUALS, "N"))
+ mainAndExprs.add(EntityCondition.makeCondition("glAccountId", EntityOperator.EQUALS, allTransactionTotal.glAccountId))
+ mainAndExprs.add(EntityCondition.makeCondition("glFiscalTypeId", EntityOperator.EQUALS, glFiscalTypeId))
+ mainAndExprs.add(EntityCondition.makeCondition("acctgTransTypeId", EntityOperator.NOT_EQUAL, "PERIOD_CLOSING"))
+ mainAndExprs.add(EntityCondition.makeCondition("transactionDate", EntityOperator.GREATER_THAN_EQUAL_TO, lastClosedDate))
+ mainAndExprs.add(EntityCondition.makeCondition("transactionDate", EntityOperator.LESS_THAN, fromDate))
+ transactionTotals = select("glAccountId", "accountName", "accountCode", "debitCreditFlag", "amount").from("AcctgTransEntrySums").where(mainAndExprs).orderBy("glAccountId").queryList()
transactionTotals.each { transactionTotal ->
- UtilMisc.addToBigDecimalInMap(accountMap, "opening" + transactionTotal.debitCreditFlag, transactionTotal.amount);
+ UtilMisc.addToBigDecimalInMap(accountMap, "opening" + transactionTotal.debitCreditFlag, transactionTotal.amount)
}
}
- UtilMisc.addToBigDecimalInMap(accountMap, allTransactionTotal.debitCreditFlag, allTransactionTotal.amount);
- allTransactionTotalsMap.put(allTransactionTotal.glAccountId, accountMap);
+ UtilMisc.addToBigDecimalInMap(accountMap, allTransactionTotal.debitCreditFlag, allTransactionTotal.amount)
+ allTransactionTotalsMap.put(allTransactionTotal.glAccountId, accountMap)
}
- allTotals = allTransactionTotalsMap.values().asList();
+ allTotals = allTransactionTotalsMap.values().asList()
}
// Posted and unposted grand total for Debits
-andExprs = [];
-andExprs.add(EntityCondition.makeCondition("organizationPartyId", EntityOperator.IN, partyIds));
-andExprs.add(EntityCondition.makeCondition("glFiscalTypeId", EntityOperator.EQUALS, glFiscalTypeId));
-andExprs.add(EntityCondition.makeCondition("debitCreditFlag", EntityOperator.EQUALS, "D"));
-andExprs.add(EntityCondition.makeCondition("transactionDate", EntityOperator.GREATER_THAN_EQUAL_TO, fromDate));
-andExprs.add(EntityCondition.makeCondition("transactionDate", EntityOperator.LESS_THAN_EQUAL_TO, thruDate));
-List allDebitTransactionTotals = select("amount").from("AcctgTransEntrySums").where(andExprs).queryList();
+andExprs = []
+andExprs.add(EntityCondition.makeCondition("organizationPartyId", EntityOperator.IN, partyIds))
+andExprs.add(EntityCondition.makeCondition("glFiscalTypeId", EntityOperator.EQUALS, glFiscalTypeId))
+andExprs.add(EntityCondition.makeCondition("debitCreditFlag", EntityOperator.EQUALS, "D"))
+andExprs.add(EntityCondition.makeCondition("transactionDate", EntityOperator.GREATER_THAN_EQUAL_TO, fromDate))
+andExprs.add(EntityCondition.makeCondition("transactionDate", EntityOperator.LESS_THAN_EQUAL_TO, thruDate))
+List allDebitTransactionTotals = select("amount").from("AcctgTransEntrySums").where(andExprs).queryList()
if (allDebitTransactionTotals) {
- allDebitTransactionTotal = allDebitTransactionTotals.first();
+ allDebitTransactionTotal = allDebitTransactionTotals.first()
if (allDebitTransactionTotal && allDebitTransactionTotal.amount) {
- allTotalDebit = allDebitTransactionTotal.amount;
+ allTotalDebit = allDebitTransactionTotal.amount
}
}
// Posted and unposted grand total for Credits
-andExprs = [];
-andExprs.add(EntityCondition.makeCondition("organizationPartyId", EntityOperator.IN, partyIds));
-andExprs.add(EntityCondition.makeCondition("glFiscalTypeId", EntityOperator.EQUALS, glFiscalTypeId));
-andExprs.add(EntityCondition.makeCondition("debitCreditFlag", EntityOperator.EQUALS, "C"));
-andExprs.add(EntityCondition.makeCondition("transactionDate", EntityOperator.GREATER_THAN_EQUAL_TO, fromDate));
-andExprs.add(EntityCondition.makeCondition("transactionDate", EntityOperator.LESS_THAN_EQUAL_TO, thruDate));
-andCond = EntityCondition.makeCondition(andExprs, EntityOperator.AND);
-List allCreditTransactionTotals = select("amount").from("AcctgTransEntrySums").where(andExprs).queryList();
+andExprs = []
+andExprs.add(EntityCondition.makeCondition("organizationPartyId", EntityOperator.IN, partyIds))
+andExprs.add(EntityCondition.makeCondition("glFiscalTypeId", EntityOperator.EQUALS, glFiscalTypeId))
+andExprs.add(EntityCondition.makeCondition("debitCreditFlag", EntityOperator.EQUALS, "C"))
+andExprs.add(EntityCondition.makeCondition("transactionDate", EntityOperator.GREATER_THAN_EQUAL_TO, fromDate))
+andExprs.add(EntityCondition.makeCondition("transactionDate", EntityOperator.LESS_THAN_EQUAL_TO, thruDate))
+andCond = EntityCondition.makeCondition(andExprs, EntityOperator.AND)
+List allCreditTransactionTotals = select("amount").from("AcctgTransEntrySums").where(andExprs).queryList()
if (allCreditTransactionTotals) {
- allCreditTransactionTotal = allCreditTransactionTotals.first();
+ allCreditTransactionTotal = allCreditTransactionTotals.first()
if (allCreditTransactionTotal && allCreditTransactionTotal.amount) {
- allTotalCredit = allCreditTransactionTotal.amount;
+ allTotalCredit = allCreditTransactionTotal.amount
}
}
-allTotals.add(["D":allTotalDebit, "C":allTotalCredit]);
-context.allTransactionTotals = allTotals;
+allTotals.add(["D":allTotalDebit, "C":allTotalCredit])
+context.allTransactionTotals = allTotals
diff --git a/applications/accounting/groovyScripts/reports/TrialBalance.groovy b/applications/accounting/groovyScripts/reports/TrialBalance.groovy
index 0e6d90f8b1..b8b84588a9 100644
--- a/applications/accounting/groovyScripts/reports/TrialBalance.groovy
+++ b/applications/accounting/groovyScripts/reports/TrialBalance.groovy
@@ -19,29 +19,29 @@
import org.apache.ofbiz.entity.condition.EntityCondition
import org.apache.ofbiz.entity.condition.EntityOperator
-import org.apache.ofbiz.party.party.PartyHelper;
+import org.apache.ofbiz.party.party.PartyHelper
-partyNameList = [];
+partyNameList = []
parties.each { party ->
- partyName = PartyHelper.getPartyName(party);
- partyNameList.add(partyName);
+ partyName = PartyHelper.getPartyName(party)
+ partyNameList.add(partyName)
}
-context.partyNameList = partyNameList;
+context.partyNameList = partyNameList
if (parameters.customTimePeriodId) {
- customTimePeriod = from("CustomTimePeriod").where("customTimePeriodId", parameters.customTimePeriodId).cache(true).queryOne();
- exprList = [];
+ customTimePeriod = from("CustomTimePeriod").where("customTimePeriodId", parameters.customTimePeriodId).cache(true).queryOne()
+ exprList = []
exprList.add(EntityCondition.makeCondition('organizationPartyId', EntityOperator.IN, partyIds))
exprList.add(EntityCondition.makeCondition('fromDate', EntityOperator.LESS_THAN, customTimePeriod.getTimestamp('thruDate')))
exprList.add(EntityCondition.makeCondition(EntityCondition.makeCondition('thruDate', EntityOperator.GREATER_THAN_EQUAL_TO, customTimePeriod.getTimestamp('fromDate')), EntityOperator.OR, EntityCondition.makeCondition('thruDate', EntityOperator.EQUALS, null)))
- List organizationGlAccounts = from("GlAccountOrganizationAndClass").where(exprList).orderBy("accountCode").queryList();
+ List organizationGlAccounts = from("GlAccountOrganizationAndClass").where(exprList).orderBy("accountCode").queryList()
accountBalances = []
postedDebitsTotal = 0
postedCreditsTotal = 0
organizationGlAccounts.each { organizationGlAccount ->
accountBalance = [:]
- accountBalance = runService('computeGlAccountBalanceForTimePeriod', [organizationPartyId: organizationGlAccount.organizationPartyId, customTimePeriodId: customTimePeriod.customTimePeriodId, glAccountId: organizationGlAccount.glAccountId]);
+ accountBalance = runService('computeGlAccountBalanceForTimePeriod', [organizationPartyId: organizationGlAccount.organizationPartyId, customTimePeriodId: customTimePeriod.customTimePeriodId, glAccountId: organizationGlAccount.glAccountId])
if (accountBalance.postedDebits != 0 || accountBalance.postedCredits != 0) {
accountBalance.glAccountId = organizationGlAccount.glAccountId
accountBalance.accountCode = organizationGlAccount.accountCode
diff --git a/applications/accounting/groovyScripts/transaction/AuthorizeTransaction.groovy b/applications/accounting/groovyScripts/transaction/AuthorizeTransaction.groovy
index 05fd3e3edd..63d17b9154 100644
--- a/applications/accounting/groovyScripts/transaction/AuthorizeTransaction.groovy
+++ b/applications/accounting/groovyScripts/transaction/AuthorizeTransaction.groovy
@@ -16,31 +16,31 @@
* specific language governing permissions and limitations
* under the License.
*/
-import org.apache.ofbiz.order.order.OrderReadHelper;
+import org.apache.ofbiz.order.order.OrderReadHelper
-orderId = context.orderId;
-orderPaymentPreferenceId = context.orderPaymentPreferenceId;
+orderId = context.orderId
+orderPaymentPreferenceId = context.orderPaymentPreferenceId
-if ((!orderId) || (!orderPaymentPreferenceId)) return;
+if ((!orderId) || (!orderPaymentPreferenceId)) return
if (orderId) {
- orderHeader = from("OrderHeader").where("orderId", orderId).queryOne();
- context.orderHeader = orderHeader;
+ orderHeader = from("OrderHeader").where("orderId", orderId).queryOne()
+ context.orderHeader = orderHeader
}
if (orderHeader) {
- orh = new OrderReadHelper(orderHeader);
- context.orh = orh;
- context.overrideAmount = orh.getOrderGrandTotal();
+ orh = new OrderReadHelper(orderHeader)
+ context.orh = orh
+ context.overrideAmount = orh.getOrderGrandTotal()
}
if (orderPaymentPreferenceId) {
- orderPaymentPreference = from("OrderPaymentPreference").where("orderPaymentPreferenceId", orderPaymentPreferenceId).queryOne();
- context.orderPaymentPreference = orderPaymentPreference;
+ orderPaymentPreference = from("OrderPaymentPreference").where("orderPaymentPreferenceId", orderPaymentPreferenceId).queryOne()
+ context.orderPaymentPreference = orderPaymentPreference
}
if (orderPaymentPreference) {
- paymentMethodType = orderPaymentPreference.getRelatedOne("PaymentMethodType", true);
- context.paymentMethodType = paymentMethodType;
- context.overrideAmount = orderPaymentPreference.getBigDecimal("maxAmount");
+ paymentMethodType = orderPaymentPreference.getRelatedOne("PaymentMethodType", true)
+ context.paymentMethodType = paymentMethodType
+ context.overrideAmount = orderPaymentPreference.getBigDecimal("maxAmount")
}
diff --git a/applications/accounting/groovyScripts/transaction/CaptureTransaction.groovy b/applications/accounting/groovyScripts/transaction/CaptureTransaction.groovy
index 306f8dea44..35a8aecc32 100644
--- a/applications/accounting/groovyScripts/transaction/CaptureTransaction.groovy
+++ b/applications/accounting/groovyScripts/transaction/CaptureTransaction.groovy
@@ -21,38 +21,38 @@ import org.apache.ofbiz.entity.condition.EntityCondition
import org.apache.ofbiz.entity.condition.EntityOperator
import org.apache.ofbiz.entity.util.EntityUtil
-orderId = context.orderId;
-orderPaymentPreferenceId = context.orderPaymentPreferenceId;
+orderId = context.orderId
+orderPaymentPreferenceId = context.orderPaymentPreferenceId
-if ((!orderId) || (!orderPaymentPreferenceId)) return;
+if ((!orderId) || (!orderPaymentPreferenceId)) return
if (orderId) {
- orderHeader = from("OrderHeader").where("orderId", orderId).queryOne();
- context.orderHeader = orderHeader;
+ orderHeader = from("OrderHeader").where("orderId", orderId).queryOne()
+ context.orderHeader = orderHeader
}
if (orderPaymentPreferenceId) {
- orderPaymentPreference = from("OrderPaymentPreference").where("orderPaymentPreferenceId", orderPaymentPreferenceId).queryOne();
- context.orderPaymentPreference = orderPaymentPreference;
+ orderPaymentPreference = from("OrderPaymentPreference").where("orderPaymentPreferenceId", orderPaymentPreferenceId).queryOne()
+ context.orderPaymentPreference = orderPaymentPreference
}
if (orderPaymentPreference) {
- paymentMethodType = orderPaymentPreference.getRelatedOne("PaymentMethodType", true);
- context.paymentMethodType = paymentMethodType;
+ paymentMethodType = orderPaymentPreference.getRelatedOne("PaymentMethodType", true)
+ context.paymentMethodType = paymentMethodType
}
if (orderPaymentPreference) {
- context.paymentTypeId = "CUSTOMER_PAYMENT";
+ context.paymentTypeId = "CUSTOMER_PAYMENT"
}
if (orderPaymentPreference) {
// we retrieve the captureAmount by looking at the latest authorized gateway response for this orderPaymentPreference
- gatewayResponses = orderPaymentPreference.getRelated("PaymentGatewayResponse", null, ["transactionDate DESC"], false);
- EntityUtil.filterByCondition(gatewayResponses, EntityCondition.makeCondition("transCodeEnumId", EntityOperator.EQUALS, "PGT_AUTHORIZE"));
+ gatewayResponses = orderPaymentPreference.getRelated("PaymentGatewayResponse", null, ["transactionDate DESC"], false)
+ EntityUtil.filterByCondition(gatewayResponses, EntityCondition.makeCondition("transCodeEnumId", EntityOperator.EQUALS, "PGT_AUTHORIZE"))
if (gatewayResponses) {
- latestAuth = gatewayResponses[0];
- context.captureAmount = latestAuth.getBigDecimal("amount");
+ latestAuth = gatewayResponses[0]
+ context.captureAmount = latestAuth.getBigDecimal("amount")
} else {
// todo: some kind of error telling user to re-authorize
}
diff --git a/applications/accounting/groovyScripts/transaction/ViewGatewayResponse.groovy b/applications/accounting/groovyScripts/transaction/ViewGatewayResponse.groovy
index eaea21af86..ae443b32de 100644
--- a/applications/accounting/groovyScripts/transaction/ViewGatewayResponse.groovy
+++ b/applications/accounting/groovyScripts/transaction/ViewGatewayResponse.groovy
@@ -30,30 +30,30 @@ import org.apache.ofbiz.entity.condition.EntityOperator
import org.apache.ofbiz.entity.util.EntityUtil
// get this field first, it determines which purpose this script satisfies
-orderPaymentPreferenceId = context.orderPaymentPreferenceId;
+orderPaymentPreferenceId = context.orderPaymentPreferenceId
// first purpose: retrieve orderId and paymentPreferenceId
if (!orderPaymentPreferenceId) {
- paymentGatewayResponse = context.paymentGatewayResponse;
- orderPaymentPreference = paymentGatewayResponse.getRelatedOne("OrderPaymentPreference", false);
- context.orderId = orderPaymentPreference.orderId;
- context.orderPaymentPreferenceId = orderPaymentPreference.orderPaymentPreferenceId;
+ paymentGatewayResponse = context.paymentGatewayResponse
+ orderPaymentPreference = paymentGatewayResponse.getRelatedOne("OrderPaymentPreference", false)
+ context.orderId = orderPaymentPreference.orderId
+ context.orderPaymentPreferenceId = orderPaymentPreference.orderPaymentPreferenceId
} else {
// second purpose: grab the latest gateway response of the orderpaymentpreferenceId
- orderPaymentPreference = from("OrderPaymentPreference").where("orderPaymentPreferenceId", orderPaymentPreferenceId).queryOne();
- gatewayResponses = orderPaymentPreference.getRelated("PaymentGatewayResponse", null, ["transactionDate DESC"], false);
- EntityUtil.filterByCondition(gatewayResponses, EntityCondition.makeCondition("transCodeEnumId", EntityOperator.EQUALS, "PGT_AUTHORIZE"));
+ orderPaymentPreference = from("OrderPaymentPreference").where("orderPaymentPreferenceId", orderPaymentPreferenceId).queryOne()
+ gatewayResponses = orderPaymentPreference.getRelated("PaymentGatewayResponse", null, ["transactionDate DESC"], false)
+ EntityUtil.filterByCondition(gatewayResponses, EntityCondition.makeCondition("transCodeEnumId", EntityOperator.EQUALS, "PGT_AUTHORIZE"))
if (gatewayResponses) {
- latestAuth = gatewayResponses[0];
- context.paymentGatewayResponse = latestAuth;
+ latestAuth = gatewayResponses[0]
+ context.paymentGatewayResponse = latestAuth
} else {
// todo: some kind of error telling user to re-authorize
}
- context.orderId = orderPaymentPreference.orderId;
+ context.orderId = orderPaymentPreference.orderId
}
// get the list of payments associated to gateway response
if (context.paymentGatewayResponse) {
- context.payments = context.paymentGatewayResponse.getRelated("Payment", null, null, false);
+ context.payments = context.paymentGatewayResponse.getRelated("Payment", null, null, false)
}
diff --git a/applications/accounting/webapp/accounting/WEB-INF/actions/agreement/GetPartyNameForDate.groovy b/applications/accounting/webapp/accounting/WEB-INF/actions/agreement/GetPartyNameForDate.groovy
index 42e04acdb8..d7192be11f 100644
--- a/applications/accounting/webapp/accounting/WEB-INF/actions/agreement/GetPartyNameForDate.groovy
+++ b/applications/accounting/webapp/accounting/WEB-INF/actions/agreement/GetPartyNameForDate.groovy
@@ -1,5 +1,5 @@
-partyIdFrom = parameters.partyIdFrom;
-partyIdTo = parameters.partyIdTo;
+partyIdFrom = parameters.partyIdFrom
+partyIdTo = parameters.partyIdTo
if (partyIdFrom) {
context.partyNameResultFrom = runService("getPartyNameForDate", [partyId: partyIdFrom, compareDate: agreementDate, lastNameFirst: "Y"])
}
diff --git a/applications/commonext/groovyScripts/ofbizsetup/ChangeOrgPartyId.groovy b/applications/commonext/groovyScripts/ofbizsetup/ChangeOrgPartyId.groovy
index 227a513d1c..af98a2f51a 100644
--- a/applications/commonext/groovyScripts/ofbizsetup/ChangeOrgPartyId.groovy
+++ b/applications/commonext/groovyScripts/ofbizsetup/ChangeOrgPartyId.groovy
@@ -18,17 +18,17 @@
*/
//partyAcctgPrefAndGroupList
-partyAcctgPrefAndGroupList = [];
-partyAcctgPrefAndGroup = delegator.findList("PartyAcctgPrefAndGroup", null, null, null, null, false);
-iter = partyAcctgPrefAndGroup.iterator();
+partyAcctgPrefAndGroupList = []
+partyAcctgPrefAndGroup = delegator.findList("PartyAcctgPrefAndGroup", null, null, null, null, false)
+iter = partyAcctgPrefAndGroup.iterator()
while (iter.hasNext()) {
group = iter.next()
- partyAcctgPrefAndGroupList.add(["key":group.partyId,"value":group.groupName]);
+ partyAcctgPrefAndGroupList.add(["key":group.partyId,"value":group.groupName])
}
-globalContext.PartyAcctgPrefAndGroupList = partyAcctgPrefAndGroupList;
-globalContext.companyListSize = partyAcctgPrefAndGroupList.size();
+globalContext.PartyAcctgPrefAndGroupList = partyAcctgPrefAndGroupList
+globalContext.companyListSize = partyAcctgPrefAndGroupList.size()
//hiddenFileds
-hiddenFields = [];
-hiddenFields.add([name : "userPrefTypeId", value : "ORGANIZATION_PARTY"]);
-hiddenFields.add([name : "userPrefGroupTypeId", value : "GLOBAL_PREFERENCES"]);
-globalContext.hiddenFields = hiddenFields;
+hiddenFields = []
+hiddenFields.add([name : "userPrefTypeId", value : "ORGANIZATION_PARTY"])
+hiddenFields.add([name : "userPrefGroupTypeId", value : "GLOBAL_PREFERENCES"])
+globalContext.hiddenFields = hiddenFields
diff --git a/applications/commonext/groovyScripts/ofbizsetup/FindFacility.groovy b/applications/commonext/groovyScripts/ofbizsetup/FindFacility.groovy
index 7842b25dd7..dbb97554df 100644
--- a/applications/commonext/groovyScripts/ofbizsetup/FindFacility.groovy
+++ b/applications/commonext/groovyScripts/ofbizsetup/FindFacility.groovy
@@ -16,44 +16,44 @@
* specific language governing permissions and limitations
* under the License.
*/
- import org.apache.ofbiz.entity.util.EntityUtil;
+ import org.apache.ofbiz.entity.util.EntityUtil
-findResult = delegator.findByAnd("Facility", [ownerPartyId: partyId], null, false);
-findResultSize = findResult.size();
+findResult = delegator.findByAnd("Facility", [ownerPartyId: partyId], null, false)
+findResultSize = findResult.size()
if (findResultSize == 1) {
- context.showScreen = "one";
- facility = findResult.get(0);
- context.facility = facility;
- context.parameters.facilityId = context.facility.facilityId;
+ context.showScreen = "one"
+ facility = findResult.get(0)
+ context.facility = facility
+ context.parameters.facilityId = context.facility.facilityId
}
if ((findResultSize > 1 ) && (findResultSize <= 10)) {
- context.showScreen = "ten";
+ context.showScreen = "ten"
} else if ((findResultSize > 10 ) || (findResultSize <= 0)) {
- context.showScreen = "more";
+ context.showScreen = "more"
}
-listPartyPostalAddress = delegator.findByAnd("PartyAndPostalAddress", [partyId: partyId], null, false);
-partyPostalAddress = EntityUtil.getFirst(EntityUtil.filterByDate(listPartyPostalAddress));
-context.partyPostalAddress = partyPostalAddress;
+listPartyPostalAddress = delegator.findByAnd("PartyAndPostalAddress", [partyId: partyId], null, false)
+partyPostalAddress = EntityUtil.getFirst(EntityUtil.filterByDate(listPartyPostalAddress))
+context.partyPostalAddress = partyPostalAddress
if("productstore".equals(tabButtonItemTop)){
if(findResultSize == 0){
- request.setAttribute("_ERROR_MESSAGE_", "Facility not set!");
- context.showScreen = "message";
- return;
+ request.setAttribute("_ERROR_MESSAGE_", "Facility not set!")
+ context.showScreen = "message"
+ return
}else{
- context.showScreen = "origin";
+ context.showScreen = "origin"
}
}else if("facility".equals(tabButtonItemTop)){
- facilityId = parameters.facilityId;
+ facilityId = parameters.facilityId
if (!facilityId && request.getAttribute("facilityId")) {
- facilityId = request.getAttribute("facilityId");
+ facilityId = request.getAttribute("facilityId")
}
- facility = delegator.findOne("Facility", [facilityId : facilityId], false);
+ facility = delegator.findOne("Facility", [facilityId : facilityId], false)
if(facility){
- facilityType = facility.getRelatedOne("FacilityType", false);
- context.facilityType = facilityType;
+ facilityType = facility.getRelatedOne("FacilityType", false)
+ context.facilityType = facilityType
}
- context.facility = facility;
- context.facilityId = facilityId;
+ context.facility = facility
+ context.facilityId = facilityId
}
diff --git a/applications/commonext/groovyScripts/ofbizsetup/GetProdCatalog.groovy b/applications/commonext/groovyScripts/ofbizsetup/GetProdCatalog.groovy
index e0c47811b6..9a595aff69 100644
--- a/applications/commonext/groovyScripts/ofbizsetup/GetProdCatalog.groovy
+++ b/applications/commonext/groovyScripts/ofbizsetup/GetProdCatalog.groovy
@@ -16,109 +16,109 @@
* specific language governing permissions and limitations
* under the License.
*/
- import org.apache.ofbiz.base.util.UtilValidate;
- import org.apache.ofbiz.entity.util.EntityUtil;
- import org.apache.ofbiz.product.catalog.CatalogWorker;
+ import org.apache.ofbiz.base.util.UtilValidate
+ import org.apache.ofbiz.entity.util.EntityUtil
+ import org.apache.ofbiz.product.catalog.CatalogWorker
- prodCatalog = null;
- prodCatalogId = parameters.prodCatalogId;
- showScreen = "origin";
- List errMsgList = [];
+ prodCatalog = null
+ prodCatalogId = parameters.prodCatalogId
+ showScreen = "origin"
+ List errMsgList = []
- productStore = EntityUtil.getFirst(delegator.findByAnd("ProductStore", [payToPartyId: partyId], null, false));
+ productStore = EntityUtil.getFirst(delegator.findByAnd("ProductStore", [payToPartyId: partyId], null, false))
if(productStore){
- context.productStoreId = productStore.productStoreId;
+ context.productStoreId = productStore.productStoreId
}
if(UtilValidate.isEmpty(productStore)){
- errMsgList.add("Product Store not set!");
- showScreen = "message";
+ errMsgList.add("Product Store not set!")
+ showScreen = "message"
} else {
- facility = delegator.findOne("Facility", [facilityId : productStore.inventoryFacilityId], false);
- webSite = EntityUtil.getFirst(delegator.findByAnd("WebSite", [productStoreId: productStore.productStoreId], null, false));
+ facility = delegator.findOne("Facility", [facilityId : productStore.inventoryFacilityId], false)
+ webSite = EntityUtil.getFirst(delegator.findByAnd("WebSite", [productStoreId: productStore.productStoreId], null, false))
if(UtilValidate.isEmpty(facility)){
- errMsgList.add("Facility not set!");
- showScreen = "message";
+ errMsgList.add("Facility not set!")
+ showScreen = "message"
}
if(UtilValidate.isEmpty(webSite)){
- errMsgList.add("WebSite not set!");
- showScreen = "message";
+ errMsgList.add("WebSite not set!")
+ showScreen = "message"
}
}
if (errMsgList) {
- request.setAttribute("_ERROR_MESSAGE_LIST_", errMsgList);
- return;
+ request.setAttribute("_ERROR_MESSAGE_LIST_", errMsgList)
+ return
}
- productStoreCatalog = EntityUtil.getFirst(delegator.findByAnd("ProductStoreCatalog", [productStoreId: productStore.productStoreId], null, false));
+ productStoreCatalog = EntityUtil.getFirst(delegator.findByAnd("ProductStoreCatalog", [productStoreId: productStore.productStoreId], null, false))
if(productStoreCatalog){
- prodCatalog = productStoreCatalog.getRelatedOne("ProdCatalog", false);
- prodCatalogId = prodCatalog.prodCatalogId;
+ prodCatalog = productStoreCatalog.getRelatedOne("ProdCatalog", false)
+ prodCatalogId = prodCatalog.prodCatalogId
}
- context.prodCatalog = prodCatalog;
+ context.prodCatalog = prodCatalog
context.prodCatalogId = prodCatalogId
- context.showScreen = showScreen;
+ context.showScreen = showScreen
if(("productcategory".equals(tabButtonItem)) || ("product".equals(tabButtonItem))){
- productCategory = null;
- productCategoryId = parameters.productCategoryId;
- showErrorMsg = "N";
+ productCategory = null
+ productCategoryId = parameters.productCategoryId
+ showErrorMsg = "N"
if(UtilValidate.isEmpty(prodCatalogId)){
- errMsgList.add("Product Catalog not set!");
- showErrorMsg = "Y";
+ errMsgList.add("Product Catalog not set!")
+ showErrorMsg = "Y"
}
- prodCatalogCategory = EntityUtil.getFirst(delegator.findByAnd("ProdCatalogCategory", [prodCatalogId: prodCatalogId, sequenceNum: new Long(1)], null, false));
+ prodCatalogCategory = EntityUtil.getFirst(delegator.findByAnd("ProdCatalogCategory", [prodCatalogId: prodCatalogId, sequenceNum: new Long(1)], null, false))
if(prodCatalogCategory){
- productCategory = EntityUtil.getFirst(delegator.findByAnd("ProductCategory", [primaryParentCategoryId : prodCatalogCategory.productCategoryId], null, false));
+ productCategory = EntityUtil.getFirst(delegator.findByAnd("ProductCategory", [primaryParentCategoryId : prodCatalogCategory.productCategoryId], null, false))
if(productCategory){
- productCategoryId = productCategory.productCategoryId;
+ productCategoryId = productCategory.productCategoryId
}
}
- context.productCategoryId = productCategoryId;
- context.productCategory = productCategory;
+ context.productCategoryId = productCategoryId
+ context.productCategory = productCategory
if("product".equals(tabButtonItem)){
- productId = parameters.productId;
- product = null;
+ productId = parameters.productId
+ product = null
if(UtilValidate.isEmpty(productCategoryId)){
- errMsgList.add("Product Category not set!");
- showErrorMsg = "Y";
+ errMsgList.add("Product Category not set!")
+ showErrorMsg = "Y"
}
/**************** get product from ProductCategory ******************/
- productCategoryMember = EntityUtil.getFirst(delegator.findByAnd("ProductCategoryMember", [productCategoryId: productCategoryId], null, false));
+ productCategoryMember = EntityUtil.getFirst(delegator.findByAnd("ProductCategoryMember", [productCategoryId: productCategoryId], null, false))
if(productCategoryMember){
- product = productCategoryMember.getRelatedOne("Product", false);
- productId = product.productId;
+ product = productCategoryMember.getRelatedOne("Product", false)
+ productId = product.productId
// Average cost
- averageCostValues = delegator.findByAnd("ProductPrice", [productId : productId, productPricePurposeId : "PURCHASE", productPriceTypeId : "AVERAGE_COST"], null, false);
+ averageCostValues = delegator.findByAnd("ProductPrice", [productId : productId, productPricePurposeId : "PURCHASE", productPriceTypeId : "AVERAGE_COST"], null, false)
if(averageCostValues){
- averageCostValue = EntityUtil.getFirst(EntityUtil.filterByDate(averageCostValues));
+ averageCostValue = EntityUtil.getFirst(EntityUtil.filterByDate(averageCostValues))
if (averageCostValue?.price != null) {
- context.averageCost = averageCostValue.price;
+ context.averageCost = averageCostValue.price
}
}
// Default cost
- defaultPriceValues = delegator.findByAnd("ProductPrice", [productId : productId, productPricePurposeId : "PURCHASE", productPriceTypeId : "DEFAULT_PRICE"], null, false);
+ defaultPriceValues = delegator.findByAnd("ProductPrice", [productId : productId, productPricePurposeId : "PURCHASE", productPriceTypeId : "DEFAULT_PRICE"], null, false)
if(defaultPriceValues){
- defaultPrice = EntityUtil.getFirst(EntityUtil.filterByDate(defaultPriceValues));
+ defaultPrice = EntityUtil.getFirst(EntityUtil.filterByDate(defaultPriceValues))
if (defaultPrice?.price != null) {
- context.defaultPrice = defaultPrice.price;
+ context.defaultPrice = defaultPrice.price
}
}
}
// get promotion category
- promoCat = CatalogWorker.getCatalogPromotionsCategoryId(request, prodCatalogId);
- context.productId = productId;
- context.product = product;
- context.promoCat = promoCat;
+ promoCat = CatalogWorker.getCatalogPromotionsCategoryId(request, prodCatalogId)
+ context.productId = productId
+ context.product = product
+ context.promoCat = promoCat
}
if (errMsgList) {
- request.setAttribute("_ERROR_MESSAGE_LIST_", errMsgList);
- return;
+ request.setAttribute("_ERROR_MESSAGE_LIST_", errMsgList)
+ return
}
- context.showErrorMsg = showErrorMsg;
+ context.showErrorMsg = showErrorMsg
}
diff --git a/applications/commonext/groovyScripts/ofbizsetup/GetProductStoreAndWebSite.groovy b/applications/commonext/groovyScripts/ofbizsetup/GetProductStoreAndWebSite.groovy
index 6b21c86296..d40e57b3a9 100644
--- a/applications/commonext/groovyScripts/ofbizsetup/GetProductStoreAndWebSite.groovy
+++ b/applications/commonext/groovyScripts/ofbizsetup/GetProductStoreAndWebSite.groovy
@@ -16,25 +16,25 @@
* specific language governing permissions and limitations
* under the License.
*/
- import org.apache.ofbiz.entity.util.EntityUtil;
+ import org.apache.ofbiz.entity.util.EntityUtil
- productStoreId = null;
+ productStoreId = null
-productStore = EntityUtil.getFirst(delegator.findByAnd("ProductStore", [payToPartyId: partyId], null, false));
+productStore = EntityUtil.getFirst(delegator.findByAnd("ProductStore", [payToPartyId: partyId], null, false))
if(productStore){
productStoreId = productStore.productStoreId
}
-context.productStoreId = productStoreId;
-context.productStore = productStore;
+context.productStoreId = productStoreId
+context.productStore = productStore
if("website".equals(tabButtonItemTop)){
if(productStoreId != null){
- webSite = EntityUtil.getFirst(delegator.findByAnd("WebSite", [productStoreId: productStoreId], null, false));
- context.showScreen = "origin";
+ webSite = EntityUtil.getFirst(delegator.findByAnd("WebSite", [productStoreId: productStoreId], null, false))
+ context.showScreen = "origin"
}else{
- request.setAttribute("_ERROR_MESSAGE_", "Product Store not set!");
- context.showScreen = "message";
- return;
+ request.setAttribute("_ERROR_MESSAGE_", "Product Store not set!")
+ context.showScreen = "message"
+ return
}
- context.webSite = webSite;
+ context.webSite = webSite
}
diff --git a/applications/content/groovyScripts/cms/CmsEditAddPrep.groovy b/applications/content/groovyScripts/cms/CmsEditAddPrep.groovy
index e3ac9823a0..43317cb2ed 100644
--- a/applications/content/groovyScripts/cms/CmsEditAddPrep.groovy
+++ b/applications/content/groovyScripts/cms/CmsEditAddPrep.groovy
@@ -24,71 +24,71 @@ import org.apache.ofbiz.content.content.ContentWorker
import org.apache.ofbiz.content.data.DataResourceWorker
import org.apache.ofbiz.webapp.ftl.FreeMarkerViewHandler
-userLogin = session.getAttribute("userLogin");
-contentAssocDataResourceViewFrom = delegator.makeValue("ContentAssocDataResourceViewFrom");
+userLogin = session.getAttribute("userLogin")
+contentAssocDataResourceViewFrom = delegator.makeValue("ContentAssocDataResourceViewFrom")
-contentId = context.contentId;
+contentId = context.contentId
-contentAssocPK = delegator.makeValue("ContentAssoc");
-contentAssocPK.setAllFields(context, false, "ca", new Boolean(true));
-Debug.logInfo("in cmseditaddprep, contentAssocPK:" + contentAssocPK,"");
+contentAssocPK = delegator.makeValue("ContentAssoc")
+contentAssocPK.setAllFields(context, false, "ca", new Boolean(true))
+Debug.logInfo("in cmseditaddprep, contentAssocPK:" + contentAssocPK,"")
-contentAssoc = null;
+contentAssoc = null
if (contentAssocPK.isPrimaryKey()) {
- contentAssoc = from("ContentAssoc").where(contentAssocPK).queryOne();
+ contentAssoc = from("ContentAssoc").where(contentAssocPK).queryOne()
}
if (contentAssoc) {
- SimpleMapProcessor.runSimpleMapProcessor("component://content/minilang/ContentManagementMapProcessors.xml", "contentAssocOut", contentAssoc, contentAssocDataResourceViewFrom, new ArrayList(), Locale.getDefault());
+ SimpleMapProcessor.runSimpleMapProcessor("component://content/minilang/ContentManagementMapProcessors.xml", "contentAssocOut", contentAssoc, contentAssocDataResourceViewFrom, new ArrayList(), Locale.getDefault())
} else {
- contentAssocPK.setAllFields(context, false, "ca", null); //set all field, pk and non
- SimpleMapProcessor.runSimpleMapProcessor("component://content/minilang/ContentManagementMapProcessors.xml", "contentAssocOut", contentAssocPK, contentAssocDataResourceViewFrom, new ArrayList(), Locale.getDefault());
+ contentAssocPK.setAllFields(context, false, "ca", null) //set all field, pk and non
+ SimpleMapProcessor.runSimpleMapProcessor("component://content/minilang/ContentManagementMapProcessors.xml", "contentAssocOut", contentAssocPK, contentAssocDataResourceViewFrom, new ArrayList(), Locale.getDefault())
}
-Debug.logInfo("in cmseditaddprep, contentAssocDataResourceViewFrom:" + contentAssocDataResourceViewFrom,"");
+Debug.logInfo("in cmseditaddprep, contentAssocDataResourceViewFrom:" + contentAssocDataResourceViewFrom,"")
-dataResourceId = "";
-textData = "";
-content = null;
+dataResourceId = ""
+textData = ""
+content = null
if (contentId) {
- content = from("Content").where("contentId", contentId).cache(true).queryOne();
+ content = from("Content").where("contentId", contentId).cache(true).queryOne()
if (content) {
- contentAssocDataResourceViewFrom.setAllFields(content, false, null, null);
+ contentAssocDataResourceViewFrom.setAllFields(content, false, null, null)
}
} else {
- contentAssocDataResourceViewFrom.set("contentTypeId", "DOCUMENT");
+ contentAssocDataResourceViewFrom.set("contentTypeId", "DOCUMENT")
}
if (content) {
- dataResourceId = content.dataResourceId;
+ dataResourceId = content.dataResourceId
}
if (!dataResourceId) {
- dataResourceId = context.drDataResourceId;
+ dataResourceId = context.drDataResourceId
if (!dataResourceId) {
- dataResourceId = context.dataResourceId;
+ dataResourceId = context.dataResourceId
}
}
if (dataResourceId) {
- dataResource = from("DataResource").where("dataResourceId", dataResourceId).cache(true).queryOne();
- SimpleMapProcessor.runSimpleMapProcessor("component://content/minilang/ContentManagementMapProcessors.xml", "dataResourceOut", dataResource, contentAssocDataResourceViewFrom, new ArrayList(), Locale.getDefault());
- templateRoot = [:];
- FreeMarkerViewHandler.prepOfbizRoot(templateRoot, request, response);
- txt = DataResourceWorker.getDataResourceText(dataResource, "text/html", Locale.getDefault(), templateRoot, delegator, true);
+ dataResource = from("DataResource").where("dataResourceId", dataResourceId).cache(true).queryOne()
+ SimpleMapProcessor.runSimpleMapProcessor("component://content/minilang/ContentManagementMapProcessors.xml", "dataResourceOut", dataResource, contentAssocDataResourceViewFrom, new ArrayList(), Locale.getDefault())
+ templateRoot = [:]
+ FreeMarkerViewHandler.prepOfbizRoot(templateRoot, request, response)
+ txt = DataResourceWorker.getDataResourceText(dataResource, "text/html", Locale.getDefault(), templateRoot, delegator, true)
if (txt) {
- textData = UtilFormatOut.encodeXmlValue(txt);
+ textData = UtilFormatOut.encodeXmlValue(txt)
}
}
-Debug.logInfo("in cmseditaddprep, textData:" + textData,"");
+Debug.logInfo("in cmseditaddprep, textData:" + textData,"")
-currentValue = new HashMap(contentAssocDataResourceViewFrom);
-currentValue.textData = textData;
-currentValue.nowTimestamp = UtilDateTime.nowTimestamp();
-context.currentValue = currentValue;
+currentValue = new HashMap(contentAssocDataResourceViewFrom)
+currentValue.textData = textData
+currentValue.nowTimestamp = UtilDateTime.nowTimestamp()
+context.currentValue = currentValue
-request.setAttribute("previousParams", currentValue);
+request.setAttribute("previousParams", currentValue)
-persistAction = context.persistAction;
+persistAction = context.persistAction
if (!persistAction) {
- persistAction = "persistContent";
+ persistAction = "persistContent"
}
context.persistAction = persistAction;
\ No newline at end of file
diff --git a/applications/content/groovyScripts/cms/FeaturePrep.groovy b/applications/content/groovyScripts/cms/FeaturePrep.groovy
index 758b17806e..98bb7a177f 100644
--- a/applications/content/groovyScripts/cms/FeaturePrep.groovy
+++ b/applications/content/groovyScripts/cms/FeaturePrep.groovy
@@ -19,26 +19,26 @@
import org.apache.ofbiz.base.util.UtilHttp
-paramMap = UtilHttp.getParameterMap(request);
+paramMap = UtilHttp.getParameterMap(request)
-contentId = context.contentId;
-dataResourceId = context.dataResourceId;
+contentId = context.contentId
+dataResourceId = context.dataResourceId
-productFeatureList = from("ProductFeature").cache(true).queryList();
-featureList = [] as ArrayList;
+productFeatureList = from("ProductFeature").cache(true).queryList()
+featureList = [] as ArrayList
if (dataResourceId) {
productFeatureList.each { productFeature ->
- productFeatureId = productFeature.productFeatureId;
- description = productFeature.description;
- productFeatureDataResource = from("ProductFeatureDataResource").where("productFeatureId", productFeatureId, "dataResourceId", dataResourceId).cache(true).queryOne();
+ productFeatureId = productFeature.productFeatureId
+ description = productFeature.description
+ productFeatureDataResource = from("ProductFeatureDataResource").where("productFeatureId", productFeatureId, "dataResourceId", dataResourceId).cache(true).queryOne()
if (productFeatureDataResource) {
- feature = [];
- feature.productFeatureId = productFeatureId;
- feature.dataResourceId = dataResourceId;
- feature.action = "Y";
- feature.description = description;
- featureList.add(feature);
+ feature = []
+ feature.productFeatureId = productFeatureId
+ feature.dataResourceId = dataResourceId
+ feature.action = "Y"
+ feature.description = description
+ featureList.add(feature)
}
}
- context.featureList = featureList;
+ context.featureList = featureList
}
diff --git a/applications/content/groovyScripts/cms/GetMenuContext.groovy b/applications/content/groovyScripts/cms/GetMenuContext.groovy
index 7d3dc2c64a..15eb4ae458 100644
--- a/applications/content/groovyScripts/cms/GetMenuContext.groovy
+++ b/applications/content/groovyScripts/cms/GetMenuContext.groovy
@@ -17,16 +17,16 @@
* under the License.
*/
-import org.apache.ofbiz.base.util.Debug;
+import org.apache.ofbiz.base.util.Debug
-Debug.logInfo("In getMenuContext.", "");
+Debug.logInfo("In getMenuContext.", "")
-session = context.session;
-menuContext = session.getAttribute("menuContext");
-Debug.logInfo("menuContext(0):" + menuContext, "");
+session = context.session
+menuContext = session.getAttribute("menuContext")
+Debug.logInfo("menuContext(0):" + menuContext, "")
if (!menuContext) {
- menuContext = [:];
- session.setAttribute("menuContext", menuContext);
+ menuContext = [:]
+ session.setAttribute("menuContext", menuContext)
}
context.menuContext = menuContext;
\ No newline at end of file
diff --git a/applications/content/groovyScripts/cms/MostRecentPrep.groovy b/applications/content/groovyScripts/cms/MostRecentPrep.groovy
index 24b16e732b..e340adfd5d 100644
--- a/applications/content/groovyScripts/cms/MostRecentPrep.groovy
+++ b/applications/content/groovyScripts/cms/MostRecentPrep.groovy
@@ -19,28 +19,28 @@
import org.apache.ofbiz.base.util.*
import org.apache.ofbiz.entity.util.*
-import org.apache.ofbiz.content.ContentManagementWorker;
-import org.apache.ofbiz.content.content.ContentWorker;
-import org.apache.ofbiz.entity.condition.EntityCondition;
-import org.apache.ofbiz.entity.condition.EntityOperator;
+import org.apache.ofbiz.content.ContentManagementWorker
+import org.apache.ofbiz.content.content.ContentWorker
+import org.apache.ofbiz.entity.condition.EntityCondition
+import org.apache.ofbiz.entity.condition.EntityOperator
-Debug.logInfo("in mostrecentprep(1):","");
-paramMap = UtilHttp.getParameterMap(request);
-forumId = ContentManagementWorker.getFromSomewhere("moderatedSiteId", paramMap, request, context);
+Debug.logInfo("in mostrecentprep(1):","")
+paramMap = UtilHttp.getParameterMap(request)
+forumId = ContentManagementWorker.getFromSomewhere("moderatedSiteId", paramMap, request, context)
if (forumId) {
- exprList = [] as ArrayList;
- fromDate = UtilDateTime.nowTimestamp();
- thruExpr2 = EntityCondition.makeCondition("caThruDate", EntityOperator.EQUALS, null);
- exprList.add(thruExpr2);
- statusIdExpr = EntityCondition.makeCondition("statusId", EntityOperator.EQUALS, "CTNT_IN_PROGRESS");
- exprList.add(statusIdExpr);
- contentIdToExpr = EntityCondition.makeCondition("caContentId", EntityOperator.EQUALS, forumId);
- exprList.add(contentIdToExpr);
- expr = EntityCondition.makeCondition(exprList, EntityOperator.AND);
- entityList = from("ContentAssocViewFrom").where(exprList).orderBy("-caFromDate").queryList();
+ exprList = [] as ArrayList
+ fromDate = UtilDateTime.nowTimestamp()
+ thruExpr2 = EntityCondition.makeCondition("caThruDate", EntityOperator.EQUALS, null)
+ exprList.add(thruExpr2)
+ statusIdExpr = EntityCondition.makeCondition("statusId", EntityOperator.EQUALS, "CTNT_IN_PROGRESS")
+ exprList.add(statusIdExpr)
+ contentIdToExpr = EntityCondition.makeCondition("caContentId", EntityOperator.EQUALS, forumId)
+ exprList.add(contentIdToExpr)
+ expr = EntityCondition.makeCondition(exprList, EntityOperator.AND)
+ entityList = from("ContentAssocViewFrom").where(exprList).orderBy("-caFromDate").queryList()
- Debug.logInfo("in mostrecentprep(1), entityList.size():" + entityList.size(),"");
- Debug.logInfo("in mostrecentprep(1), entityList:" + entityList,"");
- context.mostRecentList = entityList;
+ Debug.logInfo("in mostrecentprep(1), entityList.size():" + entityList.size(),"")
+ Debug.logInfo("in mostrecentprep(1), entityList:" + entityList,"")
+ context.mostRecentList = entityList
}
diff --git a/applications/content/groovyScripts/cms/UserPermPrep.groovy b/applications/content/groovyScripts/cms/UserPermPrep.groovy
index aedb429bdb..a5d866d3b0 100644
--- a/applications/content/groovyScripts/cms/UserPermPrep.groovy
+++ b/applications/content/groovyScripts/cms/UserPermPrep.groovy
@@ -21,37 +21,37 @@ import org.apache.ofbiz.base.util.*
import org.apache.ofbiz.entity.condition.*
import org.apache.ofbiz.content.ContentManagementWorker
-paramMap = UtilHttp.getParameterMap(request);
-forumId = ContentManagementWorker.getFromSomewhere("permRoleSiteId", paramMap, request, context);
-blogRoles = from("RoleType").where("parentTypeId", "BLOG").cache(true).queryList();
+paramMap = UtilHttp.getParameterMap(request)
+forumId = ContentManagementWorker.getFromSomewhere("permRoleSiteId", paramMap, request, context)
+blogRoles = from("RoleType").where("parentTypeId", "BLOG").cache(true).queryList()
if (forumId) {
- siteRoleMap = [:];
+ siteRoleMap = [:]
for (int i=0; i < blogRoles.size(); i++) {
- roleType = blogRoles.get(i);
- roleTypeId = roleType.roleTypeId;
- filteredRoleList = from("ContentRole").where("contentId", forumId, "roleTypeId", roleTypeId).filterByDate().queryList();
- cappedBlogRoleName = ModelUtil.dbNameToVarName(roleTypeId);
+ roleType = blogRoles.get(i)
+ roleTypeId = roleType.roleTypeId
+ filteredRoleList = from("ContentRole").where("contentId", forumId, "roleTypeId", roleTypeId).filterByDate().queryList()
+ cappedBlogRoleName = ModelUtil.dbNameToVarName(roleTypeId)
filteredRoleList.each { contentRole ->
- partyId = contentRole.partyId;
- fromDate = contentRole.fromDate;
- map = siteRoleMap.get(partyId);
+ partyId = contentRole.partyId
+ fromDate = contentRole.fromDate
+ map = siteRoleMap.get(partyId)
if (!map) {
- map = [:];
- map.partyId = partyId;
- siteRoleMap.put(partyId, map);
+ map = [:]
+ map.partyId = partyId
+ siteRoleMap.put(partyId, map)
}
- map.put(cappedBlogRoleName, "Y");
- map.put(cappedBlogRoleName + "FromDate", fromDate);
+ map.put(cappedBlogRoleName, "Y")
+ map.put(cappedBlogRoleName + "FromDate", fromDate)
}
}
- siteList = new ArrayList(siteRoleMap.values());
- context.siteList = siteList;
- context.rowCount = siteList.size();
- blogRoleList = [] as ArrayList;
+ siteList = new ArrayList(siteRoleMap.values())
+ context.siteList = siteList
+ context.rowCount = siteList.size()
+ blogRoleList = [] as ArrayList
blogRoles.each { roleType ->
- blogRoleList.add(roleType.roleTypeId);
+ blogRoleList.add(roleType.roleTypeId)
}
- context.blogRoleIdList = blogRoleList;
+ context.blogRoleIdList = blogRoleList
}
diff --git a/applications/content/groovyScripts/content/ContentSearchOptions.groovy b/applications/content/groovyScripts/content/ContentSearchOptions.groovy
index 9721c52957..b11f27a730 100644
--- a/applications/content/groovyScripts/content/ContentSearchOptions.groovy
+++ b/applications/content/groovyScripts/content/ContentSearchOptions.groovy
@@ -17,45 +17,45 @@
* under the License.
*/
-import org.apache.ofbiz.base.util.*;
-import java.sql.Timestamp;
-import org.apache.ofbiz.content.content.*;
+import org.apache.ofbiz.base.util.*
+import java.sql.Timestamp
+import org.apache.ofbiz.content.content.*
-searchOperator = parameters.get("SEARCH_OPERATOR");
+searchOperator = parameters.get("SEARCH_OPERATOR")
if (!"AND".equals(searchOperator) && !"OR".equals(searchOperator)) {
- searchOperator = "OR";
+ searchOperator = "OR"
}
//create the fromDate for calendar
-fromCal = Calendar.getInstance();
-fromCal.setTime(new java.util.Date());
-fromCal.set(Calendar.HOUR_OF_DAY, fromCal.getActualMinimum(Calendar.HOUR_OF_DAY));
-fromCal.set(Calendar.MINUTE, fromCal.getActualMinimum(Calendar.MINUTE));
-fromCal.set(Calendar.SECOND, fromCal.getActualMinimum(Calendar.SECOND));
-fromCal.set(Calendar.MILLISECOND, fromCal.getActualMinimum(Calendar.MILLISECOND));
-fromTs = new Timestamp(fromCal.getTimeInMillis());
-fromStr = fromTs.toString();
-fromStr = fromStr.substring(0, fromStr.indexOf('.'));
-context.put("fromDateStr", fromStr);
+fromCal = Calendar.getInstance()
+fromCal.setTime(new java.util.Date())
+fromCal.set(Calendar.HOUR_OF_DAY, fromCal.getActualMinimum(Calendar.HOUR_OF_DAY))
+fromCal.set(Calendar.MINUTE, fromCal.getActualMinimum(Calendar.MINUTE))
+fromCal.set(Calendar.SECOND, fromCal.getActualMinimum(Calendar.SECOND))
+fromCal.set(Calendar.MILLISECOND, fromCal.getActualMinimum(Calendar.MILLISECOND))
+fromTs = new Timestamp(fromCal.getTimeInMillis())
+fromStr = fromTs.toString()
+fromStr = fromStr.substring(0, fromStr.indexOf('.'))
+context.put("fromDateStr", fromStr)
// create the thruDate for calendar
-toCal = Calendar.getInstance();
-toCal.setTime(new java.util.Date());
-toCal.set(Calendar.HOUR_OF_DAY, toCal.getActualMaximum(Calendar.HOUR_OF_DAY));
-toCal.set(Calendar.MINUTE, toCal.getActualMaximum(Calendar.MINUTE));
-toCal.set(Calendar.SECOND, toCal.getActualMaximum(Calendar.SECOND));
-toCal.set(Calendar.MILLISECOND, toCal.getActualMaximum(Calendar.MILLISECOND));
-toTs = new Timestamp(toCal.getTimeInMillis());
-toStr = toTs.toString();
-context.put("thruDateStr", toStr);
+toCal = Calendar.getInstance()
+toCal.setTime(new java.util.Date())
+toCal.set(Calendar.HOUR_OF_DAY, toCal.getActualMaximum(Calendar.HOUR_OF_DAY))
+toCal.set(Calendar.MINUTE, toCal.getActualMaximum(Calendar.MINUTE))
+toCal.set(Calendar.SECOND, toCal.getActualMaximum(Calendar.SECOND))
+toCal.set(Calendar.MILLISECOND, toCal.getActualMaximum(Calendar.MILLISECOND))
+toTs = new Timestamp(toCal.getTimeInMillis())
+toStr = toTs.toString()
+context.put("thruDateStr", toStr)
-searchConstraintStrings = ContentSearchSession.searchGetConstraintStrings(false, session, delegator);
-searchSortOrderString = ContentSearchSession.searchGetSortOrderString(false, request);
-contentAssocTypes = from("ContentAssocType").queryList();
-roleTypes = from("RoleType").queryList();
+searchConstraintStrings = ContentSearchSession.searchGetConstraintStrings(false, session, delegator)
+searchSortOrderString = ContentSearchSession.searchGetSortOrderString(false, request)
+contentAssocTypes = from("ContentAssocType").queryList()
+roleTypes = from("RoleType").queryList()
-context.put("searchOperator", searchOperator);
-context.put("searchConstraintStrings", searchConstraintStrings);
-context.put("searchSortOrderString", searchSortOrderString);
-context.put("contentAssocTypes", contentAssocTypes);
-context.put("roleTypes", roleTypes);
+context.put("searchOperator", searchOperator)
+context.put("searchConstraintStrings", searchConstraintStrings)
+context.put("searchSortOrderString", searchSortOrderString)
+context.put("contentAssocTypes", contentAssocTypes)
+context.put("roleTypes", roleTypes)
diff --git a/applications/content/groovyScripts/content/ContentSearchResults.groovy b/applications/content/groovyScripts/content/ContentSearchResults.groovy
index c58358280b..40a6e63807 100644
--- a/applications/content/groovyScripts/content/ContentSearchResults.groovy
+++ b/applications/content/groovyScripts/content/ContentSearchResults.groovy
@@ -17,18 +17,18 @@
* under the License.
*/
-import org.apache.ofbiz.base.util.*;
-import org.apache.ofbiz.content.content.*;
+import org.apache.ofbiz.base.util.*
+import org.apache.ofbiz.content.content.*
// note: this can be run multiple times in the same request without causing problems, will check to see on its own if it has run again
-ContentSearchSession.processSearchParameters(parameters, request);
-Map result = ContentSearchEvents.getContentSearchResult(request, delegator);
+ContentSearchSession.processSearchParameters(parameters, request)
+Map result = ContentSearchEvents.getContentSearchResult(request, delegator)
-context.put("contentIds", result.get("contentIds"));
-context.put("viewIndex", result.get("viewIndex"));
-context.put("viewSize", result.get("viewSize"));
-context.put("listSize", result.get("listSize"));
-context.put("lowIndex", result.get("lowIndex"));
-context.put("highIndex", result.get("highIndex"));
-context.put("searchConstraintStrings", result.get("searchConstraintStrings"));
-context.put("searchSortOrderString", result.get("searchSortOrderString"));
+context.put("contentIds", result.get("contentIds"))
+context.put("viewIndex", result.get("viewIndex"))
+context.put("viewSize", result.get("viewSize"))
+context.put("listSize", result.get("listSize"))
+context.put("lowIndex", result.get("lowIndex"))
+context.put("highIndex", result.get("highIndex"))
+context.put("searchConstraintStrings", result.get("searchConstraintStrings"))
+context.put("searchSortOrderString", result.get("searchSortOrderString"))
diff --git a/applications/content/groovyScripts/content/GetContentLookupList.groovy b/applications/content/groovyScripts/content/GetContentLookupList.groovy
index 45e6f058f4..abc3319af8 100644
--- a/applications/content/groovyScripts/content/GetContentLookupList.groovy
+++ b/applications/content/groovyScripts/content/GetContentLookupList.groovy
@@ -17,104 +17,104 @@
* under the License.
*/
- import org.apache.ofbiz.entity.condition.*;
- import org.apache.ofbiz.entity.util.*;
- import org.apache.ofbiz.entity.*;
- import org.apache.ofbiz.base.util.*;
- import org.apache.ofbiz.entity.transaction.TransactionUtil;
- import org.apache.ofbiz.entity.util.EntityListIterator;
- import org.apache.ofbiz.entity.GenericEntity;
- import org.apache.ofbiz.entity.model.ModelField;
- import org.apache.ofbiz.entity.model.ModelEntity;
- import org.apache.ofbiz.entity.model.ModelReader;
+ import org.apache.ofbiz.entity.condition.*
+ import org.apache.ofbiz.entity.util.*
+ import org.apache.ofbiz.entity.*
+ import org.apache.ofbiz.base.util.*
+ import org.apache.ofbiz.entity.transaction.TransactionUtil
+ import org.apache.ofbiz.entity.util.EntityListIterator
+ import org.apache.ofbiz.entity.GenericEntity
+ import org.apache.ofbiz.entity.model.ModelField
+ import org.apache.ofbiz.entity.model.ModelEntity
+ import org.apache.ofbiz.entity.model.ModelReader
try {
- viewIndex = Integer.valueOf((String)parameters.get("VIEW_INDEX")).intValue();
+ viewIndex = Integer.valueOf((String)parameters.get("VIEW_INDEX")).intValue()
} catch (NumberFormatException nfe) {
- viewIndex = 0;
+ viewIndex = 0
}
-context.viewIndexFirst = 0;
-context.viewIndex = viewIndex;
-context.viewIndexPrevious = viewIndex-1;
-context.viewIndexNext = viewIndex+1;
-String curFindString="";
+context.viewIndexFirst = 0
+context.viewIndex = viewIndex
+context.viewIndexPrevious = viewIndex-1
+context.viewIndexNext = viewIndex+1
+String curFindString=""
-ModelReader reader = delegator.getModelReader();
-ModelEntity modelEntity = reader.getModelEntity("ContentAssocViewTo");
-GenericEntity findByEntity = delegator.makeValue("ContentAssocViewTo");
-List errMsgList = new ArrayList();
-Iterator fieldIterator = modelEntity.getFieldsIterator();
+ModelReader reader = delegator.getModelReader()
+ModelEntity modelEntity = reader.getModelEntity("ContentAssocViewTo")
+GenericEntity findByEntity = delegator.makeValue("ContentAssocViewTo")
+List errMsgList = new ArrayList()
+Iterator fieldIterator = modelEntity.getFieldsIterator()
while (fieldIterator.hasNext()) {
- ModelField field = fieldIterator.next();
- String fval = parameters.get(field.getName());
+ ModelField field = fieldIterator.next()
+ String fval = parameters.get(field.getName())
if (fval != null) {
if (fval.length() > 0) {
- curFindString = curFindString + "&" + field.getName() + "=" + fval;
+ curFindString = curFindString + "&" + field.getName() + "=" + fval
try {
- findByEntity.setString(field.getName(), fval);
+ findByEntity.setString(field.getName(), fval)
} catch (NumberFormatException nfe) {
- Debug.logError(nfe, "Caught an exception : " + nfe.toString(), "GetContentLookupList.groovy");
- errMsgList.add("Entered value is non-numeric for numeric field: " + field.getName());
+ Debug.logError(nfe, "Caught an exception : " + nfe.toString(), "GetContentLookupList.groovy")
+ errMsgList.add("Entered value is non-numeric for numeric field: " + field.getName())
}
}
}
}
if (errMsgList) {
- request.setAttribute("_ERROR_MESSAGE_LIST_", errMsgList);
+ request.setAttribute("_ERROR_MESSAGE_LIST_", errMsgList)
}
-curFindString = UtilFormatOut.encodeQuery(curFindString);
-context.curFindString = curFindString;
+curFindString = UtilFormatOut.encodeQuery(curFindString)
+context.curFindString = curFindString
try {
- viewSize = Integer.valueOf((String)parameters.get("VIEW_SIZE")).intValue();
+ viewSize = Integer.valueOf((String)parameters.get("VIEW_SIZE")).intValue()
} catch (NumberFormatException nfe) {
}
-context.viewSize = viewSize;
+context.viewSize = viewSize
-int lowIndex = viewIndex*viewSize+1;
-int highIndex = (viewIndex+1)*viewSize;
+int lowIndex = viewIndex*viewSize+1
+int highIndex = (viewIndex+1)*viewSize
-context.lowIndex = lowIndex;
-int arraySize = 0;
-List resultPartialList = null;
+context.lowIndex = lowIndex
+int arraySize = 0
+List resultPartialList = null
if ((highIndex - lowIndex + 1) > 0) {
// get the results as an entity list iterator
- boolean beganTransaction = false;
+ boolean beganTransaction = false
if(resultPartialList==null){
try {
- beganTransaction = TransactionUtil.begin();
- EntityListIterator listIt = from("ContentAssocViewTo").where("contentIdStart", (String)parameters.get("contentId")).orderBy("contentId ASC").cursorScrollInsensitive().cache(true).queryIterator();
- resultPartialList = listIt.getPartialList(lowIndex, highIndex - lowIndex + 1);
+ beganTransaction = TransactionUtil.begin()
+ EntityListIterator listIt = from("ContentAssocViewTo").where("contentIdStart", (String)parameters.get("contentId")).orderBy("contentId ASC").cursorScrollInsensitive().cache(true).queryIterator()
+ resultPartialList = listIt.getPartialList(lowIndex, highIndex - lowIndex + 1)
- arraySize = listIt.getResultsSizeAfterPartialList();
+ arraySize = listIt.getResultsSizeAfterPartialList()
if (arraySize < highIndex) {
- highIndex = arraySize;
+ highIndex = arraySize
}
- listIt.close();
+ listIt.close()
} catch (GenericEntityException e) {
- Debug.logError(e, "Failure in operation, rolling back transaction", "GetContentLookupList.groovy");
+ Debug.logError(e, "Failure in operation, rolling back transaction", "GetContentLookupList.groovy")
try {
// only rollback the transaction if we started one...
- TransactionUtil.rollback(beganTransaction, "Error looking up entity values in WebTools Entity Data Maintenance", e);
+ TransactionUtil.rollback(beganTransaction, "Error looking up entity values in WebTools Entity Data Maintenance", e)
} catch (GenericEntityException e2) {
- Debug.logError(e2, "Could not rollback transaction: " + e2.toString(), "GetContentLookupList.groovy");
+ Debug.logError(e2, "Could not rollback transaction: " + e2.toString(), "GetContentLookupList.groovy")
}
// after rolling back, rethrow the exception
- throw e;
+ throw e
} finally {
// only commit the transaction if we started one... this will throw an exception if it fails
- TransactionUtil.commit(beganTransaction);
+ TransactionUtil.commit(beganTransaction)
}
}
}
-context.highIndex = highIndex;
-context.arraySize = arraySize;
-context.resultPartialList = resultPartialList;
+context.highIndex = highIndex
+context.arraySize = arraySize
+context.resultPartialList = resultPartialList
-viewIndexLast = UtilMisc.getViewLastIndex(arraySize, viewSize);
-context.viewIndexLast = viewIndexLast;
-context.contentAssoc=resultPartialList;
+viewIndexLast = UtilMisc.getViewLastIndex(arraySize, viewSize)
+context.viewIndexLast = viewIndexLast
+context.contentAssoc=resultPartialList
diff --git a/applications/content/groovyScripts/content/PrepSeqNo.groovy b/applications/content/groovyScripts/content/PrepSeqNo.groovy
index 3f1adc4050..826bdbd435 100644
--- a/applications/content/groovyScripts/content/PrepSeqNo.groovy
+++ b/applications/content/groovyScripts/content/PrepSeqNo.groovy
@@ -19,15 +19,15 @@
import org.apache.ofbiz.base.util.Debug
-seqNo = context.caSequenceNum;
+seqNo = context.caSequenceNum
if (!seqNo) {
- seqNo = context.sequenceNum;
+ seqNo = context.sequenceNum
}
-Debug.logInfo("caSequenceNum:" + seqNo, "");
+Debug.logInfo("caSequenceNum:" + seqNo, "")
if (seqNo) {
- seqNumBefore = seqNo - 1;
- context.seqNumBefore = seqNumBefore;
- seqNumAfter = seqNo + 1;
- context.seqNumAfter = seqNumAfter;
+ seqNumBefore = seqNo - 1
+ context.seqNumBefore = seqNumBefore
+ seqNumAfter = seqNo + 1
+ context.seqNumAfter = seqNumAfter
}
diff --git a/applications/content/groovyScripts/contentsetup/UserPermPrep.groovy b/applications/content/groovyScripts/contentsetup/UserPermPrep.groovy
index 7f2c17ca5f..36ad65d726 100644
--- a/applications/content/groovyScripts/contentsetup/UserPermPrep.groovy
+++ b/applications/content/groovyScripts/contentsetup/UserPermPrep.groovy
@@ -17,46 +17,46 @@
* under the License.
*/
-import org.apache.ofbiz.base.util.*;
-import org.apache.ofbiz.entity.*;
-import org.apache.ofbiz.entity.condition.*;
-import org.apache.ofbiz.entity.model.*;
-import org.apache.ofbiz.entity.util.*;
-import org.apache.ofbiz.service.*;
-import org.apache.ofbiz.content.ContentManagementWorker;
+import org.apache.ofbiz.base.util.*
+import org.apache.ofbiz.entity.*
+import org.apache.ofbiz.entity.condition.*
+import org.apache.ofbiz.entity.model.*
+import org.apache.ofbiz.entity.util.*
+import org.apache.ofbiz.service.*
+import org.apache.ofbiz.content.ContentManagementWorker
-paramMap = UtilHttp.getParameterMap(request);
-forumId = ContentManagementWorker.getFromSomewhere("webSitePublishPoint", paramMap, request, context);
-blogRoles = from("RoleType").where("parentTypeId", "BLOG").cache(true).queryList();
+paramMap = UtilHttp.getParameterMap(request)
+forumId = ContentManagementWorker.getFromSomewhere("webSitePublishPoint", paramMap, request, context)
+blogRoles = from("RoleType").where("parentTypeId", "BLOG").cache(true).queryList()
if (forumId) {
- siteRoleMap = [:];
+ siteRoleMap = [:]
for (int i=0; i < blogRoles.size(); i++) {
- roleType = blogRoles.get(i);
- roleTypeId = roleType.roleTypeId;
- filteredRoleList = from("ContentRole").where("contentId", forumId, "roleTypeId", roleTypeId).filterByDate().queryList();
- cappedBlogRoleName = ModelUtil.dbNameToVarName(roleTypeId);
+ roleType = blogRoles.get(i)
+ roleTypeId = roleType.roleTypeId
+ filteredRoleList = from("ContentRole").where("contentId", forumId, "roleTypeId", roleTypeId).filterByDate().queryList()
+ cappedBlogRoleName = ModelUtil.dbNameToVarName(roleTypeId)
filteredRoleList.each { contentRole ->
- partyId = contentRole.partyId;
- fromDate = contentRole.fromDate;
- map = siteRoleMap.get(partyId);
+ partyId = contentRole.partyId
+ fromDate = contentRole.fromDate
+ map = siteRoleMap.get(partyId)
if (!map) {
- map = [:];
- map.partyId = partyId;
- siteRoleMap.put(partyId, map);
+ map = [:]
+ map.partyId = partyId
+ siteRoleMap.put(partyId, map)
}
- map.put( cappedBlogRoleName, "Y");
- map.put( cappedBlogRoleName + "FromDate", fromDate);
+ map.put( cappedBlogRoleName, "Y")
+ map.put( cappedBlogRoleName + "FromDate", fromDate)
}
}
- siteList = new ArrayList(siteRoleMap.values());
- context.siteList = siteList;
- context.rowCount = siteList.size();
- blogRoleList = [] as ArrayList;
+ siteList = new ArrayList(siteRoleMap.values())
+ context.siteList = siteList
+ context.rowCount = siteList.size()
+ blogRoleList = [] as ArrayList
blogRoles.each { roleType ->
- blogRoleList.add(roleType.roleTypeId);
+ blogRoleList.add(roleType.roleTypeId)
}
- context.blogRoleIdList = blogRoleList;
+ context.blogRoleIdList = blogRoleList
}
diff --git a/applications/content/groovyScripts/datasetup/DataCategoryPrep.groovy b/applications/content/groovyScripts/datasetup/DataCategoryPrep.groovy
index 0785b8b7cd..c84ef1e7af 100644
--- a/applications/content/groovyScripts/datasetup/DataCategoryPrep.groovy
+++ b/applications/content/groovyScripts/datasetup/DataCategoryPrep.groovy
@@ -25,12 +25,12 @@ import org.apache.ofbiz.content.data.DataResourceWorker
* DataCategory picklist.
*/
-dataCategoryTrail = [] as ArrayList;
-rootNode = [:];
-rootNode.id = "ROOT";
-DataResourceWorker.getDataCategoryMap(delegator, 0, rootNode, dataCategoryTrail, true);
+dataCategoryTrail = [] as ArrayList
+rootNode = [:]
+rootNode.id = "ROOT"
+DataResourceWorker.getDataCategoryMap(delegator, 0, rootNode, dataCategoryTrail, true)
-dataCategoryList = [] as ArrayList;
-DataResourceWorker.buildList(rootNode, dataCategoryList, 0);
+dataCategoryList = [] as ArrayList
+DataResourceWorker.buildList(rootNode, dataCategoryList, 0)
-context.dataCategoryList = dataCategoryList;
+context.dataCategoryList = dataCategoryList
diff --git a/applications/content/groovyScripts/layout/EditSubContent.groovy b/applications/content/groovyScripts/layout/EditSubContent.groovy
index 8ba7daad63..aad59d2cd2 100644
--- a/applications/content/groovyScripts/layout/EditSubContent.groovy
+++ b/applications/content/groovyScripts/layout/EditSubContent.groovy
@@ -30,25 +30,25 @@ import freemarker.template.WrappingTemplateModel
import javax.servlet.*
import javax.servlet.http.*
-Locale locale = UtilHttp.getLocale(request);
+Locale locale = UtilHttp.getLocale(request)
if (currentValue) {
- dataResourceId = currentValue.drDataResourceId;
- dataResourceTypeId = currentValue.drDataResourceTypeId;
+ dataResourceId = currentValue.drDataResourceId
+ dataResourceTypeId = currentValue.drDataResourceTypeId
if (dataResourceTypeId) {
- mimeTypeId = currentValue.drMimeTypeId;
- rootDir = request.getSession().getServletContext().getRealPath("/");
- wrapper = FreeMarkerWorker.getDefaultOfbizWrapper();
- WrappingTemplateModel.setDefaultObjectWrapper(wrapper);
- templateRoot = [:];
- FreeMarkerViewHandler.prepOfbizRoot(templateRoot, request, response);
- ctx = [:];
- ctx.rootDir = rootDir;
+ mimeTypeId = currentValue.drMimeTypeId
+ rootDir = request.getSession().getServletContext().getRealPath("/")
+ wrapper = FreeMarkerWorker.getDefaultOfbizWrapper()
+ WrappingTemplateModel.setDefaultObjectWrapper(wrapper)
+ templateRoot = [:]
+ FreeMarkerViewHandler.prepOfbizRoot(templateRoot, request, response)
+ ctx = [:]
+ ctx.rootDir = rootDir
// webSiteId and https need to go here, too
- templateRoot.context = ctx;
- out = new StringWriter();
- currentValue.drDataTemplateTypeId = "NONE";
- DataResourceWorker.renderDataResourceAsText(delegator, dataResourceId, out, templateRoot, locale, null, false);
- textData = out.toString();
- context.textData = textData;
+ templateRoot.context = ctx
+ out = new StringWriter()
+ currentValue.drDataTemplateTypeId = "NONE"
+ DataResourceWorker.renderDataResourceAsText(delegator, dataResourceId, out, templateRoot, locale, null, false)
+ textData = out.toString()
+ context.textData = textData
}
}
diff --git a/applications/content/groovyScripts/print/FindPrinters.groovy b/applications/content/groovyScripts/print/FindPrinters.groovy
index b087106c3c..f41bc92eda 100644
--- a/applications/content/groovyScripts/print/FindPrinters.groovy
+++ b/applications/content/groovyScripts/print/FindPrinters.groovy
@@ -19,6 +19,6 @@
import javax.print.PrintServiceLookup
-printServices = PrintServiceLookup.lookupPrintServices(null, null);
+printServices = PrintServiceLookup.lookupPrintServices(null, null)
printServiceNames = printServices.collect { it.getName() }
-context.printers = printServiceNames;
+context.printers = printServiceNames
diff --git a/applications/content/groovyScripts/survey/EditSurveyQuestions.groovy b/applications/content/groovyScripts/survey/EditSurveyQuestions.groovy
index 22eb72d31e..9598a6c650 100644
--- a/applications/content/groovyScripts/survey/EditSurveyQuestions.groovy
+++ b/applications/content/groovyScripts/survey/EditSurveyQuestions.groovy
@@ -21,70 +21,70 @@ import org.apache.ofbiz.entity.*
import org.apache.ofbiz.entity.condition.*
import org.apache.ofbiz.base.util.*
-surveyQuestionId = parameters.surveyQuestionId;
-context.surveyQuestionId = surveyQuestionId;
+surveyQuestionId = parameters.surveyQuestionId
+context.surveyQuestionId = surveyQuestionId
-surveyQuestion = from("SurveyQuestion").where("surveyQuestionId", surveyQuestionId).queryOne();
+surveyQuestion = from("SurveyQuestion").where("surveyQuestionId", surveyQuestionId).queryOne()
-viewIndex = parameters.VIEW_INDEX ? Integer.valueOf(parameters.VIEW_INDEX) : 0;
-viewSize = parameters.VIEW_SIZE ? Integer.valueOf(parameters.VIEW_SIZE) : 20;
+viewIndex = parameters.VIEW_INDEX ? Integer.valueOf(parameters.VIEW_INDEX) : 0
+viewSize = parameters.VIEW_SIZE ? Integer.valueOf(parameters.VIEW_SIZE) : 20
-int lowIndex = viewIndex * viewSize + 1;
-int highIndex = (viewIndex + 1) * viewSize;
+int lowIndex = viewIndex * viewSize + 1
+int highIndex = (viewIndex + 1) * viewSize
-context.viewIndexFirst = 0;
-context.viewIndex = viewIndex;
-context.viewIndexPrevious = viewIndex - 1;
-context.viewIndexNext = viewIndex + 1;
-context.viewSize = viewSize;
-context.lowIndex = lowIndex;
-int listSize = 0;
+context.viewIndexFirst = 0
+context.viewIndex = viewIndex
+context.viewIndexPrevious = viewIndex - 1
+context.viewIndexNext = viewIndex + 1
+context.viewSize = viewSize
+context.lowIndex = lowIndex
+int listSize = 0
-listIt = from("SurveyQuestionAndAppl").where("surveyId", surveyId).orderBy("sequenceNum").cursorScrollInsensitive().cache(true).queryIterator();
-surveyQuestionAndApplList = listIt.getPartialList(lowIndex, highIndex - lowIndex + 1);
+listIt = from("SurveyQuestionAndAppl").where("surveyId", surveyId).orderBy("sequenceNum").cursorScrollInsensitive().cache(true).queryIterator()
+surveyQuestionAndApplList = listIt.getPartialList(lowIndex, highIndex - lowIndex + 1)
-listSize = listIt.getResultsSizeAfterPartialList();
+listSize = listIt.getResultsSizeAfterPartialList()
if (listSize < highIndex) {
- highIndex = listSize;
+ highIndex = listSize
}
-context.viewIndexLast = (int) (listSize / viewSize);
-context.highIndex = highIndex;
-context.listSize = listSize;
-listIt.close();
+context.viewIndexLast = (int) (listSize / viewSize)
+context.highIndex = highIndex
+context.listSize = listSize
+listIt.close()
-surveyPageList = from("SurveyPage").where("surveyId", surveyId).orderBy("sequenceNum").queryList();
-surveyMultiRespList = from("SurveyMultiResp").where("surveyId", surveyId).orderBy("multiRespTitle").queryList();
+surveyPageList = from("SurveyPage").where("surveyId", surveyId).orderBy("sequenceNum").queryList()
+surveyMultiRespList = from("SurveyMultiResp").where("surveyId", surveyId).orderBy("multiRespTitle").queryList()
if (surveyQuestion && surveyQuestion.surveyQuestionTypeId && "OPTION".equals(surveyQuestion.surveyQuestionTypeId)) {
// get the options
- questionOptions = from("SurveyQuestionOption").where("surveyQuestionId", surveyQuestionId).orderBy("sequenceNum").queryList();
- context.questionOptions = questionOptions;
+ questionOptions = from("SurveyQuestionOption").where("surveyQuestionId", surveyQuestionId).orderBy("sequenceNum").queryList()
+ context.questionOptions = questionOptions
// survey question option
- optionSeqId = parameters.surveyOptionSeqId;
- surveyQuestionOption = null;
+ optionSeqId = parameters.surveyOptionSeqId
+ surveyQuestionOption = null
if (optionSeqId) {
- surveyQuestionOption = from("SurveyQuestionOption").where("surveyQuestionId", surveyQuestionId, "surveyOptionSeqId", optionSeqId).queryOne();
+ surveyQuestionOption = from("SurveyQuestionOption").where("surveyQuestionId", surveyQuestionId, "surveyOptionSeqId", optionSeqId).queryOne()
}
- context.surveyQuestionOption = surveyQuestionOption;
+ context.surveyQuestionOption = surveyQuestionOption
}
-surveyQuestionCategoryId = parameters.surveyQuestionCategoryId;
-surveyQuestionCategory = null;
-categoryQuestions = null;
+surveyQuestionCategoryId = parameters.surveyQuestionCategoryId
+surveyQuestionCategory = null
+categoryQuestions = null
if (surveyQuestionCategoryId && "Y".equals(parameters.applyQuestionFromCategory)) {
- surveyQuestionCategory = from("SurveyQuestionCategory").where("surveyQuestionCategoryId", surveyQuestionCategoryId).queryOne();
+ surveyQuestionCategory = from("SurveyQuestionCategory").where("surveyQuestionCategoryId", surveyQuestionCategoryId).queryOne()
if (surveyQuestionCategory) {
- categoryQuestions = surveyQuestionCategory.getRelated("SurveyQuestion", null, null, false);
+ categoryQuestions = surveyQuestionCategory.getRelated("SurveyQuestion", null, null, false)
}
}
-questionCategories = from("SurveyQuestionCategory").orderBy("description").queryList();
-context.surveyQuestion = surveyQuestion;
+questionCategories = from("SurveyQuestionCategory").orderBy("description").queryList()
+context.surveyQuestion = surveyQuestion
-context.surveyQuestionAndApplList = surveyQuestionAndApplList;
-context.surveyPageList = surveyPageList;
-context.surveyMultiRespList = surveyMultiRespList;
-context.surveyQuestionCategory = surveyQuestionCategory;
-context.categoryQuestions = categoryQuestions;
-context.questionCategories = questionCategories;
+context.surveyQuestionAndApplList = surveyQuestionAndApplList
+context.surveyPageList = surveyPageList
+context.surveyMultiRespList = surveyMultiRespList
+context.surveyQuestionCategory = surveyQuestionCategory
+context.categoryQuestions = categoryQuestions
+context.questionCategories = questionCategories
diff --git a/applications/content/groovyScripts/survey/EditSurveyResponse.groovy b/applications/content/groovyScripts/survey/EditSurveyResponse.groovy
index bee3fe5dda..cb24012a78 100644
--- a/applications/content/groovyScripts/survey/EditSurveyResponse.groovy
+++ b/applications/content/groovyScripts/survey/EditSurveyResponse.groovy
@@ -20,21 +20,21 @@
import org.apache.ofbiz.content.survey.*
import org.apache.ofbiz.base.util.*
-surveyResponseId = parameters.surveyResponseId;
-partyId = null;
+surveyResponseId = parameters.surveyResponseId
+partyId = null
if (!surveyId && surveyResponseId) {
- surveyResponse = from("SurveyResponse").where("surveyResponseId", surveyResponseId).queryOne();
- surveyId = surveyResponse.surveyId;
- context.surveyPartyId = surveyResponse.partyId;
- context.surveyId = surveyId;
+ surveyResponse = from("SurveyResponse").where("surveyResponseId", surveyResponseId).queryOne()
+ surveyId = surveyResponse.surveyId
+ context.surveyPartyId = surveyResponse.partyId
+ context.surveyId = surveyId
}
-surveyWrapper = new SurveyWrapper(delegator, surveyResponseId, partyId, surveyId, null);
-surveyWrapper.setEdit(true);
+surveyWrapper = new SurveyWrapper(delegator, surveyResponseId, partyId, surveyId, null)
+surveyWrapper.setEdit(true)
-templateUrl = UtilURL.fromOfbizHomePath("applications/content/template/survey/GenericSurvey.ftl");
+templateUrl = UtilURL.fromOfbizHomePath("applications/content/template/survey/GenericSurvey.ftl")
if (templateUrl) {
- writer = new StringWriter();
- surveyWrapper.render(templateUrl, writer);
- context.surveyString = writer.toString();
+ writer = new StringWriter()
+ surveyWrapper.render(templateUrl, writer)
+ context.surveyString = writer.toString()
}
diff --git a/applications/content/groovyScripts/survey/ViewSurveyResponses.groovy b/applications/content/groovyScripts/survey/ViewSurveyResponses.groovy
index ccc9a38136..8f1f5c58f2 100644
--- a/applications/content/groovyScripts/survey/ViewSurveyResponses.groovy
+++ b/applications/content/groovyScripts/survey/ViewSurveyResponses.groovy
@@ -17,25 +17,25 @@
* under the License.
*/
-import org.apache.ofbiz.content.survey.SurveyWrapper;
+import org.apache.ofbiz.content.survey.SurveyWrapper
if (!survey) {
- surveyResponseId = parameters.surveyResponseId;
+ surveyResponseId = parameters.surveyResponseId
if (surveyResponseId) {
- surveyResponse = from("SurveyResponse").where("surveyResponseId", surveyResponseId).queryOne();
+ surveyResponse = from("SurveyResponse").where("surveyResponseId", surveyResponseId).queryOne()
if (surveyResponse) {
- surveyId = surveyResponse.surveyId;
+ surveyId = surveyResponse.surveyId
if (surveyId) {
- survey = from("Survey").where("surveyId", surveyId).queryOne();
- context.survey = survey;
- context.surveyId = surveyId;
+ survey = from("Survey").where("surveyId", surveyId).queryOne()
+ context.survey = survey
+ context.surveyId = surveyId
}
}
}
}
if (survey) {
- surveyWrapper = new SurveyWrapper(delegator, surveyId);
- context.surveyWrapper = surveyWrapper;
- context.sequenceSort = ['sequenceNum'];
+ surveyWrapper = new SurveyWrapper(delegator, surveyId)
+ context.surveyWrapper = surveyWrapper
+ context.sequenceSort = ['sequenceNum']
}
diff --git a/applications/content/groovyScripts/website/EditWebSiteParties.groovy b/applications/content/groovyScripts/website/EditWebSiteParties.groovy
index 9b5a0ae95a..01d269dcca 100644
--- a/applications/content/groovyScripts/website/EditWebSiteParties.groovy
+++ b/applications/content/groovyScripts/website/EditWebSiteParties.groovy
@@ -17,16 +17,16 @@
* under the License.
*/
-webSiteRoleDatas = [] as LinkedList;
+webSiteRoleDatas = [] as LinkedList
if (webSite) {
- webSiteRoles = webSite.getRelated("WebSiteRole", null, ['sequenceNum', 'partyId'], false);
+ webSiteRoles = webSite.getRelated("WebSiteRole", null, ['sequenceNum', 'partyId'], false)
webSiteRoles.each { webSiteRole ->
- Map webSiteRoleData = [:];
- webSiteRoleData.webSiteRole = webSiteRole;
- webSiteRoleData.person = webSiteRole.getRelatedOne("Person", false);
- webSiteRoleData.partyGroup = webSiteRole.getRelatedOne("PartyGroup", false);
- webSiteRoleData.roleType = webSiteRole.getRelatedOne("RoleType", true);
- webSiteRoleDatas.add(webSiteRoleData);
+ Map webSiteRoleData = [:]
+ webSiteRoleData.webSiteRole = webSiteRole
+ webSiteRoleData.person = webSiteRole.getRelatedOne("Person", false)
+ webSiteRoleData.partyGroup = webSiteRole.getRelatedOne("PartyGroup", false)
+ webSiteRoleData.roleType = webSiteRole.getRelatedOne("RoleType", true)
+ webSiteRoleDatas.add(webSiteRoleData)
}
}
-context.webSiteRoleDatas = webSiteRoleDatas;
+context.webSiteRoleDatas = webSiteRoleDatas
diff --git a/applications/content/groovyScripts/website/WebSiteCMSMetaInfo.groovy b/applications/content/groovyScripts/website/WebSiteCMSMetaInfo.groovy
index 33c72a2d07..4b9ae53d49 100644
--- a/applications/content/groovyScripts/website/WebSiteCMSMetaInfo.groovy
+++ b/applications/content/groovyScripts/website/WebSiteCMSMetaInfo.groovy
@@ -23,31 +23,31 @@ import org.apache.ofbiz.entity.util.*
if (content) {
// lookup assoc content
- title = from("ContentAssoc").where("contentId", contentId, "mapKey", "title").orderBy("-fromDate").filterByDate().queryFirst();
+ title = from("ContentAssoc").where("contentId", contentId, "mapKey", "title").orderBy("-fromDate").filterByDate().queryFirst()
if (title) {
- tc = title.getRelatedOne("ToContent", false);
- tcdr = tc.getRelatedOne("DataResource", false);
- context.title = tcdr;
+ tc = title.getRelatedOne("ToContent", false)
+ tcdr = tc.getRelatedOne("DataResource", false)
+ context.title = tcdr
}
- titleProp = from("ContentAssoc").where("contentId", contentId, "mapKey", "titleProperty").orderBy("-fromDate").filterByDate().queryFirst();
+ titleProp = from("ContentAssoc").where("contentId", contentId, "mapKey", "titleProperty").orderBy("-fromDate").filterByDate().queryFirst()
if (titleProp) {
- tpc = titleProp.getRelatedOne("ToContent", false);
- tpcdr = tpc.getRelatedOne("DataResource", false);
- context.titleProperty = tpcdr;
+ tpc = titleProp.getRelatedOne("ToContent", false)
+ tpcdr = tpc.getRelatedOne("DataResource", false)
+ context.titleProperty = tpcdr
}
- metaDesc = from("ContentAssoc").where("contentId", contentId, "mapKey", "metaDescription").orderBy("-fromDate").filterByDate().queryFirst();
+ metaDesc = from("ContentAssoc").where("contentId", contentId, "mapKey", "metaDescription").orderBy("-fromDate").filterByDate().queryFirst()
if (metaDesc) {
- mdc = metaDesc.getRelatedOne("ToContent", false);
- mdcdr = mdc.getRelatedOne("DataResource", false);
- context.metaDescription = mdcdr;
+ mdc = metaDesc.getRelatedOne("ToContent", false)
+ mdcdr = mdc.getRelatedOne("DataResource", false)
+ context.metaDescription = mdcdr
}
- metaKey = from("ContentAssoc").where("contentId", contentId, "mapKey", "metaKeywords").orderBy("-fromDate").filterByDate().queryFirst();
+ metaKey = from("ContentAssoc").where("contentId", contentId, "mapKey", "metaKeywords").orderBy("-fromDate").filterByDate().queryFirst()
if (metaKey) {
- mkc = metaKey.getRelatedOne("ToContent", false);
- mkcdr = mkc.getRelatedOne("DataResource", false);
- context.metaKeywords = mkcdr;
+ mkc = metaKey.getRelatedOne("ToContent", false)
+ mkcdr = mkc.getRelatedOne("DataResource", false)
+ context.metaKeywords = mkcdr
}
}
diff --git a/applications/content/groovyScripts/website/WebSitePublishPoint.groovy b/applications/content/groovyScripts/website/WebSitePublishPoint.groovy
index 1b055161f6..47091e7168 100644
--- a/applications/content/groovyScripts/website/WebSitePublishPoint.groovy
+++ b/applications/content/groovyScripts/website/WebSitePublishPoint.groovy
@@ -20,26 +20,26 @@
import org.apache.ofbiz.entity.condition.*
import org.apache.ofbiz.entity.util.*
-webSiteContent = from("WebSiteContent").where("webSiteId", webSiteId, "webSiteContentTypeId", "PUBLISH_POINT").orderBy("-fromDate").cache().filterByDate().queryFirst();
+webSiteContent = from("WebSiteContent").where("webSiteId", webSiteId, "webSiteContentTypeId", "PUBLISH_POINT").orderBy("-fromDate").cache().filterByDate().queryFirst()
if (webSiteContent) {
- content = webSiteContent.getRelatedOne("Content", false);
- contentRoot = content.contentId;
- context.content = content;
- context.contentRoot = contentRoot;
+ content = webSiteContent.getRelatedOne("Content", false)
+ contentRoot = content.contentId
+ context.content = content
+ context.contentRoot = contentRoot
}
-webSiteMenu = from("WebSiteContent").where("webSiteId", webSiteId, "webSiteContentTypeId", "MENU_ROOT").orderBy("-fromDate").cache().queryFirst();
+webSiteMenu = from("WebSiteContent").where("webSiteId", webSiteId, "webSiteContentTypeId", "MENU_ROOT").orderBy("-fromDate").cache().queryFirst()
if (webSiteMenu) {
- menu = webSiteMenu.getRelatedOne("Content", false);
- menuRoot = menu.contentId;
- context.menu = menu;
- context.menuRoot = menuRoot;
+ menu = webSiteMenu.getRelatedOne("Content", false)
+ menuRoot = menu.contentId
+ context.menu = menu
+ context.menuRoot = menuRoot
}
-webSiteError = from("WebSiteContent").where("webSiteId", webSiteId, "webSiteContentTypeId", "ERROR_ROOT").orderBy("-fromDate").cache().queryFirst();
+webSiteError = from("WebSiteContent").where("webSiteId", webSiteId, "webSiteContentTypeId", "ERROR_ROOT").orderBy("-fromDate").cache().queryFirst()
if (webSiteError) {
- error = webSiteError.getRelatedOne("Content", false);
- errorRoot = error.contentId;
- context.error = error;
- context.errorRoot = errorRoot;
+ error = webSiteError.getRelatedOne("Content", false)
+ errorRoot = error.contentId
+ context.error = error
+ context.errorRoot = errorRoot
}
diff --git a/applications/humanres/groovyScripts/category/CategoryTree.groovy b/applications/humanres/groovyScripts/category/CategoryTree.groovy
index 029aa2ce0d..a2cee50c5d 100644
--- a/applications/humanres/groovyScripts/category/CategoryTree.groovy
+++ b/applications/humanres/groovyScripts/category/CategoryTree.groovy
@@ -21,39 +21,39 @@
* This script is also referenced by the ecommerce's screens and
* should not contain order component's specific code.
*/
-import org.apache.ofbiz.party.party.PartyHelper;
+import org.apache.ofbiz.party.party.PartyHelper
// Put the result of CategoryWorker.getRelatedCategories into the separateRootType function as attribute.
// The separateRootType function will return the list of category of given catalog.
// PLEASE NOTE : The structure of the list of separateRootType function is according to the JSON_DATA plugin of the jsTree.
-completedTree = [];
-completedTreeContext = [];
-subtopLists = [];
+completedTree = []
+completedTreeContext = []
+subtopLists = []
//internalOrg list
-partyRelationships = from("PartyRelationship").where("partyIdFrom", partyId, "partyRelationshipTypeId", "GROUP_ROLLUP").filterByDate().queryList();
+partyRelationships = from("PartyRelationship").where("partyIdFrom", partyId, "partyRelationshipTypeId", "GROUP_ROLLUP").filterByDate().queryList()
if (partyRelationships) {
//root
- partyRoot = from("PartyGroup").where("partyId", partyId).queryOne();
- partyRootMap = [:];
- partyRootMap.put("partyId", partyId);
- partyRootMap.put("groupName", partyRoot.getString("groupName"));
+ partyRoot = from("PartyGroup").where("partyId", partyId).queryOne()
+ partyRootMap = [:]
+ partyRootMap.put("partyId", partyId)
+ partyRootMap.put("groupName", partyRoot.getString("groupName"))
//child
for(partyRelationship in partyRelationships) {
- partyGroupMap = [:];
- partyGroupMap.put("partyId", partyRelationship.getString("partyIdTo"));
- partyGroupMap.put("groupName", PartyHelper.getPartyName(delegator, partyRelationship.getString("partyIdTo"), false));
- completedTreeContext.add(partyGroupMap);
+ partyGroupMap = [:]
+ partyGroupMap.put("partyId", partyRelationship.getString("partyIdTo"))
+ partyGroupMap.put("groupName", PartyHelper.getPartyName(delegator, partyRelationship.getString("partyIdTo"), false))
+ completedTreeContext.add(partyGroupMap)
- subtopLists.addAll(partyRelationship.getString("partyIdTo"));
+ subtopLists.addAll(partyRelationship.getString("partyIdTo"))
}
- partyRootMap.put("child", completedTreeContext);
- completedTree.add(partyRootMap);
+ partyRootMap.put("child", completedTreeContext)
+ completedTree.add(partyRootMap)
}
// The complete tree list for the category tree
-context.completedTree = completedTree;
-context.subtopLists = subtopLists;
+context.completedTree = completedTree
+context.subtopLists = subtopLists
diff --git a/applications/manufacturing/groovyScripts/bom/BomSimulation.groovy b/applications/manufacturing/groovyScripts/bom/BomSimulation.groovy
index dcb4ce7c51..b99dbe7e44 100644
--- a/applications/manufacturing/groovyScripts/bom/BomSimulation.groovy
+++ b/applications/manufacturing/groovyScripts/bom/BomSimulation.groovy
@@ -17,52 +17,52 @@
* under the License.
*/
-import org.apache.ofbiz.base.util.Debug;
-import org.apache.ofbiz.manufacturing.bom.BOMNode;
+import org.apache.ofbiz.base.util.Debug
+import org.apache.ofbiz.manufacturing.bom.BOMNode
-tree = request.getAttribute("tree");
-currencyUomId = parameters.currencyUomId;
-facilityId = parameters.facilityId;
+tree = request.getAttribute("tree")
+currencyUomId = parameters.currencyUomId
+facilityId = parameters.facilityId
if (tree) {
- treeArray = [];
- treeQty = [:];
+ treeArray = []
+ treeQty = [:]
- tree.print(treeArray);
- tree.sumQuantities(treeQty);
+ tree.print(treeArray)
+ tree.sumQuantities(treeQty)
- context.tree = treeArray;
- Iterator treeQtyIt = treeQty.values().iterator();
- productsData = [];
- grandTotalCost = 0.0;
+ context.tree = treeArray
+ Iterator treeQtyIt = treeQty.values().iterator()
+ productsData = []
+ grandTotalCost = 0.0
while (treeQtyIt) {
- BOMNode node = (BOMNode)treeQtyIt.next();
- unitCost = null;
- totalCost = null;
- qoh = null;
+ BOMNode node = (BOMNode)treeQtyIt.next()
+ unitCost = null
+ totalCost = null
+ qoh = null
// The standard cost is retrieved
try {
- outMap = [:];
+ outMap = [:]
if (currencyUomId) {
outMap = runService('getProductCost', [productId : node.getProduct().productId,
currencyUomId : currencyUomId,
costComponentTypePrefix : "EST_STD",
- userLogin : userLogin]);
- unitCost = outMap.productCost;
- totalCost = unitCost * node.getQuantity();
- grandTotalCost = grandTotalCost + totalCost ?: 0;
+ userLogin : userLogin])
+ unitCost = outMap.productCost
+ totalCost = unitCost * node.getQuantity()
+ grandTotalCost = grandTotalCost + totalCost ?: 0
}
if (facilityId) {
outMap = runService('getInventoryAvailableByFacility', [productId : node.getProduct().productId,
facilityId : facilityId,
- userLogin : userLogin]);
- qoh = outMap.quantityOnHandTotal;
+ userLogin : userLogin])
+ qoh = outMap.quantityOnHandTotal
}
} catch (Exception e) {
- Debug.logError("Error retrieving bom simulation data: " + e.getMessage(), "BomSimulation");
+ Debug.logError("Error retrieving bom simulation data: " + e.getMessage(), "BomSimulation")
}
- productsData.add([node : node, unitCost : unitCost, totalCost : totalCost, qoh : qoh]);
+ productsData.add([node : node, unitCost : unitCost, totalCost : totalCost, qoh : qoh])
}
- context.productsData = productsData;
- context.grandTotalCost = grandTotalCost;
+ context.productsData = productsData
+ context.grandTotalCost = grandTotalCost
}
diff --git a/applications/manufacturing/groovyScripts/bom/EditProductBom.groovy b/applications/manufacturing/groovyScripts/bom/EditProductBom.groovy
index 7f4e5fd1c7..ccdea7cb86 100644
--- a/applications/manufacturing/groovyScripts/bom/EditProductBom.groovy
+++ b/applications/manufacturing/groovyScripts/bom/EditProductBom.groovy
@@ -17,58 +17,58 @@
* under the License.
*/
-import java.sql.Timestamp;
-import org.apache.ofbiz.base.util.UtilHttp;
-import org.apache.ofbiz.base.util.UtilDateTime;
+import java.sql.Timestamp
+import org.apache.ofbiz.base.util.UtilHttp
+import org.apache.ofbiz.base.util.UtilDateTime
-context.nowDate = UtilDateTime.nowDate();
-context.nowTimestampString = UtilHttp.encodeBlanks(UtilDateTime.nowTimestamp().toString());
+context.nowDate = UtilDateTime.nowDate()
+context.nowTimestampString = UtilHttp.encodeBlanks(UtilDateTime.nowTimestamp().toString())
-boolean useValues = true;
-if (request.getAttribute("_ERROR_MESSAGE_")) useValues = false;
+boolean useValues = true
+if (request.getAttribute("_ERROR_MESSAGE_")) useValues = false
-productId = parameters.productId;
-if (productId) context.productId = productId;
+productId = parameters.productId
+if (productId) context.productId = productId
-productIdTo = parameters.productIdTo;
-updateMode = parameters.UPDATE_MODE;
+productIdTo = parameters.productIdTo
+updateMode = parameters.UPDATE_MODE
-if (productIdTo) context.productIdTo = productIdTo;
+if (productIdTo) context.productIdTo = productIdTo
-productAssocTypeId = parameters.productAssocTypeId;
-if (productAssocTypeId) context.productAssocTypeId = productAssocTypeId;
+productAssocTypeId = parameters.productAssocTypeId
+if (productAssocTypeId) context.productAssocTypeId = productAssocTypeId
-fromDateStr = parameters.fromDate;
+fromDateStr = parameters.fromDate
-Timestamp fromDate = null;
-if (fromDateStr) fromDate = Timestamp.valueOf(fromDateStr) ?: (Timestamp)request.getAttribute("ProductAssocCreateFromDate");;
-context.fromDate = fromDate;
+Timestamp fromDate = null
+if (fromDateStr) fromDate = Timestamp.valueOf(fromDateStr) ?: (Timestamp)request.getAttribute("ProductAssocCreateFromDate")
+context.fromDate = fromDate
-productAssoc = from("ProductAssoc").where("productId", productId, "productIdTo", productIdTo, "productAssocTypeId", productAssocTypeId, "fromDate", fromDate).queryOne();
+productAssoc = from("ProductAssoc").where("productId", productId, "productIdTo", productIdTo, "productAssocTypeId", productAssocTypeId, "fromDate", fromDate).queryOne()
if (updateMode) {
- productAssoc = [:];
- context.remove("productIdTo");
+ productAssoc = [:]
+ context.remove("productIdTo")
}
if (productAssoc) {
- context.productAssoc = productAssoc;
+ context.productAssoc = productAssoc
}
-if ("true".equalsIgnoreCase((String)request.getParameter("useValues"))) useValues = true;
-if (!productAssoc) useValues = false;
+if ("true".equalsIgnoreCase((String)request.getParameter("useValues"))) useValues = true
+if (!productAssoc) useValues = false
-context.useValues = useValues;
+context.useValues = useValues
-Collection assocTypes = from("ProductAssocType").where("parentTypeId", "PRODUCT_COMPONENT").orderBy("productAssocTypeId", "description").queryList();
-context.assocTypes = assocTypes;
+Collection assocTypes = from("ProductAssocType").where("parentTypeId", "PRODUCT_COMPONENT").orderBy("productAssocTypeId", "description").queryList()
+context.assocTypes = assocTypes
-Collection formulae = from("CustomMethod").where("customMethodTypeId", "BOM_FORMULA").orderBy("customMethodId", "description").queryList();
-context.formulae = formulae;
+Collection formulae = from("CustomMethod").where("customMethodTypeId", "BOM_FORMULA").orderBy("customMethodId", "description").queryList()
+context.formulae = formulae
if (product) {
- assocFromProducts = product.getRelated("MainProductAssoc", (productAssocTypeId ? [productAssocTypeId : productAssocTypeId]: [:]), ["sequenceNum","productId"], false);
- if (assocFromProducts) context.assocFromProducts = assocFromProducts;
+ assocFromProducts = product.getRelated("MainProductAssoc", (productAssocTypeId ? [productAssocTypeId : productAssocTypeId]: [:]), ["sequenceNum","productId"], false)
+ if (assocFromProducts) context.assocFromProducts = assocFromProducts
- assocToProducts = product.getRelated("AssocProductAssoc", (productAssocTypeId ? [productAssocTypeId : productAssocTypeId]: [:]), ["sequenceNum","productId"], false);
- if (assocToProducts) context.assocToProducts = assocToProducts;
+ assocToProducts = product.getRelated("AssocProductAssoc", (productAssocTypeId ? [productAssocTypeId : productAssocTypeId]: [:]), ["sequenceNum","productId"], false)
+ if (assocToProducts) context.assocToProducts = assocToProducts
}
diff --git a/applications/manufacturing/groovyScripts/bom/FindProductBom.groovy b/applications/manufacturing/groovyScripts/bom/FindProductBom.groovy
index 6d40b9f7a5..92392a5e30 100644
--- a/applications/manufacturing/groovyScripts/bom/FindProductBom.groovy
+++ b/applications/manufacturing/groovyScripts/bom/FindProductBom.groovy
@@ -17,26 +17,26 @@
* under the License.
*/
-import org.apache.ofbiz.entity.util.*;
-import org.apache.ofbiz.entity.condition.*;
+import org.apache.ofbiz.entity.util.*
+import org.apache.ofbiz.entity.condition.*
-condList = [];
+condList = []
if (parameters.productId) {
- cond = EntityCondition.makeCondition("productId", EntityOperator.EQUALS, parameters.productId);
- condList.add(cond);
+ cond = EntityCondition.makeCondition("productId", EntityOperator.EQUALS, parameters.productId)
+ condList.add(cond)
}
if (parameters.productIdTo) {
- cond = EntityCondition.makeCondition("productIdTo", EntityOperator.EQUALS, parameters.productIdTo);
- condList.add(cond);
+ cond = EntityCondition.makeCondition("productIdTo", EntityOperator.EQUALS, parameters.productIdTo)
+ condList.add(cond)
}
if (parameters.productAssocTypeId) {
- cond = EntityCondition.makeCondition("productAssocTypeId", EntityOperator.EQUALS, parameters.productAssocTypeId);
- condList.add(cond);
+ cond = EntityCondition.makeCondition("productAssocTypeId", EntityOperator.EQUALS, parameters.productAssocTypeId)
+ condList.add(cond)
} else {
cond = EntityCondition.makeCondition([EntityCondition.makeCondition("productAssocTypeId", EntityOperator.EQUALS, "ENGINEER_COMPONENT"),
EntityCondition.makeCondition("productAssocTypeId", EntityOperator.EQUALS, "MANUF_COMPONENT")
- ], EntityOperator.OR);
- condList.add(cond);
+ ], EntityOperator.OR)
+ condList.add(cond)
}
bomListIterator = select("productId", "internalName", "productAssocTypeId")
.from("ProductAndAssoc")
@@ -44,6 +44,6 @@ bomListIterator = select("productId", "internalName", "productAssocTypeId")
.orderBy("productId", "productAssocTypeId")
.cursorScrollInsensitive()
.cache(true)
- .queryIterator();
+ .queryIterator()
-context.ListProductBom = bomListIterator;
+context.ListProductBom = bomListIterator
diff --git a/applications/manufacturing/groovyScripts/jobshopmgt/ProductionRunActualComponents.groovy b/applications/manufacturing/groovyScripts/jobshopmgt/ProductionRunActualComponents.groovy
index c8ae23d3da..bf6390e574 100644
--- a/applications/manufacturing/groovyScripts/jobshopmgt/ProductionRunActualComponents.groovy
+++ b/applications/manufacturing/groovyScripts/jobshopmgt/ProductionRunActualComponents.groovy
@@ -17,12 +17,12 @@
* under the License.
*/
-productionRunId = parameters.productionRunId ?: parameters.workEffortId;
+productionRunId = parameters.productionRunId ?: parameters.workEffortId
-taskInfos = [];
-tasks = from("WorkEffort").where("workEffortParentId", productionRunId, "workEffortTypeId", "PROD_ORDER_TASK").orderBy("workEffortId").queryList();
+taskInfos = []
+tasks = from("WorkEffort").where("workEffortParentId", productionRunId, "workEffortTypeId", "PROD_ORDER_TASK").orderBy("workEffortId").queryList()
tasks.each { task ->
- records = from("InventoryItemDetail").where("workEffortId", task.workEffortId).queryList();
- taskInfos.add([task : task, records : records]);
+ records = from("InventoryItemDetail").where("workEffortId", task.workEffortId).queryList()
+ taskInfos.add([task : task, records : records])
}
-context.taskInfos = taskInfos;
+context.taskInfos = taskInfos
diff --git a/applications/manufacturing/groovyScripts/jobshopmgt/ProductionRunAllFixedAssets.groovy b/applications/manufacturing/groovyScripts/jobshopmgt/ProductionRunAllFixedAssets.groovy
index c412966da2..0b40a9b8a4 100644
--- a/applications/manufacturing/groovyScripts/jobshopmgt/ProductionRunAllFixedAssets.groovy
+++ b/applications/manufacturing/groovyScripts/jobshopmgt/ProductionRunAllFixedAssets.groovy
@@ -17,18 +17,18 @@
* under the License.
*/
-import org.apache.ofbiz.manufacturing.jobshopmgt.ProductionRun;
+import org.apache.ofbiz.manufacturing.jobshopmgt.ProductionRun
-productionRunId = parameters.productionRunId ?: parameters.workEffortId;
+productionRunId = parameters.productionRunId ?: parameters.workEffortId
if (productionRunId) {
- ProductionRun productionRun = new ProductionRun(productionRunId, delegator, dispatcher);
+ ProductionRun productionRun = new ProductionRun(productionRunId, delegator, dispatcher)
if (productionRun.exist()) {
- productionRunFixedAssetsData = [];
- productionRunRoutingTasks = productionRun.getProductionRunRoutingTasks();
+ productionRunFixedAssetsData = []
+ productionRunRoutingTasks = productionRun.getProductionRunRoutingTasks()
productionRunRoutingTasks.each { prodRunTask ->
- taskFixedAssets = prodRunTask.getRelated("WorkEffortFixedAssetAssign", null, null, false);
- productionRunFixedAssetsData.addAll(taskFixedAssets);
+ taskFixedAssets = prodRunTask.getRelated("WorkEffortFixedAssetAssign", null, null, false)
+ productionRunFixedAssetsData.addAll(taskFixedAssets)
}
- context.productionRunFixedAssetsData = productionRunFixedAssetsData;
+ context.productionRunFixedAssetsData = productionRunFixedAssetsData
}
}
diff --git a/applications/manufacturing/groovyScripts/jobshopmgt/ProductionRunComponents.groovy b/applications/manufacturing/groovyScripts/jobshopmgt/ProductionRunComponents.groovy
index 3cbaa6cb6d..89f09e3c6b 100644
--- a/applications/manufacturing/groovyScripts/jobshopmgt/ProductionRunComponents.groovy
+++ b/applications/manufacturing/groovyScripts/jobshopmgt/ProductionRunComponents.groovy
@@ -17,12 +17,12 @@
* under the License.
*/
-productionRunId = parameters.productionRunId ?: parameters.workEffortId;
+productionRunId = parameters.productionRunId ?: parameters.workEffortId
-taskInfos = [];
-tasks = from("WorkEffort").where("workEffortParentId", productionRunId, "workEffortTypeId", "PROD_ORDER_TASK").orderBy("workEffortId").queryList();
+taskInfos = []
+tasks = from("WorkEffort").where("workEffortParentId", productionRunId, "workEffortTypeId", "PROD_ORDER_TASK").orderBy("workEffortId").queryList()
tasks.each { task ->
- records = from("WorkEffortGoodStandard").where("workEffortId", task.workEffortId).queryList();
- taskInfos.add([task : task, records : records]);
+ records = from("WorkEffortGoodStandard").where("workEffortId", task.workEffortId).queryList()
+ taskInfos.add([task : task, records : records])
}
-context.taskInfos = taskInfos;
+context.taskInfos = taskInfos
diff --git a/applications/manufacturing/groovyScripts/jobshopmgt/ProductionRunContent.groovy b/applications/manufacturing/groovyScripts/jobshopmgt/ProductionRunContent.groovy
index 04e82bfe23..61a4bb301f 100644
--- a/applications/manufacturing/groovyScripts/jobshopmgt/ProductionRunContent.groovy
+++ b/applications/manufacturing/groovyScripts/jobshopmgt/ProductionRunContent.groovy
@@ -17,29 +17,29 @@
* under the License.
*/
-import org.apache.ofbiz.content.content.ContentWorker;
-import org.apache.ofbiz.entity.util.EntityUtil;
-import org.apache.ofbiz.entity.GenericValue;
+import org.apache.ofbiz.content.content.ContentWorker
+import org.apache.ofbiz.entity.util.EntityUtil
+import org.apache.ofbiz.entity.GenericValue
-productionRunId = parameters.productionRunId ?: parameters.workEffortId;
-context.productionRunId = productionRunId;
+productionRunId = parameters.productionRunId ?: parameters.workEffortId
+context.productionRunId = productionRunId
-delivGoodStandard = from("WorkEffortGoodStandard").where("workEffortId", productionRunId, "workEffortGoodStdTypeId", "PRUN_PROD_DELIV", "statusId", "WEGS_CREATED").orderBy("-fromDate").queryFirst();
+delivGoodStandard = from("WorkEffortGoodStandard").where("workEffortId", productionRunId, "workEffortGoodStdTypeId", "PRUN_PROD_DELIV", "statusId", "WEGS_CREATED").orderBy("-fromDate").queryFirst()
if (delivGoodStandard) {
- context.delivProductId = delivGoodStandard.productId;
+ context.delivProductId = delivGoodStandard.productId
}
if (context.delivProductId && (parameters.partyId || parameters.contentLocale)) {
- delivProductContents = from("ProductContentAndInfo").where("productId", context.delivProductId).orderBy("-fromDate").filterByDate().queryList();
- context.delivProductContents = delivProductContents;
+ delivProductContents = from("ProductContentAndInfo").where("productId", context.delivProductId).orderBy("-fromDate").filterByDate().queryList()
+ context.delivProductContents = delivProductContents
- Locale contentLocale = null;
+ Locale contentLocale = null
if (parameters.contentLocale) {
- contentLocale = new Locale(parameters.contentLocale);
+ contentLocale = new Locale(parameters.contentLocale)
}
- delivProductContentsForLocaleAndUser = [];
+ delivProductContentsForLocaleAndUser = []
delivProductContents.each { delivProductContent ->
- GenericValue content = ContentWorker.findContentForRendering(delegator, delivProductContent.contentId, contentLocale, parameters.partyId, parameters.roleTypeId, true);
- delivProductContentsForLocaleAndUser.add(from("ContentDataResourceView").where("contentId", content.contentId).queryFirst());
+ GenericValue content = ContentWorker.findContentForRendering(delegator, delivProductContent.contentId, contentLocale, parameters.partyId, parameters.roleTypeId, true)
+ delivProductContentsForLocaleAndUser.add(from("ContentDataResourceView").where("contentId", content.contentId).queryFirst())
}
- context.delivProductContentsForLocaleAndUser = delivProductContentsForLocaleAndUser;
+ context.delivProductContentsForLocaleAndUser = delivProductContentsForLocaleAndUser
}
diff --git a/applications/manufacturing/groovyScripts/jobshopmgt/ProductionRunCosts.groovy b/applications/manufacturing/groovyScripts/jobshopmgt/ProductionRunCosts.groovy
index 8010d8a8ce..3c4dbc9b44 100644
--- a/applications/manufacturing/groovyScripts/jobshopmgt/ProductionRunCosts.groovy
+++ b/applications/manufacturing/groovyScripts/jobshopmgt/ProductionRunCosts.groovy
@@ -17,18 +17,18 @@
* under the License.
*/
-import org.apache.ofbiz.entity.util.EntityUtil;
+import org.apache.ofbiz.entity.util.EntityUtil
-productionRunId = parameters.productionRunId ?: parameters.workEffortId;
-taskInfoList = [];
-tasks = from("WorkEffort").where("workEffortParentId", productionRunId, "workEffortTypeId", "PROD_ORDER_TASK").orderBy("workEffortId").queryList();
+productionRunId = parameters.productionRunId ?: parameters.workEffortId
+taskInfoList = []
+tasks = from("WorkEffort").where("workEffortParentId", productionRunId, "workEffortTypeId", "PROD_ORDER_TASK").orderBy("workEffortId").queryList()
tasks.each { task ->
- costs = from("CostComponent").where("workEffortId", task.workEffortId).filterByDate().queryList();
- taskInfoList.add([task : task, taskCosts : costs]);
+ costs = from("CostComponent").where("workEffortId", task.workEffortId).filterByDate().queryList()
+ taskInfoList.add([task : task, taskCosts : costs])
}
// get the costs directly associated to the production run (e.g. overhead costs)
-productionRun = from("WorkEffort").where("workEffortId", productionRunId).cache(true).queryOne();
-costs = from("CostComponent").where("workEffortId", productionRunId).filterByDate().queryList();
-taskInfoList.add([task : productionRun, taskCosts : costs]);
+productionRun = from("WorkEffort").where("workEffortId", productionRunId).cache(true).queryOne()
+costs = from("CostComponent").where("workEffortId", productionRunId).filterByDate().queryList()
+taskInfoList.add([task : productionRun, taskCosts : costs])
context.taskInfoList = taskInfoList;
\ No newline at end of file
diff --git a/applications/manufacturing/groovyScripts/jobshopmgt/ProductionRunDeclaration.groovy b/applications/manufacturing/groovyScripts/jobshopmgt/ProductionRunDeclaration.groovy
index 0eb51f5c3e..433263aaa8 100644
--- a/applications/manufacturing/groovyScripts/jobshopmgt/ProductionRunDeclaration.groovy
+++ b/applications/manufacturing/groovyScripts/jobshopmgt/ProductionRunDeclaration.groovy
@@ -20,125 +20,125 @@
// The only required parameter is "productionRunId".
// The "actionForm" parameter triggers actions (see "ProductionRunSimpleEvents.xml").
-import org.apache.ofbiz.entity.util.EntityUtil;
-import org.apache.ofbiz.entity.GenericValue;
-import org.apache.ofbiz.manufacturing.jobshopmgt.ProductionRun;
+import org.apache.ofbiz.entity.util.EntityUtil
+import org.apache.ofbiz.entity.GenericValue
+import org.apache.ofbiz.manufacturing.jobshopmgt.ProductionRun
-productionRunId = parameters.productionRunId ?: parameters.workEffortId;
+productionRunId = parameters.productionRunId ?: parameters.workEffortId
if (productionRunId) {
- ProductionRun productionRun = new ProductionRun(productionRunId, delegator, dispatcher);
+ ProductionRun productionRun = new ProductionRun(productionRunId, delegator, dispatcher)
if (productionRun.exist()) {
- productionRunId = productionRun.getGenericValue().workEffortId;
- context.productionRunId = productionRunId;
- context.productionRun = productionRun.getGenericValue();
+ productionRunId = productionRun.getGenericValue().workEffortId
+ context.productionRunId = productionRunId
+ context.productionRun = productionRun.getGenericValue()
// Find all the order items to which this production run is linked.
- orderItems = from("WorkOrderItemFulfillment").where("workEffortId", productionRunId).queryList();
+ orderItems = from("WorkOrderItemFulfillment").where("workEffortId", productionRunId).queryList()
if (orderItems) {
- context.orderItems = orderItems;
+ context.orderItems = orderItems
}
- quantityToProduce = productionRun.getGenericValue().get("quantityToProduce") ?: 0.0;
+ quantityToProduce = productionRun.getGenericValue().get("quantityToProduce") ?: 0.0
// Find the inventory items produced
- inventoryItems = from("WorkEffortInventoryProduced").where("workEffortId", productionRunId).queryList();
- context.inventoryItems = inventoryItems;
+ inventoryItems = from("WorkEffortInventoryProduced").where("workEffortId", productionRunId).queryList()
+ context.inventoryItems = inventoryItems
if (inventoryItems) {
- lastWorkEffortInventoryProduced = (GenericValue)inventoryItems.get(inventoryItems.size() - 1);
- lastInventoryItem = lastWorkEffortInventoryProduced.getRelatedOne("InventoryItem", false);
- context.lastLotId = lastInventoryItem.lotId;
+ lastWorkEffortInventoryProduced = (GenericValue)inventoryItems.get(inventoryItems.size() - 1)
+ lastInventoryItem = lastWorkEffortInventoryProduced.getRelatedOne("InventoryItem", false)
+ context.lastLotId = lastInventoryItem.lotId
}
// Find if the production run can produce inventory.
- quantityProduced = productionRun.getGenericValue().quantityProduced ?: 0.0;
- quantityRejected = productionRun.getGenericValue().quantityRejected ?: 0.0;
+ quantityProduced = productionRun.getGenericValue().quantityProduced ?: 0.0
+ quantityRejected = productionRun.getGenericValue().quantityRejected ?: 0.0
- lastTask = productionRun.getLastProductionRunRoutingTask();
- quantityDeclared = lastTask ? (lastTask.quantityProduced ?: 0.0) : 0.0 ;
+ lastTask = productionRun.getLastProductionRunRoutingTask()
+ quantityDeclared = lastTask ? (lastTask.quantityProduced ?: 0.0) : 0.0
- context.canDeclareAndProduce = "N";
+ context.canDeclareAndProduce = "N"
if (lastTask && ("PRUN_RUNNING".equals(lastTask.currentStatusId) || "PRUN_COMPLETED".equals(lastTask.currentStatusId))) {
- context.canDeclareAndProduce = "Y";
+ context.canDeclareAndProduce = "Y"
}
- maxQuantity = quantityDeclared - quantityProduced;
+ maxQuantity = quantityDeclared - quantityProduced
- productionRunData = [:];
- productionRunData.workEffortId = productionRunId;
- productionRunData.productId = productionRun.getProductProduced().productId;
- productionRunData.product = productionRun.getProductProduced();
+ productionRunData = [:]
+ productionRunData.workEffortId = productionRunId
+ productionRunData.productId = productionRun.getProductProduced().productId
+ productionRunData.product = productionRun.getProductProduced()
if (maxQuantity > 0 && !"WIP".equals(productionRun.getProductProduced().productTypeId)) {
- productionRunData.quantity = maxQuantity;
- context.canProduce = "Y";
+ productionRunData.quantity = maxQuantity
+ context.canProduce = "Y"
}
- productionRunData.quantityToProduce = quantityToProduce;
- productionRunData.quantityProduced = quantityProduced;
- productionRunData.quantityRejected = quantityRejected;
- productionRunData.quantityRemaining = quantityToProduce - quantityProduced;
- productionRunData.estimatedCompletionDate = productionRun.getEstimatedCompletionDate();
- productionRunData.productionRunName = productionRun.getProductionRunName();
- productionRunData.description = productionRun.getDescription();
- productionRunData.estimatedStartDate = productionRun.getEstimatedStartDate();
- productionRunData.actualStartDate = productionRun.getGenericValue().getTimestamp("actualStartDate");
- productionRunData.actualCompletionDate = productionRun.getGenericValue().getTimestamp("actualCompletionDate");
- productionRunData.currentStatusId = productionRun.getGenericValue().currentStatusId;
- productionRunData.facilityId = productionRun.getGenericValue().facilityId;
+ productionRunData.quantityToProduce = quantityToProduce
+ productionRunData.quantityProduced = quantityProduced
+ productionRunData.quantityRejected = quantityRejected
+ productionRunData.quantityRemaining = quantityToProduce - quantityProduced
+ productionRunData.estimatedCompletionDate = productionRun.getEstimatedCompletionDate()
+ productionRunData.productionRunName = productionRun.getProductionRunName()
+ productionRunData.description = productionRun.getDescription()
+ productionRunData.estimatedStartDate = productionRun.getEstimatedStartDate()
+ productionRunData.actualStartDate = productionRun.getGenericValue().getTimestamp("actualStartDate")
+ productionRunData.actualCompletionDate = productionRun.getGenericValue().getTimestamp("actualCompletionDate")
+ productionRunData.currentStatusId = productionRun.getGenericValue().currentStatusId
+ productionRunData.facilityId = productionRun.getGenericValue().facilityId
- manufacturer = from("WorkEffortPartyAssignment").where("workEffortId", productionRunId, "roleTypeId", "MANUFACTURER").filterByDate().queryFirst();
+ manufacturer = from("WorkEffortPartyAssignment").where("workEffortId", productionRunId, "roleTypeId", "MANUFACTURER").filterByDate().queryFirst()
if (manufacturer){
- productionRunData.manufacturerId = manufacturer.partyId;
+ productionRunData.manufacturerId = manufacturer.partyId
}
- context.productionRunData = productionRunData;
+ context.productionRunData = productionRunData
- actionForm = parameters.actionForm ?: "beforeActionProductionRun";
- context.actionForm = actionForm;
+ actionForm = parameters.actionForm ?: "beforeActionProductionRun"
+ context.actionForm = actionForm
//---------------
// Routing tasks
//---------------
// routingTask update sub-screen
- routingTaskId = parameters.routingTaskId;
+ routingTaskId = parameters.routingTaskId
if (routingTaskId && (actionForm.equals("UpdateRoutingTask") || actionForm.equals("EditRoutingTask"))) {
- routingTask = from("WorkEffort").where("workEffortId", routingTaskId).queryOne();
- Map routingTaskData = routingTask.getAllFields();
- routingTaskData.estimatedSetupMillis = routingTask.getDouble("estimatedSetupMillis");
- routingTaskData.estimatedMilliSeconds = routingTask.getDouble("estimatedMilliSeconds");
- context.routingTaskData = routingTaskData;
- routingTaskData.partyId = userLogin.partyId;
- context.routingTaskId = routingTaskId;
+ routingTask = from("WorkEffort").where("workEffortId", routingTaskId).queryOne()
+ Map routingTaskData = routingTask.getAllFields()
+ routingTaskData.estimatedSetupMillis = routingTask.getDouble("estimatedSetupMillis")
+ routingTaskData.estimatedMilliSeconds = routingTask.getDouble("estimatedMilliSeconds")
+ context.routingTaskData = routingTaskData
+ routingTaskData.partyId = userLogin.partyId
+ context.routingTaskId = routingTaskId
// Get the list of deliverable products, i.e. the WorkEffortGoodStandard entries
// with workEffortGoodStdTypeId = "PRUNT_PROD_DELIV":
// first of all we get the template task (the routing task)
- templateTaskAssoc = from("WorkEffortAssoc").where("workEffortIdTo", routingTask.workEffortId, "workEffortAssocTypeId", "WORK_EFF_TEMPLATE").filterByDate().queryFirst();
- templateTask = [:];
+ templateTaskAssoc = from("WorkEffortAssoc").where("workEffortIdTo", routingTask.workEffortId, "workEffortAssocTypeId", "WORK_EFF_TEMPLATE").filterByDate().queryFirst()
+ templateTask = [:]
if (templateTaskAssoc) {
- templateTask = templateTaskAssoc.getRelatedOne("FromWorkEffort", false);
+ templateTask = templateTaskAssoc.getRelatedOne("FromWorkEffort", false)
}
- delivProducts = [];
+ delivProducts = []
if (templateTask) {
- delivProducts = EntityUtil.filterByDate(templateTask.getRelated("WorkEffortGoodStandard", [workEffortGoodStdTypeId : "PRUNT_PROD_DELIV"], null, false));
+ delivProducts = EntityUtil.filterByDate(templateTask.getRelated("WorkEffortGoodStandard", [workEffortGoodStdTypeId : "PRUNT_PROD_DELIV"], null, false))
}
- context.delivProducts = delivProducts;
+ context.delivProducts = delivProducts
// Get the list of delivered products, i.e. inventory items
- prunInventoryProduced = from("WorkEffortAndInventoryProduced").where("workEffortId", routingTaskId).queryList();
- context.prunInventoryProduced = prunInventoryProduced;
+ prunInventoryProduced = from("WorkEffortAndInventoryProduced").where("workEffortId", routingTaskId).queryList()
+ context.prunInventoryProduced = prunInventoryProduced
}
// RoutingTasks list
- List productionRunRoutingTasks = productionRun.getProductionRunRoutingTasks();
- String startTaskId = null; // which production run task is ready to start and has the [Start] buton next to it
- String issueTaskId = null; // which production run task is ready to have products issued with [Issue Components] button
- String completeTaskId = null; // which task has the [Complete] button next to it
+ List productionRunRoutingTasks = productionRun.getProductionRunRoutingTasks()
+ String startTaskId = null // which production run task is ready to start and has the [Start] buton next to it
+ String issueTaskId = null // which production run task is ready to have products issued with [Issue Components] button
+ String completeTaskId = null // which task has the [Complete] button next to it
productionRunRoutingTasks.each { task ->
// only PRUN_RUNNING tasks can have items issued or production run completed
if ("PRUN_RUNNING".equals(task.currentStatusId)) {
// Use WorkEffortGoodStandard to figure out if there are products which are needed for this task (PRUNT_PRODNEEDED) and which have not been issued (ie, WEGS_CREATED).
// If so this task should have products issued
- components = from("WorkEffortGoodStandard").where("workEffortId", task.workEffortId, "workEffortGoodStdTypeId", "PRUNT_PROD_NEEDED", "statusId", "WEGS_CREATED").queryList();
+ components = from("WorkEffortGoodStandard").where("workEffortId", task.workEffortId, "workEffortGoodStdTypeId", "PRUNT_PROD_NEEDED", "statusId", "WEGS_CREATED").queryList()
if (components) {
- issueTaskId = task.workEffortId;
+ issueTaskId = task.workEffortId
}
if (!issueTaskId) {
- completeTaskId = task.workEffortId;
+ completeTaskId = task.workEffortId
}
}
@@ -149,70 +149,70 @@ if (productionRunId) {
("PRUN_CREATED".equals(task.currentStatusId) ||
"PRUN_SCHEDULED".equals(task.currentStatusId) ||
"PRUN_DOC_PRINTED".equals(task.currentStatusId))) {
- startTaskId = task.workEffortId;
+ startTaskId = task.workEffortId
}
}
- context.productionRunRoutingTasks = productionRunRoutingTasks;
- context.startTaskId = (startTaskId ? startTaskId: "null");
- context.issueTaskId = (issueTaskId? issueTaskId: "null");
- context.completeTaskId = (completeTaskId != null? completeTaskId: "null");
+ context.productionRunRoutingTasks = productionRunRoutingTasks
+ context.startTaskId = (startTaskId ? startTaskId: "null")
+ context.issueTaskId = (issueTaskId? issueTaskId: "null")
+ context.completeTaskId = (completeTaskId != null? completeTaskId: "null")
// Product components list
- productionRunComponents = productionRun.getProductionRunComponents();
- productionRunComponentsData = [];
- productionRunComponentsDataReadyForIssuance = [];
- productionRunComponentsAlreadyIssued = [];
+ productionRunComponents = productionRun.getProductionRunComponents()
+ productionRunComponentsData = []
+ productionRunComponentsDataReadyForIssuance = []
+ productionRunComponentsAlreadyIssued = []
if (productionRunComponents) {
productionRunComponents.each { component ->
- product = component.getRelatedOne("Product", false);
- componentName = product.getString("internalName");
- productionRunTask = component.getRelatedOne("WorkEffort", false);
- workEffortName = productionRunTask.getString("workEffortName");
- Map componentData = component.getAllFields();
- componentData.internalName = componentName;
- componentData.workEffortName = workEffortName;
- componentData.facilityId = productionRunTask.facilityId;
- issuances = from("WorkEffortAndInventoryAssign").where("workEffortId", component.workEffortId, "productId", product.productId).queryList();
- totalIssued = 0.0;
+ product = component.getRelatedOne("Product", false)
+ componentName = product.getString("internalName")
+ productionRunTask = component.getRelatedOne("WorkEffort", false)
+ workEffortName = productionRunTask.getString("workEffortName")
+ Map componentData = component.getAllFields()
+ componentData.internalName = componentName
+ componentData.workEffortName = workEffortName
+ componentData.facilityId = productionRunTask.facilityId
+ issuances = from("WorkEffortAndInventoryAssign").where("workEffortId", component.workEffortId, "productId", product.productId).queryList()
+ totalIssued = 0.0
issuances.each { issuance ->
- issued = issuance.quantity;
+ issued = issuance.quantity
if (issued) {
- totalIssued += issued;
+ totalIssued += issued
}
}
- returns = from("WorkEffortAndInventoryProduced").where("workEffortId", component.workEffortId , "productId", product.productId).queryList();
- totalReturned = 0.0;
+ returns = from("WorkEffortAndInventoryProduced").where("workEffortId", component.workEffortId , "productId", product.productId).queryList()
+ totalReturned = 0.0
returns.each { returned ->
- returnDetail = from("InventoryItemDetail").where("inventoryItemId", returned.inventoryItemId).orderBy("inventoryItemDetailSeqId").queryFirst();
+ returnDetail = from("InventoryItemDetail").where("inventoryItemId", returned.inventoryItemId).orderBy("inventoryItemDetailSeqId").queryFirst()
if (returnDetail) {
- qtyReturned = returnDetail.quantityOnHandDiff;
+ qtyReturned = returnDetail.quantityOnHandDiff
if (qtyReturned) {
- totalReturned += qtyReturned;
+ totalReturned += qtyReturned
}
}
}
- componentData.issuedQuantity = totalIssued;
- componentData.returnedQuantity = totalReturned;
- componentData.currentStatusId = productionRunTask.currentStatusId;
+ componentData.issuedQuantity = totalIssued
+ componentData.returnedQuantity = totalReturned
+ componentData.currentStatusId = productionRunTask.currentStatusId
if ("PRUN_RUNNING".equals(productionRunTask.currentStatusId)) {
- componentData.isRunning = "Y";
+ componentData.isRunning = "Y"
} else {
- componentData.isRunning = "null";
+ componentData.isRunning = "null"
}
- productionRunComponentsData.add(componentData);
+ productionRunComponentsData.add(componentData)
if ("PRUN_RUNNING".equals(productionRunTask.currentStatusId) && "WEGS_CREATED".equals(component.getString("statusId"))) {
- productionRunComponentsDataReadyForIssuance.add(componentData);
+ productionRunComponentsDataReadyForIssuance.add(componentData)
} else if (totalIssued > 0.0) {
- productionRunComponentsAlreadyIssued.add(componentData);
+ productionRunComponentsAlreadyIssued.add(componentData)
}
}
}
// Content
- productionRunContents = from("WorkEffortContentAndInfo").where("workEffortId", productionRunId).orderBy("-fromDate").filterByDate().queryList();
- context.productionRunContents = productionRunContents;
- context.productionRunComponents = productionRunComponents;
- context.productionRunComponentsData = productionRunComponentsData;
- context.productionRunComponentsDataReadyForIssuance = productionRunComponentsDataReadyForIssuance;
- context.productionRunComponentsAlreadyIssued = productionRunComponentsAlreadyIssued;
+ productionRunContents = from("WorkEffortContentAndInfo").where("workEffortId", productionRunId).orderBy("-fromDate").filterByDate().queryList()
+ context.productionRunContents = productionRunContents
+ context.productionRunComponents = productionRunComponents
+ context.productionRunComponentsData = productionRunComponentsData
+ context.productionRunComponentsDataReadyForIssuance = productionRunComponentsDataReadyForIssuance
+ context.productionRunComponentsAlreadyIssued = productionRunComponentsAlreadyIssued
}
}
diff --git a/applications/manufacturing/groovyScripts/jobshopmgt/ProductionRunFixedAssets.groovy b/applications/manufacturing/groovyScripts/jobshopmgt/ProductionRunFixedAssets.groovy
index 5ee0ae50c7..e745b467d2 100644
--- a/applications/manufacturing/groovyScripts/jobshopmgt/ProductionRunFixedAssets.groovy
+++ b/applications/manufacturing/groovyScripts/jobshopmgt/ProductionRunFixedAssets.groovy
@@ -17,12 +17,12 @@
* under the License.
*/
-productionRunId = parameters.productionRunId ?: parameters.workEffortId;
+productionRunId = parameters.productionRunId ?: parameters.workEffortId
-taskInfos = [];
-tasks = from("WorkEffort").where("workEffortParentId", productionRunId, "workEffortTypeId", "PROD_ORDER_TASK").orderBy("workEffortId").queryList();
+taskInfos = []
+tasks = from("WorkEffort").where("workEffortParentId", productionRunId, "workEffortTypeId", "PROD_ORDER_TASK").orderBy("workEffortId").queryList()
tasks.each { task ->
- records = task.getRelated("WorkEffortFixedAssetAssign", null, null, false);
- taskInfos.add([task : task, records : records]);
+ records = task.getRelated("WorkEffortFixedAssetAssign", null, null, false)
+ taskInfos.add([task : task, records : records])
}
-context.taskInfos = taskInfos;
+context.taskInfos = taskInfos
diff --git a/applications/manufacturing/groovyScripts/jobshopmgt/ProductionRunTaskParties.groovy b/applications/manufacturing/groovyScripts/jobshopmgt/ProductionRunTaskParties.groovy
index 3281127a36..0e1f6fbd2e 100644
--- a/applications/manufacturing/groovyScripts/jobshopmgt/ProductionRunTaskParties.groovy
+++ b/applications/manufacturing/groovyScripts/jobshopmgt/ProductionRunTaskParties.groovy
@@ -17,21 +17,21 @@
* under the License.
*/
-import org.apache.ofbiz.manufacturing.jobshopmgt.ProductionRun;
-taskPartyAssocList = [];
-productionRunId = parameters.productionRunId ?: parameters.workEffortId;
+import org.apache.ofbiz.manufacturing.jobshopmgt.ProductionRun
+taskPartyAssocList = []
+productionRunId = parameters.productionRunId ?: parameters.workEffortId
if (productionRunId) {
- ProductionRun productionRun = new ProductionRun(productionRunId, delegator, dispatcher);
+ ProductionRun productionRun = new ProductionRun(productionRunId, delegator, dispatcher)
if (productionRun.exist()) {
- productionRunTasks = productionRun.getProductionRunRoutingTasks();
+ productionRunTasks = productionRun.getProductionRunRoutingTasks()
if (productionRunTasks) {
productionRunTasks.each { prodRunTask ->
- prodRunTaskId = prodRunTask.workEffortId;
- taskPartyAssocs = from("WorkEffortPartyAssignment").where("workEffortId", prodRunTaskId).queryList();
+ prodRunTaskId = prodRunTask.workEffortId
+ taskPartyAssocs = from("WorkEffortPartyAssignment").where("workEffortId", prodRunTaskId).queryList()
if (taskPartyAssocs) {
taskPartyAssocs.each { taskPartyAssoc ->
- taskPartyAssocList.add(taskPartyAssoc);
+ taskPartyAssocList.add(taskPartyAssoc)
}
}
}
diff --git a/applications/manufacturing/groovyScripts/jobshopmgt/ProductionRunTasks.groovy b/applications/manufacturing/groovyScripts/jobshopmgt/ProductionRunTasks.groovy
index 7230bc7e94..ccb32c758c 100644
--- a/applications/manufacturing/groovyScripts/jobshopmgt/ProductionRunTasks.groovy
+++ b/applications/manufacturing/groovyScripts/jobshopmgt/ProductionRunTasks.groovy
@@ -17,14 +17,14 @@
* under the License.
*/
-import org.apache.ofbiz.manufacturing.jobshopmgt.ProductionRun;
+import org.apache.ofbiz.manufacturing.jobshopmgt.ProductionRun
-productionRunId = parameters.productionRunId ?: parameters.workEffortId;
+productionRunId = parameters.productionRunId ?: parameters.workEffortId
if (productionRunId) {
- ProductionRun productionRun = new ProductionRun(productionRunId, delegator, dispatcher);
+ ProductionRun productionRun = new ProductionRun(productionRunId, delegator, dispatcher)
if (productionRun.exist()) {
- productionRunRoutingTasks = productionRun.getProductionRunRoutingTasks();
- context.productionRunRoutingTasks = productionRunRoutingTasks;
- context.quantity = productionRun.getQuantity(); // this is useful to compute the total estimates runtime in the form
+ productionRunRoutingTasks = productionRun.getProductionRunRoutingTasks()
+ context.productionRunRoutingTasks = productionRunRoutingTasks
+ context.quantity = productionRun.getQuantity() // this is useful to compute the total estimates runtime in the form
}
}
diff --git a/applications/manufacturing/groovyScripts/jobshopmgt/ShowProductionRun.groovy b/applications/manufacturing/groovyScripts/jobshopmgt/ShowProductionRun.groovy
index cfd36eafe9..e6e5470d71 100644
--- a/applications/manufacturing/groovyScripts/jobshopmgt/ShowProductionRun.groovy
+++ b/applications/manufacturing/groovyScripts/jobshopmgt/ShowProductionRun.groovy
@@ -19,40 +19,40 @@
// The only required parameter is "productionRunId".
-import java.util.*;
-import org.apache.ofbiz.entity.*;
-import org.apache.ofbiz.entity.util.EntityUtil;
-import org.apache.ofbiz.base.util.*;
-import org.apache.ofbiz.base.util.Debug;
-import org.apache.ofbiz.base.util.UtilValidate;
-import org.apache.ofbiz.manufacturing.jobshopmgt.ProductionRun;
+import java.util.*
+import org.apache.ofbiz.entity.*
+import org.apache.ofbiz.entity.util.EntityUtil
+import org.apache.ofbiz.base.util.*
+import org.apache.ofbiz.base.util.Debug
+import org.apache.ofbiz.base.util.UtilValidate
+import org.apache.ofbiz.manufacturing.jobshopmgt.ProductionRun
-delegator = request.getAttribute("delegator");
+delegator = request.getAttribute("delegator")
-productionRunId = request.getParameter("productionRunId");
+productionRunId = request.getParameter("productionRunId")
if (UtilValidate.isEmpty(productionRunId)) {
- productionRunId = request.getParameter("workEffortId");
+ productionRunId = request.getParameter("workEffortId")
}
if (UtilValidate.isNotEmpty(productionRunId)) {
- GenericValue productionRun = delegator.findOne("WorkEffort", UtilMisc.toMap("workEffortId", productionRunId), false);
+ GenericValue productionRun = delegator.findOne("WorkEffort", UtilMisc.toMap("workEffortId", productionRunId), false)
if (UtilValidate.isNotEmpty(productionRun)) {
// If this is a task, get the parent production run
if (productionRun.getString("workEffortTypeId") != null && "PROD_ORDER_TASK".equals(productionRun.getString("workEffortTypeId"))) {
- productionRun = delegator.findOne("WorkEffort", UtilMisc.toMap("workEffortId", productionRun.getString("workEffortParentId")), false);
+ productionRun = delegator.findOne("WorkEffort", UtilMisc.toMap("workEffortId", productionRun.getString("workEffortParentId")), false)
}
}
if (UtilValidate.isEmpty(productionRun)) {
- return "error";
+ return "error"
}
if ("PRUN_CREATED".equals(productionRun.getString("currentStatusId")) ||
"PRUN_SCHEDULED".equals(productionRun.getString("currentStatusId")) ||
"PRUN_CANCELLED".equals(productionRun.getString("currentStatusId"))) {
- return "docs_not_printed";
+ return "docs_not_printed"
} else {
- return "docs_printed";
+ return "docs_printed"
}
}
-return "error";
+return "error"
diff --git a/applications/manufacturing/groovyScripts/jobshopmgt/ViewProductionRun.groovy b/applications/manufacturing/groovyScripts/jobshopmgt/ViewProductionRun.groovy
index b425b12570..a4df4d6631 100644
--- a/applications/manufacturing/groovyScripts/jobshopmgt/ViewProductionRun.groovy
+++ b/applications/manufacturing/groovyScripts/jobshopmgt/ViewProductionRun.groovy
@@ -20,49 +20,49 @@
// The only required parameter is "productionRunId".
// The "actionForm" parameter triggers actions (see "ProductionRunSimpleEvents.xml").
-import org.apache.ofbiz.entity.util.EntityUtil;
-import org.apache.ofbiz.manufacturing.jobshopmgt.ProductionRun;
+import org.apache.ofbiz.entity.util.EntityUtil
+import org.apache.ofbiz.manufacturing.jobshopmgt.ProductionRun
-productionRunId = parameters.productionRunId;
+productionRunId = parameters.productionRunId
if (productionRunId) {
- ProductionRun productionRun = new ProductionRun(productionRunId, delegator, dispatcher);
+ ProductionRun productionRun = new ProductionRun(productionRunId, delegator, dispatcher)
if (productionRun.exist()) {
- productionRunId = productionRun.getGenericValue().workEffortId;
- context.productionRunId = productionRunId;
- context.productionRun = productionRun.getGenericValue();
+ productionRunId = productionRun.getGenericValue().workEffortId
+ context.productionRunId = productionRunId
+ context.productionRun = productionRun.getGenericValue()
// Prepare production run header data
- productionRunData = [:];
- productionRunData.productionRunId = productionRunId;
- productionRunData.productId = productionRun.getProductProduced().productId;
- productionRunData.currentStatusId = productionRun.getGenericValue().currentStatusId;
- productionRunData.facilityId = productionRun.getGenericValue().facilityId;
- productionRunData.workEffortName = productionRun.getProductionRunName();
- productionRunData.description = productionRun.getDescription();
- productionRunData.quantity = productionRun.getQuantity();
- productionRunData.estimatedStartDate = productionRun.getEstimatedStartDate();
- productionRunData.estimatedCompletionDate = productionRun.getEstimatedCompletionDate();
+ productionRunData = [:]
+ productionRunData.productionRunId = productionRunId
+ productionRunData.productId = productionRun.getProductProduced().productId
+ productionRunData.currentStatusId = productionRun.getGenericValue().currentStatusId
+ productionRunData.facilityId = productionRun.getGenericValue().facilityId
+ productionRunData.workEffortName = productionRun.getProductionRunName()
+ productionRunData.description = productionRun.getDescription()
+ productionRunData.quantity = productionRun.getQuantity()
+ productionRunData.estimatedStartDate = productionRun.getEstimatedStartDate()
+ productionRunData.estimatedCompletionDate = productionRun.getEstimatedCompletionDate()
- manufacturer = from("WorkEffortPartyAssignment").where("workEffortId", productionRunId, "roleTypeId", "MANUFACTURER").filterByDate().queryFirst();
+ manufacturer = from("WorkEffortPartyAssignment").where("workEffortId", productionRunId, "roleTypeId", "MANUFACTURER").filterByDate().queryFirst()
if (manufacturer){
- productionRunData.manufacturerId = manufacturer.partyId;
+ productionRunData.manufacturerId = manufacturer.partyId
}
- context.productionRunData = productionRunData;
+ context.productionRunData = productionRunData
// Find all the order items to which this production run is linked.
- orderItems = from("WorkOrderItemFulfillment").where("workEffortId", productionRunId).queryList();
+ orderItems = from("WorkOrderItemFulfillment").where("workEffortId", productionRunId).queryList()
if (orderItems) {
- context.orderItems = orderItems;
+ context.orderItems = orderItems
}
// RoutingTasks list
- context.productionRunRoutingTasks = productionRun.getProductionRunRoutingTasks();
- context.quantity = productionRun.getQuantity(); // this is useful to compute the total estimates runtime in the form
+ context.productionRunRoutingTasks = productionRun.getProductionRunRoutingTasks()
+ context.quantity = productionRun.getQuantity() // this is useful to compute the total estimates runtime in the form
// Product component/parts list
- context.productionRunComponents = productionRun.getProductionRunComponents();;
+ context.productionRunComponents = productionRun.getProductionRunComponents()
// Find all the notes linked to this production run.
- productionRunNoteData = from("WorkEffortNoteAndData").where("workEffortId", productionRunId).queryList();
+ productionRunNoteData = from("WorkEffortNoteAndData").where("workEffortId", productionRunId).queryList()
if (productionRunNoteData) {
- context.productionRunNoteData = productionRunNoteData;
+ context.productionRunNoteData = productionRunNoteData
}
}
}
diff --git a/applications/manufacturing/groovyScripts/jobshopmgt/WorkWithShipmentPlans.groovy b/applications/manufacturing/groovyScripts/jobshopmgt/WorkWithShipmentPlans.groovy
index dfe45284d2..d60b0af9d7 100644
--- a/applications/manufacturing/groovyScripts/jobshopmgt/WorkWithShipmentPlans.groovy
+++ b/applications/manufacturing/groovyScripts/jobshopmgt/WorkWithShipmentPlans.groovy
@@ -17,112 +17,112 @@
* under the License.
*/
-import org.apache.ofbiz.manufacturing.jobshopmgt.ProductionRun;
+import org.apache.ofbiz.manufacturing.jobshopmgt.ProductionRun
// **************************************
// ShipmentPlan list form
// **************************************
-shipmentPlans = [];
-rows = [];
+shipmentPlans = []
+rows = []
if (shipment && shipment.shipmentId) {
- shipmentPlans = from("OrderShipment").where("shipmentId", shipment.shipmentId).queryList();
+ shipmentPlans = from("OrderShipment").where("shipmentId", shipment.shipmentId).queryList()
}
if (shipmentPlans) {
- workInProgress = "false";
+ workInProgress = "false"
shipmentPlans.each { shipmentPlan ->
- oneRow = new HashMap(shipmentPlan);
- orderItem = shipmentPlan.getRelatedOne("OrderItem", false);
- oneRow.productId = orderItem.productId;
- orderedQuantity = orderItem.quantity;
- canceledQuantity = orderItem.cancelQuantity;
+ oneRow = new HashMap(shipmentPlan)
+ orderItem = shipmentPlan.getRelatedOne("OrderItem", false)
+ oneRow.productId = orderItem.productId
+ orderedQuantity = orderItem.quantity
+ canceledQuantity = orderItem.cancelQuantity
if (canceledQuantity) {
- orderedQuantity = orderedQuantity - canceledQuantity;
+ orderedQuantity = orderedQuantity - canceledQuantity
}
- oneRow.totOrderedQuantity = orderedQuantity.intValue();
+ oneRow.totOrderedQuantity = orderedQuantity.intValue()
// Total quantity issued
- issuedQuantity = 0.0;
- qtyIssuedInShipment = [:];
- issuances = orderItem.getRelated("ItemIssuance", null, null, false);
+ issuedQuantity = 0.0
+ qtyIssuedInShipment = [:]
+ issuances = orderItem.getRelated("ItemIssuance", null, null, false)
issuances.each { issuance ->
if (issuance.quantity) {
- issuedQuantity += issuance.quantity;
+ issuedQuantity += issuance.quantity
if (issuance.cancelQuantity) {
- issuedQuantity -= issuance.cancelQuantity;
+ issuedQuantity -= issuance.cancelQuantity
}
if (qtyIssuedInShipment.containsKey(issuance.shipmentId)) {
- qtyInShipment = qtyIssuedInShipment[issuance.shipmentId];
- qtyInShipment += issuance.quantity;
- qtyIssuedInShipment.issuance.shipmentId = qtyInShipment;
+ qtyInShipment = qtyIssuedInShipment[issuance.shipmentId]
+ qtyInShipment += issuance.quantity
+ qtyIssuedInShipment.issuance.shipmentId = qtyInShipment
} else {
- qtyInShipment = issuance.quantity;
+ qtyInShipment = issuance.quantity
if (issuance.cancelQuantity) {
- qtyInShipment -= issuance.cancelQuantity;
+ qtyInShipment -= issuance.cancelQuantity
}
- qtyIssuedInShipment.issuance.shipmentId = qtyInShipment;
+ qtyIssuedInShipment.issuance.shipmentId = qtyInShipment
}
}
}
- oneRow.totIssuedQuantity = issuedQuantity;
+ oneRow.totIssuedQuantity = issuedQuantity
// Total quantity planned not issued
- plannedQuantity = 0.0;
- qtyPlannedInShipment = [:];
- plans = from("OrderShipment").where("orderId", orderItem.orderId ,"orderItemSeqId", orderItem.orderItemSeqId).queryList();
+ plannedQuantity = 0.0
+ qtyPlannedInShipment = [:]
+ plans = from("OrderShipment").where("orderId", orderItem.orderId ,"orderItemSeqId", orderItem.orderItemSeqId).queryList()
plans.each { plan ->
if (plan.quantity) {
- netPlanQty = plan.quantity;
+ netPlanQty = plan.quantity
if (qtyIssuedInShipment.containsKey(plan.shipmentId)) {
- qtyInShipment = qtyIssuedInShipment[plan.shipmentId];
+ qtyInShipment = qtyIssuedInShipment[plan.shipmentId]
if (netPlanQty > qtyInShipment) {
- netPlanQty -= qtyInShipment;
+ netPlanQty -= qtyInShipment
} else {
- netPlanQty = 0.0;
+ netPlanQty = 0.0
}
}
- plannedQuantity += netPlanQty;
+ plannedQuantity += netPlanQty
if (qtyPlannedInShipment.containsKey(plan.shipmentId)) {
- qtyInShipment = qtyPlannedInShipment[plan.shipmentId];
- qtyInShipment += netPlanQty;
- qtyPlannedInShipment[plan.shipmentId] = qtyInShipment;
+ qtyInShipment = qtyPlannedInShipment[plan.shipmentId]
+ qtyInShipment += netPlanQty
+ qtyPlannedInShipment[plan.shipmentId] = qtyInShipment
} else {
- qtyPlannedInShipment[plan.shipmentId] = netPlanQty;
+ qtyPlannedInShipment[plan.shipmentId] = netPlanQty
}
}
}
- oneRow.totPlannedQuantity = plannedQuantity;
+ oneRow.totPlannedQuantity = plannedQuantity
if (qtyIssuedInShipment.containsKey(shipmentPlan.shipmentId)) {
- oneRow.issuedQuantity = qtyIssuedInShipment.get(shipmentPlan.shipmentId);
+ oneRow.issuedQuantity = qtyIssuedInShipment.get(shipmentPlan.shipmentId)
} else {
- oneRow.issuedQuantity = "";
+ oneRow.issuedQuantity = ""
}
// Reserved and Not Available quantity
- reservedQuantity = 0.0;
- reservedNotAvailable = 0.0;
- reservations = orderItem.getRelated("OrderItemShipGrpInvRes", null, null, false);
+ reservedQuantity = 0.0
+ reservedNotAvailable = 0.0
+ reservations = orderItem.getRelated("OrderItemShipGrpInvRes", null, null, false)
reservations.each { reservation ->
if (reservation.quantity) {
- reservedQuantity += reservation.quantity;
+ reservedQuantity += reservation.quantity
}
if (reservation.quantityNotAvailable) {
- reservedNotAvailable += reservation.quantityNotAvailable;
+ reservedNotAvailable += reservation.quantityNotAvailable
}
}
- oneRow.notAvailableQuantity = reservedNotAvailable;
+ oneRow.notAvailableQuantity = reservedNotAvailable
// Planned Weight and Volume
- product = orderItem.getRelatedOne("Product", false);
- weight = 0.0;
- quantity = 0.0;
+ product = orderItem.getRelatedOne("Product", false)
+ weight = 0.0
+ quantity = 0.0
if (shipmentPlan.quantity) {
- quantity = shipmentPlan.quantity;
+ quantity = shipmentPlan.quantity
}
if (product.productWeight) {
- weight = product.productWeight * quantity;
+ weight = product.productWeight * quantity
}
- oneRow.weight = weight;
+ oneRow.weight = weight
if (product.weightUomId) {
- weightUom = from("Uom").where("uomId", product.weightUomId).cache(true).queryOne();
- oneRow.weightUom = weightUom.abbreviation;
+ weightUom = from("Uom").where("uomId", product.weightUomId).cache(true).queryOne()
+ oneRow.weightUom = weightUom.abbreviation
}
- volume = 0.0;
+ volume = 0.0
if (product.productHeight &&
product.productWidth &&
product.productDepth) {
@@ -130,37 +130,37 @@ if (shipmentPlans) {
volume = product.productHeight *
product.productWidth *
product.productDepth *
- quantity;
+ quantity
}
- oneRow.volume = volume;
+ oneRow.volume = volume
if (product.heightUomId &&
product.widthUomId &&
product.depthUomId) {
- heightUom = from("Uom").where("uomId", product.heightUomId).cache(true).queryOne();
- widthUom = from("Uom").where("uomId", product.widthUomId).cache(true).queryOne();
- depthUom = from("Uom").where("uomId", product.depthUomId).cache(true).queryOne();
+ heightUom = from("Uom").where("uomId", product.heightUomId).cache(true).queryOne()
+ widthUom = from("Uom").where("uomId", product.widthUomId).cache(true).queryOne()
+ depthUom = from("Uom").where("uomId", product.depthUomId).cache(true).queryOne()
oneRow.volumeUom = heightUom.abbreviation + "x" +
widthUom.abbreviation + "x" +
- depthUom.abbreviation;
+ depthUom.abbreviation
}
- rows.add(oneRow);
+ rows.add(oneRow)
// Select the production runs, if available
- productionRuns = from("WorkOrderItemFulfillment").where("orderId", shipmentPlan.orderId, "orderItemSeqId", shipmentPlan.orderItemSeqId, "shipGroupSeqId", shipmentPlan.shipGroupSeqId).orderBy("workEffortId").queryList();
+ productionRuns = from("WorkOrderItemFulfillment").where("orderId", shipmentPlan.orderId, "orderItemSeqId", shipmentPlan.orderItemSeqId, "shipGroupSeqId", shipmentPlan.shipGroupSeqId).orderBy("workEffortId").queryList()
if (productionRuns) {
- workInProgress = "true";
- productionRunsId = "";
+ workInProgress = "true"
+ productionRunsId = ""
productionRuns.each { productionRun ->
- productionRunRow = new HashMap();
- productionRunRow.put("productionRunId", productionRun.workEffortId);
- ProductionRun productionRunWrapper = new ProductionRun(productionRun.workEffortId, delegator, dispatcher);
- productionRunRow.put("productionRunEstimatedCompletionDate", productionRunWrapper.getEstimatedCompletionDate());
- productionRunRow.put("productionRunStatusId", productionRunWrapper.getGenericValue().currentStatusId);
- productionRunRow.put("productionRunQuantityProduced", productionRunWrapper.getGenericValue().quantityProduced);
- rows.add(productionRunRow);
+ productionRunRow = new HashMap()
+ productionRunRow.put("productionRunId", productionRun.workEffortId)
+ ProductionRun productionRunWrapper = new ProductionRun(productionRun.workEffortId, delegator, dispatcher)
+ productionRunRow.put("productionRunEstimatedCompletionDate", productionRunWrapper.getEstimatedCompletionDate())
+ productionRunRow.put("productionRunStatusId", productionRunWrapper.getGenericValue().currentStatusId)
+ productionRunRow.put("productionRunQuantityProduced", productionRunWrapper.getGenericValue().quantityProduced)
+ rows.add(productionRunRow)
}
}
}
- context.workInProgress = workInProgress;
- context.shipmentPlan = rows;
+ context.workInProgress = workInProgress
+ context.shipmentPlan = rows
}
diff --git a/applications/manufacturing/groovyScripts/mrp/FindInventoryEventPlan.groovy b/applications/manufacturing/groovyScripts/mrp/FindInventoryEventPlan.groovy
index d64494b242..65dcd91c84 100644
--- a/applications/manufacturing/groovyScripts/mrp/FindInventoryEventPlan.groovy
+++ b/applications/manufacturing/groovyScripts/mrp/FindInventoryEventPlan.groovy
@@ -17,72 +17,72 @@
* under the License.
*/
-import org.apache.ofbiz.base.util.ObjectType;
-import org.apache.ofbiz.entity.condition.EntityOperator;
-import org.apache.ofbiz.entity.condition.EntityCondition;
-import org.apache.ofbiz.entity.util.EntityUtilProperties;
+import org.apache.ofbiz.base.util.ObjectType
+import org.apache.ofbiz.entity.condition.EntityOperator
+import org.apache.ofbiz.entity.condition.EntityCondition
+import org.apache.ofbiz.entity.util.EntityUtilProperties
-productId = parameters.productId;
+productId = parameters.productId
// get the lookup flag
-lookupFlag = parameters.lookupFlag;
+lookupFlag = parameters.lookupFlag
// blank param list
-paramList = "";
-inventoryList = [];
+paramList = ""
+inventoryList = []
if (lookupFlag) {
- paramList = paramList + "&lookupFlag=" + lookupFlag;
- andExprs = [];
+ paramList = paramList + "&lookupFlag=" + lookupFlag
+ andExprs = []
//define main condition
- mainCond = null;
+ mainCond = null
// now do the filtering
- eventDate = parameters.eventDate;
+ eventDate = parameters.eventDate
if (eventDate?.length() > 8) {
- eventDate = eventDate.trim();
- if (eventDate.length() < 14) eventDate = eventDate + " " + "00:00:00.000";
- paramList = paramList + "&eventDate=" + eventDate;
- andExprs.add(EntityCondition.makeCondition("eventDate", EntityOperator.GREATER_THAN, ObjectType.simpleTypeConvert(eventDate, "Timestamp", null, null)));
+ eventDate = eventDate.trim()
+ if (eventDate.length() < 14) eventDate = eventDate + " " + "00:00:00.000"
+ paramList = paramList + "&eventDate=" + eventDate
+ andExprs.add(EntityCondition.makeCondition("eventDate", EntityOperator.GREATER_THAN, ObjectType.simpleTypeConvert(eventDate, "Timestamp", null, null)))
}
if (productId) {
- paramList = paramList + "&productId=" + productId;
- andExprs.add(EntityCondition.makeCondition("productId", EntityOperator.EQUALS, productId));
+ paramList = paramList + "&productId=" + productId
+ andExprs.add(EntityCondition.makeCondition("productId", EntityOperator.EQUALS, productId))
}
- andExprs.add(EntityCondition.makeCondition("mrpEventTypeId", EntityOperator.NOT_EQUAL, "INITIAL_QOH"));
- andExprs.add(EntityCondition.makeCondition("mrpEventTypeId", EntityOperator.NOT_EQUAL, "ERROR"));
- andExprs.add(EntityCondition.makeCondition("mrpEventTypeId", EntityOperator.NOT_EQUAL, "REQUIRED_MRP"));
+ andExprs.add(EntityCondition.makeCondition("mrpEventTypeId", EntityOperator.NOT_EQUAL, "INITIAL_QOH"))
+ andExprs.add(EntityCondition.makeCondition("mrpEventTypeId", EntityOperator.NOT_EQUAL, "ERROR"))
+ andExprs.add(EntityCondition.makeCondition("mrpEventTypeId", EntityOperator.NOT_EQUAL, "REQUIRED_MRP"))
- mainCond = EntityCondition.makeCondition(andExprs, EntityOperator.AND);
+ mainCond = EntityCondition.makeCondition(andExprs, EntityOperator.AND)
if ( mainCond) {
// do the lookup
- inventoryList = from("MrpEvent").where(mainCond).orderBy("productId", "eventDate").queryList();
+ inventoryList = from("MrpEvent").where(mainCond).orderBy("productId", "eventDate").queryList()
}
- context.inventoryList = inventoryList;
+ context.inventoryList = inventoryList
}
-context.paramList = paramList;
+context.paramList = paramList
// set the page parameters
-viewIndex = Integer.valueOf(parameters.VIEW_INDEX ?: 0);
-viewSize = parameters.VIEW_SIZE ?: EntityUtilProperties.getPropertyAsInteger("widget", "widget.form.defaultViewSize", 20);
-listSize = 0;
+viewIndex = Integer.valueOf(parameters.VIEW_INDEX ?: 0)
+viewSize = parameters.VIEW_SIZE ?: EntityUtilProperties.getPropertyAsInteger("widget", "widget.form.defaultViewSize", 20)
+listSize = 0
if (inventoryList)
- listSize = inventoryList.size();
+ listSize = inventoryList.size()
-lowIndex = viewIndex * viewSize;
-highIndex = (viewIndex + 1) * viewSize;
+lowIndex = viewIndex * viewSize
+highIndex = (viewIndex + 1) * viewSize
if (listSize < highIndex)
- highIndex = listSize;
+ highIndex = listSize
if ( highIndex < 1 )
- highIndex = 0;
-context.viewIndex = viewIndex;
-context.listSize = listSize;
-context.highIndex = highIndex;
-context.lowIndex = lowIndex;
-context.viewSize = viewSize;
+ highIndex = 0
+context.viewIndex = viewIndex
+context.listSize = listSize
+context.highIndex = highIndex
+context.lowIndex = lowIndex
+context.viewSize = viewSize
diff --git a/applications/manufacturing/groovyScripts/reports/CuttingListReport.groovy b/applications/manufacturing/groovyScripts/reports/CuttingListReport.groovy
index d324c3cda3..a2d4b9dda9 100644
--- a/applications/manufacturing/groovyScripts/reports/CuttingListReport.groovy
+++ b/applications/manufacturing/groovyScripts/reports/CuttingListReport.groovy
@@ -23,22 +23,22 @@ import org.apache.ofbiz.manufacturing.jobshopmgt.ProductionRun
import org.apache.ofbiz.manufacturing.jobshopmgt.ProductionRunHelper
if (security.hasEntityPermission("MANUFACTURING", "_VIEW", session)) {
- context.hasPermission = Boolean.TRUE;
+ context.hasPermission = Boolean.TRUE
} else {
- context.hasPermission = Boolean.FALSE;
+ context.hasPermission = Boolean.FALSE
}
// -----------------------------
// Report's parameters
-selectWorkEffortNameParameter = "O-PREL_A"; // sezionatura
-selectPrimaryCategoryIdParameter = "CABINETS"; // struttura
+selectWorkEffortNameParameter = "O-PREL_A" // sezionatura
+selectPrimaryCategoryIdParameter = "CABINETS" // struttura
// -----------------------------
-shipmentId = request.getParameter("shipmentId");
-context.shipmentId = shipmentId;
+shipmentId = request.getParameter("shipmentId")
+context.shipmentId = shipmentId
-shipment = delegator.findOne("Shipment", [shipmentId : shipmentId], false);
-context.shipment = shipment;
+shipment = delegator.findOne("Shipment", [shipmentId : shipmentId], false)
+context.shipment = shipment
// dimensionsByFeatureMap [key=feature; value=productsByShapeMap]
// productsByShapeMap [key=dimension; value=quantityByProductsMap]
@@ -46,85 +46,85 @@ context.shipment = shipment;
// dimension={width*, height*, qty}
// product={productId*,...}
-productIdToQuantity = [:]; // key=productId, value=quantity
-productIdToProduct = [:]; // key=productId, value=product
-dimensionToProducts = [:]; // key=Dimension, value=list of products
-dimensionToQuantity = [:]; // key=Dimension, value=tot qty (of products)
+productIdToQuantity = [:] // key=productId, value=quantity
+productIdToProduct = [:] // key=productId, value=product
+dimensionToProducts = [:] // key=Dimension, value=list of products
+dimensionToQuantity = [:] // key=Dimension, value=tot qty (of products)
shipmentPlans = from("OrderShipment").where("shipmentId", shipmentId).queryList()
if (shipmentPlans) {
shipmentPlans.each { shipmentPlan ->
// Select the production run, if available
- weIds = from("WorkOrderItemFulfillment").where("orderId", shipmentPlan.orderId, "orderItemSeqId", shipmentPlan.orderItemSeqId).orderBy("workEffortId").queryList(); // TODO: add shipmentId
- weId = EntityUtil.getFirst(weIds);
- productionRunTree = [] as ArrayList;
+ weIds = from("WorkOrderItemFulfillment").where("orderId", shipmentPlan.orderId, "orderItemSeqId", shipmentPlan.orderItemSeqId).orderBy("workEffortId").queryList() // TODO: add shipmentId
+ weId = EntityUtil.getFirst(weIds)
+ productionRunTree = [] as ArrayList
// TODO
if (weId) {
- ProductionRunHelper.getLinkedProductionRuns(delegator, dispatcher, weId.workEffortId, productionRunTree);
+ ProductionRunHelper.getLinkedProductionRuns(delegator, dispatcher, weId.workEffortId, productionRunTree)
for (int i = 0; i < productionRunTree.size(); i++) {
- oneProductionRun = (ProductionRun)productionRunTree.get(i);
+ oneProductionRun = (ProductionRun)productionRunTree.get(i)
if (ProductionRunHelper.hasTask(delegator, selectWorkEffortNameParameter, oneProductionRun.getGenericValue().workEffortId)) {
- product = oneProductionRun.getProductProduced();
- primaryCategory = product.primaryProductCategoryId;
+ product = oneProductionRun.getProductProduced()
+ primaryCategory = product.primaryProductCategoryId
if (primaryCategory && selectPrimaryCategoryIdParameter.equals(primaryCategory)) {
- productId = product.productId;
- productIdToProduct.put(productId, product);
+ productId = product.productId
+ productIdToProduct.put(productId, product)
if (!productIdToQuantity.containsKey(productId)) {
- productIdToQuantity.put(productId, 0.0);
+ productIdToQuantity.put(productId, 0.0)
}
- qty = productIdToQuantity.get(productId);
- productIdToQuantity.put(productId, oneProductionRun.getGenericValue().quantityToProduce + qty);
+ qty = productIdToQuantity.get(productId)
+ productIdToQuantity.put(productId, oneProductionRun.getGenericValue().quantityToProduce + qty)
}
}
}
}
}
productIdToProduct.values().each { product ->
- heightD = product.productHeight;
- height = 0;
+ heightD = product.productHeight
+ height = 0
if (heightD) {
- height = (heightD * 1000) as int;
+ height = (heightD * 1000) as int
}
- widthD = product.productWidth;
- width = 0;
+ widthD = product.productWidth
+ width = 0
if (widthD) {
- width = (widthD * 1000) as int;
+ width = (widthD * 1000) as int
}
- Dimension dim = new Dimension(width, height);
+ Dimension dim = new Dimension(width, height)
if (!dimensionToProducts.containsKey(dim)) {
- dimensionToProducts.put(dim, new ArrayList());
+ dimensionToProducts.put(dim, new ArrayList())
}
- prodList = (List)dimensionToProducts.get(dim);
- prodList.add(product);
+ prodList = (List)dimensionToProducts.get(dim)
+ prodList.add(product)
// tot qty per dimension
if (!dimensionToQuantity.containsKey(dim)) {
- dimensionToQuantity.put(dim, 0.0);
+ dimensionToQuantity.put(dim, 0.0)
}
- qty = dimensionToQuantity[dim];
- dimensionToQuantity.put(dim, productIdToQuantity[product.productId] + qty);
+ qty = dimensionToQuantity[dim]
+ dimensionToQuantity.put(dim, productIdToQuantity[product.productId] + qty)
}
//
//
//
- list1 = [] as ArrayList;
+ list1 = [] as ArrayList
dimensionToProducts.keySet().each { dim ->
- map1 = [:];
- list1.add(map1);
- map1.width = (dim.getWidth() / 1000);
- map1.height = (dim.getHeight() / 1000);
- map1.quantity = dimensionToQuantity.get(dim);
- list2 = [] as ArrayList;
- map1.products = list2;
- products = (List)dimensionToProducts.get(dim);
+ map1 = [:]
+ list1.add(map1)
+ map1.width = (dim.getWidth() / 1000)
+ map1.height = (dim.getHeight() / 1000)
+ map1.quantity = dimensionToQuantity.get(dim)
+ list2 = [] as ArrayList
+ map1.products = list2
+ products = (List)dimensionToProducts.get(dim)
for (int i = 0; i < products.size(); i++) {
- product = products.get(i);
- Map map2 = [:];
- list2.add(map2);
- map2.product = product;
- map2.quantity = productIdToQuantity.get(product.productId);
+ product = products.get(i)
+ Map map2 = [:]
+ list2.add(map2)
+ map2.product = product
+ map2.quantity = productIdToQuantity.get(product.productId)
}
}
- context.cuttingList = list1;
+ context.cuttingList = list1
}
\ No newline at end of file
diff --git a/applications/manufacturing/groovyScripts/reports/PRunsComponentsByFeature.groovy b/applications/manufacturing/groovyScripts/reports/PRunsComponentsByFeature.groovy
index af32ce49ab..19d7388e5f 100644
--- a/applications/manufacturing/groovyScripts/reports/PRunsComponentsByFeature.groovy
+++ b/applications/manufacturing/groovyScripts/reports/PRunsComponentsByFeature.groovy
@@ -20,100 +20,100 @@
// PRunsComponentsByFeature
// ReportF
-import org.apache.ofbiz.entity.util.EntityUtil;
-import org.apache.ofbiz.product.category.CategoryWorker;
+import org.apache.ofbiz.entity.util.EntityUtil
+import org.apache.ofbiz.product.category.CategoryWorker
if (productCategoryIdPar) {
- category = from("ProductCategory").where("productCategoryId", productCategoryIdPar).queryOne();
- context.category = category;
+ category = from("ProductCategory").where("productCategoryId", productCategoryIdPar).queryOne()
+ context.category = category
}
if (productFeatureTypeIdPar) {
- featureType = from("ProductFeatureType").where("productFeatureTypeId", productFeatureTypeIdPar).queryOne();
- context.featureType = featureType;
+ featureType = from("ProductFeatureType").where("productFeatureTypeId", productFeatureTypeIdPar).queryOne()
+ context.featureType = featureType
}
-allProductionRuns = from("WorkEffortAndGoods").where("workEffortName", planName).orderBy("productId").queryList();
-productionRuns = [];
-features = [:]; // each entry is a productFeatureId|{productFeature,products}
-products = [:]; // each entry is a productId|{product,quantity}
+allProductionRuns = from("WorkEffortAndGoods").where("workEffortName", planName).orderBy("productId").queryList()
+productionRuns = []
+features = [:] // each entry is a productFeatureId|{productFeature,products}
+products = [:] // each entry is a productId|{product,quantity}
if (!productFeatureTypeIdPar) {
- features.put(null, UtilMisc.toMap("productFeature", null, "products", products));
+ features.put(null, UtilMisc.toMap("productFeature", null, "products", products))
}
if (allProductionRuns) {
allProductionRuns.each { productionRun ->
// select the production run's task of a given name (i.e. type) if any (based on the report's parameter)
- productionRunTask = from("WorkEffort").where("workEffortParentId", productionRun.workEffortId, "workEffortName", taskNamePar).queryFirst();
+ productionRunTask = from("WorkEffort").where("workEffortParentId", productionRun.workEffortId, "workEffortName", taskNamePar).queryFirst()
if (!productionRunTask) {
// the production run doesn't include the given task, skip it
- return;
+ return
}
// select the task's components, if any
- allProductionRunComponents = from("WorkEffortGoodStandard").where("workEffortId", productionRunTask.workEffortId, "workEffortGoodStdTypeId", "PRUNT_PROD_NEEDED").queryList();
+ allProductionRunComponents = from("WorkEffortGoodStandard").where("workEffortId", productionRunTask.workEffortId, "workEffortGoodStdTypeId", "PRUNT_PROD_NEEDED").queryList()
allProductionRunComponents.each { productionRunComponent ->
// verify if the product is a member of the given category (based on the report's parameter)
if (productCategoryIdPar) {
if (!isProductInCategory(delegator, productionRunComponent.productId, productCategoryIdPar)) {
// the production run's product is not a member of the given category, skip it
- return;
+ return
}
}
- productionRunProduct = from("Product").where("productId", productionRunComponent.productId).queryOne();
+ productionRunProduct = from("Product").where("productId", productionRunComponent.productId).queryOne()
- location = null;
+ location = null
if (productionRunProduct) {
- location = from("ProductFacilityLocation").where("facilityId", productionRun.facilityId, "productId", productionRunProduct.productId).queryFirst();
+ location = from("ProductFacilityLocation").where("facilityId", productionRun.facilityId, "productId", productionRunProduct.productId).queryFirst()
}
// group by standard feature of type productFeatureTypeIdPar
if (productFeatureTypeIdPar) {
- standardFeature = from("ProductFeatureAndAppl").where("productFeatureTypeId", productFeatureTypeIdPar, "productId", productionRunComponent.productId, "productFeatureApplTypeId", "STANDARD_FEATURE").filterByDate().queryFirst();
- standardFeatureId = null;
+ standardFeature = from("ProductFeatureAndAppl").where("productFeatureTypeId", productFeatureTypeIdPar, "productId", productionRunComponent.productId, "productFeatureApplTypeId", "STANDARD_FEATURE").filterByDate().queryFirst()
+ standardFeatureId = null
if (standardFeature) {
- standardFeatureId = standardFeature.productFeatureId;
+ standardFeatureId = standardFeature.productFeatureId
}
if (!features.containsKey(standardFeatureId)) {
- features.put(standardFeatureId, [productFeature : standardFeature, products : [:]]);
+ features.put(standardFeatureId, [productFeature : standardFeature, products : [:]])
}
- feature = (Map)features.get(standardFeatureId);
- products = (Map)feature.products;
+ feature = (Map)features.get(standardFeatureId)
+ products = (Map)feature.products
}
//
// populate the products map and sum the quantities
//
if (!products.containsKey(productionRunComponent.getString("productId"))) {
- products.put(productionRunComponent.productId, [product : productionRunProduct, quantity : new Double(0), location : location]);
+ products.put(productionRunComponent.productId, [product : productionRunProduct, quantity : new Double(0), location : location])
}
- Map productMap = (Map)products.get(productionRunComponent.productId);
- productMapQty = productMap.quantity;
- currentProductQty = productionRunComponent.estimatedQuantity;
- productMap.quantity = productMapQty + currentProductQty;
+ Map productMap = (Map)products.get(productionRunComponent.productId)
+ productMapQty = productMap.quantity
+ currentProductQty = productionRunComponent.estimatedQuantity
+ productMap.quantity = productMapQty + currentProductQty
}
}
// now create lists of products for each feature group
- featuresIt = features.values().iterator();
+ featuresIt = features.values().iterator()
while (featuresIt) {
- feature = featuresIt.next();
- productsMap = feature.products;
- productsMapIt = productsMap.values().iterator();
+ feature = featuresIt.next()
+ productsMap = feature.products
+ productsMapIt = productsMap.values().iterator()
while (productsMapIt.hasNext()) {
- productMap = productsMapIt.next();
+ productMap = productsMapIt.next()
if (productMap.product.productWidth && productMap.product.productHeight) {
- productMapQty = productMap.quantity;
- productHeight = productMap.product.productHeight;
- productWidth = productMap.product.productWidth;
- productArea = (productHeight * productWidth) / (1000 * 1000);
- panelQty = 0.0;
- int panelQtyInt = 0;
- if (productArea > 0) panelQty = productMapQty / productArea;
- panelQtyInt = panelQty;
- if (panelQtyInt < panelQty) panelQtyInt++;
- productMap.panelQuantity = panelQtyInt;
+ productMapQty = productMap.quantity
+ productHeight = productMap.product.productHeight
+ productWidth = productMap.product.productWidth
+ productArea = (productHeight * productWidth) / (1000 * 1000)
+ panelQty = 0.0
+ int panelQtyInt = 0
+ if (productArea > 0) panelQty = productMapQty / productArea
+ panelQtyInt = panelQty
+ if (panelQtyInt < panelQty) panelQtyInt++
+ productMap.panelQuantity = panelQtyInt
}
}
- feature.productList = productsMap.values();
+ feature.productList = productsMap.values()
}
- context.features = features.values();
+ context.features = features.values()
}
diff --git a/applications/manufacturing/groovyScripts/reports/PRunsInfoAndOrder.groovy b/applications/manufacturing/groovyScripts/reports/PRunsInfoAndOrder.groovy
index eebe4f642f..1efd43ddda 100644
--- a/applications/manufacturing/groovyScripts/reports/PRunsInfoAndOrder.groovy
+++ b/applications/manufacturing/groovyScripts/reports/PRunsInfoAndOrder.groovy
@@ -20,17 +20,17 @@
// PRunsInfoAndOrder
// ReportG
-import org.apache.ofbiz.entity.util.EntityUtil;
-import org.apache.ofbiz.manufacturing.jobshopmgt.ProductionRunHelper;
-import org.apache.ofbiz.order.order.OrderReadHelper;
+import org.apache.ofbiz.entity.util.EntityUtil
+import org.apache.ofbiz.manufacturing.jobshopmgt.ProductionRunHelper
+import org.apache.ofbiz.order.order.OrderReadHelper
if (productCategoryIdPar) {
- category = from("ProductCategory").where("productCategoryId", productCategoryIdPar).queryOne();
- context.category = category;
+ category = from("ProductCategory").where("productCategoryId", productCategoryIdPar).queryOne()
+ context.category = category
}
-allProductionRuns = from("WorkEffortAndGoods").where("workEffortName", planName, "statusId", "WEGS_CREATED", "workEffortGoodStdTypeId", "PRUN_PROD_DELIV").orderBy("productId").queryList();
-productionRuns = [];
+allProductionRuns = from("WorkEffortAndGoods").where("workEffortName", planName, "statusId", "WEGS_CREATED", "workEffortGoodStdTypeId", "PRUN_PROD_DELIV").orderBy("productId").queryList()
+productionRuns = []
if (allProductionRuns) {
allProductionRuns.each { productionRun ->
@@ -38,20 +38,20 @@ if (allProductionRuns) {
if (productCategoryIdPar) {
if (!isProductInCategory(delegator, productionRun.productId, productCategoryIdPar)) {
// the production run's product is not a member of the given category, skip it
- return;
+ return
}
}
- productionRunProduct = from("Product").where("productId", productionRun.productId).queryOne();
- String rootProductionRunId = ProductionRunHelper.getRootProductionRun(delegator, productionRun.workEffortId);
+ productionRunProduct = from("Product").where("productId", productionRun.productId).queryOne()
+ String rootProductionRunId = ProductionRunHelper.getRootProductionRun(delegator, productionRun.workEffortId)
- productionRunOrder = from("WorkOrderItemFulfillment").where("workEffortId", rootProductionRunId).queryFirst();
- OrderReadHelper orh = new OrderReadHelper(delegator, productionRunOrder.orderId);
+ productionRunOrder = from("WorkOrderItemFulfillment").where("workEffortId", rootProductionRunId).queryFirst()
+ OrderReadHelper orh = new OrderReadHelper(delegator, productionRunOrder.orderId)
// select the production run's task of a given name (i.e. type) if any (based on the report's parameter)
- productionRunTask = from("WorkEffort").where("workEffortParentId", productionRun.workEffortId, "workEffortName", taskNamePar).queryFirst();
+ productionRunTask = from("WorkEffort").where("workEffortParentId", productionRun.workEffortId, "workEffortName", taskNamePar).queryFirst()
if (!productionRunTask) {
// the production run doesn't include the given task, skip it
- return;
+ return
}
productionRunMap = [productionRun : productionRun,
@@ -59,20 +59,20 @@ if (allProductionRuns) {
productionRunTask : productionRunTask,
productionRunOrder : productionRunOrder,
customer : orh.getPlacingParty(),
- address : orh.getShippingAddress()];
- allProductionComponents = from("WorkEffortAndGoods").where("workEffortId", productionRunTask.workEffortId, "statusId", "WEGS_CREATED", "workEffortGoodStdTypeId", "PRUNT_PROD_NEEDED").orderBy("productId").queryList();
+ address : orh.getShippingAddress()]
+ allProductionComponents = from("WorkEffortAndGoods").where("workEffortId", productionRunTask.workEffortId, "statusId", "WEGS_CREATED", "workEffortGoodStdTypeId", "PRUNT_PROD_NEEDED").orderBy("productId").queryList()
- componentList = [];
+ componentList = []
if (allProductionComponents) {
allProductionComponents.each { productionComponent ->
- productionRunProductComp = from("Product").where("productId", productionComponent.productId).queryOne();
- productionRunProductMap = [component : productionComponent,componentProduct : productionRunProductComp];
- componentList.add(productionRunProductMap);
+ productionRunProductComp = from("Product").where("productId", productionComponent.productId).queryOne()
+ productionRunProductMap = [component : productionComponent,componentProduct : productionRunProductComp]
+ componentList.add(productionRunProductMap)
}
}
- productionRunMap.componentList = componentList;
- productionRuns.add(productionRunMap);
+ productionRunMap.componentList = componentList
+ productionRuns.add(productionRunMap)
}
}
-context.productionRuns = productionRuns;
+context.productionRuns = productionRuns
diff --git a/applications/manufacturing/groovyScripts/reports/PRunsProductsAndOrder.groovy b/applications/manufacturing/groovyScripts/reports/PRunsProductsAndOrder.groovy
index afe27529e2..49e58b501d 100644
--- a/applications/manufacturing/groovyScripts/reports/PRunsProductsAndOrder.groovy
+++ b/applications/manufacturing/groovyScripts/reports/PRunsProductsAndOrder.groovy
@@ -20,17 +20,17 @@
// PRunsProductsAndOrder
// ReportD
-import org.apache.ofbiz.entity.util.EntityUtil;
-import org.apache.ofbiz.manufacturing.jobshopmgt.ProductionRunHelper;
-import org.apache.ofbiz.order.order.OrderReadHelper;
+import org.apache.ofbiz.entity.util.EntityUtil
+import org.apache.ofbiz.manufacturing.jobshopmgt.ProductionRunHelper
+import org.apache.ofbiz.order.order.OrderReadHelper
if (productCategoryIdPar) {
- category = from("ProductCategory").where("productCategoryId", productCategoryIdPar).queryOne();
- context.category = category;
+ category = from("ProductCategory").where("productCategoryId", productCategoryIdPar).queryOne()
+ context.category = category
}
-allProductionRuns = from("WorkEffortAndGoods").where("workEffortName", planName, "statusId", "WEGS_CREATED", "workEffortGoodStdTypeId", "PRUN_PROD_DELIV").orderBy("productId").queryList();
-productionRuns = [];
+allProductionRuns = from("WorkEffortAndGoods").where("workEffortName", planName, "statusId", "WEGS_CREATED", "workEffortGoodStdTypeId", "PRUN_PROD_DELIV").orderBy("productId").queryList()
+productionRuns = []
if (allProductionRuns) {
allProductionRuns.each { productionRun ->
@@ -38,28 +38,28 @@ if (allProductionRuns) {
if (productCategoryIdPar) {
if (!isProductInCategory(delegator, productionRun.productId, productCategoryIdPar)) {
// the production run's product is not a member of the given category, skip it
- return;
+ return
}
}
- productionRunProduct = from("Product").where("productId", productionRun.productId).queryOne();
- String rootProductionRunId = ProductionRunHelper.getRootProductionRun(delegator, productionRun.workEffortId);
+ productionRunProduct = from("Product").where("productId", productionRun.productId).queryOne()
+ String rootProductionRunId = ProductionRunHelper.getRootProductionRun(delegator, productionRun.workEffortId)
- productionRunOrder = from("WorkOrderItemFulfillment").where("workEffortId", rootProductionRunId).queryFirst();
- OrderReadHelper orh = new OrderReadHelper(delegator, productionRunOrder.orderId);
- location = from("ProductFacilityLocation").where("productId", productionRun.productId, "facilityId", productionRun.facilityId).queryFirst();
+ productionRunOrder = from("WorkOrderItemFulfillment").where("workEffortId", rootProductionRunId).queryFirst()
+ OrderReadHelper orh = new OrderReadHelper(delegator, productionRunOrder.orderId)
+ location = from("ProductFacilityLocation").where("productId", productionRun.productId, "facilityId", productionRun.facilityId).queryFirst()
productionRunMap = [productionRun : productionRun,
product : productionRunProduct,
productionRunOrder : productionRunOrder,
customer : orh.getPlacingParty(),
address : orh.getShippingAddress(),
- location : location];
+ location : location]
- productionRunMap.plan = planName;
- quantity = productionRun.estimatedQuantity;
+ productionRunMap.plan = planName
+ quantity = productionRun.estimatedQuantity
for (int i = 0; i < quantity; i++) {
- productionRuns.add(productionRunMap);
+ productionRuns.add(productionRunMap)
}
}
}
-context.productionRuns = productionRuns;
+context.productionRuns = productionRuns
diff --git a/applications/manufacturing/groovyScripts/reports/PRunsProductsByFeature.groovy b/applications/manufacturing/groovyScripts/reports/PRunsProductsByFeature.groovy
index 2ff1dbcdc4..867f78fab9 100644
--- a/applications/manufacturing/groovyScripts/reports/PRunsProductsByFeature.groovy
+++ b/applications/manufacturing/groovyScripts/reports/PRunsProductsByFeature.groovy
@@ -20,22 +20,22 @@
// PRunsProductsByFeature
// ReportE
-import org.apache.ofbiz.entity.util.EntityUtil;
+import org.apache.ofbiz.entity.util.EntityUtil
if (productCategoryIdPar) {
- category = from("ProductCategory").where("productCategoryId", productCategoryIdPar).queryOne();
- context.category = category;
+ category = from("ProductCategory").where("productCategoryId", productCategoryIdPar).queryOne()
+ context.category = category
}
if (productFeatureTypeIdPar) {
- featureType = from("ProductFeatureType").where("productFeatureTypeId", productFeatureTypeIdPar).queryOne();
- context.featureType = featureType;
+ featureType = from("ProductFeatureType").where("productFeatureTypeId", productFeatureTypeIdPar).queryOne()
+ context.featureType = featureType
}
-allProductionRuns = from("WorkEffortAndGoods").where("workEffortName", planName).orderBy("productId").queryList();
-productionRuns = [:];
-features = [];
+allProductionRuns = from("WorkEffortAndGoods").where("workEffortName", planName).orderBy("productId").queryList()
+productionRuns = [:]
+features = []
if (!productFeatureTypeIdPar) {
- features.put(null, UtilMisc.toMap("productFeature", null, "productionRuns", productionRuns));
+ features.put(null, UtilMisc.toMap("productFeature", null, "productionRuns", productionRuns))
}
if (allProductionRuns) {
@@ -44,36 +44,36 @@ if (allProductionRuns) {
if (productCategoryIdPar) {
if (!isProductInCategory(delegator, productionRun.productId, productCategoryIdPar)) {
// the production run's product is not a member of the given category, skip it
- return;
+ return
}
}
- productionRunProduct = from("Product").where("productId", productionRun.productId).queryOne();
+ productionRunProduct = from("Product").where("productId", productionRun.productId).queryOne()
// group by standard feature of type productFeatureTypeIdPar
if (productFeatureTypeIdPar) {
- standardFeature = from("ProductFeatureAndAppl").where("productFeatureTypeId", productFeatureTypeIdPar, "productId", productionRun.productId, "productFeatureApplTypeId", "STANDARD_FEATURE").filterByDate().queryFirst();
- standardFeatureId = null;
+ standardFeature = from("ProductFeatureAndAppl").where("productFeatureTypeId", productFeatureTypeIdPar, "productId", productionRun.productId, "productFeatureApplTypeId", "STANDARD_FEATURE").filterByDate().queryFirst()
+ standardFeatureId = null
if (standardFeature) {
- standardFeatureId = standardFeature.productFeatureId;
+ standardFeatureId = standardFeature.productFeatureId
}
if (!features.containsKey(standardFeatureId)) {
- features.put(standardFeatureId, [productFeature : standardFeature, productionRuns : []]);
+ features.put(standardFeatureId, [productFeature : standardFeature, productionRuns : []])
}
- feature = (Map)features.standardFeatureId;
- productionRuns = (List)feature.productionRuns;
+ feature = (Map)features.standardFeatureId
+ productionRuns = (List)feature.productionRuns
}
// select the production run's task of a given name (i.e. type) if any (based on the report's parameter)
- productionRunTask = from("WorkEffort").where("workEffortParentId", productionRun.workEffortId, "workEffortName", taskNamePar).queryFirst();
+ productionRunTask = from("WorkEffort").where("workEffortParentId", productionRun.workEffortId, "workEffortName", taskNamePar).queryFirst()
if (!productionRunTask) {
// the production run doesn't include the given task, skip it
- return;
+ return
}
productionRunMap = [productionRun : productionRun,
product : productionRunProduct,
- productionRunTask : productionRunTask];
- productionRuns.add(productionRunMap);
+ productionRunTask : productionRunTask]
+ productionRuns.add(productionRunMap)
}
- context.features = features.values();
+ context.features = features.values()
}
diff --git a/applications/manufacturing/groovyScripts/reports/PRunsProductsStacks.groovy b/applications/manufacturing/groovyScripts/reports/PRunsProductsStacks.groovy
index 95b0a5add7..19efc4932c 100644
--- a/applications/manufacturing/groovyScripts/reports/PRunsProductsStacks.groovy
+++ b/applications/manufacturing/groovyScripts/reports/PRunsProductsStacks.groovy
@@ -20,21 +20,21 @@
// PRunsProductsStacks
// ReportC
-import org.apache.ofbiz.entity.util.EntityUtil;
+import org.apache.ofbiz.entity.util.EntityUtil
if (productCategoryIdPar) {
- category = from("ProductCategory").where("productCategoryId", productCategoryIdPar).queryOne();
- context.category = category;
+ category = from("ProductCategory").where("productCategoryId", productCategoryIdPar).queryOne()
+ context.category = category
}
if (productFeatureTypeIdPar) {
- featureType = from("ProductFeatureType").where("productFeatureTypeId", productFeatureTypeIdPar).queryOne();
- context.featureType = featureType;
+ featureType = from("ProductFeatureType").where("productFeatureTypeId", productFeatureTypeIdPar).queryOne()
+ context.featureType = featureType
}
-allProductionRuns = from("WorkEffortAndGoods").where("workEffortName", planName).orderBy("productId").queryList();
-productionRuns = [];
-features = [:];
-products = [:];
+allProductionRuns = from("WorkEffortAndGoods").where("workEffortName", planName).orderBy("productId").queryList()
+productionRuns = []
+features = [:]
+products = [:]
if (allProductionRuns) {
allProductionRuns.each { productionRun ->
@@ -42,44 +42,44 @@ if (allProductionRuns) {
if (productCategoryIdPar) {
if (!isProductInCategory(delegator, productionRun.productId, productCategoryIdPar)) {
// the production run's product is not a member of the given category, skip it
- return;
+ return
}
}
- productionRunProduct = from("Product").where("productId", productionRun.productId).queryOne();
- location = [:];
+ productionRunProduct = from("Product").where("productId", productionRun.productId).queryOne()
+ location = [:]
if (productionRunProduct) {
- location = form("ProductFacilityLocation").where(facilityId : productionRun.facilityId, productId : productionRun.productId).queryFirst();
+ location = form("ProductFacilityLocation").where(facilityId : productionRun.facilityId, productId : productionRun.productId).queryFirst()
}
if (taskNamePar) {
// select the production run's task of a given name (i.e. type) if any (based on the report's parameter)
- productionRunTask = from("WorkEffort").where("workEffortParentId", productionRun.workEffortId , "workEffortName", taskNamePar).queryFirst();
+ productionRunTask = from("WorkEffort").where("workEffortParentId", productionRun.workEffortId , "workEffortName", taskNamePar).queryFirst()
if (!productionRunTask) {
// the production run doesn't include the given task, skip it
- return;
+ return
}
}
// Stack information
- stackInfos = [];
- productionRunQty = productionRun.quantityToProduce;
- numOfStacks = productionRunQty / stackQty; // number of stacks
- numOfStacks = numOfStacks.intValue();
- qtyInLastStack = productionRunQty % stackQty; // qty in the last stack
+ stackInfos = []
+ productionRunQty = productionRun.quantityToProduce
+ numOfStacks = productionRunQty / stackQty // number of stacks
+ numOfStacks = numOfStacks.intValue()
+ qtyInLastStack = productionRunQty % stackQty // qty in the last stack
if (qtyInLastStack > 0) {
- numOfStacks++;
+ numOfStacks++
} else {
- qtyInLastStack = stackQty;
+ qtyInLastStack = stackQty
}
for (int i = 1; i < numOfStacks; i++) {
- stackInfos.add([stackNum : "" + i, numOfStacks : "" + numOfStacks, qty : stackQty]);
+ stackInfos.add([stackNum : "" + i, numOfStacks : "" + numOfStacks, qty : stackQty])
}
- stackInfos.add([stackNum : "" + numOfStacks, numOfStacks : "" + numOfStacks, qty : qtyInLastStack]);
+ stackInfos.add([stackNum : "" + numOfStacks, numOfStacks : "" + numOfStacks, qty : qtyInLastStack])
productionRunMap = [productionRun : productionRun,
product : productionRunProduct,
location : location,
- stackInfos : stackInfos];
- productionRuns.add(productionRunMap);
+ stackInfos : stackInfos]
+ productionRuns.add(productionRunMap)
}
- context.productionRuns = productionRuns;
+ context.productionRuns = productionRuns
}
diff --git a/applications/manufacturing/groovyScripts/reports/PackageContentsAndOrder.groovy b/applications/manufacturing/groovyScripts/reports/PackageContentsAndOrder.groovy
index 97c7c42b60..80bd889722 100644
--- a/applications/manufacturing/groovyScripts/reports/PackageContentsAndOrder.groovy
+++ b/applications/manufacturing/groovyScripts/reports/PackageContentsAndOrder.groovy
@@ -20,49 +20,49 @@
// PackageContentsAndOrder
// ReportB
-import org.apache.ofbiz.entity.util.EntityUtil;
-import org.apache.ofbiz.order.order.OrderReadHelper;
-import org.apache.ofbiz.order.order.OrderContentWrapper;
+import org.apache.ofbiz.entity.util.EntityUtil
+import org.apache.ofbiz.order.order.OrderReadHelper
+import org.apache.ofbiz.order.order.OrderContentWrapper
if (productCategoryIdPar) {
- category = from("ProductCategory").where("productCategoryId", productCategoryIdPar).queryOne();
- context.category = category;
+ category = from("ProductCategory").where("productCategoryId", productCategoryIdPar).queryOne()
+ context.category = category
}
if (productFeatureTypeIdPar) {
- featureType = from("ProductFeatureType").where("productFeatureTypeId", productFeatureTypeIdPar).queryOne();
- context.featureType = featureType;
+ featureType = from("ProductFeatureType").where("productFeatureTypeId", productFeatureTypeIdPar).queryOne()
+ context.featureType = featureType
}
-packageContents = from("ShipmentPackageContent").where("shipmentId", shipmentId).queryList();
+packageContents = from("ShipmentPackageContent").where("shipmentId", shipmentId).queryList()
-packagesMap = [:];
+packagesMap = [:]
if (packageContents) {
packageContents.each { packageContent ->
- orderShipment = from("OrderShipment").where("shipmentId", shipmentId, "shipmentItemSeqId", packageContent.shipmentItemSeqId).queryFirst();
- orderItem = from("OrderItem").where("orderId", orderShipment.orderId, "orderItemSeqId", orderShipment.orderItemSeqId).queryOne();
- product = orderItem.getRelatedOne("Product", false);
+ orderShipment = from("OrderShipment").where("shipmentId", shipmentId, "shipmentItemSeqId", packageContent.shipmentItemSeqId).queryFirst()
+ orderItem = from("OrderItem").where("orderId", orderShipment.orderId, "orderItemSeqId", orderShipment.orderItemSeqId).queryOne()
+ product = orderItem.getRelatedOne("Product", false)
// verify if the product is a member of the given category (based on the report's parameter)
if (productCategoryIdPar) {
if (!isProductInCategory(delegator, product.productId, productCategoryIdPar)) {
// the production run's product is not a member of the given category, skip it
- return;
+ return
}
}
if (!packagesMap.containsKey(packageContent.shipmentPackageSeqId)) {
- OrderReadHelper orh = new OrderReadHelper(delegator, orderItem.orderId);
+ OrderReadHelper orh = new OrderReadHelper(delegator, orderItem.orderId)
packagesMap.put(packageContent.shipmentPackageSeqId,
[packageId : packageContent.shipmentPackageSeqId,
party : orh.getPlacingParty(),
address : orh.getShippingAddress(),
orderHeader : orh.getOrderHeader(),
orderShipment : orderShipment,
- components : []]);
+ components : []])
}
- OrderContentWrapper orderContentWrapper = OrderContentWrapper.makeOrderContentWrapper(orderItem, request);
+ OrderContentWrapper orderContentWrapper = OrderContentWrapper.makeOrderContentWrapper(orderItem, request)
String imageUrl = orderContentWrapper.get("IMAGE_URL", "url")
- packageMap = (Map)packagesMap.packageContent.shipmentPackageSeqId;
- components = (List)packageMap.components;
- components.add([product : product, orderItem : orderItem, imageUrl : imageUrl]);
+ packageMap = (Map)packagesMap.packageContent.shipmentPackageSeqId
+ components = (List)packageMap.components
+ components.add([product : product, orderItem : orderItem, imageUrl : imageUrl])
}
}
-context.packages = packagesMap.values();
+context.packages = packagesMap.values()
diff --git a/applications/manufacturing/groovyScripts/reports/ShipmentLabel.groovy b/applications/manufacturing/groovyScripts/reports/ShipmentLabel.groovy
index d5b257ee2a..7e0a45e926 100644
--- a/applications/manufacturing/groovyScripts/reports/ShipmentLabel.groovy
+++ b/applications/manufacturing/groovyScripts/reports/ShipmentLabel.groovy
@@ -17,73 +17,73 @@
* under the License.
*/
-import org.apache.ofbiz.entity.util.EntityUtil;
-import org.apache.ofbiz.order.order.OrderReadHelper;
+import org.apache.ofbiz.entity.util.EntityUtil
+import org.apache.ofbiz.order.order.OrderReadHelper
-shipmentId = parameters.shipmentId;
-shipment = from("Shipment").where("shipmentId", shipmentId).queryOne();
+shipmentId = parameters.shipmentId
+shipment = from("Shipment").where("shipmentId", shipmentId).queryOne()
-context.shipmentIdPar = shipment.shipmentId;
+context.shipmentIdPar = shipment.shipmentId
if (shipment) {
- shipmentPackages = from("ShipmentPackage").where("shipmentId", shipmentId).queryList();
- records = [];
- orderReaders = [:];
+ shipmentPackages = from("ShipmentPackage").where("shipmentId", shipmentId).queryList()
+ records = []
+ orderReaders = [:]
shipmentPackages.each { shipmentPackage ->
- shipmentPackageComponents = from("ShipmentPackageContent").where("shipmentId", shipmentId, "shipmentPackageSeqId", shipmentPackage.shipmentPackageSeqId).queryList();;
+ shipmentPackageComponents = from("ShipmentPackageContent").where("shipmentId", shipmentId, "shipmentPackageSeqId", shipmentPackage.shipmentPackageSeqId).queryList()
shipmentPackageComponents.each { shipmentPackageComponent ->
- shipmentItem = shipmentPackageComponent.getRelatedOne("ShipmentItem", false);
- orderShipments = shipmentItem.getRelated("OrderShipment", null, null, false);
- orderShipment = EntityUtil.getFirst(orderShipments);
+ shipmentItem = shipmentPackageComponent.getRelatedOne("ShipmentItem", false)
+ orderShipments = shipmentItem.getRelated("OrderShipment", null, null, false)
+ orderShipment = EntityUtil.getFirst(orderShipments)
- String orderId = null;
- String orderItemSeqId = null;
+ String orderId = null
+ String orderItemSeqId = null
if (orderShipment) {
- orderId = orderShipment.orderId;
- orderItemSeqId = orderShipment.orderItemSeqId;
+ orderId = orderShipment.orderId
+ orderItemSeqId = orderShipment.orderItemSeqId
}
- record = [:];
+ record = [:]
if (shipmentPackageComponent.subProductId) {
- record.productId = shipmentPackageComponent.subProductId;
- record.quantity = shipmentPackageComponent.subQuantity;
+ record.productId = shipmentPackageComponent.subProductId
+ record.quantity = shipmentPackageComponent.subQuantity
} else {
- record.productId = shipmentItem.productId;
- record.quantity = shipmentPackageComponent.quantity;
+ record.productId = shipmentItem.productId
+ record.quantity = shipmentPackageComponent.quantity
}
- record.shipmentPackageSeqId = shipmentPackageComponent.shipmentPackageSeqId;
- record.orderId = orderId;
- record.orderItemSeqId = orderItemSeqId;
- product = from("Product").where("productId", record.productId).queryOne();
- record.productName = product.internalName;
- record.shipDate = shipment.estimatedShipDate;
+ record.shipmentPackageSeqId = shipmentPackageComponent.shipmentPackageSeqId
+ record.orderId = orderId
+ record.orderItemSeqId = orderItemSeqId
+ product = from("Product").where("productId", record.productId).queryOne()
+ record.productName = product.internalName
+ record.shipDate = shipment.estimatedShipDate
// ---
- orderReadHelper = null;
+ orderReadHelper = null
if (orderReaders.containsKey(orderId)) {
- orderReadHelper = (OrderReadHelper)orderReaders.get(orderId);
+ orderReadHelper = (OrderReadHelper)orderReaders.get(orderId)
} else {
- orderHeader = from("OrderHeader").where("orderId", orderId).queryOne();
- orderReadHelper = new OrderReadHelper(orderHeader);
- orderReaders.put(orderId, orderReadHelper);
+ orderHeader = from("OrderHeader").where("orderId", orderId).queryOne()
+ orderReadHelper = new OrderReadHelper(orderHeader)
+ orderReaders.put(orderId, orderReadHelper)
}
- displayParty = orderReadHelper.getPlacingParty();
- shippingAddress = orderReadHelper.getShippingAddress();
- record.shippingAddressName = shippingAddress.toName;
- record.shippingAddressAddress = shippingAddress.address1;
- record.shippingAddressCity = shippingAddress.city;
- record.shippingAddressPostalCode = shippingAddress.postalCode;
- record.shippingAddressCountry = shippingAddress.countryGeoId;
- records.add(record);
+ displayParty = orderReadHelper.getPlacingParty()
+ shippingAddress = orderReadHelper.getShippingAddress()
+ record.shippingAddressName = shippingAddress.toName
+ record.shippingAddressAddress = shippingAddress.address1
+ record.shippingAddressCity = shippingAddress.city
+ record.shippingAddressPostalCode = shippingAddress.postalCode
+ record.shippingAddressCountry = shippingAddress.countryGeoId
+ records.add(record)
}
}
- context.records = records;
+ context.records = records
// check permission
- hasPermission = false;
+ hasPermission = false
if (security.hasEntityPermission("MANUFACTURING", "_VIEW", session)) {
- hasPermission = true;
+ hasPermission = true
}
- context.hasPermission = hasPermission;
+ context.hasPermission = hasPermission
}
-return "success";
+return "success"
diff --git a/applications/manufacturing/groovyScripts/reports/ShipmentPlanStockReport.groovy b/applications/manufacturing/groovyScripts/reports/ShipmentPlanStockReport.groovy
index 9a34ba7531..6aec2242c0 100644
--- a/applications/manufacturing/groovyScripts/reports/ShipmentPlanStockReport.groovy
+++ b/applications/manufacturing/groovyScripts/reports/ShipmentPlanStockReport.groovy
@@ -17,78 +17,78 @@
* 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.*
-inventoryStock = [:];
-shipmentId = parameters.shipmentId;
-shipment = from("Shipment").where("shipmentId", shipmentId).queryOne();
+inventoryStock = [:]
+shipmentId = parameters.shipmentId
+shipment = from("Shipment").where("shipmentId", shipmentId).queryOne()
-context.shipmentIdPar = shipment.shipmentId;
-context.estimatedReadyDatePar = shipment.estimatedReadyDate;
-context.estimatedShipDatePar = shipment.estimatedShipDate;
-records = [];
+context.shipmentIdPar = shipment.shipmentId
+context.estimatedReadyDatePar = shipment.estimatedReadyDate
+context.estimatedShipDatePar = shipment.estimatedShipDate
+records = []
if (shipment) {
- shipmentPlans = from("OrderShipment").where("shipmentId", shipmentId).queryList();
+ shipmentPlans = from("OrderShipment").where("shipmentId", shipmentId).queryList()
shipmentPlans.each { shipmentPlan ->
- orderLine = from("OrderItem").where("orderId", shipmentPlan.orderId , "orderItemSeqId", shipmentPlan.orderItemSeqId).queryOne();
- recordGroup = [:];
- recordGroup.ORDER_ID = shipmentPlan.orderId;
- recordGroup.ORDER_ITEM_SEQ_ID = shipmentPlan.orderItemSeqId;
- recordGroup.SHIPMENT_ID = shipmentPlan.shipmentId;
- recordGroup.SHIPMENT_ITEM_SEQ_ID = shipmentPlan.shipmentItemSeqId;
+ orderLine = from("OrderItem").where("orderId", shipmentPlan.orderId , "orderItemSeqId", shipmentPlan.orderItemSeqId).queryOne()
+ recordGroup = [:]
+ recordGroup.ORDER_ID = shipmentPlan.orderId
+ recordGroup.ORDER_ITEM_SEQ_ID = shipmentPlan.orderItemSeqId
+ recordGroup.SHIPMENT_ID = shipmentPlan.shipmentId
+ recordGroup.SHIPMENT_ITEM_SEQ_ID = shipmentPlan.shipmentItemSeqId
- recordGroup.PRODUCT_ID = orderLine.productId;
- recordGroup.QUANTITY = shipmentPlan.quantity;
- product = from("Product").where("productId", orderLine.productId).queryOne();
- recordGroup.PRODUCT_NAME = product.internalName;
+ recordGroup.PRODUCT_ID = orderLine.productId
+ recordGroup.QUANTITY = shipmentPlan.quantity
+ product = from("Product").where("productId", orderLine.productId).queryOne()
+ recordGroup.PRODUCT_NAME = product.internalName
inputPar = [productId : orderLine.productId,
quantity : shipmentPlan.quantity,
fromDate : "" + new Date(),
- userLogin: userLogin];
+ userLogin: userLogin]
- result = [:];
- result = runService('getNotAssembledComponents',inputPar);
+ result = [:]
+ result = runService('getNotAssembledComponents',inputPar)
if (result) {
- components = (List)result.get("notAssembledComponents");
+ components = (List)result.get("notAssembledComponents")
}
components.each { oneComponent ->
- record = new HashMap(recordGroup);
- record.componentId = oneComponent.getProduct().productId;
- record.componentName = oneComponent.getProduct().internalName;
- record.componentQuantity = new Float(oneComponent.getQuantity());
- facilityId = shipment.originFacilityId;
- float qty = 0;
+ record = new HashMap(recordGroup)
+ record.componentId = oneComponent.getProduct().productId
+ record.componentName = oneComponent.getProduct().internalName
+ record.componentQuantity = new Float(oneComponent.getQuantity())
+ facilityId = shipment.originFacilityId
+ float qty = 0
if (facilityId) {
if (!inventoryStock.containsKey(oneComponent.getProduct().productId)) {
- serviceInput = [productId : oneComponent.getProduct().productId , facilityId : facilityId];
- serviceOutput = runService('getInventoryAvailableByFacility',serviceInput);
- qha = serviceOutput.quantityOnHandTotal ?: 0.0;
- inventoryStock.put(oneComponent.getProduct().productId, qha);
+ serviceInput = [productId : oneComponent.getProduct().productId , facilityId : facilityId]
+ serviceOutput = runService('getInventoryAvailableByFacility',serviceInput)
+ qha = serviceOutput.quantityOnHandTotal ?: 0.0
+ inventoryStock.put(oneComponent.getProduct().productId, qha)
}
- qty = inventoryStock[oneComponent.getProduct().productId];
- qty = qty - oneComponent.getQuantity();
- inventoryStock.put(oneComponent.getProduct().productId, qty);
+ qty = inventoryStock[oneComponent.getProduct().productId]
+ qty = qty - oneComponent.getQuantity()
+ inventoryStock.put(oneComponent.getProduct().productId, qty)
}
- record.componentOnHand = qty;
+ record.componentOnHand = qty
// Now we get the products qty already reserved by production runs
serviceInput = [productId : oneComponent.getProduct().productId,
- userLogin : userLogin];
- serviceOutput = runService('getProductionRunTotResQty', serviceInput);
- resQty = serviceOutput.reservedQuantity;
- record.reservedQuantity = resQty;
- records.add(record);
+ userLogin : userLogin]
+ serviceOutput = runService('getProductionRunTotResQty', serviceInput)
+ resQty = serviceOutput.reservedQuantity
+ record.reservedQuantity = resQty
+ records.add(record)
}
}
- context.records = records;
+ context.records = records
// check permission
- hasPermission = false;
+ hasPermission = false
if (security.hasEntityPermission("MANUFACTURING", "_VIEW", session)) {
- hasPermission = true;
+ hasPermission = true
}
- context.hasPermission = hasPermission;
+ context.hasPermission = hasPermission
}
-return "success";
+return "success"
diff --git a/applications/manufacturing/groovyScripts/reports/ShipmentWorkEffortTasks.groovy b/applications/manufacturing/groovyScripts/reports/ShipmentWorkEffortTasks.groovy
index 476dab5c00..eeecc28a13 100644
--- a/applications/manufacturing/groovyScripts/reports/ShipmentWorkEffortTasks.groovy
+++ b/applications/manufacturing/groovyScripts/reports/ShipmentWorkEffortTasks.groovy
@@ -17,56 +17,56 @@
* under the License.
*/
-import org.apache.ofbiz.entity.GenericValue;
+import org.apache.ofbiz.entity.GenericValue
-shipmentId = parameters.shipmentId;
-shipment = from("Shipment").where("shipmentId", shipmentId).queryOne();
+shipmentId = parameters.shipmentId
+shipment = from("Shipment").where("shipmentId", shipmentId).queryOne()
-context.shipmentIdPar = shipment.shipmentId;
-context.date = new Date();
-Double fixedAssetTime = new Double(0);
-records = [];
+context.shipmentIdPar = shipment.shipmentId
+context.date = new Date()
+Double fixedAssetTime = new Double(0)
+records = []
if (shipment) {
- shipmentPlans = from("OrderShipment").where("shipmentId", shipmentId).queryList();
+ shipmentPlans = from("OrderShipment").where("shipmentId", shipmentId).queryList()
shipmentPlans.each { shipmentPlan ->
- productionRuns = from("WorkOrderItemFulfillment").where("orderId", shipmentPlan.orderId, "orderItemSeqId", shipmentPlan.orderItemSeqId).orderBy("workEffortId").queryList();
+ productionRuns = from("WorkOrderItemFulfillment").where("orderId", shipmentPlan.orderId, "orderItemSeqId", shipmentPlan.orderItemSeqId).orderBy("workEffortId").queryList()
if (productionRuns) {
productionRuns.each { productionRun ->
- productionRunProduct = [:];
- productionRunProducts = from("WorkEffortGoodStandard").where("workEffortId", productionRun.workEffortId , "workEffortGoodStdTypeId", "PRUN_PROD_DELIV", "statusId", "WEGS_CREATED").queryList();
+ productionRunProduct = [:]
+ productionRunProducts = from("WorkEffortGoodStandard").where("workEffortId", productionRun.workEffortId , "workEffortGoodStdTypeId", "PRUN_PROD_DELIV", "statusId", "WEGS_CREATED").queryList()
if (productionRunProducts) {
- productionRunProduct = ((GenericValue)productionRunProducts.get(0)).getRelatedOne("Product", false);
+ productionRunProduct = ((GenericValue)productionRunProducts.get(0)).getRelatedOne("Product", false)
}
- tasks = from("WorkEffort").where("workEffortParentId", productionRun.workEffortId, "workEffortTypeId", "PROD_ORDER_TASK").queryList();
+ tasks = from("WorkEffort").where("workEffortParentId", productionRun.workEffortId, "workEffortTypeId", "PROD_ORDER_TASK").queryList()
tasks.each { task ->
- record = [:];
- record.productId = productionRunProduct.productId;
- record.productName = productionRunProduct.internalName;
- record.fixedAssetId = task.fixedAssetId;
- record.priority = task.getLong("priority");
- record.workEffortId = productionRun.workEffortId;
- record.taskId = task.workEffortId;
- record.taskName = task.workEffortName;
- record.taskDescription = task.description;
- record.taskEstimatedTime = task.getDouble("estimatedMilliSeconds");
- record.taskEstimatedSetup = task.getDouble("estimatedSetupMillis");
- records.add(record);
+ record = [:]
+ record.productId = productionRunProduct.productId
+ record.productName = productionRunProduct.internalName
+ record.fixedAssetId = task.fixedAssetId
+ record.priority = task.getLong("priority")
+ record.workEffortId = productionRun.workEffortId
+ record.taskId = task.workEffortId
+ record.taskName = task.workEffortName
+ record.taskDescription = task.description
+ record.taskEstimatedTime = task.getDouble("estimatedMilliSeconds")
+ record.taskEstimatedSetup = task.getDouble("estimatedSetupMillis")
+ records.add(record)
if(task.getDouble("estimatedMilliSeconds") != null){
- fixedAssetTime = fixedAssetTime + task.getDouble("estimatedMilliSeconds");
+ fixedAssetTime = fixedAssetTime + task.getDouble("estimatedMilliSeconds")
}
}
}
}
}
- context.fixedAssetTime = fixedAssetTime;
- context.records = records;
+ context.fixedAssetTime = fixedAssetTime
+ context.records = records
// check permission
- hasPermission = false;
+ hasPermission = false
if (security.hasEntityPermission("MANUFACTURING", "_VIEW", session)) {
- hasPermission = true;
+ hasPermission = true
}
- context.hasPermission = hasPermission;
+ context.hasPermission = hasPermission
}
-return "success";
+return "success"
diff --git a/applications/manufacturing/groovyScripts/routing/EditCalendar.groovy b/applications/manufacturing/groovyScripts/routing/EditCalendar.groovy
index 8a895bbe73..4d3540c2af 100644
--- a/applications/manufacturing/groovyScripts/routing/EditCalendar.groovy
+++ b/applications/manufacturing/groovyScripts/routing/EditCalendar.groovy
@@ -17,29 +17,29 @@
* under the License.
*/
-import org.apache.ofbiz.base.util.UtilHttp;
+import org.apache.ofbiz.base.util.UtilHttp
-requestParams = UtilHttp.getParameterMap(request);
-calendarId = requestParams.get("calendarId") ?: request.getAttribute("calendarId");
+requestParams = UtilHttp.getParameterMap(request)
+calendarId = requestParams.get("calendarId") ?: request.getAttribute("calendarId")
if (calendarId != null) {
- techDataCalendar = from("TechDataCalendar").where("calendarId", calendarId).queryOne();
- context.techDataCalendar = techDataCalendar;
+ techDataCalendar = from("TechDataCalendar").where("calendarId", calendarId).queryOne()
+ context.techDataCalendar = techDataCalendar
}
-tryEntity = true;
-errorMessage = request.getAttribute("_ERROR_MESSAGE_");
+tryEntity = true
+errorMessage = request.getAttribute("_ERROR_MESSAGE_")
if (errorMessage) {
- tryEntity = false;
+ tryEntity = false
}
-calendarData = context.techDataCalendar;
+calendarData = context.techDataCalendar
if (!tryEntity) {
- calendarData = requestParams ?: [:];
+ calendarData = requestParams ?: [:]
}
if (!calendarData) {
- calendarData = [:];
+ calendarData = [:]
}
-context.calendarData = calendarData;
+context.calendarData = calendarData
-allCalendarWeek = from("TechDataCalendarWeek").queryList();
-context.calendarWeeks = allCalendarWeek;
+allCalendarWeek = from("TechDataCalendarWeek").queryList()
+context.calendarWeeks = allCalendarWeek
diff --git a/applications/manufacturing/groovyScripts/routing/EditCalendarExceptionDay.groovy b/applications/manufacturing/groovyScripts/routing/EditCalendarExceptionDay.groovy
index bf0418a996..881c5feae1 100644
--- a/applications/manufacturing/groovyScripts/routing/EditCalendarExceptionDay.groovy
+++ b/applications/manufacturing/groovyScripts/routing/EditCalendarExceptionDay.groovy
@@ -18,34 +18,34 @@
*/
-import java.util.*;
-import org.apache.ofbiz.base.util.*;
-import org.apache.ofbiz.entity.*;
+import java.util.*
+import org.apache.ofbiz.base.util.*
+import org.apache.ofbiz.entity.*
if (security.hasEntityPermission("MANUFACTURING", "_VIEW", session)) {
- context.hasPermission = Boolean.TRUE;
+ context.hasPermission = Boolean.TRUE
} else {
- context.hasPermission = Boolean.FALSE;
+ context.hasPermission = Boolean.FALSE
}
-techDataCalendar = [:];
-calendarExceptionDays = [];
+techDataCalendar = [:]
+calendarExceptionDays = []
-calendarId = parameters.calendarId ?: request.getAttribute("calendarId");
+calendarId = parameters.calendarId ?: request.getAttribute("calendarId")
if (calendarId) {
- techDataCalendar = from("TechDataCalendar").where("calendarId", calendarId).queryOne();
- context.techDataCalendar = techDataCalendar;
+ techDataCalendar = from("TechDataCalendar").where("calendarId", calendarId).queryOne()
+ context.techDataCalendar = techDataCalendar
}
if (techDataCalendar) {
- calendarExceptionDays = techDataCalendar.getRelated("TechDataCalendarExcDay", null, null, false);
- context.calendarExceptionDays = calendarExceptionDays;
+ calendarExceptionDays = techDataCalendar.getRelated("TechDataCalendarExcDay", null, null, false)
+ context.calendarExceptionDays = calendarExceptionDays
}
-exceptionDateStartTime = parameters.exceptionDateStartTime ?: request.getAttribute("exceptionDateStartTime");
-exceptionDateStartTime = ObjectType.simpleTypeConvert(exceptionDateStartTime, "Timestamp", null, null);
+exceptionDateStartTime = parameters.exceptionDateStartTime ?: request.getAttribute("exceptionDateStartTime")
+exceptionDateStartTime = ObjectType.simpleTypeConvert(exceptionDateStartTime, "Timestamp", null, null)
if (exceptionDateStartTime) {
- calendarExceptionDay = from("TechDataCalendarExcDay").where("calendarId", calendarId , "exceptionDateStartTime", exceptionDateStartTime).queryOne();
+ calendarExceptionDay = from("TechDataCalendarExcDay").where("calendarId", calendarId , "exceptionDateStartTime", exceptionDateStartTime).queryOne()
if (calendarExceptionDay) {
- context.calendarExceptionDay = calendarExceptionDay;
+ context.calendarExceptionDay = calendarExceptionDay
}
}
diff --git a/applications/manufacturing/groovyScripts/routing/EditCalendarExceptionWeek.groovy b/applications/manufacturing/groovyScripts/routing/EditCalendarExceptionWeek.groovy
index 8d06c23562..8140028c83 100644
--- a/applications/manufacturing/groovyScripts/routing/EditCalendarExceptionWeek.groovy
+++ b/applications/manufacturing/groovyScripts/routing/EditCalendarExceptionWeek.groovy
@@ -18,37 +18,37 @@
*/
-import org.apache.ofbiz.base.util.*;
+import org.apache.ofbiz.base.util.*
if (security.hasEntityPermission("MANUFACTURING", "_VIEW", session)) {
- context.hasPermission = Boolean.TRUE;
+ context.hasPermission = Boolean.TRUE
} else {
- context.hasPermission = Boolean.FALSE;
+ context.hasPermission = Boolean.FALSE
}
-techDataCalendar = [:];
-calendarExceptionWeeks = [];
+techDataCalendar = [:]
+calendarExceptionWeeks = []
-calendarId = parameters.calendarId ?: request.getAttribute("calendarId");;
+calendarId = parameters.calendarId ?: request.getAttribute("calendarId")
if (calendarId) {
- techDataCalendar = from("TechDataCalendar").where("calendarId", calendarId).queryOne();
- context.techDataCalendar = techDataCalendar;
+ techDataCalendar = from("TechDataCalendar").where("calendarId", calendarId).queryOne()
+ context.techDataCalendar = techDataCalendar
}
if (techDataCalendar) {
- calendarExceptionWeeks = techDataCalendar.getRelated("TechDataCalendarExcWeek", null, null, false);
+ calendarExceptionWeeks = techDataCalendar.getRelated("TechDataCalendarExcWeek", null, null, false)
}
-calendarExceptionWeeksDatas = [];
+calendarExceptionWeeksDatas = []
calendarExceptionWeeks.each { calendarExceptionWeek ->
- calendarWeek = calendarExceptionWeek.getRelatedOne("TechDataCalendarWeek", false);
- calendarExceptionWeeksDatas.add([calendarExceptionWeek : calendarExceptionWeek , calendarWeek : calendarWeek]);
- context.calendarExceptionWeeksDatas = calendarExceptionWeeksDatas;
+ calendarWeek = calendarExceptionWeek.getRelatedOne("TechDataCalendarWeek", false)
+ calendarExceptionWeeksDatas.add([calendarExceptionWeek : calendarExceptionWeek , calendarWeek : calendarWeek])
+ context.calendarExceptionWeeksDatas = calendarExceptionWeeksDatas
}
-exceptionDateStart = parameters.exceptionDateStart ?: request.getAttribute("exceptionDateStart");
-exceptionDateStart = ObjectType.simpleTypeConvert(exceptionDateStart, "java.sql.Date", null, null);
+exceptionDateStart = parameters.exceptionDateStart ?: request.getAttribute("exceptionDateStart")
+exceptionDateStart = ObjectType.simpleTypeConvert(exceptionDateStart, "java.sql.Date", null, null)
if (exceptionDateStart) {
- calendarExceptionWeek = from("TechDataCalendarExcWeek").where("calendarId", calendarId , "exceptionDateStart", exceptionDateStart).queryOne();
+ calendarExceptionWeek = from("TechDataCalendarExcWeek").where("calendarId", calendarId , "exceptionDateStart", exceptionDateStart).queryOne()
if (calendarExceptionWeek) {
- context.calendarExceptionWeek = calendarExceptionWeek;
+ context.calendarExceptionWeek = calendarExceptionWeek
}
}
\ No newline at end of file
diff --git a/applications/marketing/groovyScripts/marketing/contact/GetContactListMarketingEmail.groovy b/applications/marketing/groovyScripts/marketing/contact/GetContactListMarketingEmail.groovy
index 4ce64e96f2..442049bdb2 100644
--- a/applications/marketing/groovyScripts/marketing/contact/GetContactListMarketingEmail.groovy
+++ b/applications/marketing/groovyScripts/marketing/contact/GetContactListMarketingEmail.groovy
@@ -19,18 +19,18 @@
// figure out the MARKETING_EMAIL of the ContactList owner, for setting in the send email link
if (!contactList && contactListId) {
- contactList = from("ContactList").where("contactListId", "contactListId").cache(true).queryOne();
+ contactList = from("ContactList").where("contactListId", "contactListId").cache(true).queryOne()
}
if (contactList) {
- ownerParty = contactList.getRelatedOne("OwnerParty", false);
+ ownerParty = contactList.getRelatedOne("OwnerParty", false)
if (ownerParty) {
- contactMechs = ownerParty.getRelated("PartyContactMechPurpose", [contactMechPurposeTypeId : "MARKETING_EMAIL"], null, false);
+ contactMechs = ownerParty.getRelated("PartyContactMechPurpose", [contactMechPurposeTypeId : "MARKETING_EMAIL"], null, false)
if (!contactMechs) {
- contactMechs = ownerParty.getRelated("PartyContactMechPurpose", [contactMechPurposeTypeId : "PRIMARY_EMAIL"], null, false);
+ contactMechs = ownerParty.getRelated("PartyContactMechPurpose", [contactMechPurposeTypeId : "PRIMARY_EMAIL"], null, false)
}
if (contactMechs) {
- context.marketingEmail = contactMechs.get(0);
+ context.marketingEmail = contactMechs.get(0)
}
}
}
diff --git a/applications/marketing/groovyScripts/marketing/reports/EmailStatusReport.groovy b/applications/marketing/groovyScripts/marketing/reports/EmailStatusReport.groovy
index 49acdcaafc..9a35156b79 100644
--- a/applications/marketing/groovyScripts/marketing/reports/EmailStatusReport.groovy
+++ b/applications/marketing/groovyScripts/marketing/reports/EmailStatusReport.groovy
@@ -17,31 +17,31 @@
* 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
-conditionList = [];
+conditionList = []
if (fromDate) {
- conditionList.add(EntityCondition.makeCondition("entryDate", EntityOperator.GREATER_THAN_EQUAL_TO, fromDate));
+ conditionList.add(EntityCondition.makeCondition("entryDate", EntityOperator.GREATER_THAN_EQUAL_TO, fromDate))
}
if (thruDate) {
- conditionList.add(EntityCondition.makeCondition("entryDate", EntityOperator.LESS_THAN_EQUAL_TO, thruDate));
+ conditionList.add(EntityCondition.makeCondition("entryDate", EntityOperator.LESS_THAN_EQUAL_TO, thruDate))
}
if (partyIdTo) {
- conditionList.add(EntityCondition.makeCondition("partyIdTo", EntityOperator.EQUALS, partyIdTo));
+ conditionList.add(EntityCondition.makeCondition("partyIdTo", EntityOperator.EQUALS, partyIdTo))
} else {
- conditionList.add(EntityCondition.makeCondition("partyIdTo", EntityOperator.NOT_EQUAL, null));
+ conditionList.add(EntityCondition.makeCondition("partyIdTo", EntityOperator.NOT_EQUAL, null))
}
if (partyIdFrom) {
- conditionList.add(EntityCondition.makeCondition("partyIdFrom", EntityOperator.EQUALS, partyIdFrom));
+ conditionList.add(EntityCondition.makeCondition("partyIdFrom", EntityOperator.EQUALS, partyIdFrom))
}
if (statusId) {
- conditionList.add(EntityCondition.makeCondition("statusId", EntityOperator.EQUALS, statusId));
+ conditionList.add(EntityCondition.makeCondition("statusId", EntityOperator.EQUALS, statusId))
}
if (roleStatusId) {
- conditionList.add(EntityCondition.makeCondition("roleStatusId", EntityOperator.EQUALS, roleStatusId));
+ conditionList.add(EntityCondition.makeCondition("roleStatusId", EntityOperator.EQUALS, roleStatusId))
}
-conditionList.add(EntityCondition.makeCondition("roleTypeId", EntityOperator.EQUALS, "ADDRESSEE"));
+conditionList.add(EntityCondition.makeCondition("roleTypeId", EntityOperator.EQUALS, "ADDRESSEE"))
-commStatausList = from("CommunicationEventAndRole").where(conditionList).queryList();
-context.commStatausList = commStatausList;
+commStatausList = from("CommunicationEventAndRole").where(conditionList).queryList()
+context.commStatausList = commStatausList
diff --git a/applications/marketing/groovyScripts/marketing/reports/MarketingCampaignReport.groovy b/applications/marketing/groovyScripts/marketing/reports/MarketingCampaignReport.groovy
index 89abaca71a..837d5f17ae 100644
--- a/applications/marketing/groovyScripts/marketing/reports/MarketingCampaignReport.groovy
+++ b/applications/marketing/groovyScripts/marketing/reports/MarketingCampaignReport.groovy
@@ -23,26 +23,26 @@ import org.apache.ofbiz.marketing.report.ReportHelper
//query for both number of visits and number of orders
-marketingCampaignId = request.getParameter("marketingCampaignId");
-visitConditionList = [] as LinkedList;
-orderConditionList = [] as LinkedList;
+marketingCampaignId = request.getParameter("marketingCampaignId")
+visitConditionList = [] as LinkedList
+orderConditionList = [] as LinkedList
if (fromDate) {
- visitConditionList.add(EntityCondition.makeCondition("fromDate", EntityOperator.GREATER_THAN_EQUAL_TO, fromDate));
- orderConditionList.add(EntityCondition.makeCondition("orderDate", EntityOperator.GREATER_THAN_EQUAL_TO, fromDate));
+ visitConditionList.add(EntityCondition.makeCondition("fromDate", EntityOperator.GREATER_THAN_EQUAL_TO, fromDate))
+ orderConditionList.add(EntityCondition.makeCondition("orderDate", EntityOperator.GREATER_THAN_EQUAL_TO, fromDate))
}
if (thruDate) {
- visitConditionList.add(EntityCondition.makeCondition("fromDate", EntityOperator.LESS_THAN_EQUAL_TO, thruDate));
- orderConditionList.add(EntityCondition.makeCondition("orderDate", EntityOperator.LESS_THAN_EQUAL_TO, thruDate));
+ visitConditionList.add(EntityCondition.makeCondition("fromDate", EntityOperator.LESS_THAN_EQUAL_TO, thruDate))
+ orderConditionList.add(EntityCondition.makeCondition("orderDate", EntityOperator.LESS_THAN_EQUAL_TO, thruDate))
}
if (marketingCampaignId) {
- visitConditionList.add(EntityCondition.makeCondition("marketingCampaignId", EntityOperator.EQUALS, marketingCampaignId));
- orderConditionList.add(EntityCondition.makeCondition("marketingCampaignId", EntityOperator.EQUALS, marketingCampaignId));
+ visitConditionList.add(EntityCondition.makeCondition("marketingCampaignId", EntityOperator.EQUALS, marketingCampaignId))
+ orderConditionList.add(EntityCondition.makeCondition("marketingCampaignId", EntityOperator.EQUALS, marketingCampaignId))
}
-visits = select("marketingCampaignId", "visitId").from("MarketingCampaignAndVisit").where(visitConditionList).orderBy("marketingCampaignId").queryList();
-orders = select("marketingCampaignId", "orderId", "grandTotal").from("MarketingCampaignAndOrderHeader").where(orderConditionList).orderBy("marketingCampaignId").queryList();
+visits = select("marketingCampaignId", "visitId").from("MarketingCampaignAndVisit").where(visitConditionList).orderBy("marketingCampaignId").queryList()
+orders = select("marketingCampaignId", "orderId", "grandTotal").from("MarketingCampaignAndOrderHeader").where(orderConditionList).orderBy("marketingCampaignId").queryList()
//use this helper to build a List of visits, orders, order totals, and conversion rates
-marketingCampaignVisitAndOrders = ReportHelper.calcConversionRates(visits, orders, "marketingCampaignId");
-context.marketingCampaignVisitAndOrders = marketingCampaignVisitAndOrders;
+marketingCampaignVisitAndOrders = ReportHelper.calcConversionRates(visits, orders, "marketingCampaignId")
+context.marketingCampaignVisitAndOrders = marketingCampaignVisitAndOrders
diff --git a/applications/marketing/groovyScripts/marketing/reports/PartyStatusReport.groovy b/applications/marketing/groovyScripts/marketing/reports/PartyStatusReport.groovy
index 2b26319f52..f5bfb387eb 100644
--- a/applications/marketing/groovyScripts/marketing/reports/PartyStatusReport.groovy
+++ b/applications/marketing/groovyScripts/marketing/reports/PartyStatusReport.groovy
@@ -17,24 +17,24 @@
* 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
-conditionList = [];
+conditionList = []
if (fromDate) {
- conditionList.add(EntityCondition.makeCondition("fromDate", EntityOperator.GREATER_THAN_EQUAL_TO, fromDate));
+ conditionList.add(EntityCondition.makeCondition("fromDate", EntityOperator.GREATER_THAN_EQUAL_TO, fromDate))
}
if (statusDate) {
- conditionList.add(EntityCondition.makeCondition("statusDate", EntityOperator.GREATER_THAN_EQUAL_TO, statusDate));
+ conditionList.add(EntityCondition.makeCondition("statusDate", EntityOperator.GREATER_THAN_EQUAL_TO, statusDate))
}
if (thruDate) {
- conditionList.add(EntityCondition.makeCondition("fromDate", EntityOperator.LESS_THAN_EQUAL_TO, thruDate));
+ conditionList.add(EntityCondition.makeCondition("fromDate", EntityOperator.LESS_THAN_EQUAL_TO, thruDate))
}
if (contactListId) {
- conditionList.add(EntityCondition.makeCondition("contactListId", EntityOperator.EQUALS, contactListId));
+ conditionList.add(EntityCondition.makeCondition("contactListId", EntityOperator.EQUALS, contactListId))
}
if (statusId) {
- conditionList.add(EntityCondition.makeCondition("statusId", EntityOperator.EQUALS, statusId));
+ conditionList.add(EntityCondition.makeCondition("statusId", EntityOperator.EQUALS, statusId))
}
-partyStatusLists = from("ContactListPartyStatus").where(conditionList).queryList();
-context.partyStatusLists = partyStatusLists;
+partyStatusLists = from("ContactListPartyStatus").where(conditionList).queryList()
+context.partyStatusLists = partyStatusLists
diff --git a/applications/marketing/groovyScripts/marketing/reports/TrackingCodeReport.groovy b/applications/marketing/groovyScripts/marketing/reports/TrackingCodeReport.groovy
index b26d014d6a..1e22c95237 100644
--- a/applications/marketing/groovyScripts/marketing/reports/TrackingCodeReport.groovy
+++ b/applications/marketing/groovyScripts/marketing/reports/TrackingCodeReport.groovy
@@ -23,25 +23,25 @@ import org.apache.ofbiz.marketing.report.ReportHelper
// query for both number of visits and number of orders
-visitConditionList = [] as LinkedList;
-orderConditionList = [] as LinkedList;
+visitConditionList = [] as LinkedList
+orderConditionList = [] as LinkedList
if (fromDate) {
- visitConditionList.add(EntityCondition.makeCondition("fromDate", EntityOperator.GREATER_THAN_EQUAL_TO, fromDate));
- orderConditionList.add(EntityCondition.makeCondition("orderDate", EntityOperator.GREATER_THAN_EQUAL_TO, fromDate));
+ visitConditionList.add(EntityCondition.makeCondition("fromDate", EntityOperator.GREATER_THAN_EQUAL_TO, fromDate))
+ orderConditionList.add(EntityCondition.makeCondition("orderDate", EntityOperator.GREATER_THAN_EQUAL_TO, fromDate))
}
if (thruDate) {
- visitConditionList.add(EntityCondition.makeCondition("fromDate", EntityOperator.LESS_THAN_EQUAL_TO, thruDate));
- orderConditionList.add(EntityCondition.makeCondition("orderDate", EntityOperator.LESS_THAN_EQUAL_TO, thruDate));
+ visitConditionList.add(EntityCondition.makeCondition("fromDate", EntityOperator.LESS_THAN_EQUAL_TO, thruDate))
+ orderConditionList.add(EntityCondition.makeCondition("orderDate", EntityOperator.LESS_THAN_EQUAL_TO, thruDate))
}
if (trackingCodeId) {
- visitConditionList.add(EntityCondition.makeCondition("trackingCodeId", EntityOperator.EQUALS, trackingCodeId));
- orderConditionList.add(EntityCondition.makeCondition("trackingCodeId", EntityOperator.EQUALS, trackingCodeId));
+ visitConditionList.add(EntityCondition.makeCondition("trackingCodeId", EntityOperator.EQUALS, trackingCodeId))
+ orderConditionList.add(EntityCondition.makeCondition("trackingCodeId", EntityOperator.EQUALS, trackingCodeId))
}
-visits = select("trackingCodeId", "visitId").from("TrackingCodeAndVisit").where(visitConditionList).orderBy("trackingCodeId").queryList();
-orders = select("trackingCodeId", "orderId", "grandTotal").from("TrackingCodeAndOrderHeader").where(orderConditionList).orderBy("trackingCodeId").queryList();
+visits = select("trackingCodeId", "visitId").from("TrackingCodeAndVisit").where(visitConditionList).orderBy("trackingCodeId").queryList()
+orders = select("trackingCodeId", "orderId", "grandTotal").from("TrackingCodeAndOrderHeader").where(orderConditionList).orderBy("trackingCodeId").queryList()
// use this helper to build a List of visits, orders, order totals, and conversion rates
-trackingCodeVisitAndOrders = ReportHelper.calcConversionRates(visits, orders, "trackingCodeId");
-context.trackingCodeVisitAndOrders = trackingCodeVisitAndOrders;
+trackingCodeVisitAndOrders = ReportHelper.calcConversionRates(visits, orders, "trackingCodeId")
+context.trackingCodeVisitAndOrders = trackingCodeVisitAndOrders
diff --git a/applications/marketing/groovyScripts/sfa/CloneLead.groovy b/applications/marketing/groovyScripts/sfa/CloneLead.groovy
index 9c2850ea06..1e478b5cb5 100644
--- a/applications/marketing/groovyScripts/sfa/CloneLead.groovy
+++ b/applications/marketing/groovyScripts/sfa/CloneLead.groovy
@@ -20,75 +20,75 @@
import org.apache.ofbiz.entity.util.EntityUtil
import org.apache.ofbiz.party.contact.ContactHelper
-partyId = parameters.partyId;
+partyId = parameters.partyId
if (partyId) {
- party = from("Party").where("partyId", partyId).queryOne();
- person = party.getRelatedOne("Person", false);
- contactDetailMap = [partyId : partyId, firstName : person.firstName, lastName : person.lastName, suffix : person.suffix];
+ party = from("Party").where("partyId", partyId).queryOne()
+ person = party.getRelatedOne("Person", false)
+ contactDetailMap = [partyId : partyId, firstName : person.firstName, lastName : person.lastName, suffix : person.suffix]
partyRelationship = from("PartyRelationship")
.where("partyIdTo", partyId, "roleTypeIdTo", "EMPLOYEE", "roleTypeIdFrom", "LEAD", "partyRelationshipTypeId", "EMPLOYMENT")
.orderBy("-fromDate")
.filterByDate()
- .queryFirst();
+ .queryFirst()
if (partyRelationship) {
- contactDetailMap.title = partyRelationship.positionTitle;
- partyGroup = from("PartyGroup").where("partyId", partyRelationship.partyIdFrom).queryOne();
+ contactDetailMap.title = partyRelationship.positionTitle
+ partyGroup = from("PartyGroup").where("partyId", partyRelationship.partyIdFrom).queryOne()
if (partyGroup) {
if (partyGroup.groupName) {
- contactDetailMap.groupName = partyGroup.groupName;
+ contactDetailMap.groupName = partyGroup.groupName
}
if (partyGroup.officeSiteName) {
- contactDetailMap.officeSiteName = partyGroup.officeSiteName;
+ contactDetailMap.officeSiteName = partyGroup.officeSiteName
}
if (partyGroup.numEmployees) {
- contactDetailMap.numEmployees = partyGroup.numEmployees;
+ contactDetailMap.numEmployees = partyGroup.numEmployees
}
}
}
- generalContactMech = EntityUtil.getFirst(ContactHelper.getContactMech(person, "GENERAL_LOCATION", "POSTAL_ADDRESS", false));
+ generalContactMech = EntityUtil.getFirst(ContactHelper.getContactMech(person, "GENERAL_LOCATION", "POSTAL_ADDRESS", false))
if (generalContactMech) {
- contactDetailMap.addrContactMechId = generalContactMech.contactMechId;
- postalAddress = generalContactMech.getRelatedOne("PostalAddress", false);
+ contactDetailMap.addrContactMechId = generalContactMech.contactMechId
+ postalAddress = generalContactMech.getRelatedOne("PostalAddress", false)
if (postalAddress) {
- contactDetailMap.address1 = postalAddress.address1;
- contactDetailMap.city = postalAddress.city;
- contactDetailMap.stateProvinceGeoId = postalAddress.stateProvinceGeoId;
- contactDetailMap.countryGeoId = postalAddress.countryGeoId;
- contactDetailMap.postalCode = postalAddress.postalCode;
- address2 = postalAddress.address2;
+ contactDetailMap.address1 = postalAddress.address1
+ contactDetailMap.city = postalAddress.city
+ contactDetailMap.stateProvinceGeoId = postalAddress.stateProvinceGeoId
+ contactDetailMap.countryGeoId = postalAddress.countryGeoId
+ contactDetailMap.postalCode = postalAddress.postalCode
+ address2 = postalAddress.address2
if (address2) {
- contactDetailMap.address2 = address2;
+ contactDetailMap.address2 = address2
}
}
}
- emailContactMech = EntityUtil.getFirst(ContactHelper.getContactMech(person, "PRIMARY_EMAIL", "EMAIL_ADDRESS", false));
+ emailContactMech = EntityUtil.getFirst(ContactHelper.getContactMech(person, "PRIMARY_EMAIL", "EMAIL_ADDRESS", false))
if (emailContactMech) {
- contactDetailMap.emailAddress = emailContactMech.infoString;
- contactDetailMap.emailContactMechId = emailContactMech.contactMechId;
+ contactDetailMap.emailAddress = emailContactMech.infoString
+ contactDetailMap.emailContactMechId = emailContactMech.contactMechId
}
- phoneContactMech = EntityUtil.getFirst(ContactHelper.getContactMech(person, "PRIMARY_PHONE", "TELECOM_NUMBER", false));
+ phoneContactMech = EntityUtil.getFirst(ContactHelper.getContactMech(person, "PRIMARY_PHONE", "TELECOM_NUMBER", false))
if (phoneContactMech) {
- contactDetailMap.phoneContactMechId = phoneContactMech.contactMechId;
- telecomNumber = phoneContactMech.getRelatedOne("TelecomNumber", false);
+ contactDetailMap.phoneContactMechId = phoneContactMech.contactMechId
+ telecomNumber = phoneContactMech.getRelatedOne("TelecomNumber", false)
if (telecomNumber) {
- countryCode = telecomNumber.countryCode;
+ countryCode = telecomNumber.countryCode
if (countryCode) {
- contactDetailMap.countryCode = countryCode;
+ contactDetailMap.countryCode = countryCode
}
- areaCode = telecomNumber.areaCode;
+ areaCode = telecomNumber.areaCode
if (areaCode) {
- contactDetailMap.areaCode = areaCode;
+ contactDetailMap.areaCode = areaCode
}
- contactNumber = telecomNumber.contactNumber;
+ contactNumber = telecomNumber.contactNumber
if (contactNumber) {
- contactDetailMap.contactNumber = contactNumber;
+ contactDetailMap.contactNumber = contactNumber
}
}
}
- partyDataSource = EntityUtil.getFirst(party.getRelated("PartyDataSource", null, null, false));
+ partyDataSource = EntityUtil.getFirst(party.getRelated("PartyDataSource", null, null, false))
if (partyDataSource) {
- dataSource = partyDataSource.getRelatedOne("DataSource", false);
- contactDetailMap.leadSource = dataSource.description;
+ dataSource = partyDataSource.getRelatedOne("DataSource", false)
+ contactDetailMap.leadSource = dataSource.description
}
}
-context.contactDetailMap = contactDetailMap;
+context.contactDetailMap = contactDetailMap
diff --git a/applications/marketing/groovyScripts/sfa/MergeContacts.groovy b/applications/marketing/groovyScripts/sfa/MergeContacts.groovy
index 9bdd860efc..d0549c7faf 100644
--- a/applications/marketing/groovyScripts/sfa/MergeContacts.groovy
+++ b/applications/marketing/groovyScripts/sfa/MergeContacts.groovy
@@ -20,60 +20,60 @@
import org.apache.ofbiz.entity.util.EntityUtil
import org.apache.ofbiz.party.contact.ContactHelper
-contactInfoList = [];
-partyIdFrom = parameters.partyIdFrom;
-partyIdTo = parameters.partyIdTo;
+contactInfoList = []
+partyIdFrom = parameters.partyIdFrom
+partyIdTo = parameters.partyIdTo
if (partyIdFrom && partyIdTo) {
- partyList = [partyIdTo, partyIdFrom];
+ partyList = [partyIdTo, partyIdFrom]
partyList.each { partyId ->
- party = from("Party").where("partyId", partyId).queryOne();
- person = party.getRelatedOne("Person", false);
- contactDetailMap = [partyId : partyId, firstName : person.firstName, lastName : person.lastName];
+ party = from("Party").where("partyId", partyId).queryOne()
+ person = party.getRelatedOne("Person", false)
+ contactDetailMap = [partyId : partyId, firstName : person.firstName, lastName : person.lastName]
- generalContactMech = EntityUtil.getFirst(ContactHelper.getContactMech(party, "GENERAL_LOCATION", "POSTAL_ADDRESS", false));
+ generalContactMech = EntityUtil.getFirst(ContactHelper.getContactMech(party, "GENERAL_LOCATION", "POSTAL_ADDRESS", false))
if (generalContactMech) {
- contactDetailMap.addrContactMechId = generalContactMech.contactMechId;
- postalAddress = generalContactMech.getRelatedOne("PostalAddress", false);
+ contactDetailMap.addrContactMechId = generalContactMech.contactMechId
+ postalAddress = generalContactMech.getRelatedOne("PostalAddress", false)
if (postalAddress) {
- contactDetailMap.address1 = postalAddress.address1;
- contactDetailMap.city = postalAddress.city;
- address2 = postalAddress.address2;
+ contactDetailMap.address1 = postalAddress.address1
+ contactDetailMap.city = postalAddress.city
+ address2 = postalAddress.address2
if (address2) {
- contactDetailMap.address2 = address2;
+ contactDetailMap.address2 = address2
}
- geo = from("Geo").where("geoId", postalAddress.stateProvinceGeoId).queryOne();
- contactDetailMap.state = geo.geoName;
+ geo = from("Geo").where("geoId", postalAddress.stateProvinceGeoId).queryOne()
+ contactDetailMap.state = geo.geoName
- geo = from("Geo").where("geoId", postalAddress.countryGeoId).queryOne();
- contactDetailMap.country = geo.geoName;
+ geo = from("Geo").where("geoId", postalAddress.countryGeoId).queryOne()
+ contactDetailMap.country = geo.geoName
}
}
- emailContactMech = EntityUtil.getFirst(ContactHelper.getContactMech(party, "PRIMARY_EMAIL", "EMAIL_ADDRESS", false));
+ emailContactMech = EntityUtil.getFirst(ContactHelper.getContactMech(party, "PRIMARY_EMAIL", "EMAIL_ADDRESS", false))
if (emailContactMech) {
- contactDetailMap.primaryEmail = emailContactMech.infoString;
- contactDetailMap.emailContactMechId = emailContactMech.contactMechId;
+ contactDetailMap.primaryEmail = emailContactMech.infoString
+ contactDetailMap.emailContactMechId = emailContactMech.contactMechId
}
- phoneContactMech = EntityUtil.getFirst(ContactHelper.getContactMech(party, "PRIMARY_PHONE", "TELECOM_NUMBER", false));
+ phoneContactMech = EntityUtil.getFirst(ContactHelper.getContactMech(party, "PRIMARY_PHONE", "TELECOM_NUMBER", false))
if (phoneContactMech) {
- contactDetailMap.phoneContactMechId = phoneContactMech.contactMechId;
- telecomNumber = phoneContactMech.getRelatedOne("TelecomNumber", false);
+ contactDetailMap.phoneContactMechId = phoneContactMech.contactMechId
+ telecomNumber = phoneContactMech.getRelatedOne("TelecomNumber", false)
if (telecomNumber) {
- countryCode = telecomNumber.countryCode;
+ countryCode = telecomNumber.countryCode
if (countryCode) {
- contactDetailMap.countryCode = countryCode;
+ contactDetailMap.countryCode = countryCode
}
- areaCode = telecomNumber.areaCode;
+ areaCode = telecomNumber.areaCode
if (areaCode) {
- contactDetailMap.areaCode = areaCode;
+ contactDetailMap.areaCode = areaCode
}
- contactNumber = telecomNumber.contactNumber;
+ contactNumber = telecomNumber.contactNumber
if (contactNumber) {
- contactDetailMap.contactNumber = contactNumber;
+ contactDetailMap.contactNumber = contactNumber
}
}
}
- contactInfoList.add(contactDetailMap);
+ contactInfoList.add(contactDetailMap)
}
}
context.contactInfoList = contactInfoList;
\ No newline at end of file
diff --git a/applications/order/groovyScripts/entry/AddGiftCertificates.groovy b/applications/order/groovyScripts/entry/AddGiftCertificates.groovy
index af6a39102e..064770b30e 100644
--- a/applications/order/groovyScripts/entry/AddGiftCertificates.groovy
+++ b/applications/order/groovyScripts/entry/AddGiftCertificates.groovy
@@ -16,40 +16,40 @@
* specific language governing permissions and limitations
* under the License.
*/
-import org.apache.ofbiz.base.util.UtilValidate;
-import org.apache.ofbiz.entity.condition.EntityCondition;
-import org.apache.ofbiz.entity.condition.EntityOperator;
-import org.apache.ofbiz.product.store.ProductStoreWorker;
+import org.apache.ofbiz.base.util.UtilValidate
+import org.apache.ofbiz.entity.condition.EntityCondition
+import org.apache.ofbiz.entity.condition.EntityOperator
+import org.apache.ofbiz.product.store.ProductStoreWorker
-cart = session.getAttribute("shoppingCart");
-productStoreId = ProductStoreWorker.getProductStoreId(request);
+cart = session.getAttribute("shoppingCart")
+productStoreId = ProductStoreWorker.getProductStoreId(request)
if (productStoreId == null) {
- productStoreId = cart.getProductStoreId();
+ productStoreId = cart.getProductStoreId()
}
// Get Gift cards availbale in data
-giftCardCategories = from("ProductCategory").where("productCategoryTypeId", "GIFT_CARD_CATEGORY").queryList();
-giftCardProductList = [];
+giftCardCategories = from("ProductCategory").where("productCategoryTypeId", "GIFT_CARD_CATEGORY").queryList()
+giftCardProductList = []
if (UtilValidate.isNotEmpty(giftCardCategories)) {
giftCardCategories.each { giftCardCategory ->
- giftCardCategoryMembers = from("ProductCategoryMember").where("productCategoryId", giftCardCategory.productCategoryId).queryList();
+ giftCardCategoryMembers = from("ProductCategoryMember").where("productCategoryId", giftCardCategory.productCategoryId).queryList()
if (UtilValidate.isNotEmpty(giftCardCategoryMembers)) {
giftCardCategoryMembers.each { giftCardCategoryMember ->
- giftCardProducts = from("ProductAndPriceView").where("productId", giftCardCategoryMember.productId).queryList();
+ giftCardProducts = from("ProductAndPriceView").where("productId", giftCardCategoryMember.productId).queryList()
if (UtilValidate.isNotEmpty(giftCardProducts)) {
giftCardProducts.each { giftCardProduct ->
- giftCardProductList.add(giftCardProduct);
+ giftCardProductList.add(giftCardProduct)
}
}
}
}
}
}
-context.giftCardProductList = giftCardProductList;
+context.giftCardProductList = giftCardProductList
// Get Survey Id for Gift Certificates
-productStoreFinActSetting = from("ProductStoreFinActSetting").where("productStoreId", productStoreId, "finAccountTypeId", "GIFTCERT_ACCOUNT").queryOne();
-context.surveyId = productStoreFinActSetting.purchaseSurveyId;
+productStoreFinActSetting = from("ProductStoreFinActSetting").where("productStoreId", productStoreId, "finAccountTypeId", "GIFTCERT_ACCOUNT").queryOne()
+context.surveyId = productStoreFinActSetting.purchaseSurveyId
diff --git a/applications/order/groovyScripts/entry/AdditionalPartyListing.groovy b/applications/order/groovyScripts/entry/AdditionalPartyListing.groovy
index 09eea8c6c8..f3c814aa7a 100644
--- a/applications/order/groovyScripts/entry/AdditionalPartyListing.groovy
+++ b/applications/order/groovyScripts/entry/AdditionalPartyListing.groovy
@@ -17,39 +17,39 @@
* under the License.
*/
-import org.apache.ofbiz.order.shoppingcart.ShoppingCartEvents;
-import org.apache.ofbiz.order.shoppingcart.ShoppingCart;
-import org.apache.ofbiz.entity.*;
-import org.apache.ofbiz.base.util.*;
+import org.apache.ofbiz.order.shoppingcart.ShoppingCartEvents
+import org.apache.ofbiz.order.shoppingcart.ShoppingCart
+import org.apache.ofbiz.entity.*
+import org.apache.ofbiz.base.util.*
-cart = ShoppingCartEvents.getCartObject(request);
-additionalPartyRole = cart.getAdditionalPartyRoleMap();
+cart = ShoppingCartEvents.getCartObject(request)
+additionalPartyRole = cart.getAdditionalPartyRoleMap()
-roleData = [:];
-partyData = [:];
+roleData = [:]
+partyData = [:]
additionalPartyRole.each { roleTypeId, partyList ->
- roleData[roleTypeId] = from("RoleType").where("roleTypeId", roleTypeId).queryOne();
+ roleData[roleTypeId] = from("RoleType").where("roleTypeId", roleTypeId).queryOne()
partyList.each { partyId ->
- partyMap = [:];
- partyMap.partyId = partyId;
- party = from("Party").where("partyId", partyId).cache(true).queryOne();
+ partyMap = [:]
+ partyMap.partyId = partyId
+ party = from("Party").where("partyId", partyId).cache(true).queryOne()
if (party.partyTypeId.equals("PERSON")) {
- party = party.getRelatedOne("Person", true);
- partyMap.type = "person";
- partyMap.firstName = party.firstName;
- partyMap.lastName = party.lastName;
+ party = party.getRelatedOne("Person", true)
+ partyMap.type = "person"
+ partyMap.firstName = party.firstName
+ partyMap.lastName = party.lastName
} else {
- party = party.getRelatedOne("PartyGroup", true);
- partyMap.type = "group";
- partyMap.groupName = party.groupName;
+ party = party.getRelatedOne("PartyGroup", true)
+ partyMap.type = "group"
+ partyMap.groupName = party.groupName
}
- partyData[partyId] = partyMap;
+ partyData[partyId] = partyMap
}
}
-context.additionalPartyRoleMap = additionalPartyRole;
-context.roleList = additionalPartyRole.keySet();
-context.roleData = roleData;
-context.partyData = partyData;
+context.additionalPartyRoleMap = additionalPartyRole
+context.roleList = additionalPartyRole.keySet()
+context.roleData = roleData
+context.partyData = partyData
diff --git a/applications/order/groovyScripts/entry/BillSettings.groovy b/applications/order/groovyScripts/entry/BillSettings.groovy
index 535ef4e3b1..df93ac9661 100644
--- a/applications/order/groovyScripts/entry/BillSettings.groovy
+++ b/applications/order/groovyScripts/entry/BillSettings.groovy
@@ -17,77 +17,77 @@
* 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 = session.getAttribute("shoppingCart");
-orderPartyId = cart.getPartyId();
-currencyUomId = cart.getCurrency();
-context.cart = cart;
-context.paymentMethodType = request.getParameter("paymentMethodType");
+cart = session.getAttribute("shoppingCart")
+orderPartyId = cart.getPartyId()
+currencyUomId = cart.getCurrency()
+context.cart = cart
+context.paymentMethodType = request.getParameter("paymentMethodType")
// nuke the event messages
-request.removeAttribute("_EVENT_MESSAGE_");
+request.removeAttribute("_EVENT_MESSAGE_")
// If there's a paymentMethodId request attribute, the user has just created a new payment method,
// so put the new paymentMethodId in the context for the UI
-newPaymentMethodId=request.getAttribute("paymentMethodId");
+newPaymentMethodId=request.getAttribute("paymentMethodId")
if (newPaymentMethodId) {
- context.checkOutPaymentId = newPaymentMethodId;
+ context.checkOutPaymentId = newPaymentMethodId
}
if (orderPartyId && !orderPartyId.equals("_NA_")) {
- orderParty = from("Party").where("partyId", orderPartyId).queryOne();
- orderPerson = orderParty.getRelatedOne("Person", false);
- context.orderParty = orderParty;
- context.orderPerson = orderPerson;
+ orderParty = from("Party").where("partyId", orderPartyId).queryOne()
+ orderPerson = orderParty.getRelatedOne("Person", false)
+ context.orderParty = orderParty
+ context.orderPerson = orderPerson
if (orderParty) {
- context.paymentMethodList = EntityUtil.filterByDate(orderParty.getRelated("PaymentMethod", null, null, false), true);
+ context.paymentMethodList = EntityUtil.filterByDate(orderParty.getRelated("PaymentMethod", null, null, false), true)
- billingAccountList = BillingAccountWorker.makePartyBillingAccountList(userLogin, currencyUomId, orderPartyId, delegator, dispatcher);
+ billingAccountList = BillingAccountWorker.makePartyBillingAccountList(userLogin, currencyUomId, orderPartyId, delegator, dispatcher)
if (billingAccountList) {
- context.selectedBillingAccountId = cart.getBillingAccountId();
- context.billingAccountList = billingAccountList;
+ context.selectedBillingAccountId = cart.getBillingAccountId()
+ context.billingAccountList = billingAccountList
}
}
}
if (request.getParameter("useShipAddr") && cart.getShippingContactMechId()) {
- shippingContactMech = cart.getShippingContactMechId();
- postalAddress = from("PostalAddress").where("contactMechId", shippingContactMech).queryOne();
- context.postalFields = postalAddress;
+ shippingContactMech = cart.getShippingContactMechId()
+ postalAddress = from("PostalAddress").where("contactMechId", shippingContactMech).queryOne()
+ context.postalFields = postalAddress
} else {
- context.postalFields = UtilHttp.getParameterMap(request);
+ context.postalFields = UtilHttp.getParameterMap(request)
}
if (cart) {
if (cart.getPaymentMethodIds()) {
- checkOutPaymentId = cart.getPaymentMethodIds().get(0);
- context.checkOutPaymentId = checkOutPaymentId;
+ checkOutPaymentId = cart.getPaymentMethodIds().get(0)
+ context.checkOutPaymentId = checkOutPaymentId
if (!orderParty) {
- paymentMethod = from("PaymentMethod").where("paymentMethodId", checkOutPaymentId).queryOne();
+ paymentMethod = from("PaymentMethod").where("paymentMethodId", checkOutPaymentId).queryOne()
if ("CREDIT_CARD".equals(paymentMethod?.paymentMethodTypeId)) {
- paymentMethodType = "CC";
- account = paymentMethod.getRelatedOne("CreditCard", false);
- context.creditCard = account;
- context.paymentMethodType = paymentMethodType;
+ paymentMethodType = "CC"
+ account = paymentMethod.getRelatedOne("CreditCard", false)
+ context.creditCard = account
+ context.paymentMethodType = paymentMethodType
} else if ("EFT_ACCOUNT".equals(paymentMethod.paymentMethodTypeId)) {
- paymentMethodType = "EFT";
- account = paymentMethod.getRelatedOne("EftAccount", false);
- context.eftAccount = account;
- context.paymentMethodType = paymentMethodType;
+ paymentMethodType = "EFT"
+ account = paymentMethod.getRelatedOne("EftAccount", false)
+ context.eftAccount = account
+ context.paymentMethodType = paymentMethodType
}
if (account) {
- address = account.getRelatedOne("PostalAddress", false);
- context.postalAddress = address;
+ address = account.getRelatedOne("PostalAddress", false)
+ context.postalAddress = address
}
}
} else if (cart.getPaymentMethodTypeIds()) {
- checkOutPaymentId = cart.getPaymentMethodTypeIds().get(0);
- context.checkOutPaymentId = checkOutPaymentId;
+ checkOutPaymentId = cart.getPaymentMethodTypeIds().get(0)
+ context.checkOutPaymentId = checkOutPaymentId
}
}
diff --git a/applications/order/groovyScripts/entry/CheckInits.groovy b/applications/order/groovyScripts/entry/CheckInits.groovy
index d99487a22e..9d03e0513b 100644
--- a/applications/order/groovyScripts/entry/CheckInits.groovy
+++ b/applications/order/groovyScripts/entry/CheckInits.groovy
@@ -17,51 +17,51 @@
* under the License.
*/
-import org.apache.ofbiz.service.*;
-import org.apache.ofbiz.entity.*;
-import org.apache.ofbiz.entity.condition.*;
-import org.apache.ofbiz.entity.util.*;
-import org.apache.ofbiz.base.util.*;
-import org.apache.ofbiz.order.shoppingcart.*;
-import org.apache.ofbiz.party.party.PartyWorker;
-import org.apache.ofbiz.party.contact.ContactHelper;
-import org.apache.ofbiz.product.catalog.CatalogWorker;
-import org.apache.ofbiz.product.store.ProductStoreWorker;
-import org.apache.ofbiz.order.shoppingcart.product.ProductDisplayWorker;
-import org.apache.ofbiz.order.shoppingcart.product.ProductPromoWorker;
+import org.apache.ofbiz.service.*
+import org.apache.ofbiz.entity.*
+import org.apache.ofbiz.entity.condition.*
+import org.apache.ofbiz.entity.util.*
+import org.apache.ofbiz.base.util.*
+import org.apache.ofbiz.order.shoppingcart.*
+import org.apache.ofbiz.party.party.PartyWorker
+import org.apache.ofbiz.party.contact.ContactHelper
+import org.apache.ofbiz.product.catalog.CatalogWorker
+import org.apache.ofbiz.product.store.ProductStoreWorker
+import org.apache.ofbiz.order.shoppingcart.product.ProductDisplayWorker
+import org.apache.ofbiz.order.shoppingcart.product.ProductPromoWorker
-productStore = ProductStoreWorker.getProductStore(request);
+productStore = ProductStoreWorker.getProductStore(request)
if (productStore) {
- context.defaultProductStore = productStore;
+ context.defaultProductStore = productStore
if (productStore.defaultSalesChannelEnumId)
- context.defaultSalesChannel = from("Enumeration").where("enumId", productStore.defaultSalesChannelEnumId).cache(true).queryOne();
+ context.defaultSalesChannel = from("Enumeration").where("enumId", productStore.defaultSalesChannelEnumId).cache(true).queryOne()
}
// Get the Cart
-shoppingCart = session.getAttribute("shoppingCart");
-context.shoppingCart = shoppingCart;
+shoppingCart = session.getAttribute("shoppingCart")
+context.shoppingCart = shoppingCart
-salesChannels = from("Enumeration").where("enumTypeId", "ORDER_SALES_CHANNEL").orderBy("sequenceId").cache(true).queryList();
-context.salesChannels = salesChannels;
+salesChannels = from("Enumeration").where("enumTypeId", "ORDER_SALES_CHANNEL").orderBy("sequenceId").cache(true).queryList()
+context.salesChannels = salesChannels
-productStores = from("ProductStore").orderBy("productStoreId", "storeName").cache(true).queryList();
-context.productStores = productStores;
+productStores = from("ProductStore").orderBy("productStoreId", "storeName").cache(true).queryList()
+context.productStores = productStores
-suppliers = from("PartyRoleAndPartyDetail").where("roleTypeId", "SUPPLIER").orderBy("groupName", "partyId").queryList();
-context.suppliers = suppliers;
+suppliers = from("PartyRoleAndPartyDetail").where("roleTypeId", "SUPPLIER").orderBy("groupName", "partyId").queryList()
+context.suppliers = suppliers
-organizations = from("PartyAcctgPrefAndGroup").queryList();
-context.organizations = organizations;
+organizations = from("PartyAcctgPrefAndGroup").queryList()
+context.organizations = organizations
// Set Shipping From the Party
-partyId = null;
-partyId = parameters.partyId;
+partyId = null
+partyId = parameters.partyId
if (partyId) {
- party = from("Person").where("partyId", partyId).queryOne();
+ party = from("Person").where("partyId", partyId).queryOne()
if (party) {
- contactMech = EntityUtil.getFirst(ContactHelper.getContactMech(party, "SHIPPING_LOCATION", "POSTAL_ADDRESS", false));
+ contactMech = EntityUtil.getFirst(ContactHelper.getContactMech(party, "SHIPPING_LOCATION", "POSTAL_ADDRESS", false))
if (contactMech) {
- ShoppingCart shoppingCart = ShoppingCartEvents.getCartObject(request);
- shoppingCart.setAllShippingContactMechId(contactMech.contactMechId);
+ ShoppingCart shoppingCart = ShoppingCartEvents.getCartObject(request)
+ shoppingCart.setAllShippingContactMechId(contactMech.contactMechId)
}
}
}
diff --git a/applications/order/groovyScripts/entry/CheckoutOptions.groovy b/applications/order/groovyScripts/entry/CheckoutOptions.groovy
index 8a763fb12d..c3fac9019b 100644
--- a/applications/order/groovyScripts/entry/CheckoutOptions.groovy
+++ b/applications/order/groovyScripts/entry/CheckoutOptions.groovy
@@ -17,81 +17,81 @@
* under the License.
*/
-import org.apache.ofbiz.base.util.*;
-import org.apache.ofbiz.entity.*;
-import org.apache.ofbiz.entity.util.*;
-import org.apache.ofbiz.accounting.payment.*;
-import org.apache.ofbiz.party.contact.*;
-import org.apache.ofbiz.product.store.*;
-import org.apache.ofbiz.order.shoppingcart.shipping.*;
+import org.apache.ofbiz.base.util.*
+import org.apache.ofbiz.entity.*
+import org.apache.ofbiz.entity.util.*
+import org.apache.ofbiz.accounting.payment.*
+import org.apache.ofbiz.party.contact.*
+import org.apache.ofbiz.product.store.*
+import org.apache.ofbiz.order.shoppingcart.shipping.*
-shoppingCart = session.getAttribute("shoppingCart");
-currencyUomId = shoppingCart.getCurrency();
-partyId = shoppingCart.getPartyId();
-party = from("Party").where("partyId", partyId).cache(true).queryOne();
-productStore = ProductStoreWorker.getProductStore(request);
+shoppingCart = session.getAttribute("shoppingCart")
+currencyUomId = shoppingCart.getCurrency()
+partyId = shoppingCart.getPartyId()
+party = from("Party").where("partyId", partyId).cache(true).queryOne()
+productStore = ProductStoreWorker.getProductStore(request)
-shippingEstWpr = null;
+shippingEstWpr = null
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()
// Reassign items requiring drop-shipping to new or existing drop-ship groups
- shoppingCart.createDropShipGroups(dispatcher);
+ shoppingCart.createDropShipGroups(dispatcher)
}
-profiledefs = from("PartyProfileDefault").where("partyId", userLogin.partyId, "productStoreId", productStoreId).queryOne();
-context.profiledefs = profiledefs;
+profiledefs = from("PartyProfileDefault").where("partyId", userLogin.partyId, "productStoreId", productStoreId).queryOne()
+context.profiledefs = profiledefs
-context.shoppingCart = shoppingCart;
-context.userLogin = userLogin;
-context.productStoreId = productStore.get("productStoreId");
-context.productStore = productStore;
-shipToParty = from("Party").where("partyId", shoppingCart.getShipToCustomerPartyId()).cache(true).queryOne();
-context.shippingContactMechList = ContactHelper.getContactMech(shipToParty, "SHIPPING_LOCATION", "POSTAL_ADDRESS", false);
-context.emailList = ContactHelper.getContactMechByType(party, "EMAIL_ADDRESS", false);
+context.shoppingCart = shoppingCart
+context.userLogin = userLogin
+context.productStoreId = productStore.get("productStoreId")
+context.productStore = productStore
+shipToParty = from("Party").where("partyId", shoppingCart.getShipToCustomerPartyId()).cache(true).queryOne()
+context.shippingContactMechList = ContactHelper.getContactMech(shipToParty, "SHIPPING_LOCATION", "POSTAL_ADDRESS", false)
+context.emailList = ContactHelper.getContactMechByType(party, "EMAIL_ADDRESS", false)
if (shoppingCart.getShipmentMethodTypeId() && shoppingCart.getCarrierPartyId()) {
- context.chosenShippingMethod = shoppingCart.getShipmentMethodTypeId() + '@' + shoppingCart.getCarrierPartyId();
+ context.chosenShippingMethod = shoppingCart.getShipmentMethodTypeId() + '@' + shoppingCart.getCarrierPartyId()
} else if (profiledefs?.defaultShipMeth) {
- context.chosenShippingMethod = profiledefs.defaultShipMeth;
+ context.chosenShippingMethod = profiledefs.defaultShipMeth
}
// other profile defaults
if (!shoppingCart.getShippingAddress() && profiledefs?.defaultShipAddr) {
- shoppingCart.setAllShippingContactMechId(profiledefs.defaultShipAddr);
+ shoppingCart.setAllShippingContactMechId(profiledefs.defaultShipAddr)
}
if (shoppingCart.selectedPayments() == 0 && profiledefs?.defaultPayMeth) {
- shoppingCart.addPayment(profiledefs.defaultPayMeth);
+ shoppingCart.addPayment(profiledefs.defaultPayMeth)
}
// create a list containing all the parties associated to the current cart, useful to change
// the ship to party id
-cartParties = [shoppingCart.getShipToCustomerPartyId()];
+cartParties = [shoppingCart.getShipToCustomerPartyId()]
if (!cartParties.contains(partyId)) {
- cartParties.add(partyId);
+ cartParties.add(partyId)
}
if (!cartParties.contains(shoppingCart.getOrderPartyId())) {
- cartParties.add(shoppingCart.getOrderPartyId());
+ cartParties.add(shoppingCart.getOrderPartyId())
}
if (!cartParties.contains(shoppingCart.getPlacingCustomerPartyId())) {
- cartParties.add(shoppingCart.getPlacingCustomerPartyId());
+ cartParties.add(shoppingCart.getPlacingCustomerPartyId())
}
if (!cartParties.contains(shoppingCart.getBillToCustomerPartyId())) {
- cartParties.add(shoppingCart.getBillToCustomerPartyId());
+ cartParties.add(shoppingCart.getBillToCustomerPartyId())
}
if (!cartParties.contains(shoppingCart.getEndUserCustomerPartyId())) {
- cartParties.add(shoppingCart.getEndUserCustomerPartyId());
+ cartParties.add(shoppingCart.getEndUserCustomerPartyId())
}
if (!cartParties.contains(shoppingCart.getSupplierAgentPartyId())) {
- cartParties.add(shoppingCart.getSupplierAgentPartyId());
+ cartParties.add(shoppingCart.getSupplierAgentPartyId())
}
-salesReps = shoppingCart.getAdditionalPartyRoleMap().SALES_REP;
+salesReps = shoppingCart.getAdditionalPartyRoleMap().SALES_REP
if (salesReps) {
salesReps.each { salesRep ->
if (!cartParties.contains(salesRep)) {
- cartParties.add(salesRep);
+ cartParties.add(salesRep)
}
}
}
-context.cartParties = cartParties;
+context.cartParties = cartParties
diff --git a/applications/order/groovyScripts/entry/CheckoutPayment.groovy b/applications/order/groovyScripts/entry/CheckoutPayment.groovy
index e41ea38e0e..f675fe8e6d 100644
--- a/applications/order/groovyScripts/entry/CheckoutPayment.groovy
+++ b/applications/order/groovyScripts/entry/CheckoutPayment.groovy
@@ -17,59 +17,59 @@
* under the License.
*/
-import org.apache.ofbiz.base.util.*;
-import org.apache.ofbiz.entity.*;
-import org.apache.ofbiz.entity.util.*;
-import org.apache.ofbiz.accounting.payment.*;
-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.accounting.payment.*
+import org.apache.ofbiz.party.contact.*
+import org.apache.ofbiz.product.store.*
-cart = session.getAttribute("shoppingCart");
-currencyUomId = cart.getCurrency();
-userLogin = session.getAttribute("userLogin");
-partyId = cart.getPartyId();
-party = from("Party").where("partyId", partyId).cache(true).queryOne();
-productStoreId = ProductStoreWorker.getProductStoreId(request);
+cart = session.getAttribute("shoppingCart")
+currencyUomId = cart.getCurrency()
+userLogin = session.getAttribute("userLogin")
+partyId = cart.getPartyId()
+party = from("Party").where("partyId", partyId).cache(true).queryOne()
+productStoreId = ProductStoreWorker.getProductStoreId(request)
-checkOutPaymentId = "";
+checkOutPaymentId = ""
if (cart) {
if (cart.getPaymentMethodIds()) {
- checkOutPaymentId = cart.getPaymentMethodIds().get(0);
+ checkOutPaymentId = cart.getPaymentMethodIds().get(0)
} else if (cart.getPaymentMethodTypeIds()) {
- checkOutPaymentId = cart.getPaymentMethodTypeIds().get(0);
+ checkOutPaymentId = cart.getPaymentMethodTypeIds().get(0)
}
}
-finAccounts = from("FinAccountAndRole").where("partyId", partyId, "roleTypeId", "OWNER").filterByDate(UtilDateTime.nowTimestamp(), "fromDate", "thruDate", "roleFromDate", "roleThruDate").queryList();
-context.finAccounts = finAccounts;
+finAccounts = from("FinAccountAndRole").where("partyId", partyId, "roleTypeId", "OWNER").filterByDate(UtilDateTime.nowTimestamp(), "fromDate", "thruDate", "roleFromDate", "roleThruDate").queryList()
+context.finAccounts = finAccounts
-context.shoppingCart = cart;
-context.userLogin = userLogin;
-context.productStoreId = productStoreId;
-context.checkOutPaymentId = checkOutPaymentId;
-context.paymentMethodList = EntityUtil.filterByDate(party.getRelated("PaymentMethod", null, ["paymentMethodTypeId"], false), true);
+context.shoppingCart = cart
+context.userLogin = userLogin
+context.productStoreId = productStoreId
+context.checkOutPaymentId = checkOutPaymentId
+context.paymentMethodList = EntityUtil.filterByDate(party.getRelated("PaymentMethod", null, ["paymentMethodTypeId"], false), true)
-billingAccountList = BillingAccountWorker.makePartyBillingAccountList(userLogin, currencyUomId, partyId, delegator, dispatcher);
+billingAccountList = BillingAccountWorker.makePartyBillingAccountList(userLogin, currencyUomId, partyId, delegator, dispatcher)
if (billingAccountList) {
- context.selectedBillingAccountId = cart.getBillingAccountId();
- context.billingAccountList = billingAccountList;
+ context.selectedBillingAccountId = cart.getBillingAccountId()
+ context.billingAccountList = billingAccountList
}
-checkIdealPayment = false;
-productStore = ProductStoreWorker.getProductStore(request);
-productStorePaymentSettingList = productStore.getRelated("ProductStorePaymentSetting", null, null, true);
-productStorePaymentSettingIter = productStorePaymentSettingList.iterator();
+checkIdealPayment = false
+productStore = ProductStoreWorker.getProductStore(request)
+productStorePaymentSettingList = productStore.getRelated("ProductStorePaymentSetting", null, null, true)
+productStorePaymentSettingIter = productStorePaymentSettingList.iterator()
while (productStorePaymentSettingIter.hasNext()) {
- productStorePaymentSetting = productStorePaymentSettingIter.next();
+ productStorePaymentSetting = productStorePaymentSettingIter.next()
if (productStorePaymentSetting.get("paymentMethodTypeId") == "EXT_IDEAL") {
- checkIdealPayment = true;
+ checkIdealPayment = true
}
}
if (checkIdealPayment) {
- issuerList = org.apache.ofbiz.accounting.thirdparty.ideal.IdealEvents.getIssuerList();
+ issuerList = org.apache.ofbiz.accounting.thirdparty.ideal.IdealEvents.getIssuerList()
if (issuerList) {
- context.issuerList = issuerList;
+ context.issuerList = issuerList
}
}
diff --git a/applications/order/groovyScripts/entry/CheckoutReview.groovy b/applications/order/groovyScripts/entry/CheckoutReview.groovy
index 39021d157e..8369b985b7 100644
--- a/applications/order/groovyScripts/entry/CheckoutReview.groovy
+++ b/applications/order/groovyScripts/entry/CheckoutReview.groovy
@@ -17,140 +17,140 @@
* under the License.
*/
-import java.lang.*;
-import java.math.BigDecimal;
-import org.apache.ofbiz.base.util.*;
-import org.apache.ofbiz.entity.*;
-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.order.shoppingcart.*;
-import org.apache.ofbiz.product.store.*;
-import org.apache.ofbiz.party.party.PartyWorker;
+import java.lang.*
+import java.math.BigDecimal
+import org.apache.ofbiz.base.util.*
+import org.apache.ofbiz.entity.*
+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.order.shoppingcart.*
+import org.apache.ofbiz.product.store.*
+import org.apache.ofbiz.party.party.PartyWorker
import org.apache.ofbiz.webapp.website.WebSiteWorker
-cart = ShoppingCartEvents.getCartObject(request);
-context.cart = cart;
-context.currencyUomId = cart.getCurrency();
-context.productStore = ProductStoreWorker.getProductStore(request);
+cart = ShoppingCartEvents.getCartObject(request)
+context.cart = cart
+context.currencyUomId = cart.getCurrency()
+context.productStore = ProductStoreWorker.getProductStore(request)
// nuke the event messages
-request.removeAttribute("_EVENT_MESSAGE_");
+request.removeAttribute("_EVENT_MESSAGE_")
-orderItems = cart.makeOrderItems();
-context.orderItems = orderItems;
+orderItems = cart.makeOrderItems()
+context.orderItems = orderItems
-orderAdjustments = cart.makeAllAdjustments();
+orderAdjustments = cart.makeAllAdjustments()
-orderItemShipGroupInfo = cart.makeAllShipGroupInfos();
+orderItemShipGroupInfo = cart.makeAllShipGroupInfos()
if (orderItemShipGroupInfo) {
orderItemShipGroupInfo.each { osiInfo ->
if ("OrderAdjustment".equals(osiInfo.getEntityName())) {
// shipping / tax adjustment(s)
- orderAdjustments.add(osiInfo);
+ orderAdjustments.add(osiInfo)
}
}
}
-context.orderAdjustments = orderAdjustments;
+context.orderAdjustments = orderAdjustments
-workEfforts = cart.makeWorkEfforts();
-context.workEfforts = workEfforts;
+workEfforts = cart.makeWorkEfforts()
+context.workEfforts = workEfforts
-orderHeaderAdjustments = OrderReadHelper.getOrderHeaderAdjustments(orderAdjustments, null);
-context.orderHeaderAdjustments = orderHeaderAdjustments;
-context.headerAdjustmentsToShow = OrderReadHelper.filterOrderAdjustments(orderHeaderAdjustments, true, false, false, false, false);
+orderHeaderAdjustments = OrderReadHelper.getOrderHeaderAdjustments(orderAdjustments, null)
+context.orderHeaderAdjustments = orderHeaderAdjustments
+context.headerAdjustmentsToShow = OrderReadHelper.filterOrderAdjustments(orderHeaderAdjustments, true, false, false, false, false)
-orderSubTotal = OrderReadHelper.getOrderItemsSubTotal(orderItems, orderAdjustments);
-context.orderSubTotal = orderSubTotal;
-context.placingCustomerPerson = userLogin?.getRelatedOne("Person", false);
-context.shippingAddress = cart.getShippingAddress();
+orderSubTotal = OrderReadHelper.getOrderItemsSubTotal(orderItems, orderAdjustments)
+context.orderSubTotal = orderSubTotal
+context.placingCustomerPerson = userLogin?.getRelatedOne("Person", false)
+context.shippingAddress = cart.getShippingAddress()
-paymentMethods = cart.getPaymentMethods();
-paymentMethod = null;
+paymentMethods = cart.getPaymentMethods()
+paymentMethod = null
if (paymentMethods) {
- paymentMethod = paymentMethods.get(0);
- context.paymentMethod = paymentMethod;
+ paymentMethod = paymentMethods.get(0)
+ context.paymentMethod = paymentMethod
}
if ("CREDIT_CARD".equals(paymentMethod?.paymentMethodTypeId)) {
- creditCard = paymentMethod.getRelatedOne("CreditCard", true);
- context.creditCard = creditCard;
- context.formattedCardNumber = ContactHelper.formatCreditCard(creditCard);
+ creditCard = paymentMethod.getRelatedOne("CreditCard", true)
+ context.creditCard = creditCard
+ context.formattedCardNumber = ContactHelper.formatCreditCard(creditCard)
} else if ("EFT_ACCOUNT".equals(paymentMethod?.paymentMethodTypeId)) {
- eftAccount = paymentMethod.getRelatedOne("EftAccount", true);
- context.eftAccount = eftAccount;
+ eftAccount = paymentMethod.getRelatedOne("EftAccount", true)
+ context.eftAccount = eftAccount
}
-paymentMethodTypeIds = cart.getPaymentMethodTypeIds();
-paymentMethodType = null;
-paymentMethodTypeId = null;
+paymentMethodTypeIds = cart.getPaymentMethodTypeIds()
+paymentMethodType = null
+paymentMethodTypeId = null
if (paymentMethodTypeIds) {
- paymentMethodTypeId = paymentMethodTypeIds.get(0);
- paymentMethodType = from("PaymentMethodType").where("paymentMethodTypeId", paymentMethodTypeId).queryOne();
- context.paymentMethodType = paymentMethodType;
+ paymentMethodTypeId = paymentMethodTypeIds.get(0)
+ paymentMethodType = from("PaymentMethodType").where("paymentMethodTypeId", paymentMethodTypeId).queryOne()
+ context.paymentMethodType = paymentMethodType
}
-webSiteId = WebSiteWorker.getWebSiteId(request);
-productStoreId = ProductStoreWorker.getProductStoreId(request);
-productStore = ProductStoreWorker.getProductStore(productStoreId, delegator);
+webSiteId = WebSiteWorker.getWebSiteId(request)
+productStoreId = ProductStoreWorker.getProductStoreId(request)
+productStore = ProductStoreWorker.getProductStore(productStoreId, delegator)
if (productStore) {
- 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
}
-billingAddress = null;
+billingAddress = null
if (paymentMethod) {
- creditCard = paymentMethod.getRelatedOne("CreditCard", false);
- billingAddress = creditCard?.getRelatedOne("PostalAddress", false);
+ creditCard = paymentMethod.getRelatedOne("CreditCard", false)
+ billingAddress = creditCard?.getRelatedOne("PostalAddress", false)
}
-if (billingAddress) context.billingAddress = billingAddress;
+if (billingAddress) context.billingAddress = billingAddress
-billingAccount = cart.getBillingAccountId() ? from("BillingAccount").where("billingAccountId", cart.getBillingAccountId()).queryOne() : null;
-if (billingAccount) context.billingAccount = billingAccount;
+billingAccount = cart.getBillingAccountId() ? from("BillingAccount").where("billingAccountId", cart.getBillingAccountId()).queryOne() : null
+if (billingAccount) context.billingAccount = billingAccount
-context.customerPoNumber = cart.getPoNumber();
-context.carrierPartyId = cart.getCarrierPartyId();
-context.shipmentMethodTypeId = cart.getShipmentMethodTypeId();
-context.shippingInstructions = cart.getShippingInstructions();
-context.maySplit = cart.getMaySplit();
-context.giftMessage = cart.getGiftMessage();
-context.isGift = cart.getIsGift();
-context.shipBeforeDate = cart.getShipBeforeDate();
-context.shipAfterDate = cart.getShipAfterDate();
+context.customerPoNumber = cart.getPoNumber()
+context.carrierPartyId = cart.getCarrierPartyId()
+context.shipmentMethodTypeId = cart.getShipmentMethodTypeId()
+context.shippingInstructions = cart.getShippingInstructions()
+context.maySplit = cart.getMaySplit()
+context.giftMessage = cart.getGiftMessage()
+context.isGift = cart.getIsGift()
+context.shipBeforeDate = cart.getShipBeforeDate()
+context.shipAfterDate = cart.getShipAfterDate()
-shipmentMethodType = from("ShipmentMethodType").where("shipmentMethodTypeId", cart.getShipmentMethodTypeId()).queryOne();
-if (shipmentMethodType) context.shipMethDescription = shipmentMethodType.description;
+shipmentMethodType = from("ShipmentMethodType").where("shipmentMethodTypeId", cart.getShipmentMethodTypeId()).queryOne()
+if (shipmentMethodType) context.shipMethDescription = shipmentMethodType.description
-orh = new OrderReadHelper(orderAdjustments, orderItems);
-context.localOrderReadHelper = orh;
+orh = new OrderReadHelper(orderAdjustments, orderItems)
+context.localOrderReadHelper = orh
-shippingAmount = OrderReadHelper.getAllOrderItemsAdjustmentsTotal(orderItems, orderAdjustments, false, false, true);
-shippingAmount = shippingAmount.add(OrderReadHelper.calcOrderAdjustments(orderHeaderAdjustments, orderSubTotal, false, false, true));
-context.orderShippingTotal = shippingAmount;
+shippingAmount = OrderReadHelper.getAllOrderItemsAdjustmentsTotal(orderItems, orderAdjustments, false, false, true)
+shippingAmount = shippingAmount.add(OrderReadHelper.calcOrderAdjustments(orderHeaderAdjustments, orderSubTotal, false, false, true))
+context.orderShippingTotal = shippingAmount
-taxAmount = OrderReadHelper.getOrderTaxByTaxAuthGeoAndParty(orderAdjustments).taxGrandTotal;
-context.orderTaxTotal = taxAmount;
-context.orderGrandTotal = OrderReadHelper.getOrderGrandTotal(orderItems, orderAdjustments);
+taxAmount = OrderReadHelper.getOrderTaxByTaxAuthGeoAndParty(orderAdjustments).taxGrandTotal
+context.orderTaxTotal = taxAmount
+context.orderGrandTotal = OrderReadHelper.getOrderGrandTotal(orderItems, orderAdjustments)
-orderName = cart.getOrderName();
-context.orderName = orderName;
+orderName = cart.getOrderName()
+context.orderName = orderName
-orderPartyId = cart.getPartyId();
+orderPartyId = cart.getPartyId()
if (orderPartyId) {
- partyMap = PartyWorker.getPartyOtherValues(request, orderPartyId, "orderParty", "orderPerson", "orderPartyGroup");
+ partyMap = PartyWorker.getPartyOtherValues(request, orderPartyId, "orderParty", "orderPerson", "orderPartyGroup")
if (partyMap) {
partyMap.each { key, value ->
- context[key] = value;
+ context[key] = value
}
}
}
-orderTerms = cart.getOrderTerms();
+orderTerms = cart.getOrderTerms()
if (orderTerms) {
- context.orderTerms = orderTerms;
+ context.orderTerms = orderTerms
}
-orderType = cart.getOrderType();
-context.orderType = orderType;
+orderType = cart.getOrderType()
+context.orderType = orderType
diff --git a/applications/order/groovyScripts/entry/CheckoutShippingAddress.groovy b/applications/order/groovyScripts/entry/CheckoutShippingAddress.groovy
index fe2bc3c0aa..1cc8e99628 100644
--- a/applications/order/groovyScripts/entry/CheckoutShippingAddress.groovy
+++ b/applications/order/groovyScripts/entry/CheckoutShippingAddress.groovy
@@ -17,36 +17,36 @@
* under the License.
*/
-import org.apache.ofbiz.base.util.*;
-import org.apache.ofbiz.entity.*;
-import org.apache.ofbiz.entity.util.*;
-import org.apache.ofbiz.party.contact.*;
-import org.apache.ofbiz.product.store.*;
-import org.apache.ofbiz.entity.util.EntityUtil;
-import org.apache.ofbiz.entity.condition.EntityCondition;
-import org.apache.ofbiz.entity.condition.EntityExpr;
-import org.apache.ofbiz.entity.condition.EntityOperator;
+import org.apache.ofbiz.base.util.*
+import org.apache.ofbiz.entity.*
+import org.apache.ofbiz.entity.util.*
+import org.apache.ofbiz.party.contact.*
+import org.apache.ofbiz.product.store.*
+import org.apache.ofbiz.entity.util.EntityUtil
+import org.apache.ofbiz.entity.condition.EntityCondition
+import org.apache.ofbiz.entity.condition.EntityExpr
+import org.apache.ofbiz.entity.condition.EntityOperator
-cart = session.getAttribute("shoppingCart");
-party = userLogin.getRelatedOne("Party", false);
-partyId = party.partyId;
-productStoreId = ProductStoreWorker.getProductStoreId(request);
+cart = session.getAttribute("shoppingCart")
+party = userLogin.getRelatedOne("Party", false)
+partyId = party.partyId
+productStoreId = ProductStoreWorker.getProductStoreId(request)
-productStoreId = cart.getProductStoreId();
+productStoreId = cart.getProductStoreId()
if (productStoreId) {
- productStore = ProductStoreWorker.getProductStore(productStoreId, delegator);
- payToPartyId = productStore.payToPartyId;
+ productStore = ProductStoreWorker.getProductStore(productStoreId, delegator)
+ payToPartyId = productStore.payToPartyId
}
-shippingContactMechId = request.getParameter("shipping_contact_mech_id");
+shippingContactMechId = request.getParameter("shipping_contact_mech_id")
for (shipGroupIndex = 0; shipGroupIndex < cart.getShipGroupSize(); shipGroupIndex++) {
- supplierPartyId = cart.getSupplierPartyId(shipGroupIndex);
- context[shipGroupIndex + "_supplierPartyId"] = supplierPartyId;
+ supplierPartyId = cart.getSupplierPartyId(shipGroupIndex)
+ context[shipGroupIndex + "_supplierPartyId"] = supplierPartyId
}
-agreements = from("Agreement").where("partyIdTo", payToPartyId, "partyIdFrom", partyId).filterByDate().cache(true).queryList();
-context.agreements = agreements;
+agreements = from("Agreement").where("partyIdTo", payToPartyId, "partyIdFrom", partyId).filterByDate().cache(true).queryList()
+context.agreements = agreements
-context.shoppingCart = cart;
-context.userLogin = userLogin;
-context.productStoreId = productStoreId;
-context.shippingContactMechList = ContactHelper.getContactMech(party, "SHIPPING_LOCATION", "POSTAL_ADDRESS", false);
+context.shoppingCart = cart
+context.userLogin = userLogin
+context.productStoreId = productStoreId
+context.shippingContactMechList = ContactHelper.getContactMech(party, "SHIPPING_LOCATION", "POSTAL_ADDRESS", false)
diff --git a/applications/order/groovyScripts/entry/OptionSettings.groovy b/applications/order/groovyScripts/entry/OptionSettings.groovy
index ad16552b0c..40746f7625 100644
--- a/applications/order/groovyScripts/entry/OptionSettings.groovy
+++ b/applications/order/groovyScripts/entry/OptionSettings.groovy
@@ -17,54 +17,54 @@
* under the License.
*/
-import java.sql.Timestamp;
-import org.apache.ofbiz.entity.*;
-import org.apache.ofbiz.base.util.*;
-import org.apache.ofbiz.order.shoppingcart.*;
-import org.apache.ofbiz.party.contact.*;
-import org.apache.ofbiz.product.store.*;
+import java.sql.Timestamp
+import org.apache.ofbiz.entity.*
+import org.apache.ofbiz.base.util.*
+import org.apache.ofbiz.order.shoppingcart.*
+import org.apache.ofbiz.party.contact.*
+import org.apache.ofbiz.product.store.*
-cart = session.getAttribute("shoppingCart");
-context.cart = cart;
+cart = session.getAttribute("shoppingCart")
+context.cart = cart
-productStore = ProductStoreWorker.getProductStore(request);
+productStore = ProductStoreWorker.getProductStore(request)
if (productStore) {
- context.productStore = productStore;
- context.carrierShipmentMethodList = from("ProductStoreShipmentMethView").where("productStoreId", productStore.productStoreId).orderBy("sequenceNumber").cache(true).queryList();
+ context.productStore = productStore
+ context.carrierShipmentMethodList = from("ProductStoreShipmentMethView").where("productStoreId", productStore.productStoreId).orderBy("sequenceNumber").cache(true).queryList()
}
// nuke the event messages
-request.removeAttribute("_EVENT_MESSAGE_");
+request.removeAttribute("_EVENT_MESSAGE_")
-party = null;
-orderPartyIdId = cart.getPartyId();
+party = null
+orderPartyIdId = cart.getPartyId()
if (orderPartyIdId) {
- orderPartyId = from("Party").where("partyId", orderPartyIdId).queryOne();
- context.orderPartyId = orderPartyId;
+ orderPartyId = from("Party").where("partyId", orderPartyIdId).queryOne()
+ context.orderPartyId = orderPartyId
}
-context.emailList = ContactHelper.getContactMechByType(orderPartyId, "EMAIL_ADDRESS", false);
+context.emailList = ContactHelper.getContactMechByType(orderPartyId, "EMAIL_ADDRESS", false)
// create the beforeDate for calendar
-fromCal = Calendar.getInstance();
-fromCal.setTime(new java.util.Date());
-fromCal.set(Calendar.HOUR_OF_DAY, fromCal.getActualMinimum(Calendar.HOUR_OF_DAY));
-fromCal.set(Calendar.MINUTE, fromCal.getActualMinimum(Calendar.MINUTE));
-fromCal.set(Calendar.SECOND, fromCal.getActualMinimum(Calendar.SECOND));
-fromCal.set(Calendar.MILLISECOND, fromCal.getActualMinimum(Calendar.MILLISECOND));
-fromTs = new Timestamp(fromCal.getTimeInMillis());
-fromStr = fromTs.toString();
-fromStr = fromStr.substring(0, fromStr.indexOf('.'));
-context.beforeDateStr = fromStr;
+fromCal = Calendar.getInstance()
+fromCal.setTime(new java.util.Date())
+fromCal.set(Calendar.HOUR_OF_DAY, fromCal.getActualMinimum(Calendar.HOUR_OF_DAY))
+fromCal.set(Calendar.MINUTE, fromCal.getActualMinimum(Calendar.MINUTE))
+fromCal.set(Calendar.SECOND, fromCal.getActualMinimum(Calendar.SECOND))
+fromCal.set(Calendar.MILLISECOND, fromCal.getActualMinimum(Calendar.MILLISECOND))
+fromTs = new Timestamp(fromCal.getTimeInMillis())
+fromStr = fromTs.toString()
+fromStr = fromStr.substring(0, fromStr.indexOf('.'))
+context.beforeDateStr = fromStr
// create the afterDate for calendar
-toCal = Calendar.getInstance();
-toCal.setTime(new java.util.Date());
-toCal.set(Calendar.HOUR_OF_DAY, toCal.getActualMaximum(Calendar.HOUR_OF_DAY));
-toCal.set(Calendar.MINUTE, toCal.getActualMaximum(Calendar.MINUTE));
-toCal.set(Calendar.SECOND, toCal.getActualMaximum(Calendar.SECOND));
-toCal.set(Calendar.MILLISECOND, toCal.getActualMaximum(Calendar.MILLISECOND));
-toTs = new Timestamp(toCal.getTimeInMillis());
-toStr = toTs.toString();
-context.afterDateStr = toStr;
+toCal = Calendar.getInstance()
+toCal.setTime(new java.util.Date())
+toCal.set(Calendar.HOUR_OF_DAY, toCal.getActualMaximum(Calendar.HOUR_OF_DAY))
+toCal.set(Calendar.MINUTE, toCal.getActualMaximum(Calendar.MINUTE))
+toCal.set(Calendar.SECOND, toCal.getActualMaximum(Calendar.SECOND))
+toCal.set(Calendar.MILLISECOND, toCal.getActualMaximum(Calendar.MILLISECOND))
+toTs = new Timestamp(toCal.getTimeInMillis())
+toStr = toTs.toString()
+context.afterDateStr = toStr
diff --git a/applications/order/groovyScripts/entry/OrderAgreements.groovy b/applications/order/groovyScripts/entry/OrderAgreements.groovy
index f4627a75ef..e2764fd8d0 100644
--- a/applications/order/groovyScripts/entry/OrderAgreements.groovy
+++ b/applications/order/groovyScripts/entry/OrderAgreements.groovy
@@ -17,79 +17,79 @@
* under the License.
*/
-import org.apache.ofbiz.entity.condition.EntityCondition;
-import org.apache.ofbiz.entity.condition.EntityOperator;
-import org.apache.ofbiz.entity.util.EntityUtil;
-import org.apache.ofbiz.order.shoppingcart.*;
-import org.apache.ofbiz.product.catalog.CatalogWorker;
+import org.apache.ofbiz.entity.condition.EntityCondition
+import org.apache.ofbiz.entity.condition.EntityOperator
+import org.apache.ofbiz.entity.util.EntityUtil
+import org.apache.ofbiz.order.shoppingcart.*
+import org.apache.ofbiz.product.catalog.CatalogWorker
-shoppingCart = ShoppingCartEvents.getCartObject(request);
-context.cart = shoppingCart;
+shoppingCart = ShoppingCartEvents.getCartObject(request)
+context.cart = shoppingCart
// get applicable agreements for order entry
if ('PURCHASE_ORDER'.equals(shoppingCart.getOrderType())) {
// for a purchase order, orderPartyId = billFromVendor (the supplier)
- supplierPartyId = shoppingCart.getOrderPartyId();
- customerPartyId = shoppingCart.getBillToCustomerPartyId();
+ supplierPartyId = shoppingCart.getOrderPartyId()
+ customerPartyId = shoppingCart.getBillToCustomerPartyId()
// the agreement for a purchse order is from us to the supplier
agreementCondition = EntityCondition.makeCondition([
EntityCondition.makeCondition('partyIdTo', EntityOperator.EQUALS, supplierPartyId),
EntityCondition.makeCondition('partyIdFrom', EntityOperator.EQUALS, customerPartyId)
- ], EntityOperator.AND);
+ ], EntityOperator.AND)
agreementRoleCondition = EntityCondition.makeCondition([
EntityCondition.makeCondition('partyId', EntityOperator.EQUALS, supplierPartyId),
EntityCondition.makeCondition('roleTypeId', EntityOperator.EQUALS, 'SUPPLIER')
- ], EntityOperator.AND);
+ ], EntityOperator.AND)
} else {
// for a sales order, orderPartyId = billToCustomer (the customer)
- customerPartyId = shoppingCart.getOrderPartyId();
- companyPartyId = shoppingCart.getBillFromVendorPartyId();
+ customerPartyId = shoppingCart.getOrderPartyId()
+ companyPartyId = shoppingCart.getBillFromVendorPartyId()
// the agreement for a sales order is from the customer to us
agreementCondition = EntityCondition.makeCondition([
EntityCondition.makeCondition('partyIdTo', EntityOperator.EQUALS, companyPartyId),
EntityCondition.makeCondition('partyIdFrom', EntityOperator.EQUALS, customerPartyId)
- ], EntityOperator.AND);
+ ], EntityOperator.AND)
agreementRoleCondition = EntityCondition.makeCondition([
EntityCondition.makeCondition('partyId', EntityOperator.EQUALS, customerPartyId),
EntityCondition.makeCondition('roleTypeId', EntityOperator.EQUALS, 'CUSTOMER')
- ], EntityOperator.AND);
+ ], EntityOperator.AND)
}
-agreements = from("Agreement").where(agreementCondition).filterByDate().cache(true).queryList();
+agreements = from("Agreement").where(agreementCondition).filterByDate().cache(true).queryList()
if (agreements) {
- context.agreements = agreements;
+ context.agreements = agreements
}
-agreementRoles = from("AgreementRole").where(agreementRoleCondition).cache(true).queryList();
+agreementRoles = from("AgreementRole").where(agreementRoleCondition).cache(true).queryList()
if (agreementRoles) {
- context.agreementRoles = agreementRoles;
+ context.agreementRoles = agreementRoles
}
// catalog id collection, current catalog id and name
-productStoreId = shoppingCart.getProductStoreId();
+productStoreId = shoppingCart.getProductStoreId()
if ('SALES_ORDER' == shoppingCart.getOrderType() && productStoreId) {
- catalogCol = CatalogWorker.getCatalogIdsAvailable(delegator, productStoreId, shoppingCart.getOrderPartyId());
+ catalogCol = CatalogWorker.getCatalogIdsAvailable(delegator, productStoreId, shoppingCart.getOrderPartyId())
} else {
- catalogCol = CatalogWorker.getAllCatalogIds(request);
+ catalogCol = CatalogWorker.getAllCatalogIds(request)
}
if (catalogCol) {
- context.catalogCol = catalogCol;
+ context.catalogCol = catalogCol
- currentCatalogId = catalogCol.get(0);
- context.currentCatalogId = currentCatalogId;
- context.currentCatalogName = CatalogWorker.getCatalogName(request, currentCatalogId);
+ currentCatalogId = catalogCol.get(0)
+ context.currentCatalogId = currentCatalogId
+ context.currentCatalogName = CatalogWorker.getCatalogName(request, currentCatalogId)
}
// currencies and shopping cart currency
-context.currencies = from("Uom").where("uomTypeId", "CURRENCY_MEASURE").cache(true).queryList();
-context.currencyUomId = shoppingCart.getCurrency();
+context.currencies = from("Uom").where("uomTypeId", "CURRENCY_MEASURE").cache(true).queryList()
+context.currencyUomId = shoppingCart.getCurrency()
diff --git a/applications/order/groovyScripts/entry/OrderTerms.groovy b/applications/order/groovyScripts/entry/OrderTerms.groovy
index 2951e18592..c3f57f3b12 100644
--- a/applications/order/groovyScripts/entry/OrderTerms.groovy
+++ b/applications/order/groovyScripts/entry/OrderTerms.groovy
@@ -17,37 +17,37 @@
* under the License.
*/
-import org.apache.ofbiz.base.util.*;
-import org.apache.ofbiz.entity.*;
-import org.apache.ofbiz.order.shoppingcart.*;
+import org.apache.ofbiz.base.util.*
+import org.apache.ofbiz.entity.*
+import org.apache.ofbiz.order.shoppingcart.*
-cart = ShoppingCartEvents.getCartObject(request);
-context.cart = cart;
+cart = ShoppingCartEvents.getCartObject(request)
+context.cart = cart
-orderTerms = cart.getOrderTerms();
-context.orderTerms = orderTerms;
+orderTerms = cart.getOrderTerms()
+context.orderTerms = orderTerms
if (request.getParameter('createNew') == 'Y') {
- termIndexStr = request.getParameter('termIndex');
+ termIndexStr = request.getParameter('termIndex')
if (termIndexStr) {
try {
- termIndex = Integer.parseInt(termIndexStr);
+ termIndex = Integer.parseInt(termIndexStr)
- orderTerm = orderTerms[termIndex];
+ orderTerm = orderTerms[termIndex]
if (orderTerm) {
- context.termTypeId = orderTerm.termTypeId;
- context.termValue = orderTerm.termValue;
- context.termDays = orderTerm.termDays;
- context.textValue = orderTerm.textValue;
- context.description = orderTerm.description;
+ context.termTypeId = orderTerm.termTypeId
+ context.termValue = orderTerm.termValue
+ context.termDays = orderTerm.termDays
+ context.textValue = orderTerm.textValue
+ context.description = orderTerm.description
- context.termIndex = termIndexStr;
+ context.termIndex = termIndexStr
}
} catch (NumberFormatException nfe) {
- Debug.log("Error parsing termIndex: ${termIndexStr}");
+ Debug.log("Error parsing termIndex: ${termIndexStr}")
}
}
diff --git a/applications/order/groovyScripts/entry/SetAdditionalParty.groovy b/applications/order/groovyScripts/entry/SetAdditionalParty.groovy
index 290b36ce1a..954c346461 100644
--- a/applications/order/groovyScripts/entry/SetAdditionalParty.groovy
+++ b/applications/order/groovyScripts/entry/SetAdditionalParty.groovy
@@ -17,25 +17,25 @@
* under the License.
*/
-import org.apache.ofbiz.entity.*;
-import org.apache.ofbiz.base.util.*;
-import org.apache.ofbiz.order.shoppingcart.*;
+import org.apache.ofbiz.entity.*
+import org.apache.ofbiz.base.util.*
+import org.apache.ofbiz.order.shoppingcart.*
-shoppingCart = ShoppingCartEvents.getCartObject(request);
-orderType = shoppingCart.getOrderType();
-context.orderType = orderType;
+shoppingCart = ShoppingCartEvents.getCartObject(request)
+orderType = shoppingCart.getOrderType()
+context.orderType = orderType
if (!request.getParameterValues("additionalRoleTypeId")) {
- partyType = request.getParameter("additionalPartyType");
- context.additionalPartyType = partyType;
+ partyType = request.getParameter("additionalPartyType")
+ context.additionalPartyType = partyType
- additionalPartyId = request.getParameter("additionalPartyId");
- context.additionalPartyId = additionalPartyId;
+ additionalPartyId = request.getParameter("additionalPartyId")
+ context.additionalPartyId = additionalPartyId
- roles = from("PartyRole").where("partyId", additionalPartyId).queryList();
- roleData = [];
+ roles = from("PartyRole").where("partyId", additionalPartyId).queryList()
+ roleData = []
roles.each { role ->
- roleData.add(role.getRelatedOne("RoleType", false));
+ roleData.add(role.getRelatedOne("RoleType", false))
}
- context.roles = roleData;
+ context.roles = roleData
}
diff --git a/applications/order/groovyScripts/entry/SetCheckOutTabBar.groovy b/applications/order/groovyScripts/entry/SetCheckOutTabBar.groovy
index b5b4c896f4..643c58d55d 100644
--- a/applications/order/groovyScripts/entry/SetCheckOutTabBar.groovy
+++ b/applications/order/groovyScripts/entry/SetCheckOutTabBar.groovy
@@ -17,13 +17,13 @@
* under the License.
*/
-import java.util.ArrayList;
-import org.apache.ofbiz.base.util.UtilMisc;
-import org.apache.ofbiz.order.shoppingcart.ShoppingCartEvents;
+import java.util.ArrayList
+import org.apache.ofbiz.base.util.UtilMisc
+import org.apache.ofbiz.order.shoppingcart.ShoppingCartEvents
-checkoutSteps = [];
+checkoutSteps = []
-shoppingCart = ShoppingCartEvents.getCartObject(request);
+shoppingCart = ShoppingCartEvents.getCartObject(request)
// ----------------------------------
// The ordered list of steps is prepared here
@@ -47,19 +47,19 @@ checkoutSteps.add([label : "OrderReviewOrder", uri : "confirmOrder", enabled : "
// ---------------------------------------
-isLastStep = "N";
-enabled = "Y";
+isLastStep = "N"
+enabled = "Y"
checkoutSteps.eachWithIndex { checkoutStep, i ->
- checkoutStep.put("enabled", enabled);
+ checkoutStep.put("enabled", enabled)
if (enabled.equals("Y")) {
if (i == (checkoutSteps.size() - 1)) {
- isLastStep = "Y";
+ isLastStep = "Y"
}
if (stepLabelId.equals(checkoutStep.label)) {
- enabled = "N";
+ enabled = "N"
}
}
}
-context.isLastStep = isLastStep;
-context.checkoutSteps = checkoutSteps;
+context.isLastStep = isLastStep
+context.checkoutSteps = checkoutSteps
diff --git a/applications/order/groovyScripts/entry/SetShoppingCart.groovy b/applications/order/groovyScripts/entry/SetShoppingCart.groovy
index b442b70493..f430ab1411 100644
--- a/applications/order/groovyScripts/entry/SetShoppingCart.groovy
+++ b/applications/order/groovyScripts/entry/SetShoppingCart.groovy
@@ -17,11 +17,11 @@
* under the License.
*/
-import org.apache.ofbiz.order.shoppingcart.ShoppingCartEvents;
+import org.apache.ofbiz.order.shoppingcart.ShoppingCartEvents
// Get the Cart and put it in the context.
-shoppingCart = ShoppingCartEvents.getCartObject(request);
-context.shoppingCart = shoppingCart;
-context.currencyUomId = shoppingCart.getCurrency();
-context.partyId = shoppingCart.getPartyId();
+shoppingCart = ShoppingCartEvents.getCartObject(request)
+context.shoppingCart = shoppingCart
+context.currencyUomId = shoppingCart.getCurrency()
+context.partyId = shoppingCart.getPartyId()
diff --git a/applications/order/groovyScripts/entry/ShipSettings.groovy b/applications/order/groovyScripts/entry/ShipSettings.groovy
index 20a05f08ed..66c65b4aae 100644
--- a/applications/order/groovyScripts/entry/ShipSettings.groovy
+++ b/applications/order/groovyScripts/entry/ShipSettings.groovy
@@ -17,101 +17,101 @@
* under the License.
*/
-import org.apache.ofbiz.entity.*;
-import org.apache.ofbiz.base.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.UtilValidate;
-import org.apache.ofbiz.entity.condition.EntityCondition;
-import org.apache.ofbiz.entity.util.EntityUtil;
+import org.apache.ofbiz.entity.*
+import org.apache.ofbiz.base.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.UtilValidate
+import org.apache.ofbiz.entity.condition.EntityCondition
+import org.apache.ofbiz.entity.util.EntityUtil
-cart = session.getAttribute("shoppingCart");
+cart = session.getAttribute("shoppingCart")
if (cart) {
-createNewShipGroup = request.getParameter("createNewShipGroup");
+createNewShipGroup = request.getParameter("createNewShipGroup")
if ("Y".equals(createNewShipGroup)) {
- cart.addShipInfo();
+ cart.addShipInfo()
}
-orderPartyId = cart.getPartyId();
-shipToPartyId = parameters.shipToPartyId;
-context.cart = cart;
+orderPartyId = cart.getPartyId()
+shipToPartyId = parameters.shipToPartyId
+context.cart = cart
if(shipToPartyId) {
- context.shipToPartyId = shipToPartyId;
+ context.shipToPartyId = shipToPartyId
} else {
- context.shipToPartyId = cart.getShipToCustomerPartyId();
+ context.shipToPartyId = cart.getShipToCustomerPartyId()
}
// nuke the event messages
-request.removeAttribute("_EVENT_MESSAGE_");
+request.removeAttribute("_EVENT_MESSAGE_")
if ("SALES_ORDER".equals(cart.getOrderType())) {
if (!"_NA_".equals(orderPartyId)) {
- orderParty = from("Party").where("partyId", orderPartyId).queryOne();
+ orderParty = from("Party").where("partyId", orderPartyId).queryOne()
if (orderParty) {
- shippingContactMechList = ContactHelper.getContactMech(orderParty, "SHIPPING_LOCATION", "POSTAL_ADDRESS", false);
- orderPerson = orderParty.getRelatedOne("Person", false);
- context.orderParty = orderParty;
- context.orderPerson = orderPerson;
- context.shippingContactMechList = shippingContactMechList;
+ shippingContactMechList = ContactHelper.getContactMech(orderParty, "SHIPPING_LOCATION", "POSTAL_ADDRESS", false)
+ orderPerson = orderParty.getRelatedOne("Person", false)
+ context.orderParty = orderParty
+ context.orderPerson = orderPerson
+ context.shippingContactMechList = shippingContactMechList
}
}
// Ship to another party
if (!context.shipToPartyId.equals(orderPartyId)) {
- shipToParty = from("Party").where("partyId", context.shipToPartyId).queryOne();
+ shipToParty = from("Party").where("partyId", context.shipToPartyId).queryOne()
if (shipToParty) {
- shipToPartyShippingContactMechList = ContactHelper.getContactMech(shipToParty, "SHIPPING_LOCATION", "POSTAL_ADDRESS", false);
- context.shipToPartyShippingContactMechList = shipToPartyShippingContactMechList;
+ shipToPartyShippingContactMechList = ContactHelper.getContactMech(shipToParty, "SHIPPING_LOCATION", "POSTAL_ADDRESS", false)
+ context.shipToPartyShippingContactMechList = shipToPartyShippingContactMechList
}
}
// suppliers for the drop-ship select box
- suppliers = from("PartyRole").where("roleTypeId", "SUPPLIER").queryList();
- context.suppliers = suppliers;
+ suppliers = from("PartyRole").where("roleTypeId", "SUPPLIER").queryList()
+ context.suppliers = suppliers
// facilities used to reserve the items per ship group
- productStoreFacilities = from("ProductStoreFacility").where("productStoreId", cart.getProductStoreId()).queryList();
- context.productStoreFacilities = productStoreFacilities;
+ productStoreFacilities = from("ProductStoreFacility").where("productStoreId", cart.getProductStoreId()).queryList()
+ context.productStoreFacilities = productStoreFacilities
} else {
// Purchase order
if (!"_NA_".equals(orderPartyId)) {
- orderParty = from("Party").where("partyId", orderPartyId).queryOne();
+ orderParty = from("Party").where("partyId", orderPartyId).queryOne()
if (orderParty) {
- orderPerson = orderParty.getRelatedOne("Person", false);
- context.orderParty = orderParty;
- context.orderPerson = orderPerson;
+ orderPerson = orderParty.getRelatedOne("Person", false)
+ context.orderParty = orderParty
+ context.orderPerson = orderPerson
}
}
- companyId = cart.getBillToCustomerPartyId();
+ companyId = cart.getBillToCustomerPartyId()
if (companyId) {
- facilityMaps = [];
- facilities = from("Facility").where("ownerPartyId", companyId).cache(true).queryList();
+ facilityMaps = []
+ facilities = from("Facility").where("ownerPartyId", companyId).cache(true).queryList()
// if facilites is null then check the PartyRelationship where there is a relationship set for Parent & Child organization. Then also fetch the value of companyId from there.
if (UtilValidate.isEmpty(facilities)) {
- partyRelationship = from("PartyRelationship").where("roleTypeIdFrom": "PARENT_ORGANIZATION", "partyIdTo": companyId).queryFirst();
+ partyRelationship = from("PartyRelationship").where("roleTypeIdFrom": "PARENT_ORGANIZATION", "partyIdTo": companyId).queryFirst()
if (UtilValidate.isNotEmpty(partyRelationship)) {
- companyId = partyRelationship.partyIdFrom;
- facilities = from("Facility").where("ownerPartyId", companyId).cache(true).queryList();
+ companyId = partyRelationship.partyIdFrom
+ facilities = from("Facility").where("ownerPartyId", companyId).cache(true).queryList()
}
}
facilities.each { facility ->
- facilityMap = [:];
- facilityContactMechValueMaps = ContactMechWorker.getFacilityContactMechValueMaps(delegator, facility.facilityId, false, null);
- facilityMap.facilityContactMechList = facilityContactMechValueMaps;
- facilityMap.facility = facility;
- facilityMaps.add(facilityMap);
+ facilityMap = [:]
+ facilityContactMechValueMaps = ContactMechWorker.getFacilityContactMechValueMaps(delegator, facility.facilityId, false, null)
+ facilityMap.facilityContactMechList = facilityContactMechValueMaps
+ facilityMap.facility = facility
+ facilityMaps.add(facilityMap)
}
- context.facilityMaps = facilityMaps;
+ context.facilityMaps = facilityMaps
}
// Ship to another party
if (!context.shipToPartyId.equals(orderPartyId)) {
- shipToParty = from("Party").where("partyId", context.shipToPartyId).queryOne();
+ shipToParty = from("Party").where("partyId", context.shipToPartyId).queryOne()
if (shipToParty)
{
- shipToPartyShippingContactMechList = ContactHelper.getContactMech(shipToParty, "SHIPPING_LOCATION", "POSTAL_ADDRESS", false);
- context.shipToPartyShippingContactMechList = shipToPartyShippingContactMechList;
+ shipToPartyShippingContactMechList = ContactHelper.getContactMech(shipToParty, "SHIPPING_LOCATION", "POSTAL_ADDRESS", false)
+ context.shipToPartyShippingContactMechList = shipToPartyShippingContactMechList
}
}
}
diff --git a/applications/order/groovyScripts/entry/ShoppingList.groovy b/applications/order/groovyScripts/entry/ShoppingList.groovy
index 616efe4df5..cf687ebd6d 100644
--- a/applications/order/groovyScripts/entry/ShoppingList.groovy
+++ b/applications/order/groovyScripts/entry/ShoppingList.groovy
@@ -17,18 +17,18 @@
* under the License.
*/
-import org.apache.ofbiz.service.*;
-import org.apache.ofbiz.entity.*;
-import org.apache.ofbiz.entity.condition.*;
-import org.apache.ofbiz.entity.util.*;
-import org.apache.ofbiz.base.util.*;
-import org.apache.ofbiz.order.shoppingcart.*;
+import org.apache.ofbiz.service.*
+import org.apache.ofbiz.entity.*
+import org.apache.ofbiz.entity.condition.*
+import org.apache.ofbiz.entity.util.*
+import org.apache.ofbiz.base.util.*
+import org.apache.ofbiz.order.shoppingcart.*
-shoppingCart = session.getAttribute("shoppingCart");
-partyId = shoppingCart.getPartyId();
+shoppingCart = session.getAttribute("shoppingCart")
+partyId = shoppingCart.getPartyId()
// Get the party's collection of Shopping Lists
-shoppingLists = from("ShoppingList").where("partyId", partyId).cache(true).queryList();
+shoppingLists = from("ShoppingList").where("partyId", partyId).cache(true).queryList()
if (shoppingLists) {
- context.shoppingLists = shoppingLists;
+ context.shoppingLists = shoppingLists
}
diff --git a/applications/order/groovyScripts/entry/ShowCart.groovy b/applications/order/groovyScripts/entry/ShowCart.groovy
index c47f28257e..cb9ed6bebc 100644
--- a/applications/order/groovyScripts/entry/ShowCart.groovy
+++ b/applications/order/groovyScripts/entry/ShowCart.groovy
@@ -17,109 +17,109 @@
* under the License.
*/
-import org.apache.ofbiz.service.*;
-import org.apache.ofbiz.entity.*;
-import org.apache.ofbiz.base.util.*;
-import org.apache.ofbiz.order.order.OrderReadHelper;
-import org.apache.ofbiz.order.shoppingcart.*;
-import org.apache.ofbiz.party.party.PartyWorker;
-import org.apache.ofbiz.product.catalog.CatalogWorker;
+import org.apache.ofbiz.service.*
+import org.apache.ofbiz.entity.*
+import org.apache.ofbiz.base.util.*
+import org.apache.ofbiz.order.order.OrderReadHelper
+import org.apache.ofbiz.order.shoppingcart.*
+import org.apache.ofbiz.party.party.PartyWorker
+import org.apache.ofbiz.product.catalog.CatalogWorker
-productId = parameters.productId;
+productId = parameters.productId
if (productId) {
- quantityOnHandTotal = parameters.quantityOnHandTotal;
+ quantityOnHandTotal = parameters.quantityOnHandTotal
if (!quantityOnHandTotal) {
- quantityOnHandTotal = 0;
+ quantityOnHandTotal = 0
}
- context.quantityOnHandTotal = quantityOnHandTotal;
+ context.quantityOnHandTotal = quantityOnHandTotal
- availableToPromiseTotal = parameters.availableToPromiseTotal;
+ availableToPromiseTotal = parameters.availableToPromiseTotal
if (!availableToPromiseTotal) {
- availableToPromiseTotal = 0;
+ availableToPromiseTotal = 0
}
- context.availableToPromiseTotal = availableToPromiseTotal;
+ context.availableToPromiseTotal = availableToPromiseTotal
}
-context.productId = productId;
+context.productId = productId
// Just in case we are here from the choosecatalog form, the
// following call will save in the session the new catalogId
-CatalogWorker.getCurrentCatalogId(request);
+CatalogWorker.getCurrentCatalogId(request)
// Get the Cart and Prepare Size
-shoppingCart = ShoppingCartEvents.getCartObject(request);
-context.shoppingCartSize = shoppingCart.size();
-context.shoppingCart = shoppingCart;
-context.currencyUomId = shoppingCart.getCurrency();
-context.orderType = shoppingCart.getOrderType();
+shoppingCart = ShoppingCartEvents.getCartObject(request)
+context.shoppingCartSize = shoppingCart.size()
+context.shoppingCart = shoppingCart
+context.currencyUomId = shoppingCart.getCurrency()
+context.orderType = shoppingCart.getOrderType()
-orderItems = shoppingCart.makeOrderItems();
-orderAdjustments = shoppingCart.makeAllAdjustments();
-orderItemShipGroupInfo = shoppingCart.makeAllShipGroupInfos();
+orderItems = shoppingCart.makeOrderItems()
+orderAdjustments = shoppingCart.makeAllAdjustments()
+orderItemShipGroupInfo = shoppingCart.makeAllShipGroupInfos()
if (orderItemShipGroupInfo) {
orderItemShipGroupInfo.each { osiInfo ->
if ("OrderAdjustment".equals(osiInfo.getEntityName())) {
// shipping / tax adjustment(s)
- orderAdjustments.add(osiInfo);
+ orderAdjustments.add(osiInfo)
}
}
}
-orderHeaderAdjustments = OrderReadHelper.getOrderHeaderAdjustments(orderAdjustments, null);
-orderSubTotal = OrderReadHelper.getOrderItemsSubTotal(orderItems, orderAdjustments);
-shippingAmount = OrderReadHelper.getAllOrderItemsAdjustmentsTotal(orderItems, orderAdjustments, false, false, true);
-shippingAmount = shippingAmount.add(OrderReadHelper.calcOrderAdjustments(orderHeaderAdjustments, orderSubTotal, false, false, true));
-context.orderShippingTotal = shippingAmount;
-taxAmount = OrderReadHelper.getOrderTaxByTaxAuthGeoAndParty(orderAdjustments).taxGrandTotal;
-context.orderTaxTotal = taxAmount;
+orderHeaderAdjustments = OrderReadHelper.getOrderHeaderAdjustments(orderAdjustments, null)
+orderSubTotal = OrderReadHelper.getOrderItemsSubTotal(orderItems, orderAdjustments)
+shippingAmount = OrderReadHelper.getAllOrderItemsAdjustmentsTotal(orderItems, orderAdjustments, false, false, true)
+shippingAmount = shippingAmount.add(OrderReadHelper.calcOrderAdjustments(orderHeaderAdjustments, orderSubTotal, false, false, true))
+context.orderShippingTotal = shippingAmount
+taxAmount = OrderReadHelper.getOrderTaxByTaxAuthGeoAndParty(orderAdjustments).taxGrandTotal
+context.orderTaxTotal = taxAmount
// get all the possible gift wrap options
-allgiftWraps = from("ProductFeature").where("productFeatureTypeId", "GIFT_WRAP").orderBy("defaultSequenceNum").queryList();
-context.allgiftWraps = allgiftWraps;
+allgiftWraps = from("ProductFeature").where("productFeatureTypeId", "GIFT_WRAP").orderBy("defaultSequenceNum").queryList()
+context.allgiftWraps = allgiftWraps
-context.contentPathPrefix = CatalogWorker.getContentPathPrefix(request);
+context.contentPathPrefix = CatalogWorker.getContentPathPrefix(request)
// retrieve the product store id from the cart
-productStoreId = shoppingCart.getProductStoreId();
-context.productStoreId = productStoreId;
+productStoreId = shoppingCart.getProductStoreId()
+context.productStoreId = productStoreId
-partyId = shoppingCart.getPartyId();
-if ("_NA_".equals(partyId)) partyId = null;
-context.partyId = partyId;
+partyId = shoppingCart.getPartyId()
+if ("_NA_".equals(partyId)) partyId = null
+context.partyId = partyId
-defaultDesiredDeliveryDate = shoppingCart.getDefaultItemDeliveryDate();
+defaultDesiredDeliveryDate = shoppingCart.getDefaultItemDeliveryDate()
if (!defaultDesiredDeliveryDate) {
- defaultDesiredDeliveryDate = (new java.sql.Date(System.currentTimeMillis())).toString();
+ defaultDesiredDeliveryDate = (new java.sql.Date(System.currentTimeMillis())).toString()
} else {
- context.useAsDefaultDesiredDeliveryDate = "true";
+ context.useAsDefaultDesiredDeliveryDate = "true"
}
-context.defaultDesiredDeliveryDate = defaultDesiredDeliveryDate;
+context.defaultDesiredDeliveryDate = defaultDesiredDeliveryDate
-defaultComment = shoppingCart.getDefaultItemComment();
+defaultComment = shoppingCart.getDefaultItemComment()
if (defaultComment) {
- context.useAsDefaultComment = "true";
+ context.useAsDefaultComment = "true"
}
-context.defaultComment = defaultComment;
+context.defaultComment = defaultComment
// get all party shopping lists
if (partyId) {
- shoppingLists = from("ShoppingList").where("partyId", partyId).queryList();
- context.shoppingLists = shoppingLists;
+ shoppingLists = from("ShoppingList").where("partyId", partyId).queryList()
+ context.shoppingLists = shoppingLists
}
// get product inventory summary for each shopping cart item
-productStore = from("ProductStore").where("productStoreId", productStoreId).cache(true).queryOne();
+productStore = from("ProductStore").where("productStoreId", productStoreId).cache(true).queryOne()
context.productStore = productStore
-productStoreFacilityId = null;
+productStoreFacilityId = null
if (productStore) {
- productStoreFacilityId = productStore.inventoryFacilityId;
+ productStoreFacilityId = productStore.inventoryFacilityId
}
-context.facilityId = productStoreFacilityId;
-inventorySummary = runService('getProductInventorySummaryForItems', [orderItems : shoppingCart.makeOrderItems(), facilityId : productStoreFacilityId]);
-context.availableToPromiseMap = inventorySummary.availableToPromiseMap;
-context.quantityOnHandMap = inventorySummary.quantityOnHandMap;
-context.mktgPkgATPMap = inventorySummary.mktgPkgATPMap;
-context.mktgPkgQOHMap = inventorySummary.mktgPkgQOHMap;
+context.facilityId = productStoreFacilityId
+inventorySummary = runService('getProductInventorySummaryForItems', [orderItems : shoppingCart.makeOrderItems(), facilityId : productStoreFacilityId])
+context.availableToPromiseMap = inventorySummary.availableToPromiseMap
+context.quantityOnHandMap = inventorySummary.quantityOnHandMap
+context.mktgPkgATPMap = inventorySummary.mktgPkgATPMap
+context.mktgPkgQOHMap = inventorySummary.mktgPkgQOHMap
// get purchase order item types
-purchaseOrderItemTypeList = from("OrderItemType").where("parentTypeId", "PURCHASE_SPECIFIC").cache(true).queryList();
-context.purchaseOrderItemTypeList = purchaseOrderItemTypeList;
+purchaseOrderItemTypeList = from("OrderItemType").where("parentTypeId", "PURCHASE_SPECIFIC").cache(true).queryList()
+context.purchaseOrderItemTypeList = purchaseOrderItemTypeList
diff --git a/applications/order/groovyScripts/entry/ShowPromoText.groovy b/applications/order/groovyScripts/entry/ShowPromoText.groovy
index 3bd6f843d8..9fab14e337 100644
--- a/applications/order/groovyScripts/entry/ShowPromoText.groovy
+++ b/applications/order/groovyScripts/entry/ShowPromoText.groovy
@@ -17,49 +17,49 @@
* under the License.
*/
-import org.apache.ofbiz.base.util.UtilMisc;
-import org.apache.ofbiz.order.shoppingcart.product.ProductPromoWorker;
-import org.apache.ofbiz.order.shoppingcart.*;
+import org.apache.ofbiz.base.util.UtilMisc
+import org.apache.ofbiz.order.shoppingcart.product.ProductPromoWorker
+import org.apache.ofbiz.order.shoppingcart.*
-shoppingCart = ShoppingCartEvents.getCartObject(request);
-mode = shoppingCart.getOrderType();
+shoppingCart = ShoppingCartEvents.getCartObject(request)
+mode = shoppingCart.getOrderType()
-promoShowLimit = 3;
+promoShowLimit = 3
if ("SALES_ORDER".equals(mode)) {
//Get Promo Text Data
- productPromosAll = ProductPromoWorker.getStoreProductPromos(delegator, dispatcher, request);
+ productPromosAll = ProductPromoWorker.getStoreProductPromos(delegator, dispatcher, request)
//Make sure that at least one promo has non-empty promoText
- showPromoText = false;
- promoToShow = 0;
- productPromosAllShowable = new ArrayList(productPromosAll.size());
+ showPromoText = false
+ promoToShow = 0
+ productPromosAllShowable = new ArrayList(productPromosAll.size())
productPromosAll.each { productPromo ->
- promoText = productPromo.promoText;
+ promoText = productPromo.promoText
if (promoText && !"N".equals(productPromo.showToCustomer)) {
- showPromoText = true;
- promoToShow++;
- productPromosAllShowable.add(productPromo);
+ showPromoText = true
+ promoToShow++
+ productPromosAllShowable.add(productPromo)
}
}
// now slim it down to promoShowLimit
- productPromosRandomTemp = new ArrayList(productPromosAllShowable);
- productPromos = null;
+ productPromosRandomTemp = new ArrayList(productPromosAllShowable)
+ productPromos = null
if (productPromosRandomTemp.size() > promoShowLimit) {
- productPromos = new ArrayList(promoShowLimit);
+ productPromos = new ArrayList(promoShowLimit)
for (i = 0; i < promoShowLimit; i++) {
- randomIndex = Math.round(java.lang.Math.random() * (productPromosRandomTemp.size() - 1)) as int;
- productPromos.add(productPromosRandomTemp.remove(randomIndex));
+ randomIndex = Math.round(java.lang.Math.random() * (productPromosRandomTemp.size() - 1)) as int
+ productPromos.add(productPromosRandomTemp.remove(randomIndex))
}
} else {
- productPromos = productPromosRandomTemp;
+ productPromos = productPromosRandomTemp
}
- context.promoShowLimit = promoShowLimit;
- context.productPromosAllShowable = productPromosAllShowable;
- context.productPromos = productPromos;
- context.showPromoText = showPromoText;
- context.promoToShow = promoToShow;
+ context.promoShowLimit = promoShowLimit
+ context.productPromosAllShowable = productPromosAllShowable
+ context.productPromos = productPromos
+ context.showPromoText = showPromoText
+ context.promoToShow = promoToShow
} else {
- context.showPromoText = false;
+ context.showPromoText = false
}
diff --git a/applications/order/groovyScripts/entry/SplitShip.groovy b/applications/order/groovyScripts/entry/SplitShip.groovy
index 3db29b67fb..de51908a44 100644
--- a/applications/order/groovyScripts/entry/SplitShip.groovy
+++ b/applications/order/groovyScripts/entry/SplitShip.groovy
@@ -17,17 +17,17 @@
* under the License.
*/
-import org.apache.ofbiz.party.contact.ContactHelper;
-import org.apache.ofbiz.product.store.ProductStoreWorker;
+import org.apache.ofbiz.party.contact.ContactHelper
+import org.apache.ofbiz.product.store.ProductStoreWorker
-shoppingCart = session.getAttribute("shoppingCart");
-partyId = shoppingCart.getPartyId();
-party = from("Party").where("partyId", partyId).cache(true).queryOne();
-productStoreId = ProductStoreWorker.getProductStoreId(request);
+shoppingCart = session.getAttribute("shoppingCart")
+partyId = shoppingCart.getPartyId()
+party = from("Party").where("partyId", partyId).cache(true).queryOne()
+productStoreId = ProductStoreWorker.getProductStoreId(request)
-context.cart = shoppingCart;
-context.shippingContactMechList = ContactHelper.getContactMech(party, "SHIPPING_LOCATION", "POSTAL_ADDRESS", false);
+context.cart = shoppingCart
+context.shippingContactMechList = ContactHelper.getContactMech(party, "SHIPPING_LOCATION", "POSTAL_ADDRESS", false)
-profiledefs = from("PartyProfileDefault").where("partyId", partyId, "productStoreId", productStoreId).cache(true).queryOne();
+profiledefs = from("PartyProfileDefault").where("partyId", partyId, "productStoreId", productStoreId).cache(true).queryOne()
-context.profileDefs = profiledefs;
+context.profileDefs = profiledefs
diff --git a/applications/order/groovyScripts/entry/StorePaymentOptions.groovy b/applications/order/groovyScripts/entry/StorePaymentOptions.groovy
index 33164c861f..506a795295 100644
--- a/applications/order/groovyScripts/entry/StorePaymentOptions.groovy
+++ b/applications/order/groovyScripts/entry/StorePaymentOptions.groovy
@@ -17,17 +17,17 @@
* under the License.
*/
-import org.apache.ofbiz.base.util.*;
-import org.apache.ofbiz.entity.*;
-import org.apache.ofbiz.product.store.*;
+import org.apache.ofbiz.base.util.*
+import org.apache.ofbiz.entity.*
+import org.apache.ofbiz.product.store.*
-productStore = ProductStoreWorker.getProductStore(request);
+productStore = ProductStoreWorker.getProductStore(request)
-productStorePaymentMethodTypeIdMap = new HashMap();
-productStorePaymentSettingList = productStore.getRelated("ProductStorePaymentSetting", null, null, true);
-productStorePaymentSettingIter = productStorePaymentSettingList.iterator();
+productStorePaymentMethodTypeIdMap = new HashMap()
+productStorePaymentSettingList = productStore.getRelated("ProductStorePaymentSetting", null, null, true)
+productStorePaymentSettingIter = productStorePaymentSettingList.iterator()
while (productStorePaymentSettingIter.hasNext()) {
- productStorePaymentSetting = productStorePaymentSettingIter.next();
- productStorePaymentMethodTypeIdMap.put(productStorePaymentSetting.get("paymentMethodTypeId"), true);
+ productStorePaymentSetting = productStorePaymentSettingIter.next()
+ productStorePaymentMethodTypeIdMap.put(productStorePaymentSetting.get("paymentMethodTypeId"), true)
}
-context.put("productStorePaymentMethodTypeIdMap", productStorePaymentMethodTypeIdMap);
+context.put("productStorePaymentMethodTypeIdMap", productStorePaymentMethodTypeIdMap)
diff --git a/applications/order/groovyScripts/entry/cart/LookupBulkAddProducts.groovy b/applications/order/groovyScripts/entry/cart/LookupBulkAddProducts.groovy
index 76aa5cd79d..d6fa41602d 100644
--- a/applications/order/groovyScripts/entry/cart/LookupBulkAddProducts.groovy
+++ b/applications/order/groovyScripts/entry/cart/LookupBulkAddProducts.groovy
@@ -17,38 +17,38 @@
* under the License.
*/
-import org.apache.ofbiz.entity.condition.EntityExpr;
-import org.apache.ofbiz.entity.condition.EntityFunction;
-import org.apache.ofbiz.entity.condition.EntityOperator;
-import org.apache.ofbiz.entity.condition.EntityFieldValue;
-import org.apache.ofbiz.entity.condition.EntityConditionList;
-import org.apache.ofbiz.entity.condition.EntityCondition;
+import org.apache.ofbiz.entity.condition.EntityExpr
+import org.apache.ofbiz.entity.condition.EntityFunction
+import org.apache.ofbiz.entity.condition.EntityOperator
+import org.apache.ofbiz.entity.condition.EntityFieldValue
+import org.apache.ofbiz.entity.condition.EntityConditionList
+import org.apache.ofbiz.entity.condition.EntityCondition
-productId = request.getParameter("productId") ?: "";
+productId = request.getParameter("productId") ?: ""
-conditionList = [];
-orConditionList = [];
-mainConditionList = [];
+conditionList = []
+orConditionList = []
+mainConditionList = []
if (productId) {
//make sure the look up is case insensitive
conditionList.add(EntityCondition.makeCondition(EntityFunction.UPPER(EntityFieldValue.makeFieldValue("productId")),
- EntityOperator.LIKE, productId.toUpperCase() + "%"));
+ EntityOperator.LIKE, productId.toUpperCase() + "%"))
}
// do not include configurable products
-conditionList.add(EntityCondition.makeCondition("productTypeId", EntityOperator.NOT_EQUAL, "AGGREGATED"));
-conditionList.add(EntityCondition.makeCondition("productTypeId", EntityOperator.NOT_EQUAL, "AGGREGATED_SERVICE"));
+conditionList.add(EntityCondition.makeCondition("productTypeId", EntityOperator.NOT_EQUAL, "AGGREGATED"))
+conditionList.add(EntityCondition.makeCondition("productTypeId", EntityOperator.NOT_EQUAL, "AGGREGATED_SERVICE"))
// no virtual products: note that isVirtual could be null,
// we consider those products to be non-virtual and hence addable to the order in bulk
-orConditionList.add(EntityCondition.makeCondition("isVirtual", EntityOperator.EQUALS, "N"));
-orConditionList.add(EntityCondition.makeCondition("isVirtual", EntityOperator.EQUALS, null));
+orConditionList.add(EntityCondition.makeCondition("isVirtual", EntityOperator.EQUALS, "N"))
+orConditionList.add(EntityCondition.makeCondition("isVirtual", EntityOperator.EQUALS, null))
-orConditions = EntityCondition.makeCondition(orConditionList, EntityOperator.OR);
-conditions = EntityCondition.makeCondition(conditionList, EntityOperator.AND);
+orConditions = EntityCondition.makeCondition(orConditionList, EntityOperator.OR)
+conditions = EntityCondition.makeCondition(conditionList, EntityOperator.AND)
-mainConditionList.add(orConditions);
-mainConditionList.add(conditions);
+mainConditionList.add(orConditions)
+mainConditionList.add(conditions)
-context.productList = select("productId", "brandName", "internalName").from("Product").where(mainConditionList).orderBy("productId").queryList();
+context.productList = select("productId", "brandName", "internalName").from("Product").where(mainConditionList).orderBy("productId").queryList()
diff --git a/applications/order/groovyScripts/entry/cart/LookupBulkAddSupplierProducts.groovy b/applications/order/groovyScripts/entry/cart/LookupBulkAddSupplierProducts.groovy
index 4f47164965..2c3704e562 100644
--- a/applications/order/groovyScripts/entry/cart/LookupBulkAddSupplierProducts.groovy
+++ b/applications/order/groovyScripts/entry/cart/LookupBulkAddSupplierProducts.groovy
@@ -17,120 +17,120 @@
* under the License.
*/
-import org.apache.ofbiz.entity.condition.*;
-import org.apache.ofbiz.entity.util.EntityUtil;
-import org.apache.ofbiz.base.util.*;
-import org.apache.ofbiz.order.shoppingcart.ShoppingCart;
-import org.apache.ofbiz.order.shoppingcart.ShoppingCartEvents;
-import org.apache.ofbiz.order.order.OrderReadHelper;
+import org.apache.ofbiz.entity.condition.*
+import org.apache.ofbiz.entity.util.EntityUtil
+import org.apache.ofbiz.base.util.*
+import org.apache.ofbiz.order.shoppingcart.ShoppingCart
+import org.apache.ofbiz.order.shoppingcart.ShoppingCartEvents
+import org.apache.ofbiz.order.order.OrderReadHelper
// This script can take quite a while to run with a decent amount of data
// so we'll take a best effort approach to limit the size of the results
-maxRows = null;
+maxRows = null
// TODO: Find a way to get the pagination parameters for a given form
if (!parameters.containsKey("VIEW_INDEX_2")) {
// There's only one set of pagination parameters so it must be for us
if (parameters.VIEW_SIZE_1) {
if (parameters.VIEW_INDEX_1) {
- viewSize = Integer.valueOf(parameters.VIEW_SIZE_1);
- viewIndex = Integer.valueOf(parameters.VIEW_INDEX_1);
- maxRows = viewSize * (viewIndex + 1);
+ viewSize = Integer.valueOf(parameters.VIEW_SIZE_1)
+ viewIndex = Integer.valueOf(parameters.VIEW_INDEX_1)
+ maxRows = viewSize * (viewIndex + 1)
}
}
}
if (!maxRows) {
- maxRows = 50;
+ maxRows = 50
}
-productId = parameters.productId;
-supplier = null;
-supplierPartyId = null;
+productId = parameters.productId
+supplier = null
+supplierPartyId = null
-orderId = parameters.orderId;
+orderId = parameters.orderId
if (orderId) {
- orderItemShipGroup = from("OrderItemShipGroup").orderBy("orderId").queryFirst();
- orderHeader = from("OrderHeader").where("orderId", orderId).queryOne();
- supplier = from("OrderHeaderAndRoles").where("orderId", orderId, "roleTypeId", "BILL_FROM_VENDOR").queryFirst();
- context.shipGroupSeqId = orderItemShipGroup.shipGroupSeqId ;
- context.orderHeader = orderHeader;
+ orderItemShipGroup = from("OrderItemShipGroup").orderBy("orderId").queryFirst()
+ orderHeader = from("OrderHeader").where("orderId", orderId).queryOne()
+ supplier = from("OrderHeaderAndRoles").where("orderId", orderId, "roleTypeId", "BILL_FROM_VENDOR").queryFirst()
+ context.shipGroupSeqId = orderItemShipGroup.shipGroupSeqId
+ context.orderHeader = orderHeader
}
-ShoppingCart shoppingCart = ShoppingCartEvents.getCartObject(request);
+ShoppingCart shoppingCart = ShoppingCartEvents.getCartObject(request)
-conditionList = [];
+conditionList = []
if (productId) {
// make sure the look up is case insensitive
conditionList.add(EntityCondition.makeCondition(EntityFunction.UPPER(EntityFieldValue.makeFieldValue("productId")),
- EntityOperator.LIKE, productId.toUpperCase() + "%"));
+ EntityOperator.LIKE, productId.toUpperCase() + "%"))
}
if (!supplier) {
- supplierPartyId = shoppingCart.getOrderPartyId();
+ supplierPartyId = shoppingCart.getOrderPartyId()
} else {
- supplierPartyId = supplier.getString("partyId");
+ supplierPartyId = supplier.getString("partyId")
}
-conditionList.add(EntityCondition.makeCondition("partyId", EntityOperator.EQUALS, supplierPartyId));
+conditionList.add(EntityCondition.makeCondition("partyId", EntityOperator.EQUALS, supplierPartyId))
-conditionList.add(EntityCondition.makeCondition("currencyUomId", EntityOperator.EQUALS, shoppingCart.getCurrency()));
-conditionList.add(EntityCondition.makeConditionDate("availableFromDate", "availableThruDate"));
+conditionList.add(EntityCondition.makeCondition("currencyUomId", EntityOperator.EQUALS, shoppingCart.getCurrency()))
+conditionList.add(EntityCondition.makeConditionDate("availableFromDate", "availableThruDate"))
supplierProducts = select("productId", "supplierProductId", "supplierProductName", "lastPrice", "minimumOrderQuantity", "orderQtyIncrements").from("SupplierProduct")
.where(conditionList)
.orderBy("productId")
- .queryList();
+ .queryList()
-newProductList = [];
+newProductList = []
for (supplierProduct in supplierProducts) {
- productId = supplierProduct.productId;
+ productId = supplierProduct.productId
- String facilityId = parameters.facilityId;
+ String facilityId = parameters.facilityId
if (facilityId) {
- productFacilityList = from("ProductFacility").where("productId", productId, "facilityId", facilityId).cache(true).queryList();
+ productFacilityList = from("ProductFacility").where("productId", productId, "facilityId", facilityId).cache(true).queryList()
} else {
- productFacilityList = from("ProductFacility").where("productId", productId).cache(true).queryList();
+ productFacilityList = from("ProductFacility").where("productId", productId).cache(true).queryList()
}
if (newProductList.size() >= maxRows) {
// We've got enough results to display, keep going to get the result size but skip the heavy stuff
- newProductList.add(null);
+ newProductList.add(null)
} else {
- quantityOnOrder = 0.0;
+ quantityOnOrder = 0.0
// find approved purchase orders
- orderHeaders = from("OrderHeader").where("orderTypeId", "PURCHASE_ORDER", "statusId", "ORDER_APPROVED").orderBy("orderId DESC").queryList();
+ orderHeaders = from("OrderHeader").where("orderTypeId", "PURCHASE_ORDER", "statusId", "ORDER_APPROVED").orderBy("orderId DESC").queryList()
orderHeaders.each { orderHeader ->
- orderReadHelper = new OrderReadHelper(orderHeader);
- orderItems = orderReadHelper.getOrderItems();
+ orderReadHelper = new OrderReadHelper(orderHeader)
+ orderItems = orderReadHelper.getOrderItems()
orderItems.each { orderItem ->
if (productId.equals(orderItem.productId) && "ITEM_APPROVED".equals(orderItem.statusId)) {
if (!orderItem.cancelQuantity) {
- cancelQuantity = 0.0;
+ cancelQuantity = 0.0
}
- shippedQuantity = orderReadHelper.getItemShippedQuantity(orderItem);
- quantityOnOrder += orderItem.quantity - cancelQuantity - shippedQuantity;
+ shippedQuantity = orderReadHelper.getItemShippedQuantity(orderItem)
+ quantityOnOrder += orderItem.quantity - cancelQuantity - shippedQuantity
}
}
}
- product = from("Product").where("productId", productId).cache(true).queryOne();
+ product = from("Product").where("productId", productId).cache(true).queryOne()
productFacilityList.each { productFacility ->
- result = runService('getInventoryAvailableByFacility', ["productId" : productId, "facilityId" : productFacility.facilityId]);
- qohAtp = result.quantityOnHandTotal.toPlainString() + "/" + result.availableToPromiseTotal.toPlainString();
- productInfoMap = [:];
+ result = runService('getInventoryAvailableByFacility', ["productId" : productId, "facilityId" : productFacility.facilityId])
+ qohAtp = result.quantityOnHandTotal.toPlainString() + "/" + result.availableToPromiseTotal.toPlainString()
+ productInfoMap = [:]
- productInfoMap.internalName = product.internalName;
+ productInfoMap.internalName = product.internalName
- productInfoMap.productId = productId;
- productInfoMap.qohAtp = qohAtp;
- productInfoMap.quantityOnOrder = quantityOnOrder;
+ productInfoMap.productId = productId
+ productInfoMap.qohAtp = qohAtp
+ productInfoMap.quantityOnOrder = quantityOnOrder
- productInfoMap.supplierProductId = supplierProduct.supplierProductId;
- productInfoMap.lastPrice = supplierProduct.lastPrice;
- productInfoMap.orderQtyIncrements = supplierProduct.orderQtyIncrements;
- productInfoMap.minimumOrderQuantity = supplierProduct.minimumOrderQuantity;
+ productInfoMap.supplierProductId = supplierProduct.supplierProductId
+ productInfoMap.lastPrice = supplierProduct.lastPrice
+ productInfoMap.orderQtyIncrements = supplierProduct.orderQtyIncrements
+ productInfoMap.minimumOrderQuantity = supplierProduct.minimumOrderQuantity
- productInfoMap.minimumStock = productFacility.minimumStock;
+ productInfoMap.minimumStock = productFacility.minimumStock
- newProductList.add(productInfoMap);
+ newProductList.add(productInfoMap)
}
}
}
-context.productListSize = newProductList.size();
-context.productList = newProductList;
+context.productListSize = newProductList.size()
+context.productList = newProductList
diff --git a/applications/order/groovyScripts/entry/cart/ShowPromotionDetails.groovy b/applications/order/groovyScripts/entry/cart/ShowPromotionDetails.groovy
index 9de855fc8d..cbf45ea914 100644
--- a/applications/order/groovyScripts/entry/cart/ShowPromotionDetails.groovy
+++ b/applications/order/groovyScripts/entry/cart/ShowPromotionDetails.groovy
@@ -17,66 +17,66 @@
* under the License.
*/
-import org.apache.ofbiz.base.util.*;
-import org.apache.ofbiz.entity.util.EntityUtil;
-import org.apache.ofbiz.order.shoppingcart.product.ProductPromoWorker;
+import org.apache.ofbiz.base.util.*
+import org.apache.ofbiz.entity.util.EntityUtil
+import org.apache.ofbiz.order.shoppingcart.product.ProductPromoWorker
-productPromoId = request.getParameter("productPromoId");
-if (!productPromoId) productPromoId = parameters.productPromoId;
-productPromo = from("ProductPromo").where("productPromoId", productPromoId).queryOne();
+productPromoId = request.getParameter("productPromoId")
+if (!productPromoId) productPromoId = parameters.productPromoId
+productPromo = from("ProductPromo").where("productPromoId", productPromoId).queryOne()
-promoAutoDescription = ProductPromoWorker.makeAutoDescription(productPromo, delegator, locale);
+promoAutoDescription = ProductPromoWorker.makeAutoDescription(productPromo, delegator, locale)
-productPromoCategoryList = from("ProductPromoCategory").where("productPromoId", productPromoId).cache(true).queryList();
-productPromoCategoryIncludeList = EntityUtil.filterByAnd(productPromoCategoryList, [productPromoApplEnumId : "PPPA_INCLUDE"]);
-productPromoCategoryExcludeList = EntityUtil.filterByAnd(productPromoCategoryList, [productPromoApplEnumId : "PPPA_EXCLUDE"]);
-productPromoCategoryAlwaysList = EntityUtil.filterByAnd(productPromoCategoryList, [productPromoApplEnumId : "PPPA_ALWAYS"]);
+productPromoCategoryList = from("ProductPromoCategory").where("productPromoId", productPromoId).cache(true).queryList()
+productPromoCategoryIncludeList = EntityUtil.filterByAnd(productPromoCategoryList, [productPromoApplEnumId : "PPPA_INCLUDE"])
+productPromoCategoryExcludeList = EntityUtil.filterByAnd(productPromoCategoryList, [productPromoApplEnumId : "PPPA_EXCLUDE"])
+productPromoCategoryAlwaysList = EntityUtil.filterByAnd(productPromoCategoryList, [productPromoApplEnumId : "PPPA_ALWAYS"])
-productIdsCond = [] as Set;
-productIdsAction = [] as Set;
-ProductPromoWorker.makeProductPromoCondActionIdSets(productPromoId, productIdsCond, productIdsAction, delegator, null);
+productIdsCond = [] as Set
+productIdsAction = [] as Set
+ProductPromoWorker.makeProductPromoCondActionIdSets(productPromoId, productIdsCond, productIdsAction, delegator, null)
-productIds = new TreeSet(productIdsCond);
-productIds.addAll(productIdsAction);
+productIds = new TreeSet(productIdsCond)
+productIds.addAll(productIdsAction)
-context.productPromoId = productPromoId;
-context.productPromo = productPromo;
-context.promoAutoDescription = promoAutoDescription;
+context.productPromoId = productPromoId
+context.productPromo = productPromo
+context.promoAutoDescription = promoAutoDescription
-context.productPromoCategoryIncludeList = productPromoCategoryIncludeList;
-context.productPromoCategoryExcludeList = productPromoCategoryExcludeList;
-context.productPromoCategoryAlwaysList = productPromoCategoryAlwaysList;
+context.productPromoCategoryIncludeList = productPromoCategoryIncludeList
+context.productPromoCategoryExcludeList = productPromoCategoryExcludeList
+context.productPromoCategoryAlwaysList = productPromoCategoryAlwaysList
-context.productIdsCond = productIdsCond;
-context.productIdsAction = productIdsAction;
-context.productIds = productIds as List;
+context.productIdsCond = productIdsCond
+context.productIdsAction = productIdsAction
+context.productIds = productIds as List
-viewIndex = 0;
-viewSize = 10;
-highIndex = 0;
-lowIndex = 0;
-listSize = productIds.size();
+viewIndex = 0
+viewSize = 10
+highIndex = 0
+lowIndex = 0
+listSize = productIds.size()
try {
- viewIndex = Integer.valueOf(request.getParameter("VIEW_INDEX"));
+ viewIndex = Integer.valueOf(request.getParameter("VIEW_INDEX"))
} catch (Exception e) {
- viewIndex = 0;
+ viewIndex = 0
}
try {
- viewSize = Integer.valueOf(request.getParameter("VIEW_SIZE"));
+ viewSize = Integer.valueOf(request.getParameter("VIEW_SIZE"))
} catch (Exception e) {
- viewSize = 10;
+ viewSize = 10
}
-lowIndex = viewIndex * viewSize;
-highIndex = (viewIndex + 1) * viewSize;
+lowIndex = viewIndex * viewSize
+highIndex = (viewIndex + 1) * viewSize
if (listSize < highIndex) {
- highIndex = listSize;
+ highIndex = listSize
}
-context.viewIndex = viewIndex;
-context.viewSize = viewSize;
-context.listSize = listSize;
-context.lowIndex = lowIndex;
-context.highIndex = highIndex;
+context.viewIndex = viewIndex
+context.viewSize = viewSize
+context.listSize = listSize
+context.lowIndex = lowIndex
+context.highIndex = highIndex
diff --git a/applications/order/groovyScripts/entry/catalog/AdvancedSearchOptions.groovy b/applications/order/groovyScripts/entry/catalog/AdvancedSearchOptions.groovy
index b63ae8ab72..99d86f683f 100644
--- a/applications/order/groovyScripts/entry/catalog/AdvancedSearchOptions.groovy
+++ b/applications/order/groovyScripts/entry/catalog/AdvancedSearchOptions.groovy
@@ -22,38 +22,38 @@
* should not contain order component's specific code.
*/
-import org.apache.ofbiz.base.util.*;
-import org.apache.ofbiz.product.catalog.*;
-import org.apache.ofbiz.product.feature.*;
-import org.apache.ofbiz.product.product.*;
-import org.apache.ofbiz.entity.condition.EntityCondition;
-import org.apache.ofbiz.entity.condition.EntityOperator;
+import org.apache.ofbiz.base.util.*
+import org.apache.ofbiz.product.catalog.*
+import org.apache.ofbiz.product.feature.*
+import org.apache.ofbiz.product.product.*
+import org.apache.ofbiz.entity.condition.EntityCondition
+import org.apache.ofbiz.entity.condition.EntityOperator
-searchCategoryId = parameters.SEARCH_CATEGORY_ID;
+searchCategoryId = parameters.SEARCH_CATEGORY_ID
if (!searchCategoryId) {
- currentCatalogId = CatalogWorker.getCurrentCatalogId(request);
- searchCategoryId = CatalogWorker.getCatalogSearchCategoryId(request, currentCatalogId);
+ currentCatalogId = CatalogWorker.getCurrentCatalogId(request)
+ searchCategoryId = CatalogWorker.getCatalogSearchCategoryId(request, currentCatalogId)
}
-searchCategory = from("ProductCategory").where("productCategoryId", searchCategoryId).queryOne();
+searchCategory = from("ProductCategory").where("productCategoryId", searchCategoryId).queryOne()
-productFeaturesByTypeMap = ParametricSearch.makeCategoryFeatureLists(searchCategoryId, delegator);
-productFeatureTypeIdsOrdered = new TreeSet(productFeaturesByTypeMap.keySet()) as List;
+productFeaturesByTypeMap = ParametricSearch.makeCategoryFeatureLists(searchCategoryId, delegator)
+productFeatureTypeIdsOrdered = new TreeSet(productFeaturesByTypeMap.keySet()) as List
if(productFeatureTypeIdsOrdered) {
- context.productFeatureTypes = from("ProductFeatureType").where(EntityCondition.makeCondition("productFeatureTypeId", EntityOperator.IN, productFeatureTypeIdsOrdered)).queryList();
+ context.productFeatureTypes = from("ProductFeatureType").where(EntityCondition.makeCondition("productFeatureTypeId", EntityOperator.IN, productFeatureTypeIdsOrdered)).queryList()
}
-searchOperator = parameters.SEARCH_OPERATOR;
+searchOperator = parameters.SEARCH_OPERATOR
if (!"AND".equals(searchOperator) && !"OR".equals(searchOperator)) {
- searchOperator = "OR";
+ searchOperator = "OR"
}
-searchConstraintStrings = ProductSearchSession.searchGetConstraintStrings(false, session, delegator);
-searchSortOrderString = ProductSearchSession.searchGetSortOrderString(false, request);
+searchConstraintStrings = ProductSearchSession.searchGetConstraintStrings(false, session, delegator)
+searchSortOrderString = ProductSearchSession.searchGetSortOrderString(false, request)
-context.searchCategoryId = searchCategoryId;
-context.searchCategory = searchCategory;
-context.productFeaturesByTypeMap = productFeaturesByTypeMap;
-context.productFeatureTypeIdsOrdered = productFeatureTypeIdsOrdered;
-context.searchOperator = searchOperator;
-context.searchConstraintStrings = searchConstraintStrings;
-context.searchSortOrderString = searchSortOrderString;
+context.searchCategoryId = searchCategoryId
+context.searchCategory = searchCategory
+context.productFeaturesByTypeMap = productFeaturesByTypeMap
+context.productFeatureTypeIdsOrdered = productFeatureTypeIdsOrdered
+context.searchOperator = searchOperator
+context.searchConstraintStrings = searchConstraintStrings
+context.searchSortOrderString = searchSortOrderString
diff --git a/applications/order/groovyScripts/entry/catalog/Category.groovy b/applications/order/groovyScripts/entry/catalog/Category.groovy
index f743c9151b..96e082fc25 100644
--- a/applications/order/groovyScripts/entry/catalog/Category.groovy
+++ b/applications/order/groovyScripts/entry/catalog/Category.groovy
@@ -22,79 +22,79 @@
* should not contain order component's specific code.
*/
-import org.apache.ofbiz.base.util.*;
-import org.apache.ofbiz.entity.*;
-import org.apache.ofbiz.product.catalog.*;
-import org.apache.ofbiz.product.category.CategoryWorker;
-import org.apache.ofbiz.product.category.CategoryContentWrapper;
-import org.apache.ofbiz.product.store.ProductStoreWorker;
+import org.apache.ofbiz.base.util.*
+import org.apache.ofbiz.entity.*
+import org.apache.ofbiz.product.catalog.*
+import org.apache.ofbiz.product.category.CategoryWorker
+import org.apache.ofbiz.product.category.CategoryContentWrapper
+import org.apache.ofbiz.product.store.ProductStoreWorker
-detailScreen = "categorydetail";
-catalogName = CatalogWorker.getCatalogName(request);
+detailScreen = "categorydetail"
+catalogName = CatalogWorker.getCatalogName(request)
-productCategoryId = request.getAttribute("productCategoryId") ?: parameters.category_id;
-context.productCategoryId = productCategoryId;
+productCategoryId = request.getAttribute("productCategoryId") ?: parameters.category_id
+context.productCategoryId = productCategoryId
-context.productStore = ProductStoreWorker.getProductStore(request);
+context.productStore = ProductStoreWorker.getProductStore(request)
-pageTitle = null;
-metaDescription = null;
-metaKeywords = null;
+pageTitle = null
+metaDescription = null
+metaKeywords = null
-category = from("ProductCategory").where("productCategoryId", productCategoryId).cache(true).queryOne();
+category = from("ProductCategory").where("productCategoryId", productCategoryId).cache(true).queryOne()
if (category) {
if (category.detailScreen) {
- detailScreen = category.detailScreen;
+ detailScreen = category.detailScreen
}
- categoryPageTitle = from("ProductCategoryContentAndInfo").where("productCategoryId", productCategoryId, "prodCatContentTypeId", "PAGE_TITLE").cache(true).queryList();
+ categoryPageTitle = from("ProductCategoryContentAndInfo").where("productCategoryId", productCategoryId, "prodCatContentTypeId", "PAGE_TITLE").cache(true).queryList()
if (categoryPageTitle) {
- pageTitle = from("ElectronicText").where("dataResourceId", categoryPageTitle.get(0).dataResourceId).cache(true).queryOne();
+ pageTitle = from("ElectronicText").where("dataResourceId", categoryPageTitle.get(0).dataResourceId).cache(true).queryOne()
}
- categoryMetaDescription = from("ProductCategoryContentAndInfo").where("productCategoryId", productCategoryId, "prodCatContentTypeId", "META_DESCRIPTION").cache(true).queryList();
+ categoryMetaDescription = from("ProductCategoryContentAndInfo").where("productCategoryId", productCategoryId, "prodCatContentTypeId", "META_DESCRIPTION").cache(true).queryList()
if (categoryMetaDescription) {
- metaDescription = from("ElectronicText").where("dataResourceId", categoryMetaDescription.get(0).dataResourceId).cache(true).queryOne();
+ metaDescription = from("ElectronicText").where("dataResourceId", categoryMetaDescription.get(0).dataResourceId).cache(true).queryOne()
}
- categoryMetaKeywords = from("ProductCategoryContentAndInfo").where("productCategoryId", productCategoryId, "prodCatContentTypeId", "META_KEYWORD").cache(true).queryList();
+ categoryMetaKeywords = from("ProductCategoryContentAndInfo").where("productCategoryId", productCategoryId, "prodCatContentTypeId", "META_KEYWORD").cache(true).queryList()
if (categoryMetaKeywords) {
- metaKeywords = from("ElectronicText").where("dataResourceId", categoryMetaKeywords.get(0).dataResourceId).cache(true).queryOne();
+ metaKeywords = from("ElectronicText").where("dataResourceId", categoryMetaKeywords.get(0).dataResourceId).cache(true).queryOne()
}
- categoryContentWrapper = new CategoryContentWrapper(category, request);
+ categoryContentWrapper = new CategoryContentWrapper(category, request)
- categoryDescription = categoryContentWrapper.get("DESCRIPTION", "html");
+ categoryDescription = categoryContentWrapper.get("DESCRIPTION", "html")
if (pageTitle) {
- context.title = pageTitle.textData;
+ context.title = pageTitle.textData
} else {
- context.title = categoryContentWrapper.get("CATEGORY_NAME", "html");
+ context.title = categoryContentWrapper.get("CATEGORY_NAME", "html")
}
if (metaDescription) {
- context.metaDescription = metaDescription.textData;
+ context.metaDescription = metaDescription.textData
} else {
if (categoryDescription) {
- context.metaDescription = categoryDescription;
+ context.metaDescription = categoryDescription
}
}
if (metaKeywords) {
- context.metaKeywords = metaKeywords.textData;
+ context.metaKeywords = metaKeywords.textData
} else {
if (categoryDescription) {
- context.metaKeywords = categoryDescription + ", " + catalogName;
+ context.metaKeywords = categoryDescription + ", " + catalogName
} else {
- context.metaKeywords = catalogName;
+ context.metaKeywords = catalogName
}
}
- context.productCategory = category;
+ context.productCategory = category
}
// check the catalogs template path and update
-templatePathPrefix = CatalogWorker.getTemplatePathPrefix(request);
+templatePathPrefix = CatalogWorker.getTemplatePathPrefix(request)
if (templatePathPrefix) {
- detailScreen = templatePathPrefix + detailScreen;
+ detailScreen = templatePathPrefix + detailScreen
}
-context.detailScreen = detailScreen;
+context.detailScreen = detailScreen
-request.setAttribute("productCategoryId", productCategoryId);
-request.setAttribute("defaultViewSize", 10);
-request.setAttribute("limitView", true);
+request.setAttribute("productCategoryId", productCategoryId)
+request.setAttribute("defaultViewSize", 10)
+request.setAttribute("limitView", true)
diff --git a/applications/order/groovyScripts/entry/catalog/CategoryDetail.groovy b/applications/order/groovyScripts/entry/catalog/CategoryDetail.groovy
index 18570879fe..badfc59181 100644
--- a/applications/order/groovyScripts/entry/catalog/CategoryDetail.groovy
+++ b/applications/order/groovyScripts/entry/catalog/CategoryDetail.groovy
@@ -22,88 +22,88 @@
* should not contain order component's specific code.
*/
-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.service.*;
-import org.apache.ofbiz.product.catalog.*;
-import org.apache.ofbiz.product.category.CategoryContentWrapper;
-import org.apache.ofbiz.product.store.ProductStoreWorker;
+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.service.*
+import org.apache.ofbiz.product.catalog.*
+import org.apache.ofbiz.product.category.CategoryContentWrapper
+import org.apache.ofbiz.product.store.ProductStoreWorker
-productCategoryId = request.getAttribute("productCategoryId");
-context.productCategoryId = productCategoryId;
+productCategoryId = request.getAttribute("productCategoryId")
+context.productCategoryId = productCategoryId
-viewSize = parameters.VIEW_SIZE;
-viewIndex = parameters.VIEW_INDEX;
-currentCatalogId = CatalogWorker.getCurrentCatalogId(request);
+viewSize = parameters.VIEW_SIZE
+viewIndex = parameters.VIEW_INDEX
+currentCatalogId = CatalogWorker.getCurrentCatalogId(request)
// set the default view size
-defaultViewSize = request.getAttribute("defaultViewSize") ?: EntityUtilProperties.getPropertyValue("widget", "widget.form.defaultViewSize", "20", delegator);
-context.defaultViewSize = defaultViewSize;
+defaultViewSize = request.getAttribute("defaultViewSize") ?: EntityUtilProperties.getPropertyValue("widget", "widget.form.defaultViewSize", "20", delegator)
+context.defaultViewSize = defaultViewSize
// set the limit view
-limitView = request.getAttribute("limitView") ?: true;
-context.limitView = limitView;
+limitView = request.getAttribute("limitView") ?: true
+context.limitView = limitView
// get the product category & members
andMap = [productCategoryId : productCategoryId,
viewIndexString : viewIndex,
viewSizeString : viewSize,
defaultViewSize : defaultViewSize,
- limitView : limitView];
-andMap.put("prodCatalogId", currentCatalogId);
-andMap.put("checkViewAllow", true);
+ limitView : limitView]
+andMap.put("prodCatalogId", currentCatalogId)
+andMap.put("checkViewAllow", true)
// Prevents out of stock product to be displayed on site
-productStore = ProductStoreWorker.getProductStore(request);
+productStore = ProductStoreWorker.getProductStore(request)
if (productStore) {
- andMap.put("productStoreId", productStore.productStoreId);
+ andMap.put("productStoreId", productStore.productStoreId)
}
if (context.orderByFields) {
- andMap.put("orderByFields", context.orderByFields);
+ andMap.put("orderByFields", context.orderByFields)
} else {
- andMap.put("orderByFields", ["sequenceNum", "productId"]);
+ andMap.put("orderByFields", ["sequenceNum", "productId"])
}
-catResult = runService('getProductCategoryAndLimitedMembers', andMap);
-productCategory = catResult.productCategory;
-productCategoryMembers = catResult.productCategoryMembers;
-context.productCategoryMembers = productCategoryMembers;
-context.productCategory = productCategory;
-context.viewIndex = catResult.viewIndex;
-context.viewSize = catResult.viewSize;
-context.lowIndex = catResult.lowIndex;
-context.highIndex = catResult.highIndex;
-context.listSize = catResult.listSize;
+catResult = runService('getProductCategoryAndLimitedMembers', andMap)
+productCategory = catResult.productCategory
+productCategoryMembers = catResult.productCategoryMembers
+context.productCategoryMembers = productCategoryMembers
+context.productCategory = productCategory
+context.viewIndex = catResult.viewIndex
+context.viewSize = catResult.viewSize
+context.lowIndex = catResult.lowIndex
+context.highIndex = catResult.highIndex
+context.listSize = catResult.listSize
// set this as a last viewed
// DEJ20070220: WHY is this done this way? why not use the existing CategoryWorker stuff?
-LAST_VIEWED_TO_KEEP = 10; // modify this to change the number of last viewed to keep
-lastViewedCategories = session.getAttribute("lastViewedCategories");
+LAST_VIEWED_TO_KEEP = 10 // modify this to change the number of last viewed to keep
+lastViewedCategories = session.getAttribute("lastViewedCategories")
if (!lastViewedCategories) {
- lastViewedCategories = [];
- session.setAttribute("lastViewedCategories", lastViewedCategories);
+ lastViewedCategories = []
+ session.setAttribute("lastViewedCategories", lastViewedCategories)
}
-lastViewedCategories.remove(productCategoryId);
-lastViewedCategories.add(0, productCategoryId);
+lastViewedCategories.remove(productCategoryId)
+lastViewedCategories.add(0, productCategoryId)
while (lastViewedCategories.size() > LAST_VIEWED_TO_KEEP) {
- lastViewedCategories.remove(lastViewedCategories.size() - 1);
+ lastViewedCategories.remove(lastViewedCategories.size() - 1)
}
// set the content path prefix
-contentPathPrefix = CatalogWorker.getContentPathPrefix(request);
-context.put("contentPathPrefix", contentPathPrefix);
+contentPathPrefix = CatalogWorker.getContentPathPrefix(request)
+context.put("contentPathPrefix", contentPathPrefix)
// little routine to see if any members have a quantity > 0 assigned
-members = context.get("productCategoryMembers");
+members = context.get("productCategoryMembers")
if (UtilValidate.isNotEmpty(members)) {
for (i = 0; i < members.size(); i++) {
- productCategoryMember = (GenericValue) members.get(i);
+ productCategoryMember = (GenericValue) members.get(i)
if (productCategoryMember.get("quantity") != null && productCategoryMember.getDouble("quantity").doubleValue() > 0.0) {
- context.put("hasQuantities", new Boolean(true));
- break;
+ context.put("hasQuantities", new Boolean(true))
+ break
}
}
}
-CategoryContentWrapper categoryContentWrapper = new CategoryContentWrapper(productCategory, request);
-context.put("categoryContentWrapper", categoryContentWrapper);
+CategoryContentWrapper categoryContentWrapper = new CategoryContentWrapper(productCategory, request)
+context.put("categoryContentWrapper", categoryContentWrapper)
diff --git a/applications/order/groovyScripts/entry/catalog/ChooseCatalog.groovy b/applications/order/groovyScripts/entry/catalog/ChooseCatalog.groovy
index a8f4ae60af..1ea9764fcf 100644
--- a/applications/order/groovyScripts/entry/catalog/ChooseCatalog.groovy
+++ b/applications/order/groovyScripts/entry/catalog/ChooseCatalog.groovy
@@ -17,33 +17,33 @@
* under the License.
*/
-import org.apache.ofbiz.base.util.*;
-import org.apache.ofbiz.entity.util.*;
-import org.apache.ofbiz.product.catalog.*;
-import org.apache.ofbiz.order.shoppingcart.*;
-import org.apache.ofbiz.product.store.ProductStoreWorker;
+import org.apache.ofbiz.base.util.*
+import org.apache.ofbiz.entity.util.*
+import org.apache.ofbiz.product.catalog.*
+import org.apache.ofbiz.order.shoppingcart.*
+import org.apache.ofbiz.product.store.ProductStoreWorker
-catalogCol = null;
-currentCatalogId = null;
-currentCatalogName = null;
+catalogCol = null
+currentCatalogId = null
+currentCatalogName = null
-cart = ShoppingCartEvents.getCartObject(request);
-productStoreId = cart.getProductStoreId();
-partyId = cart.getOrderPartyId();
+cart = ShoppingCartEvents.getCartObject(request)
+productStoreId = cart.getProductStoreId()
+partyId = cart.getOrderPartyId()
-currentCatalogId = CatalogWorker.getCurrentCatalogId(request);
+currentCatalogId = CatalogWorker.getCurrentCatalogId(request)
if ("SALES_ORDER".equals(cart.getOrderType())) {
- catalogCol = CatalogWorker.getCatalogIdsAvailable(delegator, productStoreId, partyId);
+ catalogCol = CatalogWorker.getCatalogIdsAvailable(delegator, productStoreId, partyId)
} else {
- catalogCol = CatalogWorker.getAllCatalogIds(request);
+ catalogCol = CatalogWorker.getAllCatalogIds(request)
if (!currentCatalogId && catalogCol) {
- currentCatalogId = catalogCol.get(0);
+ currentCatalogId = catalogCol.get(0)
}
- session.setAttribute("CURRENT_CATALOG_ID", currentCatalogId);
+ session.setAttribute("CURRENT_CATALOG_ID", currentCatalogId)
}
-currentCatalogName = CatalogWorker.getCatalogName(request, currentCatalogId);
+currentCatalogName = CatalogWorker.getCatalogName(request, currentCatalogId)
-context.catalogCol = catalogCol;
-context.currentCatalogId = currentCatalogId;
-context.currentCatalogName = currentCatalogName;
+context.catalogCol = catalogCol
+context.currentCatalogId = currentCatalogId
+context.currentCatalogName = currentCatalogName
diff --git a/applications/order/groovyScripts/entry/catalog/CompareProducts.groovy b/applications/order/groovyScripts/entry/catalog/CompareProducts.groovy
index 388fcb3363..6b8c6c3a2a 100644
--- a/applications/order/groovyScripts/entry/catalog/CompareProducts.groovy
+++ b/applications/order/groovyScripts/entry/catalog/CompareProducts.groovy
@@ -17,63 +17,63 @@
* under the License.
*/
-import org.apache.ofbiz.product.product.*;
-import org.apache.ofbiz.order.shoppingcart.*;
-import org.apache.ofbiz.product.catalog.*;
-import org.apache.ofbiz.product.store.*;
-import org.apache.ofbiz.entity.condition.*;
-import org.apache.ofbiz.entity.util.*;
-import org.apache.ofbiz.base.util.*;
+import org.apache.ofbiz.product.product.*
+import org.apache.ofbiz.order.shoppingcart.*
+import org.apache.ofbiz.product.catalog.*
+import org.apache.ofbiz.product.store.*
+import org.apache.ofbiz.entity.condition.*
+import org.apache.ofbiz.entity.util.*
+import org.apache.ofbiz.base.util.*
-compareList = ProductEvents.getProductCompareList(request);
-context.compareList = compareList;
-cart = ShoppingCartEvents.getCartObject(request);
-catalogId = CatalogWorker.getCurrentCatalogId(request);
-productStore = ProductStoreWorker.getProductStore(request);
-productStoreId = productStore.productStoreId;
+compareList = ProductEvents.getProductCompareList(request)
+context.compareList = compareList
+cart = ShoppingCartEvents.getCartObject(request)
+catalogId = CatalogWorker.getCurrentCatalogId(request)
+productStore = ProductStoreWorker.getProductStore(request)
+productStoreId = productStore.productStoreId
-productDataMap = [:];
-context.productDataMap = productDataMap;
-productFeatureTypeIds = [] as LinkedHashSet;
-context.productFeatureTypeIds = productFeatureTypeIds;
-productFeatureTypeMap = [:];
-context.productFeatureTypeMap = productFeatureTypeMap;
+productDataMap = [:]
+context.productDataMap = productDataMap
+productFeatureTypeIds = [] as LinkedHashSet
+context.productFeatureTypeIds = productFeatureTypeIds
+productFeatureTypeMap = [:]
+context.productFeatureTypeMap = productFeatureTypeMap
compareList.each { product ->
- productData = [:];
- productDataMap[product.productId] = productData;
+ productData = [:]
+ productDataMap[product.productId] = productData
- productData.productContentWrapper = ProductContentWrapper.makeProductContentWrapper(product, request);
+ productData.productContentWrapper = ProductContentWrapper.makeProductContentWrapper(product, request)
priceContext = [product : product, currencyUomId : cart.getCurrency(),
- autoUserLogin : autoUserLogin, userLogin : userLogin];
- priceContext.webSiteId = webSiteId;
- priceContext.prodCatalogId = catalogId;
- priceContext.productStoreId = productStoreId;
- priceContext.agreementId = cart.getAgreementId();
- priceContext.partyId = cart.getPartyId(); // IMPORTANT: otherwise it'll be calculating prices using the logged in user which could be a CSR instead of the customer
- priceContext.checkIncludeVat = "Y";
- productData.priceMap = runService('calculateProductPrice', priceContext);
+ autoUserLogin : autoUserLogin, userLogin : userLogin]
+ priceContext.webSiteId = webSiteId
+ priceContext.prodCatalogId = catalogId
+ priceContext.productStoreId = productStoreId
+ priceContext.agreementId = cart.getAgreementId()
+ priceContext.partyId = cart.getPartyId() // IMPORTANT: otherwise it'll be calculating prices using the logged in user which could be a CSR instead of the customer
+ priceContext.checkIncludeVat = "Y"
+ productData.priceMap = runService('calculateProductPrice', priceContext)
condList = [
EntityCondition.makeCondition("productId", product.productId),
EntityUtil.getFilterByDateExpr(),
EntityCondition.makeCondition("productFeatureApplTypeId", EntityOperator.IN, ["STANDARD_FEATURE", "DISTINGUISHING_FEAT", "SELECTABLE_FEATURE"])
- ];
- productFeatureAppls = from("ProductFeatureAppl").where(condList).orderBy("sequenceNum").cache(true).queryList();
+ ]
+ productFeatureAppls = from("ProductFeatureAppl").where(condList).orderBy("sequenceNum").cache(true).queryList()
productFeatureAppls.each { productFeatureAppl ->
- productFeature = productFeatureAppl.getRelatedOne("ProductFeature", true);
+ productFeature = productFeatureAppl.getRelatedOne("ProductFeature", true)
if (!productData[productFeature.productFeatureTypeId]) {
- productData[productFeature.productFeatureTypeId] = [:];
+ productData[productFeature.productFeatureTypeId] = [:]
}
if (!productData[productFeature.productFeatureTypeId][productFeatureAppl.productFeatureApplTypeId]) {
- productData[productFeature.productFeatureTypeId][productFeatureAppl.productFeatureApplTypeId] = [];
+ productData[productFeature.productFeatureTypeId][productFeatureAppl.productFeatureApplTypeId] = []
}
- productData[productFeature.productFeatureTypeId][productFeatureAppl.productFeatureApplTypeId] << productFeature;
- productFeatureTypeIds << productFeature.productFeatureTypeId;
+ productData[productFeature.productFeatureTypeId][productFeatureAppl.productFeatureApplTypeId] << productFeature
+ productFeatureTypeIds << productFeature.productFeatureTypeId
}
}
productFeatureTypeIds.each { productFeatureTypeId ->
- productFeatureTypeMap[productFeatureTypeId] = from("ProductFeatureType").where("productFeatureTypeId", productFeatureTypeId).cache(true).queryOne();
+ productFeatureTypeMap[productFeatureTypeId] = from("ProductFeatureType").where("productFeatureTypeId", productFeatureTypeId).cache(true).queryOne()
}
diff --git a/applications/order/groovyScripts/entry/catalog/InlineProductDetail.groovy b/applications/order/groovyScripts/entry/catalog/InlineProductDetail.groovy
index 13c35477da..b2ad1ac70a 100644
--- a/applications/order/groovyScripts/entry/catalog/InlineProductDetail.groovy
+++ b/applications/order/groovyScripts/entry/catalog/InlineProductDetail.groovy
@@ -17,291 +17,291 @@
* under the License.
*/
-import java.lang.*;
-import java.util.*;
-import java.text.NumberFormat;
-import org.apache.ofbiz.base.util.*;
-import org.apache.ofbiz.service.*;
-import org.apache.ofbiz.entity.*;
-import org.apache.ofbiz.entity.condition.*;
-import org.apache.ofbiz.entity.util.*;
-import org.apache.ofbiz.webapp.taglib.ContentUrlTag;
-import org.apache.ofbiz.webapp.stats.VisitHandler;
+import java.lang.*
+import java.util.*
+import java.text.NumberFormat
+import org.apache.ofbiz.base.util.*
+import org.apache.ofbiz.service.*
+import org.apache.ofbiz.entity.*
+import org.apache.ofbiz.entity.condition.*
+import org.apache.ofbiz.entity.util.*
+import org.apache.ofbiz.webapp.taglib.ContentUrlTag
+import org.apache.ofbiz.webapp.stats.VisitHandler
import org.apache.ofbiz.webapp.website.WebSiteWorker
-import org.apache.ofbiz.order.shoppingcart.ShoppingCartEvents;
-import org.apache.ofbiz.product.catalog.*;
-import org.apache.ofbiz.product.category.*;
-import org.apache.ofbiz.product.product.ProductWorker;
-import org.apache.ofbiz.product.product.ProductContentWrapper;
-import org.apache.ofbiz.product.product.ProductSearch;
-import org.apache.ofbiz.product.product.ProductSearchSession;
-import org.apache.ofbiz.product.store.*;
+import org.apache.ofbiz.order.shoppingcart.ShoppingCartEvents
+import org.apache.ofbiz.product.catalog.*
+import org.apache.ofbiz.product.category.*
+import org.apache.ofbiz.product.product.ProductWorker
+import org.apache.ofbiz.product.product.ProductContentWrapper
+import org.apache.ofbiz.product.product.ProductSearch
+import org.apache.ofbiz.product.product.ProductSearchSession
+import org.apache.ofbiz.product.store.*
-inlineProductId = request.getAttribute("inlineProductId");
-inlineCounter = request.getAttribute("inlineCounter");
-context.inlineCounter = inlineCounter;
-context.inlineProductId = inlineProductId;
+inlineProductId = request.getAttribute("inlineProductId")
+inlineCounter = request.getAttribute("inlineCounter")
+context.inlineCounter = inlineCounter
+context.inlineProductId = inlineProductId
-contentPathPrefix = CatalogWorker.getContentPathPrefix(request);
-catalogName = CatalogWorker.getCatalogName(request);
-currentCatalogId = CatalogWorker.getCurrentCatalogId(request);
+contentPathPrefix = CatalogWorker.getContentPathPrefix(request)
+catalogName = CatalogWorker.getCatalogName(request)
+currentCatalogId = CatalogWorker.getCurrentCatalogId(request)
if (inlineProductId) {
- inlineProduct = from("Product").where("productId", inlineProductId).cache(true).queryOne();
+ inlineProduct = from("Product").where("productId", inlineProductId).cache(true).queryOne()
if (inlineProduct) {
- context.product = inlineProduct;
- contentWrapper = new ProductContentWrapper(inlineProduct, request);
- context.put("title", contentWrapper.get("PRODUCT_NAME", "html"));
- context.put("metaDescription", contentWrapper.get("DESCRIPTION", "html"));
- productTemplate = product.detailScreen;
+ context.product = inlineProduct
+ contentWrapper = new ProductContentWrapper(inlineProduct, request)
+ context.put("title", contentWrapper.get("PRODUCT_NAME", "html"))
+ context.put("metaDescription", contentWrapper.get("DESCRIPTION", "html"))
+ productTemplate = product.detailScreen
if (productTemplate) {
- detailScreen = productTemplate;
+ detailScreen = productTemplate
}
}
}
-templatePathPrefix = CatalogWorker.getTemplatePathPrefix(request);
+templatePathPrefix = CatalogWorker.getTemplatePathPrefix(request)
if (templatePathPrefix) {
- detailScreen = templatePathPrefix + detailScreen;
+ detailScreen = templatePathPrefix + detailScreen
}
-context.detailScreen = detailScreen;
+context.detailScreen = detailScreen
String buildNext(Map map, List order, String current, String prefix, Map featureTypes) {
- def ct = 0;
- def buf = new StringBuffer();
- buf.append("function listFT" + inlineCounter + current + prefix + "() { ");
- buf.append("document.forms[\"configform\"].elements[\"FT" + inlineCounter + current + "\"].options.length = 1;");
- buf.append("document.forms[\"configform\"].elements[\"FT" + inlineCounter + current + "\"].options[0] = new Option(\"" + featureTypes[current] + "\",\"\",true,true);");
+ def ct = 0
+ def buf = new StringBuffer()
+ buf.append("function listFT" + inlineCounter + current + prefix + "() { ")
+ buf.append("document.forms[\"configform\"].elements[\"FT" + inlineCounter + current + "\"].options.length = 1;")
+ buf.append("document.forms[\"configform\"].elements[\"FT" + inlineCounter + current + "\"].options[0] = new Option(\"" + featureTypes[current] + "\",\"\",true,true);")
map.each { key, value ->
- def optValue = null;
+ def optValue = null
if (order.indexOf(current) == (order.size()-1)) {
- optValue = value.iterator().next();
+ optValue = value.iterator().next()
} else {
- optValue = prefix + "_" + ct;
+ optValue = prefix + "_" + ct
}
- buf.append("document.forms[\"configform\"].elements[\"FT" + inlineCounter + current + "\"].options[" + (ct + 1) + "] = new Option(\"" + key + "\",\"" + optValue + "\");");
- ct++;
+ buf.append("document.forms[\"configform\"].elements[\"FT" + inlineCounter + current + "\"].options[" + (ct + 1) + "] = new Option(\"" + key + "\",\"" + optValue + "\");")
+ ct++
}
- buf.append(" }");
+ buf.append(" }")
if (order.indexOf(current) < (order.size()-1)) {
- ct = 0;
+ ct = 0
map.each { key, value ->
- def nextOrder = order.get(order.indexOf(current)+1);
- def newPrefix = prefix + "_" + ct;
- buf.append(buildNext(value, order, nextOrder, newPrefix, featureTypes));
- ct++;
+ def nextOrder = order.get(order.indexOf(current)+1)
+ def newPrefix = prefix + "_" + ct
+ buf.append(buildNext(value, order, nextOrder, newPrefix, featureTypes))
+ ct++
}
}
- return buf.toString();
+ return buf.toString()
}
-cart = ShoppingCartEvents.getCartObject(request);
+cart = ShoppingCartEvents.getCartObject(request)
// set the content path prefix
-contentPathPrefix = CatalogWorker.getContentPathPrefix(request);
-context.contentPathPrefix = contentPathPrefix;
+contentPathPrefix = CatalogWorker.getContentPathPrefix(request)
+context.contentPathPrefix = contentPathPrefix
// get the product detail information
if (inlineProduct) {
- inlineProductId = inlineProduct.productId;
- productTypeId = inlineProduct.productTypeId;
- featureTypes = [:];
- featureOrder = [];
+ inlineProductId = inlineProduct.productId
+ productTypeId = inlineProduct.productTypeId
+ featureTypes = [:]
+ featureOrder = []
// make the productContentWrapper
- productContentWrapper = new ProductContentWrapper(inlineProduct, request);
- context.productContentWrapper = productContentWrapper;
+ productContentWrapper = new ProductContentWrapper(inlineProduct, request)
+ context.productContentWrapper = productContentWrapper
// get the main detail image (virtual or single product)
- mainDetailImage = productContentWrapper.get("DETAIL_IMAGE_URL", "url");
+ mainDetailImage = productContentWrapper.get("DETAIL_IMAGE_URL", "url")
if (mainDetailImage) {
- mainDetailImageUrl = ContentUrlTag.getContentPrefix(request) + mainDetailImage;
- context.mainDetailImageUrl = mainDetailImageUrl.toString();
+ mainDetailImageUrl = ContentUrlTag.getContentPrefix(request) + mainDetailImage
+ context.mainDetailImageUrl = mainDetailImageUrl.toString()
}
// get the product price
- webSiteId = WebSiteWorker.getWebSiteId(request);
- autoUserLogin = request.getSession().getAttribute("autoUserLogin");
+ webSiteId = WebSiteWorker.getWebSiteId(request)
+ autoUserLogin = request.getSession().getAttribute("autoUserLogin")
if (cart.isSalesOrder()) {
// sales order: run the "calculateProductPrice" service
priceContext = [product : inlineProduct, prodCatalogId : currentCatalogId,
- currencyUomId : cart.getCurrency(), autoUserLogin : autoUserLogin];
- priceContext.webSiteId = webSiteId;
- priceContext.productStoreId = productStoreId;
- priceContext.checkIncludeVat = "Y";
- priceContext.agreementId = cart.getAgreementId();
- priceContext.partyId = cart.getPartyId(); // IMPORTANT: must put this in, or price will be calculated for the CSR instead of the customer
- priceMap = runService('calculateProductPrice', priceContext);
- context.priceMap = priceMap;
+ currencyUomId : cart.getCurrency(), autoUserLogin : autoUserLogin]
+ priceContext.webSiteId = webSiteId
+ priceContext.productStoreId = productStoreId
+ priceContext.checkIncludeVat = "Y"
+ priceContext.agreementId = cart.getAgreementId()
+ priceContext.partyId = cart.getPartyId() // IMPORTANT: must put this in, or price will be calculated for the CSR instead of the customer
+ priceMap = runService('calculateProductPrice', priceContext)
+ context.priceMap = priceMap
} else {
// purchase order: run the "calculatePurchasePrice" service
priceContext = [product : inlineProduct, currencyUomId : cart.getCurrency(),
- partyId : cart.getPartyId(), userLogin : userLogin];
- priceMap = runService('calculatePurchasePrice', priceContext);
- context.priceMap = priceMap;
+ partyId : cart.getPartyId(), userLogin : userLogin]
+ priceMap = runService('calculatePurchasePrice', priceContext)
+ context.priceMap = priceMap
}
- context.variantTree = null;
- context.variantTreeSize = null;
- context.variantSample = null;
- context.variantSampleKeys = null;
- context.variantSampleSize = null;
+ context.variantTree = null
+ context.variantTreeSize = null
+ context.variantSample = null
+ context.variantSampleKeys = null
+ context.variantSampleSize = null
if ("Y".equals(inlineProduct.isVirtual)) {
if ("VV_FEATURETREE".equals(ProductWorker.getProductVirtualVariantMethod(delegator, inlineProductId))) {
- context.featureLists = ProductWorker.getSelectableProductFeaturesByTypesAndSeq(inlineProduct);
+ context.featureLists = ProductWorker.getSelectableProductFeaturesByTypesAndSeq(inlineProduct)
} else {
- featureMap = runService("getProductFeatureSet", [productId : inlineProductId]);
- featureSet = featureMap.featureSet;
+ featureMap = runService("getProductFeatureSet", [productId : inlineProductId])
+ featureSet = featureMap.featureSet
if (featureSet) {
- variantTreeMap = runService('getProductVariantTree', [productId : inlineProductId, featureOrder : featureSet, productStoreId : productStoreId]);
- variantTree = variantTreeMap.variantTree;
- imageMap = variantTreeMap.variantSample;
- virtualVariant = variantTreeMap.virtualVariant;
- context.virtualVariant = virtualVariant;
+ variantTreeMap = runService('getProductVariantTree', [productId : inlineProductId, featureOrder : featureSet, productStoreId : productStoreId])
+ variantTree = variantTreeMap.variantTree
+ imageMap = variantTreeMap.variantSample
+ virtualVariant = variantTreeMap.virtualVariant
+ context.virtualVariant = virtualVariant
if (variantTree) {
- context.variantTree = variantTree;
- context.variantTreeSize = variantTree.size();
+ context.variantTree = variantTree
+ context.variantTreeSize = variantTree.size()
}
if (imageMap) {
- context.variantSample = imageMap;
- context.variantSampleKeys = imageMap.keySet();
- context.variantSampleSize = imageMap.size();
+ context.variantSample = imageMap
+ context.variantSampleKeys = imageMap.keySet()
+ context.variantSampleSize = imageMap.size()
}
- context.featureSet = featureSet;
+ context.featureSet = featureSet
if (variantTree) {
- featureOrder = new LinkedList(featureSet);
+ featureOrder = new LinkedList(featureSet)
featureOrder.each { featureKey ->
- featureValue = from("ProductFeatureType").where("productFeatureTypeId", featureKey).cache(true).queryOne();
- fValue = featureValue.get("description") ?: featureValue.productFeatureTypeId;
- featureTypes[featureKey] = fValue;
+ featureValue = from("ProductFeatureType").where("productFeatureTypeId", featureKey).cache(true).queryOne()
+ fValue = featureValue.get("description") ?: featureValue.productFeatureTypeId
+ featureTypes[featureKey] = fValue
}
}
- context.featureTypes = featureTypes;
- context.featureOrder = featureOrder;
+ context.featureTypes = featureTypes
+ context.featureOrder = featureOrder
if (featureOrder) {
- context.featureOrderFirst = featureOrder[0];
+ context.featureOrderFirst = featureOrder[0]
}
if (variantTree && imageMap) {
- jsBuf = new StringBuffer();
- jsBuf.append("");
+ jsBuf.append(amt.toString())
+ jsBuf.append(variantPriceJS.toString())
+ jsBuf.append("")
- context.virtualJavaScript = jsBuf;
+ context.virtualJavaScript = jsBuf
}
}
}
diff --git a/applications/order/groovyScripts/entry/catalog/KeywordSearch.groovy b/applications/order/groovyScripts/entry/catalog/KeywordSearch.groovy
index 6db1186093..cebe70be64 100644
--- a/applications/order/groovyScripts/entry/catalog/KeywordSearch.groovy
+++ b/applications/order/groovyScripts/entry/catalog/KeywordSearch.groovy
@@ -22,25 +22,25 @@
* should not contain order component's specific code.
*/
-import org.apache.ofbiz.base.util.*;
-import org.apache.ofbiz.product.catalog.*;
-import org.apache.ofbiz.product.feature.*;
-import org.apache.ofbiz.product.product.*;
+import org.apache.ofbiz.base.util.*
+import org.apache.ofbiz.product.catalog.*
+import org.apache.ofbiz.product.feature.*
+import org.apache.ofbiz.product.product.*
-module = "KeywordSearch.groovy";
+module = "KeywordSearch.groovy"
// note: this can be run multiple times in the same request without causing problems, will check to see on its own if it has run again
-ProductSearchSession.processSearchParameters(parameters, request);
-prodCatalogId = CatalogWorker.getCurrentCatalogId(request);
-result = ProductSearchSession.getProductSearchResult(request, delegator, prodCatalogId);
+ProductSearchSession.processSearchParameters(parameters, request)
+prodCatalogId = CatalogWorker.getCurrentCatalogId(request)
+result = ProductSearchSession.getProductSearchResult(request, delegator, prodCatalogId)
-context.productIds = result.productIds;
-context.viewIndex = result.viewIndex;
-context.viewSize = result.viewSize;
-context.listSize = result.listSize;
-context.lowIndex = result.lowIndex;
-context.highIndex = result.highIndex;
-context.paging = result.paging;
-context.previousViewSize = result.previousViewSize;
-context.searchConstraintStrings = result.searchConstraintStrings;
-context.searchSortOrderString = result.searchSortOrderString;
+context.productIds = result.productIds
+context.viewIndex = result.viewIndex
+context.viewSize = result.viewSize
+context.listSize = result.listSize
+context.lowIndex = result.lowIndex
+context.highIndex = result.highIndex
+context.paging = result.paging
+context.previousViewSize = result.previousViewSize
+context.searchConstraintStrings = result.searchConstraintStrings
+context.searchSortOrderString = result.searchSortOrderString
diff --git a/applications/order/groovyScripts/entry/catalog/KeywordSearchOptions.groovy b/applications/order/groovyScripts/entry/catalog/KeywordSearchOptions.groovy
index c07c8b9dd3..7a4da01c37 100644
--- a/applications/order/groovyScripts/entry/catalog/KeywordSearchOptions.groovy
+++ b/applications/order/groovyScripts/entry/catalog/KeywordSearchOptions.groovy
@@ -22,18 +22,18 @@
* should not contain order component's specific code.
*/
-import org.apache.ofbiz.product.catalog.*;
+import org.apache.ofbiz.product.catalog.*
-currentCatalogId = CatalogWorker.getCurrentCatalogId(request);
-searchCategoryId = CatalogWorker.getCatalogSearchCategoryId(request, currentCatalogId);
-otherSearchProdCatalogCategories = CatalogWorker.getProdCatalogCategories(request, currentCatalogId, "PCCT_OTHER_SEARCH");
+currentCatalogId = CatalogWorker.getCurrentCatalogId(request)
+searchCategoryId = CatalogWorker.getCatalogSearchCategoryId(request, currentCatalogId)
+otherSearchProdCatalogCategories = CatalogWorker.getProdCatalogCategories(request, currentCatalogId, "PCCT_OTHER_SEARCH")
-searchOperator = request.getParameter("SEARCH_OPERATOR");
+searchOperator = request.getParameter("SEARCH_OPERATOR")
if (!"AND".equals(searchOperator) && !"OR".equals(searchOperator)) {
- searchOperator = "OR";
+ searchOperator = "OR"
}
-context.currentCatalogId = currentCatalogId;
-context.searchCategoryId = searchCategoryId;
-context.otherSearchProdCatalogCategories = otherSearchProdCatalogCategories;
-context.searchOperator = searchOperator;
+context.currentCatalogId = currentCatalogId
+context.searchCategoryId = searchCategoryId
+context.otherSearchProdCatalogCategories = otherSearchProdCatalogCategories
+context.searchOperator = searchOperator
diff --git a/applications/order/groovyScripts/entry/catalog/PrepareConfigForm.groovy b/applications/order/groovyScripts/entry/catalog/PrepareConfigForm.groovy
index a20870b3e7..1f4d655944 100644
--- a/applications/order/groovyScripts/entry/catalog/PrepareConfigForm.groovy
+++ b/applications/order/groovyScripts/entry/catalog/PrepareConfigForm.groovy
@@ -22,33 +22,33 @@
* should not contain order component's specific code.
*/
-import org.apache.ofbiz.order.shoppingcart.ShoppingCartEvents;
-import org.apache.ofbiz.product.config.ProductConfigWorker;
-import org.apache.ofbiz.product.store.ProductStoreWorker;
-import org.apache.ofbiz.base.util.*;
+import org.apache.ofbiz.order.shoppingcart.ShoppingCartEvents
+import org.apache.ofbiz.product.config.ProductConfigWorker
+import org.apache.ofbiz.product.store.ProductStoreWorker
+import org.apache.ofbiz.base.util.*
-currencyUomId = ShoppingCartEvents.getCartObject(request).getCurrency();
-product = context.product;
+currencyUomId = ShoppingCartEvents.getCartObject(request).getCurrency()
+product = context.product
if (product) {
- configWrapper = ProductConfigWorker.getProductConfigWrapper(product.productId, currencyUomId, request);
- ProductConfigWorker.fillProductConfigWrapper(configWrapper, request);
+ configWrapper = ProductConfigWorker.getProductConfigWrapper(product.productId, currencyUomId, request)
+ ProductConfigWorker.fillProductConfigWrapper(configWrapper, request)
if (!configWrapper.isCompleted()) {
- configId = request.getParameter("configId");
+ configId = request.getParameter("configId")
if (configId) {
- configWrapper.loadConfig(delegator, configId);
+ configWrapper.loadConfig(delegator, configId)
} else {
- configWrapper.setDefaultConfig();
+ configWrapper.setDefaultConfig()
}
}
- ProductConfigWorker.storeProductConfigWrapper(configWrapper, delegator);
+ ProductConfigWorker.storeProductConfigWrapper(configWrapper, delegator)
if (!ProductStoreWorker.isStoreInventoryAvailable(request, configWrapper, 1.0)) {
- context.productNotAvailable = "Y";
+ context.productNotAvailable = "Y"
}
- context.configwrapper = configWrapper;
- context.configId = configWrapper.getConfigId();
- context.totalPrice = configWrapper.getTotalPrice();
- context.renderSingleChoiceWithRadioButtons = "Y";
- context.showOffsetPrice = "Y";
+ context.configwrapper = configWrapper
+ context.configId = configWrapper.getConfigId()
+ context.totalPrice = configWrapper.getTotalPrice()
+ context.renderSingleChoiceWithRadioButtons = "Y"
+ context.showOffsetPrice = "Y"
}
diff --git a/applications/order/groovyScripts/entry/catalog/Product.groovy b/applications/order/groovyScripts/entry/catalog/Product.groovy
index e5cffa49a1..12656b1d3a 100644
--- a/applications/order/groovyScripts/entry/catalog/Product.groovy
+++ b/applications/order/groovyScripts/entry/catalog/Product.groovy
@@ -17,129 +17,129 @@
* under the License.
*/
-import java.lang.*;
-import java.util.*;
-import org.apache.ofbiz.base.util.*;
-import org.apache.ofbiz.entity.*;
-import org.apache.ofbiz.service.*;
-import org.apache.ofbiz.product.catalog.*;
-import org.apache.ofbiz.product.category.*;
-import org.apache.ofbiz.product.product.ProductWorker;
-import org.apache.ofbiz.product.product.ProductContentWrapper;
-import org.apache.ofbiz.entity.util.EntityUtil;
+import java.lang.*
+import java.util.*
+import org.apache.ofbiz.base.util.*
+import org.apache.ofbiz.entity.*
+import org.apache.ofbiz.service.*
+import org.apache.ofbiz.product.catalog.*
+import org.apache.ofbiz.product.category.*
+import org.apache.ofbiz.product.product.ProductWorker
+import org.apache.ofbiz.product.product.ProductContentWrapper
+import org.apache.ofbiz.entity.util.EntityUtil
-contentPathPrefix = CatalogWorker.getContentPathPrefix(request);
-catalogName = CatalogWorker.getCatalogName(request);
-currentCatalogId = CatalogWorker.getCurrentCatalogId(request);
-requestParams = UtilHttp.getParameterMap(request);
+contentPathPrefix = CatalogWorker.getContentPathPrefix(request)
+catalogName = CatalogWorker.getCatalogName(request)
+currentCatalogId = CatalogWorker.getCurrentCatalogId(request)
+requestParams = UtilHttp.getParameterMap(request)
-detailScreen = "productdetail";
-productId = requestParams.product_id ?: request.getAttribute("product_id");
+detailScreen = "productdetail"
+productId = requestParams.product_id ?: request.getAttribute("product_id")
-pageTitle = null;
-metaDescription = null;
-metaKeywords = null;
+pageTitle = null
+metaDescription = null
+metaKeywords = null
// get the product entity
if (productId) {
- product = from("Product").where("productId", productId).cache(true).queryOne();
+ product = from("Product").where("productId", productId).cache(true).queryOne()
if (product) {
// first make sure this isn't a virtual-variant that has an associated virtual product, if it does show that instead of the variant
if("Y".equals(product.isVirtual) && "Y".equals(product.isVariant)){
- virtualVariantProductAssocs = from("ProductAssoc").where("productId", productId, "productAssocTypeId", "ALTERNATIVE_PACKAGE").orderBy("-fromDate").filterByDate().cache(true).queryList();
+ virtualVariantProductAssocs = from("ProductAssoc").where("productId", productId, "productAssocTypeId", "ALTERNATIVE_PACKAGE").orderBy("-fromDate").filterByDate().cache(true).queryList()
if (virtualVariantProductAssocs) {
- productAssoc = EntityUtil.getFirst(virtualVariantProductAssocs);
- product = productAssoc.getRelatedOne("AssocProduct", true);
+ productAssoc = EntityUtil.getFirst(virtualVariantProductAssocs)
+ product = productAssoc.getRelatedOne("AssocProduct", true)
}
}
}
// first make sure this isn't a variant that has an associated virtual product, if it does show that instead of the variant
- virtualProductId = ProductWorker.getVariantVirtualId(product);
+ virtualProductId = ProductWorker.getVariantVirtualId(product)
if (virtualProductId) {
- productId = virtualProductId;
- product = from("Product").where("productId", productId).cache(true).queryOne();
+ productId = virtualProductId
+ product = from("Product").where("productId", productId).cache(true).queryOne()
}
- productPageTitle = from("ProductContentAndInfo").where("productId", productId, "productContentTypeId", "PAGE_TITLE").cache(true).queryList();
+ productPageTitle = from("ProductContentAndInfo").where("productId", productId, "productContentTypeId", "PAGE_TITLE").cache(true).queryList()
if (productPageTitle) {
- pageTitle = from("ElectronicText").where("dataResourceId", productPageTitle.get(0).dataResourceId).cache(true).queryOne();
+ pageTitle = from("ElectronicText").where("dataResourceId", productPageTitle.get(0).dataResourceId).cache(true).queryOne()
}
- productMetaDescription = from("ProductContentAndInfo").where("productId", productId, "productContentTypeId", "META_DESCRIPTION").cache(true).queryList();
+ productMetaDescription = from("ProductContentAndInfo").where("productId", productId, "productContentTypeId", "META_DESCRIPTION").cache(true).queryList()
if (productMetaDescription) {
- metaDescription = from("ElectronicText").where("dataResourceId", productMetaDescription.get(0).dataResourceId).cache(true).queryOne();
+ metaDescription = from("ElectronicText").where("dataResourceId", productMetaDescription.get(0).dataResourceId).cache(true).queryOne()
}
- productMetaKeywords = from("ProductContentAndInfo").where("productId", productId, "productContentTypeId", "META_KEYWORD").cache(true).queryList();
+ productMetaKeywords = from("ProductContentAndInfo").where("productId", productId, "productContentTypeId", "META_KEYWORD").cache(true).queryList()
if (productMetaKeywords) {
- metaKeywords = from("ElectronicText").where("dataResourceId", productMetaKeywords.get(0).dataResourceId).cache(true).queryOne();
+ metaKeywords = from("ElectronicText").where("dataResourceId", productMetaKeywords.get(0).dataResourceId).cache(true).queryOne()
}
- context.productId = productId;
+ context.productId = productId
// now check to see if there is a view allow category and if this product is in it...
if (product) {
- viewProductCategoryId = CatalogWorker.getCatalogViewAllowCategoryId(delegator, currentCatalogId);
+ viewProductCategoryId = CatalogWorker.getCatalogViewAllowCategoryId(delegator, currentCatalogId)
if (viewProductCategoryId) {
if (!CategoryWorker.isProductInCategory(delegator, productId, viewProductCategoryId)) {
// a view allow productCategoryId was found, but the product is not in the category, axe it...
- product = null;
+ product = null
}
}
}
if (product) {
- context.product = product;
- contentWrapper = new ProductContentWrapper(product, request);
+ context.product = product
+ contentWrapper = new ProductContentWrapper(product, request)
if (pageTitle) {
- context.title = pageTitle.textData;
+ context.title = pageTitle.textData
} else {
- context.put("title", contentWrapper.get("PRODUCT_NAME", "html"));
+ context.put("title", contentWrapper.get("PRODUCT_NAME", "html"))
}
if (metaDescription) {
- context.metaDescription = metaDescription.textData;
+ context.metaDescription = metaDescription.textData
} else {
- context.put("metaDescription", contentWrapper.get("DESCRIPTION", "html"));
+ context.put("metaDescription", contentWrapper.get("DESCRIPTION", "html"))
}
if (metaKeywords) {
- context.metaKeywords = metaKeywords.textData;
+ context.metaKeywords = metaKeywords.textData
} else {
- keywords = [];
- keywords.add(contentWrapper.get("PRODUCT_NAME", "html"));
- keywords.add(catalogName);
- members = from("ProductCategoryMember").where("productId", productId).cache(true).queryList();
+ keywords = []
+ keywords.add(contentWrapper.get("PRODUCT_NAME", "html"))
+ keywords.add(catalogName)
+ members = from("ProductCategoryMember").where("productId", productId).cache(true).queryList()
members.each { member ->
- category = member.getRelatedOne("ProductCategory", true);
+ category = member.getRelatedOne("ProductCategory", true)
if (category.description) {
- categoryContentWrapper = new CategoryContentWrapper(category, request);
- categoryDescription = categoryContentWrapper.get("DESCRIPTION", "html");
+ categoryContentWrapper = new CategoryContentWrapper(category, request)
+ categoryDescription = categoryContentWrapper.get("DESCRIPTION", "html")
if (categoryDescription) {
- keywords.add(categoryDescription);
+ keywords.add(categoryDescription)
}
}
}
- context.metaKeywords = StringUtil.join(keywords, ", ");
+ context.metaKeywords = StringUtil.join(keywords, ", ")
}
// Set the default template for aggregated product (product component configurator ui)
if (product.productTypeId && ("AGGREGATED".equals(product.productTypeId) || "AGGREGATED_SERVICE".equals(product.productTypeId)) && context.configproductdetailScreen) {
- detailScreen = context.configproductdetailScreen;
+ detailScreen = context.configproductdetailScreen
}
- productTemplate = product.detailScreen;
+ productTemplate = product.detailScreen
if (productTemplate) {
- detailScreen = productTemplate;
+ detailScreen = productTemplate
}
}
}
// check the catalog's template path and update
-templatePathPrefix = CatalogWorker.getTemplatePathPrefix(request);
+templatePathPrefix = CatalogWorker.getTemplatePathPrefix(request)
if (templatePathPrefix) {
- detailScreen = templatePathPrefix + detailScreen;
+ detailScreen = templatePathPrefix + detailScreen
}
// set the template for the view
-context.detailScreen = detailScreen;
+context.detailScreen = detailScreen
diff --git a/applications/order/groovyScripts/entry/catalog/ProductDetail.groovy b/applications/order/groovyScripts/entry/catalog/ProductDetail.groovy
index f474180992..f7fdf738ef 100644
--- a/applications/order/groovyScripts/entry/catalog/ProductDetail.groovy
+++ b/applications/order/groovyScripts/entry/catalog/ProductDetail.groovy
@@ -22,613 +22,613 @@
* should not contain order component's specific code.
*/
-import java.text.NumberFormat;
+import java.text.NumberFormat
-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.service.*;
-import org.apache.ofbiz.webapp.taglib.ContentUrlTag;
-import org.apache.ofbiz.product.product.ProductContentWrapper;
-import org.apache.ofbiz.product.product.ProductSearch;
-import org.apache.ofbiz.product.product.ProductSearchSession;
-import org.apache.ofbiz.product.product.ProductWorker;
-import org.apache.ofbiz.product.catalog.*;
-import org.apache.ofbiz.product.store.*;
-import org.apache.ofbiz.webapp.stats.VisitHandler;
+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.service.*
+import org.apache.ofbiz.webapp.taglib.ContentUrlTag
+import org.apache.ofbiz.product.product.ProductContentWrapper
+import org.apache.ofbiz.product.product.ProductSearch
+import org.apache.ofbiz.product.product.ProductSearchSession
+import org.apache.ofbiz.product.product.ProductWorker
+import org.apache.ofbiz.product.catalog.*
+import org.apache.ofbiz.product.store.*
+import org.apache.ofbiz.webapp.stats.VisitHandler
import org.apache.ofbiz.webapp.website.WebSiteWorker
-import org.apache.ofbiz.order.shoppingcart.ShoppingCartEvents;
-import org.apache.ofbiz.order.shoppingcart.ShoppingCart;
+import org.apache.ofbiz.order.shoppingcart.ShoppingCartEvents
+import org.apache.ofbiz.order.shoppingcart.ShoppingCart
String buildNext(Map map, List order, String current, String prefix, Map featureTypes) {
- def ct = 0;
- def buf = new StringBuffer();
- buf.append("function listFT" + current + prefix + "() { ");
- buf.append("document.forms[\"addform\"].elements[\"FT" + current + "\"].options.length = 1;");
- buf.append("document.forms[\"addform\"].elements[\"FT" + current + "\"].options[0] = new Option(\"" + featureTypes[current] + "\",\"\",true,true);");
+ def ct = 0
+ def buf = new StringBuffer()
+ buf.append("function listFT" + current + prefix + "() { ")
+ buf.append("document.forms[\"addform\"].elements[\"FT" + current + "\"].options.length = 1;")
+ buf.append("document.forms[\"addform\"].elements[\"FT" + current + "\"].options[0] = new Option(\"" + featureTypes[current] + "\",\"\",true,true);")
map.each { key, value ->
- def optValue = null;
+ def optValue = null
if (order.indexOf(current) == (order.size()-1)) {
- optValue = value.iterator().next();
+ optValue = value.iterator().next()
} else {
- optValue = prefix + "_" + ct;
+ optValue = prefix + "_" + ct
}
- buf.append("document.forms[\"addform\"].elements[\"FT" + current + "\"].options[" + (ct + 1) + "] = new Option(\"" + key + "\",\"" + optValue + "\");");
- ct++;
+ buf.append("document.forms[\"addform\"].elements[\"FT" + current + "\"].options[" + (ct + 1) + "] = new Option(\"" + key + "\",\"" + optValue + "\");")
+ ct++
}
- buf.append(" }");
+ buf.append(" }")
if (order.indexOf(current) < (order.size()-1)) {
- ct = 0;
+ ct = 0
map.each { key, value ->
- def nextOrder = order.get(order.indexOf(current)+1);
- def newPrefix = prefix + "_" + ct;
- buf.append(buildNext(value, order, nextOrder, newPrefix, featureTypes));
- ct++;
+ def nextOrder = order.get(order.indexOf(current)+1)
+ def newPrefix = prefix + "_" + ct
+ buf.append(buildNext(value, order, nextOrder, newPrefix, featureTypes))
+ ct++
}
}
- return buf.toString();
+ return buf.toString()
}
-cart = ShoppingCartEvents.getCartObject(request);
+cart = ShoppingCartEvents.getCartObject(request)
// set currency format
-currencyUomId = null;
-if (cart) currencyUomId = cart.getCurrency();
-if (!currencyUomId) currencyUomId = EntityUtilProperties.getPropertyValue("general", "currency.uom.id.default", "USD", delegator);
+currencyUomId = null
+if (cart) currencyUomId = cart.getCurrency()
+if (!currencyUomId) currencyUomId = EntityUtilProperties.getPropertyValue("general", "currency.uom.id.default", "USD", delegator)
// get the shopping lists for the user (if logged in)
if (userLogin) {
exprList = [EntityCondition.makeCondition("partyId", EntityOperator.EQUALS, userLogin.partyId),
- EntityCondition.makeCondition("listName", EntityOperator.NOT_EQUAL, "auto-save")];
- allShoppingLists = from("ShoppingList").where(exprList).orderBy("listName").queryList();
- context.shoppingLists = allShoppingLists;
+ EntityCondition.makeCondition("listName", EntityOperator.NOT_EQUAL, "auto-save")]
+ allShoppingLists = from("ShoppingList").where(exprList).orderBy("listName").queryList()
+ context.shoppingLists = allShoppingLists
}
// set the content path prefix
-contentPathPrefix = CatalogWorker.getContentPathPrefix(request);
-context.contentPathPrefix = contentPathPrefix;
+contentPathPrefix = CatalogWorker.getContentPathPrefix(request)
+context.contentPathPrefix = contentPathPrefix
// get the product detail information
if (product) {
- productId = product.productId;
- context.product_id = productId;
- productTypeId = product.productTypeId;
+ productId = product.productId
+ context.product_id = productId
+ productTypeId = product.productTypeId
- boolean isMarketingPackage = EntityTypeUtil.hasParentType(delegator, "ProductType", "productTypeId", product.productTypeId, "parentTypeId", "MARKETING_PKG");
- context.isMarketingPackage = (isMarketingPackage? "true": "false");
+ boolean isMarketingPackage = EntityTypeUtil.hasParentType(delegator, "ProductType", "productTypeId", product.productTypeId, "parentTypeId", "MARKETING_PKG")
+ context.isMarketingPackage = (isMarketingPackage? "true": "false")
- featureTypes = [:];
- featureOrder = [];
+ featureTypes = [:]
+ featureOrder = []
// set this as a last viewed
- LAST_VIEWED_TO_KEEP = 10; // modify this to change the number of last viewed to keep
- lastViewedProducts = session.getAttribute("lastViewedProducts");
+ LAST_VIEWED_TO_KEEP = 10 // modify this to change the number of last viewed to keep
+ lastViewedProducts = session.getAttribute("lastViewedProducts")
if (!lastViewedProducts) {
- lastViewedProducts = [];
- session.setAttribute("lastViewedProducts", lastViewedProducts);
+ lastViewedProducts = []
+ session.setAttribute("lastViewedProducts", lastViewedProducts)
}
- lastViewedProducts.remove(productId);
- lastViewedProducts.add(0, productId);
+ lastViewedProducts.remove(productId)
+ lastViewedProducts.add(0, productId)
while (lastViewedProducts.size() > LAST_VIEWED_TO_KEEP) {
- lastViewedProducts.remove(lastViewedProducts.size() - 1);
+ lastViewedProducts.remove(lastViewedProducts.size() - 1)
}
// make the productContentWrapper
- productContentWrapper = new ProductContentWrapper(product, request);
- context.productContentWrapper = productContentWrapper;
+ productContentWrapper = new ProductContentWrapper(product, request)
+ context.productContentWrapper = productContentWrapper
// get the main detail image (virtual or single product)
- mainDetailImage = productContentWrapper.get("DETAIL_IMAGE_URL", "url");
+ mainDetailImage = productContentWrapper.get("DETAIL_IMAGE_URL", "url")
if (mainDetailImage) {
- mainDetailImageUrl = ContentUrlTag.getContentPrefix(request) + mainDetailImage;
- context.mainDetailImageUrl = mainDetailImageUrl.toString();
+ mainDetailImageUrl = ContentUrlTag.getContentPrefix(request) + mainDetailImage
+ context.mainDetailImageUrl = mainDetailImageUrl.toString()
}
// get next/previous information for category
- categoryId = parameters.category_id ?: product.primaryProductCategoryId;
- if (categoryId) context.categoryId = categoryId;
+ categoryId = parameters.category_id ?: product.primaryProductCategoryId
+ if (categoryId) context.categoryId = categoryId
- catNextPreviousResult = null;
+ catNextPreviousResult = null
if (categoryId) {
- prevNextMap = [categoryId : categoryId, productId : productId];
- prevNextMap.orderByFields = context.orderByFields ?: ["sequenceNum", "productId"];
- catNextPreviousResult = runService('getPreviousNextProducts', prevNextMap);
+ prevNextMap = [categoryId : categoryId, productId : productId]
+ prevNextMap.orderByFields = context.orderByFields ?: ["sequenceNum", "productId"]
+ catNextPreviousResult = runService('getPreviousNextProducts', prevNextMap)
if (ServiceUtil.isError(catNextPreviousResult)) {
- request.setAttribute("errorMessageList", [ServiceUtil.getErrorMessage(catNextPreviousResult)]);
- return;
+ request.setAttribute("errorMessageList", [ServiceUtil.getErrorMessage(catNextPreviousResult)])
+ return
}
if (catNextPreviousResult && catNextPreviousResult.category) {
- context.category = catNextPreviousResult.category;
- context.previousProductId = catNextPreviousResult.previousProductId;
- context.nextProductId = catNextPreviousResult.nextProductId;
+ context.category = catNextPreviousResult.category
+ context.previousProductId = catNextPreviousResult.previousProductId
+ context.nextProductId = catNextPreviousResult.nextProductId
}
}
// get the product store for only Sales Order not for Purchase Order.
- productStore = null;
- productStoreId = null;
- cart = ShoppingCartEvents.getCartObject(request);
+ productStore = null
+ productStoreId = null
+ cart = ShoppingCartEvents.getCartObject(request)
if (cart.isSalesOrder()) {
- productStore = ProductStoreWorker.getProductStore(request);
- productStoreId = productStore.productStoreId;
- context.productStoreId = productStoreId;
+ productStore = ProductStoreWorker.getProductStore(request)
+ productStoreId = productStore.productStoreId
+ context.productStoreId = productStoreId
}
// get a defined survey
- productSurvey = ProductStoreWorker.getProductSurveys(delegator, productStoreId, productId, "CART_ADD");
+ productSurvey = ProductStoreWorker.getProductSurveys(delegator, productStoreId, productId, "CART_ADD")
if (productSurvey) {
- survey = EntityUtil.getFirst(productSurvey);
- origParamMapId = UtilHttp.stashParameterMap(request);
- surveyContext = ["_ORIG_PARAM_MAP_ID_" : origParamMapId];
- surveyPartyId = userLogin?.partyId;
- wrapper = new ProductStoreSurveyWrapper(survey, surveyPartyId, surveyContext);
- context.surveyWrapper = wrapper;
+ survey = EntityUtil.getFirst(productSurvey)
+ origParamMapId = UtilHttp.stashParameterMap(request)
+ surveyContext = ["_ORIG_PARAM_MAP_ID_" : origParamMapId]
+ surveyPartyId = userLogin?.partyId
+ wrapper = new ProductStoreSurveyWrapper(survey, surveyPartyId, surveyContext)
+ context.surveyWrapper = wrapper
}
// get the product price
- catalogId = CatalogWorker.getCurrentCatalogId(request);
- currentCatalogId = catalogId;
- webSiteId = WebSiteWorker.getWebSiteId(request);
- autoUserLogin = request.getSession().getAttribute("autoUserLogin");
+ catalogId = CatalogWorker.getCurrentCatalogId(request)
+ currentCatalogId = catalogId
+ webSiteId = WebSiteWorker.getWebSiteId(request)
+ autoUserLogin = request.getSession().getAttribute("autoUserLogin")
if (cart.isSalesOrder()) {
// sales order: run the "calculateProductPrice" service
priceContext = [product : product, prodCatalogId : catalogId,
- currencyUomId : cart.getCurrency(), autoUserLogin : autoUserLogin];
- priceContext.webSiteId = webSiteId;
- priceContext.productStoreId = productStoreId;
- priceContext.checkIncludeVat = "Y";
- priceContext.agreementId = cart.getAgreementId();
- priceContext.partyId = cart.getPartyId(); // IMPORTANT: must put this in, or price will be calculated for the CSR instead of the customer
- priceMap = runService('calculateProductPrice', priceContext);
- context.priceMap = priceMap;
+ currencyUomId : cart.getCurrency(), autoUserLogin : autoUserLogin]
+ priceContext.webSiteId = webSiteId
+ priceContext.productStoreId = productStoreId
+ priceContext.checkIncludeVat = "Y"
+ priceContext.agreementId = cart.getAgreementId()
+ priceContext.partyId = cart.getPartyId() // IMPORTANT: must put this in, or price will be calculated for the CSR instead of the customer
+ priceMap = runService('calculateProductPrice', priceContext)
+ context.priceMap = priceMap
} else {
// purchase order: run the "calculatePurchasePrice" service
priceContext = [product : product, currencyUomId : cart.getCurrency(),
- partyId : cart.getPartyId(), userLogin : userLogin];
- priceMap = runService('calculatePurchasePrice', priceContext);
- context.priceMap = priceMap;
+ partyId : cart.getPartyId(), userLogin : userLogin]
+ priceMap = runService('calculatePurchasePrice', priceContext)
+ context.priceMap = priceMap
}
// get the product review(s)
// get all product review in case of Purchase Order.
- reviewByAnd = [:];
- reviewByAnd.statusId = "PRR_APPROVED";
+ reviewByAnd = [:]
+ reviewByAnd.statusId = "PRR_APPROVED"
if (cart.isSalesOrder()) {
- reviewByAnd.productStoreId = productStoreId;
+ reviewByAnd.productStoreId = productStoreId
}
- reviews = product.getRelated("ProductReview", reviewByAnd, ["-postedDateTime"], true);
- context.productReviews = reviews;
+ reviews = product.getRelated("ProductReview", reviewByAnd, ["-postedDateTime"], true)
+ context.productReviews = reviews
// get the average rating
if (reviews) {
- ratingReviews = EntityUtil.filterByAnd(reviews, [EntityCondition.makeCondition("productRating", EntityOperator.NOT_EQUAL, null)]);
+ ratingReviews = EntityUtil.filterByAnd(reviews, [EntityCondition.makeCondition("productRating", EntityOperator.NOT_EQUAL, null)])
if (ratingReviews) {
- context.averageRating = ProductWorker.getAverageProductRating(product, reviews, productStoreId);
- context.numRatings = ratingReviews.size();
+ context.averageRating = ProductWorker.getAverageProductRating(product, reviews, productStoreId)
+ context.numRatings = ratingReviews.size()
}
}
// get the days to ship
// if order is purchase then don't calculate available inventory for product.
if (cart.isSalesOrder()) {
- facilityId = productStore.inventoryFacilityId;
+ facilityId = productStore.inventoryFacilityId
- resultOutput = runService('getInventoryAvailableByFacility', [productId : productId, facilityId : facilityId, useCache : false]);
- totalAvailableToPromise = resultOutput.availableToPromiseTotal;
+ resultOutput = runService('getInventoryAvailableByFacility', [productId : productId, facilityId : facilityId, useCache : false])
+ totalAvailableToPromise = resultOutput.availableToPromiseTotal
if (totalAvailableToPromise) {
- productFacility = from("ProductFacility").where("productId", productId, "facilityId", facilityId).cache(true).queryOne();
+ productFacility = from("ProductFacility").where("productId", productId, "facilityId", facilityId).cache(true).queryOne()
context.daysToShip = productFacility?.daysToShip
}
} else {
- supplierProduct = from("SupplierProduct").where("productId", productId).orderBy("-availableFromDate").cache(true).queryFirst();
+ supplierProduct = from("SupplierProduct").where("productId", productId).orderBy("-availableFromDate").cache(true).queryFirst()
if (supplierProduct?.standardLeadTimeDays) {
- standardLeadTimeDays = supplierProduct.standardLeadTimeDays;
- daysToShip = standardLeadTimeDays + 1;
- context.daysToShip = daysToShip;
+ standardLeadTimeDays = supplierProduct.standardLeadTimeDays
+ daysToShip = standardLeadTimeDays + 1
+ context.daysToShip = daysToShip
}
}
// get the product distinguishing features
- disFeatureMap = runService('getProductFeatures', [productId : productId, type : "DISTINGUISHING_FEAT"]);
- disFeatureList = disFeatureMap.productFeatures;
- context.disFeatureList = disFeatureList;
+ disFeatureMap = runService('getProductFeatures', [productId : productId, type : "DISTINGUISHING_FEAT"])
+ disFeatureList = disFeatureMap.productFeatures
+ context.disFeatureList = disFeatureList
// an example of getting features of a certain type to show
- sizeProductFeatureAndAppls = from("ProductFeatureAndAppl").where("productId", productId, "productFeatureTypeId", "SIZE").orderBy("sequenceNum", "defaultSequenceNum").queryList();
- context.sizeProductFeatureAndAppls = sizeProductFeatureAndAppls;
+ sizeProductFeatureAndAppls = from("ProductFeatureAndAppl").where("productId", productId, "productFeatureTypeId", "SIZE").orderBy("sequenceNum", "defaultSequenceNum").queryList()
+ context.sizeProductFeatureAndAppls = sizeProductFeatureAndAppls
// get product variant for Box/Case/Each
- productVariants = [];
- boolean isAlternativePacking = ProductWorker.isAlternativePacking(delegator, product.productId, null);
- mainProducts = [];
+ productVariants = []
+ boolean isAlternativePacking = ProductWorker.isAlternativePacking(delegator, product.productId, null)
+ mainProducts = []
if(isAlternativePacking){
- productVirtualVariants = from("ProductAssoc").where("productIdTo", product.productId , "productAssocTypeId", "ALTERNATIVE_PACKAGE").cache(true).queryList();
+ productVirtualVariants = from("ProductAssoc").where("productIdTo", product.productId , "productAssocTypeId", "ALTERNATIVE_PACKAGE").cache(true).queryList()
if(productVirtualVariants){
productVirtualVariants.each { virtualVariantKey ->
- mainProductMap = [:];
- mainProduct = virtualVariantKey.getRelatedOne("MainProduct", true);
- quantityUom = mainProduct.getRelatedOne("QuantityUom", true);
- mainProductMap.productId = mainProduct.productId;
- mainProductMap.piecesIncluded = mainProduct.piecesIncluded;
- mainProductMap.uomDesc = quantityUom.description;
- mainProducts.add(mainProductMap);
+ mainProductMap = [:]
+ mainProduct = virtualVariantKey.getRelatedOne("MainProduct", true)
+ quantityUom = mainProduct.getRelatedOne("QuantityUom", true)
+ mainProductMap.productId = mainProduct.productId
+ mainProductMap.piecesIncluded = mainProduct.piecesIncluded
+ mainProductMap.uomDesc = quantityUom.description
+ mainProducts.add(mainProductMap)
}
}
}
- context.mainProducts = mainProducts;
+ context.mainProducts = mainProducts
// Special Variant Code
if ("Y".equals(product.isVirtual)) {
if ("VV_FEATURETREE".equals(ProductWorker.getProductVirtualVariantMethod(delegator, productId))) {
- context.featureLists = ProductWorker.getSelectableProductFeaturesByTypesAndSeq(product);
+ context.featureLists = ProductWorker.getSelectableProductFeaturesByTypesAndSeq(product)
} else {
- featureMap = runService('getProductFeatureSet', [productId : productId]);
- featureSet = featureMap.featureSet;
+ featureMap = runService('getProductFeatureSet', [productId : productId])
+ featureSet = featureMap.featureSet
if (featureSet) {
//if order is purchase then don't calculate available inventory for product.
if (cart.isPurchaseOrder()) {
- variantTreeMap = runService('getProductVariantTree', [productId : productId, featureOrder : featureSet, checkInventory: false]);
+ variantTreeMap = runService('getProductVariantTree', [productId : productId, featureOrder : featureSet, checkInventory: false])
} else {
- variantTreeMap = runService('getProductVariantTree', [productId : productId, featureOrder : featureSet, productStoreId : productStoreId]);
+ variantTreeMap = runService('getProductVariantTree', [productId : productId, featureOrder : featureSet, productStoreId : productStoreId])
}
- variantTree = variantTreeMap.variantTree;
- imageMap = variantTreeMap.variantSample;
- virtualVariant = variantTreeMap.virtualVariant;
- context.virtualVariant = virtualVariant;
+ variantTree = variantTreeMap.variantTree
+ imageMap = variantTreeMap.variantSample
+ virtualVariant = variantTreeMap.virtualVariant
+ context.virtualVariant = virtualVariant
if (variantTree) {
- context.variantTree = variantTree;
- context.variantTreeSize = variantTree.size();
+ context.variantTree = variantTree
+ context.variantTreeSize = variantTree.size()
}
- unavailableVariants = variantTreeMap.unavailableVariants;
+ unavailableVariants = variantTreeMap.unavailableVariants
if (unavailableVariants) {
- context.unavailableVariants = unavailableVariants;
+ context.unavailableVariants = unavailableVariants
}
if (imageMap) {
- context.variantSample = imageMap;
- context.variantSampleKeys = imageMap.keySet();
- context.variantSampleSize = imageMap.size();
+ context.variantSample = imageMap
+ context.variantSampleKeys = imageMap.keySet()
+ context.variantSampleSize = imageMap.size()
}
- context.featureSet = featureSet;
+ context.featureSet = featureSet
if (variantTree) {
- featureOrder = new LinkedList(featureSet);
+ featureOrder = new LinkedList(featureSet)
featureOrder.each { featureKey ->
- featureValue = from("ProductFeatureType").where("productFeatureTypeId", featureKey).cache(true).queryOne();
- fValue = featureValue.get("description") ?: featureValue.productFeatureTypeId;
- featureTypes[featureKey] = fValue;
+ featureValue = from("ProductFeatureType").where("productFeatureTypeId", featureKey).cache(true).queryOne()
+ fValue = featureValue.get("description") ?: featureValue.productFeatureTypeId
+ featureTypes[featureKey] = fValue
}
}
- context.featureTypes = featureTypes;
- context.featureOrder = featureOrder;
+ context.featureTypes = featureTypes
+ context.featureOrder = featureOrder
if (featureOrder) {
- context.featureOrderFirst = featureOrder[0];
+ context.featureOrderFirst = featureOrder[0]
}
if (variantTree && imageMap) {
- jsBuf = new StringBuffer();
- jsBuf.append("");
+ context.variantPriceList = variantPriceList
+ jsBuf.append(amt.toString())
+ jsBuf.append(variantPriceJS.toString())
+ jsBuf.append("")
- context.virtualJavaScript = jsBuf;
+ context.virtualJavaScript = jsBuf
}
}
}
} else {
- context.minimumQuantity= ShoppingCart.getMinimumOrderQuantity(delegator, priceMap.price, productId);
+ context.minimumQuantity= ShoppingCart.getMinimumOrderQuantity(delegator, priceMap.price, productId)
if(isAlternativePacking){
// get alternative product price when product doesn't have any feature
- jsBuf = new StringBuffer();
- jsBuf.append("");
- context.virtualVariantJavaScript = jsBuf;
+ context.virtualVariantPriceList = virtualVariantPriceList
+ jsBuf.append(amt.toString())
+ jsBuf.append(variantPriceJS.toString())
+ jsBuf.append("")
+ context.virtualVariantJavaScript = jsBuf
}
}
}
- availableInventory = 0.0;
+ availableInventory = 0.0
// if the product is a MARKETING_PKG_AUTO/PICK, then also get the quantity which can be produced from components
if (isMarketingPackage) {
- resultOutput = runService('getMktgPackagesAvailable', [productId : productId]);
- availableInventory = resultOutput.availableToPromiseTotal;
+ resultOutput = runService('getMktgPackagesAvailable', [productId : productId])
+ availableInventory = resultOutput.availableToPromiseTotal
} else {
//get last inventory count from product facility for the product
- facilities = from("ProductFacility").where("productId", product.productId).queryList();
+ facilities = from("ProductFacility").where("productId", product.productId).queryList()
if(facilities) {
facilities.each { facility ->
- lastInventoryCount = facility.lastInventoryCount;
+ lastInventoryCount = facility.lastInventoryCount
if (lastInventoryCount != null) {
- availableInventory += lastInventoryCount;
+ availableInventory += lastInventoryCount
}
}
}
}
- context.availableInventory = availableInventory;
+ context.availableInventory = availableInventory
// get product associations
- alsoBoughtProducts = runService('getAssociatedProducts', [productId : productId, type : "ALSO_BOUGHT", checkViewAllow : true, prodCatalogId : currentCatalogId, bidirectional : false, sortDescending : true]);
- context.alsoBoughtProducts = alsoBoughtProducts.assocProducts;
+ alsoBoughtProducts = runService('getAssociatedProducts', [productId : productId, type : "ALSO_BOUGHT", checkViewAllow : true, prodCatalogId : currentCatalogId, bidirectional : false, sortDescending : true])
+ context.alsoBoughtProducts = alsoBoughtProducts.assocProducts
- obsoleteProducts = runService('getAssociatedProducts', [productId : productId, type : "PRODUCT_OBSOLESCENCE", checkViewAllow : true, prodCatalogId : currentCatalogId]);
- context.obsoleteProducts = obsoleteProducts.assocProducts;
+ obsoleteProducts = runService('getAssociatedProducts', [productId : productId, type : "PRODUCT_OBSOLESCENCE", checkViewAllow : true, prodCatalogId : currentCatalogId])
+ context.obsoleteProducts = obsoleteProducts.assocProducts
- crossSellProducts = runService('getAssociatedProducts', [productId : productId, type : "PRODUCT_COMPLEMENT", checkViewAllow : true, prodCatalogId : currentCatalogId]);
- context.crossSellProducts = crossSellProducts.assocProducts;
+ crossSellProducts = runService('getAssociatedProducts', [productId : productId, type : "PRODUCT_COMPLEMENT", checkViewAllow : true, prodCatalogId : currentCatalogId])
+ context.crossSellProducts = crossSellProducts.assocProducts
- upSellProducts = runService('getAssociatedProducts', [productId : productId, type : "PRODUCT_UPGRADE", checkViewAllow : true, prodCatalogId : currentCatalogId]);
- context.upSellProducts = upSellProducts.assocProducts;
+ upSellProducts = runService('getAssociatedProducts', [productId : productId, type : "PRODUCT_UPGRADE", checkViewAllow : true, prodCatalogId : currentCatalogId])
+ context.upSellProducts = upSellProducts.assocProducts
- obsolenscenseProducts = runService('getAssociatedProducts', [productIdTo : productId, type : "PRODUCT_OBSOLESCENCE", checkViewAllow : true, prodCatalogId : currentCatalogId]);
- context.obsolenscenseProducts = obsolenscenseProducts.assocProducts;
+ obsolenscenseProducts = runService('getAssociatedProducts', [productIdTo : productId, type : "PRODUCT_OBSOLESCENCE", checkViewAllow : true, prodCatalogId : currentCatalogId])
+ context.obsolenscenseProducts = obsolenscenseProducts.assocProducts
- accessoryProducts = runService('getAssociatedProducts', [productId : productId, type : "PRODUCT_ACCESSORY", checkViewAllow : true, prodCatalogId : currentCatalogId]);
- context.accessoryProducts = accessoryProducts.assocProducts;
+ accessoryProducts = runService('getAssociatedProducts', [productId : productId, type : "PRODUCT_ACCESSORY", checkViewAllow : true, prodCatalogId : currentCatalogId])
+ context.accessoryProducts = accessoryProducts.assocProducts
// get the DIGITAL_DOWNLOAD related Content records to show the contentName/description
- downloadProductContentAndInfoList = from("ProductContentAndInfo").where("productId", productId, "productContentTypeId", "DIGITAL_DOWNLOAD").cache(true).queryList();
- context.downloadProductContentAndInfoList = downloadProductContentAndInfoList;
+ downloadProductContentAndInfoList = from("ProductContentAndInfo").where("productId", productId, "productContentTypeId", "DIGITAL_DOWNLOAD").cache(true).queryList()
+ context.downloadProductContentAndInfoList = downloadProductContentAndInfoList
// not the best to save info in an action, but this is probably the best place to count a view; it is done async
- dispatcher.runAsync("countProductView", [productId : productId, weight : new Long(1)], false);
+ dispatcher.runAsync("countProductView", [productId : productId, weight : new Long(1)], false)
//get product image from image management
- productImageList = [];
- productContentAndInfoImageManamentList = from("ProductContentAndInfo").where("productId", productId, "productContentTypeId", "IMAGE", "statusId", "IM_APPROVED", "drIsPublic", "Y").orderBy("sequenceNum").queryList();
+ productImageList = []
+ productContentAndInfoImageManamentList = from("ProductContentAndInfo").where("productId", productId, "productContentTypeId", "IMAGE", "statusId", "IM_APPROVED", "drIsPublic", "Y").orderBy("sequenceNum").queryList()
if(productContentAndInfoImageManamentList) {
productContentAndInfoImageManamentList.each { productContentAndInfoImageManament ->
- contentAssocThumb = from("ContentAssoc").where("contentId", productContentAndInfoImageManament.contentId, "contentAssocTypeId", "IMAGE_THUMBNAIL").queryFirst();
+ contentAssocThumb = from("ContentAssoc").where("contentId", productContentAndInfoImageManament.contentId, "contentAssocTypeId", "IMAGE_THUMBNAIL").queryFirst()
if(contentAssocThumb) {
- imageContentThumb = from("Content").where("contentId", contentAssocThumb.contentIdTo).queryOne();
+ imageContentThumb = from("Content").where("contentId", contentAssocThumb.contentIdTo).queryOne()
if(imageContentThumb) {
- productImageThumb = from("ContentDataResourceView").where("contentId", imageContentThumb.contentId, "drDataResourceId", imageContentThumb.dataResourceId).queryOne();
- productImageMap = [:];
- productImageMap.productImageThumb = productImageThumb.drObjectInfo;
- productImageMap.productImage = productContentAndInfoImageManament.drObjectInfo;
- productImageList.add(productImageMap);
+ productImageThumb = from("ContentDataResourceView").where("contentId", imageContentThumb.contentId, "drDataResourceId", imageContentThumb.dataResourceId).queryOne()
+ productImageMap = [:]
+ productImageMap.productImageThumb = productImageThumb.drObjectInfo
+ productImageMap.productImage = productContentAndInfoImageManament.drObjectInfo
+ productImageList.add(productImageMap)
}
}
}
- context.productImageList = productImageList;
+ context.productImageList = productImageList
}
// get reservation start date for rental product
if("ASSET_USAGE".equals(productTypeId) || "ASSET_USAGE_OUT_IN".equals(productTypeId)){
- context.startDate = UtilDateTime.addDaysToTimestamp(UtilDateTime.nowTimestamp(), 1).toString().substring(0,10); // should be tomorrow.
+ context.startDate = UtilDateTime.addDaysToTimestamp(UtilDateTime.nowTimestamp(), 1).toString().substring(0,10) // should be tomorrow.
}
// get product tags
- productKeywords = from("ProductKeyword").where("productId": productId, "keywordTypeId" : "KWT_TAG", "statusId" : "KW_APPROVED").queryList();
- keywordMap = [:];
+ productKeywords = from("ProductKeyword").where("productId": productId, "keywordTypeId" : "KWT_TAG", "statusId" : "KW_APPROVED").queryList()
+ keywordMap = [:]
if (productKeywords) {
for (productKeyword in productKeywords) {
- productKeyWordCount = from("ProductKeyword").where("keyword", productKeyword.keyword, "keywordTypeId", "KWT_TAG", "statusId", "KW_APPROVED").queryCount();
- keywordMap.put(productKeyword.keyword,productKeyWordCount);
+ productKeyWordCount = from("ProductKeyword").where("keyword", productKeyword.keyword, "keywordTypeId", "KWT_TAG", "statusId", "KW_APPROVED").queryCount()
+ keywordMap.put(productKeyword.keyword,productKeyWordCount)
}
- context.productTags = keywordMap;
+ context.productTags = keywordMap
}
}
diff --git a/applications/order/groovyScripts/entry/catalog/ProductSummary.groovy b/applications/order/groovyScripts/entry/catalog/ProductSummary.groovy
index ead0feb3f9..9ec6d4b211 100644
--- a/applications/order/groovyScripts/entry/catalog/ProductSummary.groovy
+++ b/applications/order/groovyScripts/entry/catalog/ProductSummary.groovy
@@ -22,214 +22,214 @@
* should not contain order component's specific code.
*/
-import org.apache.ofbiz.base.util.*;
-import org.apache.ofbiz.entity.*;
-import org.apache.ofbiz.entity.util.EntityQuery;
-import org.apache.ofbiz.service.*;
-import org.apache.ofbiz.product.product.ProductContentWrapper;
-import org.apache.ofbiz.product.config.ProductConfigWorker;
-import org.apache.ofbiz.product.catalog.*;
-import org.apache.ofbiz.product.store.*;
-import org.apache.ofbiz.order.shoppingcart.*;
-import org.apache.ofbiz.product.product.ProductWorker;
+import org.apache.ofbiz.base.util.*
+import org.apache.ofbiz.entity.*
+import org.apache.ofbiz.entity.util.EntityQuery
+import org.apache.ofbiz.service.*
+import org.apache.ofbiz.product.product.ProductContentWrapper
+import org.apache.ofbiz.product.config.ProductConfigWorker
+import org.apache.ofbiz.product.catalog.*
+import org.apache.ofbiz.product.store.*
+import org.apache.ofbiz.order.shoppingcart.*
+import org.apache.ofbiz.product.product.ProductWorker
import org.apache.ofbiz.webapp.website.WebSiteWorker
-import java.text.NumberFormat;
+import java.text.NumberFormat
//either optProduct, optProductId or productId must be specified
-product = request.getAttribute("optProduct");
-optProductId = request.getAttribute("optProductId");
-productId = product?.productId ?: optProductId ?: request.getAttribute("productId");
+product = request.getAttribute("optProduct")
+optProductId = request.getAttribute("optProductId")
+productId = product?.productId ?: optProductId ?: request.getAttribute("productId")
-webSiteId = WebSiteWorker.getWebSiteId(request);
-catalogId = CatalogWorker.getCurrentCatalogId(request);
-cart = ShoppingCartEvents.getCartObject(request);
-productStore = null;
-productStoreId = null;
-facilityId = null;
+webSiteId = WebSiteWorker.getWebSiteId(request)
+catalogId = CatalogWorker.getCurrentCatalogId(request)
+cart = ShoppingCartEvents.getCartObject(request)
+productStore = null
+productStoreId = null
+facilityId = null
if (cart.isSalesOrder()) {
- productStore = ProductStoreWorker.getProductStore(request);
- productStoreId = productStore.productStoreId;
- context.productStoreId = productStoreId;
- facilityId = productStore.inventoryFacilityId;
+ productStore = ProductStoreWorker.getProductStore(request)
+ productStoreId = productStore.productStoreId
+ context.productStoreId = productStoreId
+ facilityId = productStore.inventoryFacilityId
}
if (!facilityId) {
- productStoreFacility = EntityQuery.use(delegator).select("facilityId").from("ProductStoreFacility").where("productStoreId", productStoreId).queryFirst();
+ productStoreFacility = EntityQuery.use(delegator).select("facilityId").from("ProductStoreFacility").where("productStoreId", productStoreId).queryFirst()
if (productStoreFacility) {
- facilityId = productStoreFacility.facilityId;
+ facilityId = productStoreFacility.facilityId
}
}
-autoUserLogin = session.getAttribute("autoUserLogin");
-userLogin = session.getAttribute("userLogin");
+autoUserLogin = session.getAttribute("autoUserLogin")
+userLogin = session.getAttribute("userLogin")
-context.remove("daysToShip");
-context.remove("averageRating");
-context.remove("numRatings");
-context.remove("totalPrice");
+context.remove("daysToShip")
+context.remove("averageRating")
+context.remove("numRatings")
+context.remove("totalPrice")
// get the product entity
if (!product && productId) {
- product = from("Product").where("productId", productId).cache(true).queryOne();
+ product = from("Product").where("productId", productId).cache(true).queryOne()
}
if (product) {
//if order is purchase then don't calculate available inventory for product.
if (cart.isSalesOrder()) {
- resultOutput = runService('getInventoryAvailableByFacility', [productId : product.productId, facilityId : facilityId, useCache : true]);
- totalAvailableToPromise = resultOutput.availableToPromiseTotal;
+ resultOutput = runService('getInventoryAvailableByFacility', [productId : product.productId, facilityId : facilityId, useCache : true])
+ totalAvailableToPromise = resultOutput.availableToPromiseTotal
if (totalAvailableToPromise && totalAvailableToPromise.doubleValue() > 0) {
- productFacility = from("ProductFacility").where("productId", product.productId, "facilityId", facilityId).cache(true).queryOne();
+ productFacility = from("ProductFacility").where("productId", product.productId, "facilityId", facilityId).cache(true).queryOne()
if (productFacility?.daysToShip != null) {
- context.daysToShip = productFacility.daysToShip;
+ context.daysToShip = productFacility.daysToShip
}
}
} else {
- supplierProduct = from("SupplierProduct").where("productId", product.productId).orderBy("-availableFromDate").cache(true).queryFirst();
+ supplierProduct = from("SupplierProduct").where("productId", product.productId).orderBy("-availableFromDate").cache(true).queryFirst()
if (supplierProduct?.standardLeadTimeDays != null) {
- standardLeadTimeDays = supplierProduct.standardLeadTimeDays;
- daysToShip = standardLeadTimeDays + 1;
- context.daysToShip = daysToShip;
+ standardLeadTimeDays = supplierProduct.standardLeadTimeDays
+ daysToShip = standardLeadTimeDays + 1
+ context.daysToShip = daysToShip
}
}
// make the productContentWrapper
- productContentWrapper = new ProductContentWrapper(product, request);
- context.productContentWrapper = productContentWrapper;
+ productContentWrapper = new ProductContentWrapper(product, request)
+ context.productContentWrapper = productContentWrapper
}
-categoryId = null;
-reviews = null;
+categoryId = null
+reviews = null
if (product) {
- categoryId = parameters.category_id ?: request.getAttribute("productCategoryId");
+ categoryId = parameters.category_id ?: request.getAttribute("productCategoryId")
// get the product price
if (cart.isSalesOrder()) {
// sales order: run the "calculateProductPrice" service
priceContext = [product : product, currencyUomId : cart.getCurrency(),
- autoUserLogin : autoUserLogin, userLogin : userLogin];
- priceContext.webSiteId = webSiteId;
- priceContext.prodCatalogId = catalogId;
- priceContext.productStoreId = productStoreId;
- priceContext.agreementId = cart.getAgreementId();
- priceContext.partyId = cart.getPartyId(); // IMPORTANT: otherwise it'll be calculating prices using the logged in user which could be a CSR instead of the customer
- priceContext.checkIncludeVat = "Y";
- priceMap = runService('calculateProductPrice', priceContext);
+ autoUserLogin : autoUserLogin, userLogin : userLogin]
+ priceContext.webSiteId = webSiteId
+ priceContext.prodCatalogId = catalogId
+ priceContext.productStoreId = productStoreId
+ priceContext.agreementId = cart.getAgreementId()
+ priceContext.partyId = cart.getPartyId() // IMPORTANT: otherwise it'll be calculating prices using the logged in user which could be a CSR instead of the customer
+ priceContext.checkIncludeVat = "Y"
+ priceMap = runService('calculateProductPrice', priceContext)
- context.price = priceMap;
+ context.price = priceMap
} else {
// purchase order: run the "calculatePurchasePrice" service
priceContext = [product : product, currencyUomId : cart.getCurrency(),
- partyId : cart.getPartyId(), userLogin : userLogin];
- priceMap = runService('calculatePurchasePrice', priceContext);
+ partyId : cart.getPartyId(), userLogin : userLogin]
+ priceMap = runService('calculatePurchasePrice', priceContext)
- context.price = priceMap;
+ context.price = priceMap
}
// get aggregated product totalPrice
if ("AGGREGATED".equals(product.productTypeId)||"AGGREGATED_SERVICE".equals(product.productTypeId)) {
- configWrapper = ProductConfigWorker.getProductConfigWrapper(productId, cart.getCurrency(), request);
+ configWrapper = ProductConfigWorker.getProductConfigWrapper(productId, cart.getCurrency(), request)
if (configWrapper) {
- configWrapper.setDefaultConfig();
- context.totalPrice = configWrapper.getTotalPrice();
+ configWrapper.setDefaultConfig()
+ context.totalPrice = configWrapper.getTotalPrice()
}
}
// get the product review(s)
- reviews = product.getRelated("ProductReview", null, ["-postedDateTime"], true);
+ reviews = product.getRelated("ProductReview", null, ["-postedDateTime"], true)
// get product variant for Box/Case/Each
- productVariants = [];
- boolean isAlternativePacking = ProductWorker.isAlternativePacking(delegator, product.productId, null);
- mainProducts = [];
+ productVariants = []
+ boolean isAlternativePacking = ProductWorker.isAlternativePacking(delegator, product.productId, null)
+ mainProducts = []
if(isAlternativePacking){
- productVirtualVariants = from("ProductAssoc").where("productIdTo", product.productId , "productAssocTypeId", "ALTERNATIVE_PACKAGE").cache(true).queryList();
+ productVirtualVariants = from("ProductAssoc").where("productIdTo", product.productId , "productAssocTypeId", "ALTERNATIVE_PACKAGE").cache(true).queryList()
if(productVirtualVariants){
productVirtualVariants.each { virtualVariantKey ->
- mainProductMap = [:];
- mainProduct = virtualVariantKey.getRelatedOne("MainProduct", true);
- quantityUom = mainProduct.getRelatedOne("QuantityUom", true);
- mainProductMap.productId = mainProduct.productId;
- mainProductMap.piecesIncluded = mainProduct.piecesIncluded;
- mainProductMap.uomDesc = quantityUom.description;
- mainProducts.add(mainProductMap);
+ mainProductMap = [:]
+ mainProduct = virtualVariantKey.getRelatedOne("MainProduct", true)
+ quantityUom = mainProduct.getRelatedOne("QuantityUom", true)
+ mainProductMap.productId = mainProduct.productId
+ mainProductMap.piecesIncluded = mainProduct.piecesIncluded
+ mainProductMap.uomDesc = quantityUom.description
+ mainProducts.add(mainProductMap)
}
}
// get alternative product price when product doesn't have any feature
- jsBuf = new StringBuffer();
- jsBuf.append("");
- context.virtualJavaScript = jsBuf;
+ context.variantPriceList = variantPriceList
+ jsBuf.append(amt.toString())
+ jsBuf.append(variantPriceJS.toString())
+ jsBuf.append("")
+ context.virtualJavaScript = jsBuf
}
}
- context.mainProducts = mainProducts;
+ context.mainProducts = mainProducts
}
// get the average rating
if (reviews) {
- totalProductRating = 0;
- numRatings = 0;
+ totalProductRating = 0
+ numRatings = 0
reviews.each { productReview ->
- productRating = productReview.productRating;
+ productRating = productReview.productRating
if (productRating) {
- totalProductRating += productRating;
- numRatings++;
+ totalProductRating += productRating
+ numRatings++
}
}
if (numRatings) {
- context.averageRating = totalProductRating/numRatings;
- context.numRatings = numRatings;
+ context.averageRating = totalProductRating/numRatings
+ context.numRatings = numRatings
}
}
// an example of getting features of a certain type to show
-sizeProductFeatureAndAppls = from("ProductFeatureAndAppl").where("productId", productId, "productFeatureTypeId", "SIZE").orderBy("sequenceNum", "defaultSequenceNum").cache(true).queryList();
+sizeProductFeatureAndAppls = from("ProductFeatureAndAppl").where("productId", productId, "productFeatureTypeId", "SIZE").orderBy("sequenceNum", "defaultSequenceNum").cache(true).queryList()
-context.product = product;
-context.categoryId = categoryId;
-context.productReviews = reviews;
-context.sizeProductFeatureAndAppls = sizeProductFeatureAndAppls;
+context.product = product
+context.categoryId = categoryId
+context.productReviews = reviews
+context.sizeProductFeatureAndAppls = sizeProductFeatureAndAppls
diff --git a/applications/order/groovyScripts/entry/catalog/ProductUomDropDownOnly.groovy b/applications/order/groovyScripts/entry/catalog/ProductUomDropDownOnly.groovy
index 8e02840d14..5fe806de91 100644
--- a/applications/order/groovyScripts/entry/catalog/ProductUomDropDownOnly.groovy
+++ b/applications/order/groovyScripts/entry/catalog/ProductUomDropDownOnly.groovy
@@ -17,23 +17,23 @@
* under the License.
*/
-import org.apache.ofbiz.base.util.*;
+import org.apache.ofbiz.base.util.*
-product = from("Product").where("productId", parameters.productId).queryOne();
+product = from("Product").where("productId", parameters.productId).queryOne()
if (product) {
- productVirtualVariants = from("ProductAssoc").where("productIdTo", product.productId , "productAssocTypeId", "ALTERNATIVE_PACKAGE").cache(true).queryList();
+ productVirtualVariants = from("ProductAssoc").where("productIdTo", product.productId , "productAssocTypeId", "ALTERNATIVE_PACKAGE").cache(true).queryList()
if(productVirtualVariants){
- def mainProducts = [];
+ def mainProducts = []
productVirtualVariants.each { virtualVariantKey ->
- mainProductMap = [:];
- mainProduct = virtualVariantKey.getRelatedOne("MainProduct", true);
- quantityUom = mainProduct.getRelatedOne("QuantityUom", true);
- mainProductMap.productId = mainProduct.productId;
- mainProductMap.piecesIncluded = mainProduct.piecesIncluded;
- mainProductMap.uomDesc = quantityUom.description;
- mainProducts.add(mainProductMap);
+ mainProductMap = [:]
+ mainProduct = virtualVariantKey.getRelatedOne("MainProduct", true)
+ quantityUom = mainProduct.getRelatedOne("QuantityUom", true)
+ mainProductMap.productId = mainProduct.productId
+ mainProductMap.piecesIncluded = mainProduct.piecesIncluded
+ mainProductMap.uomDesc = quantityUom.description
+ mainProducts.add(mainProductMap)
}
- context.mainProducts = mainProducts;
+ context.mainProducts = mainProducts
}
- context.product = product;
+ context.product = product
}
diff --git a/applications/order/groovyScripts/entry/catalog/QuickAdd.groovy b/applications/order/groovyScripts/entry/catalog/QuickAdd.groovy
index 58c16d86d0..6870ce7fc0 100644
--- a/applications/order/groovyScripts/entry/catalog/QuickAdd.groovy
+++ b/applications/order/groovyScripts/entry/catalog/QuickAdd.groovy
@@ -22,29 +22,29 @@
* should not contain order component's specific code.
*/
-import java.lang.*;
-import java.util.*;
-import org.apache.ofbiz.base.util.*;
-import org.apache.ofbiz.entity.*;
-import org.apache.ofbiz.service.*;
-import org.apache.ofbiz.product.catalog.*;
+import java.lang.*
+import java.util.*
+import org.apache.ofbiz.base.util.*
+import org.apache.ofbiz.entity.*
+import org.apache.ofbiz.service.*
+import org.apache.ofbiz.product.catalog.*
-currentCatalogId = CatalogWorker.getCurrentCatalogId(request);
-categoryId = parameters.category_id ?: CatalogWorker.getCatalogQuickaddCategoryPrimary(request);
+currentCatalogId = CatalogWorker.getCurrentCatalogId(request)
+categoryId = parameters.category_id ?: CatalogWorker.getCatalogQuickaddCategoryPrimary(request)
-quickAddCategories = CatalogWorker.getCatalogQuickaddCategories(request);
-context.quickAddCats = quickAddCategories;
-context.categoryId = categoryId;
+quickAddCategories = CatalogWorker.getCatalogQuickaddCategories(request)
+context.quickAddCats = quickAddCategories
+context.categoryId = categoryId
if (categoryId) {
fields = [productCategoryId : categoryId, defaultViewSize : 10,
- limitView : false, prodCatalogId : currentCatalogId, checkViewAllow : true];
- result = runService('getProductCategoryAndLimitedMembers', fields);
+ limitView : false, prodCatalogId : currentCatalogId, checkViewAllow : true]
+ result = runService('getProductCategoryAndLimitedMembers', fields)
if (result) {
result.each { key, value ->
- context[key] = value;
+ context[key] = value
}
}
- productCategory = from("ProductCategory").where("productCategoryId", categoryId).queryOne();
- context.productCategory = productCategory;
+ productCategory = from("ProductCategory").where("productCategoryId", categoryId).queryOne()
+ context.productCategory = productCategory
}
diff --git a/applications/order/groovyScripts/entry/catalog/SideDeepCategory.groovy b/applications/order/groovyScripts/entry/catalog/SideDeepCategory.groovy
index 8d5a75ae8d..a1160e0ad7 100644
--- a/applications/order/groovyScripts/entry/catalog/SideDeepCategory.groovy
+++ b/applications/order/groovyScripts/entry/catalog/SideDeepCategory.groovy
@@ -22,18 +22,18 @@
* should not contain order component's specific code.
*/
-import org.apache.ofbiz.base.util.*;
-import org.apache.ofbiz.product.catalog.*;
-import org.apache.ofbiz.product.category.*;
+import org.apache.ofbiz.base.util.*
+import org.apache.ofbiz.product.catalog.*
+import org.apache.ofbiz.product.category.*
-CategoryWorker.getRelatedCategories(request, "topLevelList", CatalogWorker.getCatalogTopCategoryId(request, CatalogWorker.getCurrentCatalogId(request)), true);
-curCategoryId = parameters.category_id ?: parameters.CATEGORY_ID ?: "";
-request.setAttribute("curCategoryId", curCategoryId);
-CategoryWorker.setTrail(request, curCategoryId);
+CategoryWorker.getRelatedCategories(request, "topLevelList", CatalogWorker.getCatalogTopCategoryId(request, CatalogWorker.getCurrentCatalogId(request)), true)
+curCategoryId = parameters.category_id ?: parameters.CATEGORY_ID ?: ""
+request.setAttribute("curCategoryId", curCategoryId)
+CategoryWorker.setTrail(request, curCategoryId)
-categoryList = request.getAttribute("topLevelList");
+categoryList = request.getAttribute("topLevelList")
if (categoryList) {
- catContentWrappers = [:];
- CategoryWorker.getCategoryContentWrappers(catContentWrappers, categoryList, request);
- context.catContentWrappers = catContentWrappers;
+ catContentWrappers = [:]
+ CategoryWorker.getCategoryContentWrappers(catContentWrappers, categoryList, request)
+ context.catContentWrappers = catContentWrappers
}
diff --git a/applications/order/groovyScripts/lookup/LookupAssociatedProducts.groovy b/applications/order/groovyScripts/lookup/LookupAssociatedProducts.groovy
index b7806a3da8..4eda93db24 100644
--- a/applications/order/groovyScripts/lookup/LookupAssociatedProducts.groovy
+++ b/applications/order/groovyScripts/lookup/LookupAssociatedProducts.groovy
@@ -17,28 +17,28 @@
* under the License.
*/
-import org.apache.ofbiz.base.util.UtilValidate;
-import org.apache.ofbiz.entity.condition.EntityCondition;
-import org.apache.ofbiz.entity.condition.EntityOperator;
-import org.apache.ofbiz.entity.util.EntityUtil;
+import org.apache.ofbiz.base.util.UtilValidate
+import org.apache.ofbiz.entity.condition.EntityCondition
+import org.apache.ofbiz.entity.condition.EntityOperator
+import org.apache.ofbiz.entity.util.EntityUtil
-productId = request.getParameter("productId");
+productId = request.getParameter("productId")
if (productId != null) {
- product = from("Product").where("productId", productId).queryOne();
- prodAssocs = product.getRelated("MainProductAssoc", null, null, false);
+ product = from("Product").where("productId", productId).queryOne()
+ prodAssocs = product.getRelated("MainProductAssoc", null, null, false)
if (UtilValidate.isNotEmpty(prodAssocs)) {
- products = EntityUtil.filterByAnd(prodAssocs, [EntityCondition.makeCondition("productAssocTypeId", EntityOperator.NOT_EQUAL, "PRODUCT_VARIANT")]);
+ products = EntityUtil.filterByAnd(prodAssocs, [EntityCondition.makeCondition("productAssocTypeId", EntityOperator.NOT_EQUAL, "PRODUCT_VARIANT")])
if (UtilValidate.isNotEmpty(products)) {
- productList = [];
+ productList = []
products.each { product ->
if (product != null) {
- String productIdTo = product.getString("productIdTo");
- productList.add(from("Product").where("productId", productIdTo).queryFirst());
+ String productIdTo = product.getString("productIdTo")
+ productList.add(from("Product").where("productId", productIdTo).queryFirst())
}
}
- context.put("productList",productList);
+ context.put("productList",productList)
}
}
}
diff --git a/applications/order/groovyScripts/order/CompanyHeader.groovy b/applications/order/groovyScripts/order/CompanyHeader.groovy
index d6c0d31ca6..517fdffffc 100644
--- a/applications/order/groovyScripts/order/CompanyHeader.groovy
+++ b/applications/order/groovyScripts/order/CompanyHeader.groovy
@@ -21,201 +21,201 @@
// parameters or use orderId, invoiceId, or returnId to look them up.
// if none of these parameters are available then fromPartyId is used or "ORGANIZATION_PARTY" from general.properties as fallback
-import java.sql.Timestamp;
+import java.sql.Timestamp
-import org.apache.ofbiz.base.util.*;
-import org.apache.ofbiz.entity.*;
-import org.apache.ofbiz.entity.util.*;
-import org.apache.ofbiz.party.contact.*;
-import org.apache.ofbiz.order.order.OrderReadHelper;
-import org.apache.ofbiz.party.content.PartyContentWrapper;
-import org.apache.ofbiz.entity.util.EntityUtilProperties;
+import org.apache.ofbiz.base.util.*
+import org.apache.ofbiz.entity.*
+import org.apache.ofbiz.entity.util.*
+import org.apache.ofbiz.party.contact.*
+import org.apache.ofbiz.order.order.OrderReadHelper
+import org.apache.ofbiz.party.content.PartyContentWrapper
+import org.apache.ofbiz.entity.util.EntityUtilProperties
-orderHeader = parameters.orderHeader;
-orderId = parameters.orderId;
-invoice = parameters.invoice;
-invoiceId = parameters.invoiceId;
-shipmentId = parameters.shipmentId;
-returnHeader = parameters.returnHeader;
-returnId = parameters.returnId;
-quote = null;
-quoteId = parameters.quoteId;
-fromPartyId = parameters.fromPartyId;
+orderHeader = parameters.orderHeader
+orderId = parameters.orderId
+invoice = parameters.invoice
+invoiceId = parameters.invoiceId
+shipmentId = parameters.shipmentId
+returnHeader = parameters.returnHeader
+returnId = parameters.returnId
+quote = null
+quoteId = parameters.quoteId
+fromPartyId = parameters.fromPartyId
if (!orderHeader && orderId) {
- orderHeader = from("OrderHeader").where("orderId", orderId).queryOne();
+ orderHeader = from("OrderHeader").where("orderId", orderId).queryOne()
try {
if (parameters.facilityId) {
- UtilHttp.setContentDisposition(response, "PickSheet" + orderId + ".pdf");
+ UtilHttp.setContentDisposition(response, "PickSheet" + orderId + ".pdf")
} else {
- UtilHttp.setContentDisposition(response, orderId + ".pdf");
+ UtilHttp.setContentDisposition(response, orderId + ".pdf")
}
} catch (MissingPropertyException e) {
// This hack for OFBIZ-6792 to avoid "groovy.lang.MissingPropertyException: No such property: response for class: CompanyHeader" when response does not exist (in sendOrderConfirmation service)
}
} else if (shipmentId) {
- shipment = from("Shipment").where("shipmentId", shipmentId).queryOne();
- orderHeader = shipment.getRelatedOne("PrimaryOrderHeader", false);
+ shipment = from("Shipment").where("shipmentId", shipmentId).queryOne()
+ orderHeader = shipment.getRelatedOne("PrimaryOrderHeader", false)
}
if (!invoice && invoiceId) {
- invoice = from("Invoice").where("invoiceId", invoiceId).queryOne();
+ invoice = from("Invoice").where("invoiceId", invoiceId).queryOne()
try {
- UtilHttp.setContentDisposition(response, invoiceId + ".pdf");
+ UtilHttp.setContentDisposition(response, invoiceId + ".pdf")
} catch (MissingPropertyException e) {
// This hack for OFBIZ-6792 to avoid "groovy.lang.MissingPropertyException: No such property: response for class: CompanyHeader" when response does not exist (in sendOrderConfirmation service)
}
}
if (!returnHeader && returnId) {
- returnHeader = from("ReturnHeader").where("returnId", returnId).queryOne();
+ returnHeader = from("ReturnHeader").where("returnId", returnId).queryOne()
}
if (quoteId) {
- quote = from("Quote").where("quoteId", quoteId).queryOne();
+ quote = from("Quote").where("quoteId", quoteId).queryOne()
}
// defaults:
-def logoImageUrl = null; // the default value, "/images/ofbiz_powered.gif", is set in the screen decorators
-def partyId = null;
+def logoImageUrl = null // the default value, "/images/ofbiz_powered.gif", is set in the screen decorators
+def partyId = null
// get the logo partyId from order or invoice - note that it is better to do comparisons this way in case the there are null values
if (orderHeader) {
- orh = new OrderReadHelper(orderHeader);
+ orh = new OrderReadHelper(orderHeader)
// for sales order, the logo party is the "BILL_FROM_VENDOR" of the order. If that's not available, we'll use the OrderHeader's ProductStore's payToPartyId
if ("SALES_ORDER".equals(orderHeader.orderTypeId)) {
if (orh.getBillFromParty()) {
- partyId = orh.getBillFromParty().partyId;
+ partyId = orh.getBillFromParty().partyId
} else {
- productStore = orderHeader.getRelatedOne("ProductStore", false);
+ productStore = orderHeader.getRelatedOne("ProductStore", false)
if (orderHeader.orderTypeId.equals("SALES_ORDER") && productStore?.payToPartyId) {
- partyId = productStore.payToPartyId;
+ partyId = productStore.payToPartyId
}
}
// purchase orders - use the BILL_TO_CUSTOMER of the order
} else if ("PURCHASE_ORDER".equals(orderHeader.orderTypeId)) {
- def billToParty = orh.getBillToParty();
+ def billToParty = orh.getBillToParty()
if (billToParty) {
- partyId = billToParty.partyId;
+ partyId = billToParty.partyId
} else {
- def billToCustomer = EntityUtil.getFirst(orderHeader.getRelated("OrderRole", [roleTypeId : "BILL_TO_CUSTOMER"], null, false));
+ def billToCustomer = EntityUtil.getFirst(orderHeader.getRelated("OrderRole", [roleTypeId : "BILL_TO_CUSTOMER"], null, false))
if (billToCustomer) {
- partyId = billToCustomer.partyId;
+ partyId = billToCustomer.partyId
}
}
}
} else if (invoice) {
if ("SALES_INVOICE".equals(invoice.invoiceTypeId) && invoice.partyIdFrom) {
- partyId = invoice.partyIdFrom;
+ partyId = invoice.partyIdFrom
}
if ("PURCHASE_INVOICE".equals(invoice.invoiceTypeId) || "CUST_RTN_INVOICE".equals(invoice.invoiceTypeId) && invoice.partyId) {
- partyId = invoice.partyId;
+ partyId = invoice.partyId
}
} else if (returnHeader) {
if ("CUSTOMER_RETURN".equals(returnHeader.returnHeaderTypeId) && returnHeader.toPartyId) {
- partyId = returnHeader.toPartyId;
+ partyId = returnHeader.toPartyId
} else if ("VENDOR_RETURN".equals(returnHeader.returnHeaderTypeId) && returnHeader.fromPartyId) {
- partyId = returnHeader.fromPartyId;
+ partyId = returnHeader.fromPartyId
}
} else if (quote) {
- productStore = quote.getRelatedOne("ProductStore", false);
+ productStore = quote.getRelatedOne("ProductStore", false)
if (productStore?.payToPartyId) {
- partyId = productStore.payToPartyId;
+ partyId = productStore.payToPartyId
}
}
// if partyId wasn't found use fromPartyId-parameter
if (!partyId) {
if (fromPartyId) {
- partyId = fromPartyId;
+ partyId = fromPartyId
} else {
- partyId = parameters.get('ApplicationDecorator|organizationPartyId') ? parameters.get('ApplicationDecorator|organizationPartyId') : context.defaultOrganizationPartyId;
+ partyId = parameters.get('ApplicationDecorator|organizationPartyId') ? parameters.get('ApplicationDecorator|organizationPartyId') : context.defaultOrganizationPartyId
}
}
// the logo
-partyGroup = from("PartyGroup").where("partyId", partyId).queryOne();
+partyGroup = from("PartyGroup").where("partyId", partyId).queryOne()
if (partyGroup) {
- partyContentWrapper = new PartyContentWrapper(dispatcher, partyGroup, locale, EntityUtilProperties.getPropertyValue("content", "defaultMimeType", "text/html; charset=utf-8", delegator));
- partyContent = partyContentWrapper.getFirstPartyContentByType(partyGroup.partyId , partyGroup, "LGOIMGURL", delegator);
+ partyContentWrapper = new PartyContentWrapper(dispatcher, partyGroup, locale, EntityUtilProperties.getPropertyValue("content", "defaultMimeType", "text/html; charset=utf-8", delegator))
+ partyContent = partyContentWrapper.getFirstPartyContentByType(partyGroup.partyId , partyGroup, "LGOIMGURL", delegator)
if (partyContent) {
- logoImageUrl = "/content/control/stream?contentId=" + partyContent.contentId;
+ logoImageUrl = "/content/control/stream?contentId=" + partyContent.contentId
} else {
if (partyGroup?.logoImageUrl) {
- logoImageUrl = partyGroup.logoImageUrl;
+ logoImageUrl = partyGroup.logoImageUrl
}
}
}
//If logoImageUrl not null then only set it to context else it will override the default value "/images/ofbiz_powered.gif"
if (logoImageUrl) {
- context.logoImageUrl = logoImageUrl;
+ context.logoImageUrl = logoImageUrl
}
// the company name
-companyName = "Default Company";
+companyName = "Default Company"
if (partyGroup?.groupName) {
- companyName = partyGroup.groupName;
+ companyName = partyGroup.groupName
}
-context.companyName = companyName;
+context.companyName = companyName
// the address
addresses = from("PartyContactWithPurpose")
.where("partyId", partyId, "contactMechPurposeTypeId", "GENERAL_LOCATION")
.filterByDate("contactFromDate", "contactThruDate", "purposeFromDate", "purposeThruDate")
- .queryList();
-address = null;
+ .queryList()
+address = null
if (addresses) {
- address = from("PostalAddress").where("contactMechId", addresses[0].contactMechId).queryOne();
+ address = from("PostalAddress").where("contactMechId", addresses[0].contactMechId).queryOne()
}
if (address) {
// get the country name and state/province abbreviation
- country = address.getRelatedOne("CountryGeo", true);
+ country = address.getRelatedOne("CountryGeo", true)
if (country) {
- context.countryName = country.get("geoName", locale);
+ context.countryName = country.get("geoName", locale)
}
- stateProvince = address.getRelatedOne("StateProvinceGeo", true);
+ stateProvince = address.getRelatedOne("StateProvinceGeo", true)
if (stateProvince) {
- context.stateProvinceAbbr = stateProvince.abbreviation;
+ context.stateProvinceAbbr = stateProvince.abbreviation
}
}
-context.postalAddress = address;
+context.postalAddress = address
//telephone
phones = from("PartyContactWithPurpose")
.where("partyId", partyId, "contactMechPurposeTypeId", "PRIMARY_PHONE")
.filterByDate("contactFromDate", "contactThruDate", "purposeFromDate", "purposeThruDate")
- .queryList();
+ .queryList()
if (phones) {
- context.phone = from("TelecomNumber").where("contactMechId", phones[0].contactMechId).queryOne();
+ context.phone = from("TelecomNumber").where("contactMechId", phones[0].contactMechId).queryOne()
}
// Fax
faxNumbers = from("PartyContactWithPurpose")
.where("partyId", partyId, "contactMechPurposeTypeId", "FAX_NUMBER")
.filterByDate("contactFromDate", "contactThruDate", "purposeFromDate", "purposeThruDate")
- .queryList();
+ .queryList()
if (faxNumbers) {
- context.fax = from("TelecomNumber").where("contactMechId", faxNumbers[0].contactMechId).queryOne();
+ context.fax = from("TelecomNumber").where("contactMechId", faxNumbers[0].contactMechId).queryOne()
}
//Email
emails = from("PartyContactWithPurpose")
.where("partyId", partyId, "contactMechPurposeTypeId", "PRIMARY_EMAIL")
.filterByDate("contactFromDate", "contactThruDate", "purposeFromDate", "purposeThruDate")
- .queryList();
+ .queryList()
if (emails) {
- context.email = from("ContactMech").where("contactMechId", emails[0].contactMechId).queryOne();
+ context.email = from("ContactMech").where("contactMechId", emails[0].contactMechId).queryOne()
} else { //get email address from party contact mech
selContacts = from("PartyContactMech")
.where("partyId", partyId).filterByDate(nowTimestamp, "fromDate", "thruDate")
- .queryList();
+ .queryList()
if (selContacts) {
- i = selContacts.iterator();
+ i = selContacts.iterator()
while (i.hasNext()) {
- email = i.next().getRelatedOne("ContactMech", false);
+ email = i.next().getRelatedOne("ContactMech", false)
if ("ELECTRONIC_ADDRESS".equals(email.contactMechTypeId)) {
- context.email = email;
- break;
+ context.email = email
+ break
}
}
}
@@ -225,22 +225,22 @@ if (emails) {
websiteUrls = from("PartyContactWithPurpose")
.where("partyId", partyId, "contactMechPurposeTypeId", "PRIMARY_WEB_URL")
.filterByDate("contactFromDate", "contactThruDate", "purposeFromDate", "purposeThruDate")
- .queryList();
+ .queryList()
if (websiteUrls) {
- websiteUrl = EntityUtil.getFirst(websiteUrls);
- context.website = from("ContactMech").where("contactMechId", websiteUrl.contactMechId).queryOne();
+ websiteUrl = EntityUtil.getFirst(websiteUrls)
+ context.website = from("ContactMech").where("contactMechId", websiteUrl.contactMechId).queryOne()
} else { //get web address from party contact mech
selContacts = from("PartyContactMech")
.where("partyId", partyId)
.filterByDate(nowTimestamp, "fromDate", "thruDate")
- .queryList();
+ .queryList()
if (selContacts) {
- Iterator i = selContacts.iterator();
+ Iterator i = selContacts.iterator()
while (i.hasNext()) {
- website = i.next().getRelatedOne("ContactMech", false);
+ website = i.next().getRelatedOne("ContactMech", false)
if ("WEB_ADDRESS".equals(website.contactMechTypeId)) {
- context.website = website;
- break;
+ context.website = website
+ break
}
}
}
@@ -250,26 +250,26 @@ if (websiteUrls) {
selPayments = from("PaymentMethod")
.where("partyId", partyId, "paymentMethodTypeId", "EFT_ACCOUNT")
.filterByDate(nowTimestamp, "fromDate", "thruDate")
- .queryList();
+ .queryList()
if (selPayments) {
- context.eftAccount = from("EftAccount").where("paymentMethodId", selPayments[0].paymentMethodId).queryOne();
+ context.eftAccount = from("EftAccount").where("paymentMethodId", selPayments[0].paymentMethodId).queryOne()
}
// Tax ID Info
partyTaxAuthInfoList = from("PartyTaxAuthInfo").where("partyId", partyId)
.filterByDate(nowTimestamp, "fromDate", "thruDate")
- .queryList();
+ .queryList()
if (partyTaxAuthInfoList) {
if (address?.countryGeoId) {
// if we have an address with country filter by that
partyTaxAuthInfoList.eachWithIndex { partyTaxAuthInfo, i ->
if (partyTaxAuthInfo.taxAuthGeoId.equals(address.countryGeoId)) {
- context.sendingPartyTaxId = partyTaxAuthInfo.partyTaxId;
+ context.sendingPartyTaxId = partyTaxAuthInfo.partyTaxId
}
}
} else {
// otherwise just grab the first one
- context.sendingPartyTaxId = partyTaxAuthInfoList[0].partyTaxId;
+ context.sendingPartyTaxId = partyTaxAuthInfoList[0].partyTaxId
}
}
diff --git a/applications/order/groovyScripts/order/FilterOrderList.groovy b/applications/order/groovyScripts/order/FilterOrderList.groovy
index a6f6988ff9..65663026ae 100644
--- a/applications/order/groovyScripts/order/FilterOrderList.groovy
+++ b/applications/order/groovyScripts/order/FilterOrderList.groovy
@@ -17,70 +17,70 @@
* under the License.
*/
-import java.math.BigDecimal;
-import org.apache.ofbiz.base.util.UtilValidate;
-import org.apache.ofbiz.entity.GenericValue;
-import org.apache.ofbiz.order.order.OrderReadHelper;
-import org.apache.ofbiz.product.store.ProductStoreWorker;
-import org.apache.ofbiz.order.order.OrderListState;
+import java.math.BigDecimal
+import org.apache.ofbiz.base.util.UtilValidate
+import org.apache.ofbiz.entity.GenericValue
+import org.apache.ofbiz.order.order.OrderReadHelper
+import org.apache.ofbiz.product.store.ProductStoreWorker
+import org.apache.ofbiz.order.order.OrderListState
-orderHeaderList = context.orderHeaderList;
-productStore = ProductStoreWorker.getProductStore(request);
+orderHeaderList = context.orderHeaderList
+productStore = ProductStoreWorker.getProductStore(request)
-filterInventoryProblems = [];
+filterInventoryProblems = []
if (state.hasFilter("filterInventoryProblems") && orderHeaderList) {
orderHeaderList.each { orderHeader ->
- orderReadHelper = OrderReadHelper.getHelper(orderHeader);
- backorderQty = orderReadHelper.getOrderBackorderQuantity();
+ orderReadHelper = OrderReadHelper.getHelper(orderHeader)
+ backorderQty = orderReadHelper.getOrderBackorderQuantity()
if (backorderQty.compareTo(BigDecimal.ZERO) > 0) {
- filterInventoryProblems.add(orderHeader.orderId);
+ filterInventoryProblems.add(orderHeader.orderId)
}
}
}
-filterPOsOpenPastTheirETA = [];
-filterPOsWithRejectedItems = [];
-filterPartiallyReceivedPOs = [];
+filterPOsOpenPastTheirETA = []
+filterPOsWithRejectedItems = []
+filterPartiallyReceivedPOs = []
-state = OrderListState.getInstance(request);
+state = OrderListState.getInstance(request)
if ((state.hasFilter("filterPartiallyReceivedPOs") ||
state.hasFilter("filterPOsOpenPastTheirETA") ||
state.hasFilter("filterPOsWithRejectedItems")) &&
orderHeaderList) {
orderHeaderList.each { orderHeader ->
- orderReadHelper = OrderReadHelper.getHelper(orderHeader);
+ orderReadHelper = OrderReadHelper.getHelper(orderHeader)
if ("PURCHASE_ORDER".equals(orderHeader.orderTypeId)) {
if (orderReadHelper.getRejectedOrderItems() &&
state.hasFilter("filterPOsWithRejectedItems")) {
- filterPOsWithRejectedItems.add(orderHeader.get("orderId"));
+ filterPOsWithRejectedItems.add(orderHeader.get("orderId"))
} else if (orderReadHelper.getPastEtaOrderItems(orderHeader.get("orderId")) &&
state.hasFilter("filterPOsOpenPastTheirETA")) {
- filterPOsOpenPastTheirETA.add(orderHeader.orderId);
+ filterPOsOpenPastTheirETA.add(orderHeader.orderId)
} else if (orderReadHelper.getPartiallyReceivedItems() &&
state.hasFilter("filterPartiallyReceivedPOs")) {
- filterPartiallyReceivedPOs.add(orderHeader.orderId);
+ filterPartiallyReceivedPOs.add(orderHeader.orderId)
}
}
}
}
-filterAuthProblems = [];
+filterAuthProblems = []
if (state.hasFilter("filterAuthProblems") && orderHeaderList) {
orderHeaderList.each { orderHeader ->
- orderReadHelper = OrderReadHelper.getHelper(orderHeader);
- paymentPrefList = orderReadHelper.getPaymentPreferences();
+ orderReadHelper = OrderReadHelper.getHelper(orderHeader)
+ paymentPrefList = orderReadHelper.getPaymentPreferences()
paymentPrefList.each { paymentPref ->
if ("PAYMENT_NOT_AUTH".equals(paymentPref.statusId)) {
- filterAuthProblems.add(orderHeader.orderId);
+ filterAuthProblems.add(orderHeader.orderId)
}
}
}
}
-context.filterInventoryProblems = filterInventoryProblems;
-context.filterPOsWithRejectedItems = filterPOsWithRejectedItems;
-context.filterPOsOpenPastTheirETA = filterPOsOpenPastTheirETA;
-context.filterPartiallyReceivedPOs = filterPartiallyReceivedPOs;
-context.filterAuthProblems = filterAuthProblems;
+context.filterInventoryProblems = filterInventoryProblems
+context.filterPOsWithRejectedItems = filterPOsWithRejectedItems
+context.filterPOsOpenPastTheirETA = filterPOsOpenPastTheirETA
+context.filterPartiallyReceivedPOs = filterPartiallyReceivedPOs
+context.filterAuthProblems = filterAuthProblems
diff --git a/applications/order/groovyScripts/order/FindOrders.groovy b/applications/order/groovyScripts/order/FindOrders.groovy
index d76be0ea1b..f31d8bd218 100644
--- a/applications/order/groovyScripts/order/FindOrders.groovy
+++ b/applications/order/groovyScripts/order/FindOrders.groovy
@@ -17,164 +17,164 @@
* under the License.
*/
-import java.util.*;
-import java.sql.Timestamp;
-import org.apache.ofbiz.entity.*;
-import org.apache.ofbiz.base.util.*;
-import org.apache.ofbiz.entity.util.*;
+import java.util.*
+import java.sql.Timestamp
+import org.apache.ofbiz.entity.*
+import org.apache.ofbiz.base.util.*
+import org.apache.ofbiz.entity.util.*
-module = "FindOrders.groovy";
+module = "FindOrders.groovy"
// get the order types
-orderTypes = from("OrderType").orderBy("description").queryList();
-context.orderTypes = orderTypes;
+orderTypes = from("OrderType").orderBy("description").queryList()
+context.orderTypes = orderTypes
// get the role types
-roleTypes = from("RoleType").orderBy("description").queryList();
-context.roleTypes = roleTypes;
+roleTypes = from("RoleType").orderBy("description").queryList()
+context.roleTypes = roleTypes
// get the order statuses
-orderStatuses = from("StatusItem").where("statusTypeId", "ORDER_STATUS").orderBy("sequenceId", "description").queryList();
-context.orderStatuses = orderStatuses;
+orderStatuses = from("StatusItem").where("statusTypeId", "ORDER_STATUS").orderBy("sequenceId", "description").queryList()
+context.orderStatuses = orderStatuses
// get websites
-websites = from("WebSite").orderBy("siteName").queryList();
-context.webSites = websites;
+websites = from("WebSite").orderBy("siteName").queryList()
+context.webSites = websites
// get the stores
-stores = from("ProductStore").orderBy("storeName").queryList();
-context.productStores = stores;
+stores = from("ProductStore").orderBy("storeName").queryList()
+context.productStores = stores
// get the channels
-channels = from("Enumeration").where("enumTypeId", "ORDER_SALES_CHANNEL").orderBy("sequenceId").queryList();
-context.salesChannels = channels;
+channels = from("Enumeration").where("enumTypeId", "ORDER_SALES_CHANNEL").orderBy("sequenceId").queryList()
+context.salesChannels = channels
// get the Shipping Methods
-carrierShipmentMethods = from("CarrierShipmentMethod").queryList();
-context.carrierShipmentMethods = carrierShipmentMethods;
+carrierShipmentMethods = from("CarrierShipmentMethod").queryList()
+context.carrierShipmentMethods = carrierShipmentMethods
// get the Payment Status
-paymentStatusList = from("StatusItem").where("statusTypeId", "PAYMENT_PREF_STATUS").orderBy("description").queryList();
-context.paymentStatusList = paymentStatusList;
+paymentStatusList = from("StatusItem").where("statusTypeId", "PAYMENT_PREF_STATUS").orderBy("description").queryList()
+context.paymentStatusList = paymentStatusList
// get the good identification types
-goodIdentificationTypes = from("GoodIdentificationType").orderBy("goodIdentificationTypeId", "description").queryList();
-context.goodIdentificationTypes = goodIdentificationTypes;
+goodIdentificationTypes = from("GoodIdentificationType").orderBy("goodIdentificationTypeId", "description").queryList()
+context.goodIdentificationTypes = goodIdentificationTypes
// current role type
-currentRoleTypeId = request.getParameter("roleTypeId");
+currentRoleTypeId = request.getParameter("roleTypeId")
if (currentRoleTypeId) {
- currentRole = from("RoleType").where("roleTypeId", currentRoleTypeId).cache(true).queryOne();
- context.currentRole = currentRole;
+ currentRole = from("RoleType").where("roleTypeId", currentRoleTypeId).cache(true).queryOne()
+ context.currentRole = currentRole
}
// current selected type
-currentTypeId = request.getParameter("orderTypeId");
+currentTypeId = request.getParameter("orderTypeId")
if (currentTypeId) {
- currentType = from("OrderType").where("orderTypeId", currentTypeId).cache(true).queryOne();
- context.currentType = currentType;
+ currentType = from("OrderType").where("orderTypeId", currentTypeId).cache(true).queryOne()
+ context.currentType = currentType
}
// current selected status
-currentStatusIds = request.getParameter("orderStatusId");
-context.currentStatuses = currentStatusIds;
+currentStatusIds = request.getParameter("orderStatusId")
+context.currentStatuses = currentStatusIds
// current website
-currentWebSiteId = request.getParameter("orderWebSiteId");
+currentWebSiteId = request.getParameter("orderWebSiteId")
if (currentWebSiteId) {
- currentWebSite = from("WebSite").where("webSiteId", currentWebSiteId).cache(true).queryOne();
- context.currentWebSite = currentWebSite;
+ currentWebSite = from("WebSite").where("webSiteId", currentWebSiteId).cache(true).queryOne()
+ context.currentWebSite = currentWebSite
}
// current store
-currentProductStoreId = request.getParameter("productStoreId");
+currentProductStoreId = request.getParameter("productStoreId")
if (currentProductStoreId) {
- currentProductStore = from("ProductStore").where("productStoreId", currentProductStoreId).cache(true).queryOne();
- context.currentProductStore = currentProductStore;
+ currentProductStore = from("ProductStore").where("productStoreId", currentProductStoreId).cache(true).queryOne()
+ context.currentProductStore = currentProductStore
}
// current Shipping Method
-shipmentMethod = request.getParameter("shipmentMethod");
+shipmentMethod = request.getParameter("shipmentMethod")
if (shipmentMethod) {
- carrierPartyId = shipmentMethod.substring(0, shipmentMethod.indexOf("@"));
- shipmentMethodTypeId = shipmentMethod.substring(shipmentMethod.indexOf("@")+1);
+ carrierPartyId = shipmentMethod.substring(0, shipmentMethod.indexOf("@"))
+ shipmentMethodTypeId = shipmentMethod.substring(shipmentMethod.indexOf("@")+1)
if (carrierPartyId && shipmentMethodTypeId) {
- currentCarrierShipmentMethod = from("CarrierShipmentMethod").where("partyId", carrierPartyId, "shipmentMethodTypeId", shipmentMethodTypeId).queryFirst();
- context.currentCarrierShipmentMethod = currentCarrierShipmentMethod;
+ currentCarrierShipmentMethod = from("CarrierShipmentMethod").where("partyId", carrierPartyId, "shipmentMethodTypeId", shipmentMethodTypeId).queryFirst()
+ context.currentCarrierShipmentMethod = currentCarrierShipmentMethod
}
}
// current channel
-currentSalesChannelId = request.getParameter("salesChannelEnumId");
+currentSalesChannelId = request.getParameter("salesChannelEnumId")
if (currentSalesChannelId) {
- currentSalesChannel = from("Enumeration").where("enumId", currentSalesChannelId).queryOne();
- context.currentSalesChannel = currentSalesChannel;
+ currentSalesChannel = from("Enumeration").where("enumId", currentSalesChannelId).queryOne()
+ context.currentSalesChannel = currentSalesChannel
}
// current good identification type
-currentGoodIdentificationTypeId = request.getParameter("goodIdentificationTypeId");
+currentGoodIdentificationTypeId = request.getParameter("goodIdentificationTypeId")
if (currentGoodIdentificationTypeId) {
- currentGoodIdentificationType = from("GoodIdentificationType").where("goodIdentificationTypeId", currentGoodIdentificationTypeId).queryOne();
- context.currentGoodIdentificationType = currentGoodIdentificationType;
+ currentGoodIdentificationType = from("GoodIdentificationType").where("goodIdentificationTypeId", currentGoodIdentificationTypeId).queryOne()
+ context.currentGoodIdentificationType = currentGoodIdentificationType
}
// create the fromDate for calendar
-fromCal = Calendar.getInstance();
-fromCal.setTime(new java.util.Date());
-fromCal.set(Calendar.DAY_OF_WEEK, fromCal.getActualMinimum(Calendar.DAY_OF_WEEK));
-fromCal.set(Calendar.HOUR_OF_DAY, fromCal.getActualMinimum(Calendar.HOUR_OF_DAY));
-fromCal.set(Calendar.MINUTE, fromCal.getActualMinimum(Calendar.MINUTE));
-fromCal.set(Calendar.SECOND, fromCal.getActualMinimum(Calendar.SECOND));
-fromCal.set(Calendar.MILLISECOND, fromCal.getActualMinimum(Calendar.MILLISECOND));
-fromTs = new Timestamp(fromCal.getTimeInMillis());
-fromStr = fromTs.toString();
-fromStr = fromStr.substring(0, fromStr.indexOf('.'));
-context.fromDateStr = fromStr;
+fromCal = Calendar.getInstance()
+fromCal.setTime(new java.util.Date())
+fromCal.set(Calendar.DAY_OF_WEEK, fromCal.getActualMinimum(Calendar.DAY_OF_WEEK))
+fromCal.set(Calendar.HOUR_OF_DAY, fromCal.getActualMinimum(Calendar.HOUR_OF_DAY))
+fromCal.set(Calendar.MINUTE, fromCal.getActualMinimum(Calendar.MINUTE))
+fromCal.set(Calendar.SECOND, fromCal.getActualMinimum(Calendar.SECOND))
+fromCal.set(Calendar.MILLISECOND, fromCal.getActualMinimum(Calendar.MILLISECOND))
+fromTs = new Timestamp(fromCal.getTimeInMillis())
+fromStr = fromTs.toString()
+fromStr = fromStr.substring(0, fromStr.indexOf('.'))
+context.fromDateStr = fromStr
// create the thruDate for calendar
-toCal = Calendar.getInstance();
-toCal.setTime(new java.util.Date());
-toCal.set(Calendar.DAY_OF_WEEK, toCal.getActualMaximum(Calendar.DAY_OF_WEEK));
-toCal.set(Calendar.HOUR_OF_DAY, toCal.getActualMaximum(Calendar.HOUR_OF_DAY));
-toCal.set(Calendar.MINUTE, toCal.getActualMaximum(Calendar.MINUTE));
-toCal.set(Calendar.SECOND, toCal.getActualMaximum(Calendar.SECOND));
-toCal.set(Calendar.MILLISECOND, toCal.getActualMaximum(Calendar.MILLISECOND));
-toTs = new Timestamp(toCal.getTimeInMillis());
-toStr = toTs.toString();
-context.thruDateStr = toStr;
+toCal = Calendar.getInstance()
+toCal.setTime(new java.util.Date())
+toCal.set(Calendar.DAY_OF_WEEK, toCal.getActualMaximum(Calendar.DAY_OF_WEEK))
+toCal.set(Calendar.HOUR_OF_DAY, toCal.getActualMaximum(Calendar.HOUR_OF_DAY))
+toCal.set(Calendar.MINUTE, toCal.getActualMaximum(Calendar.MINUTE))
+toCal.set(Calendar.SECOND, toCal.getActualMaximum(Calendar.SECOND))
+toCal.set(Calendar.MILLISECOND, toCal.getActualMaximum(Calendar.MILLISECOND))
+toTs = new Timestamp(toCal.getTimeInMillis())
+toStr = toTs.toString()
+context.thruDateStr = toStr
// set the page parameters
-viewIndex = request.getParameter("viewIndex") ? Integer.valueOf(request.getParameter("viewIndex")) : 1;
-context.viewIndex = viewIndex;
+viewIndex = request.getParameter("viewIndex") ? Integer.valueOf(request.getParameter("viewIndex")) : 1
+context.viewIndex = viewIndex
viewSize = request.getParameter("viewSize") ? Integer.valueOf(request.getParameter("viewSize")) :
- EntityUtilProperties.getPropertyValue("widget", "widget.form.defaultViewSize", "20", delegator);
-context.viewSize = viewSize;
+ EntityUtilProperties.getPropertyValue("widget", "widget.form.defaultViewSize", "20", delegator)
+context.viewSize = viewSize
// get the lookup flag
-lookupFlag = request.getParameter("lookupFlag");
+lookupFlag = request.getParameter("lookupFlag")
// fields from the service call
-paramList = request.getAttribute("paramList") ?: "";
-context.paramList = paramList;
+paramList = request.getAttribute("paramList") ?: ""
+context.paramList = paramList
if (paramList) {
- paramIds = paramList.split("&");
- context.paramIdList = Arrays.asList(paramIds);
+ paramIds = paramList.split("&")
+ context.paramIdList = Arrays.asList(paramIds)
}
-orderList = request.getAttribute("orderList");
-context.orderList = orderList;
+orderList = request.getAttribute("orderList")
+context.orderList = orderList
-orderListSize = request.getAttribute("orderListSize");
-context.orderListSize = orderListSize;
+orderListSize = request.getAttribute("orderListSize")
+context.orderListSize = orderListSize
-context.filterInventoryProblems = request.getAttribute("filterInventoryProblemsList");
-context.filterPOsWithRejectedItems = request.getAttribute("filterPOsWithRejectedItemsList");
-context.filterPOsOpenPastTheirETA = request.getAttribute("filterPOsOpenPastTheirETAList");
-context.filterPartiallyReceivedPOs = request.getAttribute("filterPartiallyReceivedPOsList");
+context.filterInventoryProblems = request.getAttribute("filterInventoryProblemsList")
+context.filterPOsWithRejectedItems = request.getAttribute("filterPOsWithRejectedItemsList")
+context.filterPOsOpenPastTheirETA = request.getAttribute("filterPOsOpenPastTheirETAList")
+context.filterPartiallyReceivedPOs = request.getAttribute("filterPartiallyReceivedPOsList")
-lowIndex = request.getAttribute("lowIndex");
-context.lowIndex = lowIndex;
+lowIndex = request.getAttribute("lowIndex")
+context.lowIndex = lowIndex
-highIndex = request.getAttribute("highIndex");
-context.highIndex = highIndex;
+highIndex = request.getAttribute("highIndex")
+context.highIndex = highIndex
diff --git a/applications/order/groovyScripts/order/NewNote.groovy b/applications/order/groovyScripts/order/NewNote.groovy
index 1e71fecab4..387fefa05a 100644
--- a/applications/order/groovyScripts/order/NewNote.groovy
+++ b/applications/order/groovyScripts/order/NewNote.groovy
@@ -17,23 +17,23 @@
* under the License.
*/
-orderId = request.getParameter("orderId");
-context.orderId = orderId;
+orderId = request.getParameter("orderId")
+context.orderId = orderId
-workEffortId = request.getParameter("workEffortId");
-partyId = request.getParameter("partyId");
-roleTypeId = request.getParameter("roleTypeId");
-fromDate = request.getParameter("fromDate");
+workEffortId = request.getParameter("workEffortId")
+partyId = request.getParameter("partyId")
+roleTypeId = request.getParameter("roleTypeId")
+fromDate = request.getParameter("fromDate")
-donePage = request.getParameter("DONE_PAGE") ?: "orderview?orderId=" + orderId;
+donePage = request.getParameter("DONE_PAGE") ?: "orderview?orderId=" + orderId
if (workEffortId)
- donePage += "&workEffortId=" + workEffortId;
+ donePage += "&workEffortId=" + workEffortId
if (partyId)
- donePage += "&partyId=" + partyId;
+ donePage += "&partyId=" + partyId
if (roleTypeId)
- donePage += "&roleTypeId=" + roleTypeId;
+ donePage += "&roleTypeId=" + roleTypeId
if (fromDate)
- donePage += "&fromDate=" + fromDate;
+ donePage += "&fromDate=" + fromDate
-context.donePage = donePage;
+context.donePage = donePage
diff --git a/applications/order/groovyScripts/order/OrderDeliveryScheduleInfo.groovy b/applications/order/groovyScripts/order/OrderDeliveryScheduleInfo.groovy
index a266850d75..d3e681c183 100644
--- a/applications/order/groovyScripts/order/OrderDeliveryScheduleInfo.groovy
+++ b/applications/order/groovyScripts/order/OrderDeliveryScheduleInfo.groovy
@@ -17,29 +17,29 @@
* under the License.
*/
-import org.apache.ofbiz.base.util.*;
-import org.apache.ofbiz.entity.*;
+import org.apache.ofbiz.base.util.*
+import org.apache.ofbiz.entity.*
-orderId = request.getParameter("orderId");
-orderTypeId = null;
-orderHeader = from("OrderHeader").where("orderId", orderId).queryOne();
+orderId = request.getParameter("orderId")
+orderTypeId = null
+orderHeader = from("OrderHeader").where("orderId", orderId).queryOne()
if (orderHeader) {
- orderTypeId = orderHeader.orderTypeId;
+ orderTypeId = orderHeader.orderTypeId
}
//Determine whether a schedule has already been defined for this PO
-schedule = from("OrderDeliverySchedule").where("orderId", orderId, "orderItemSeqId", "_NA_").queryOne();
+schedule = from("OrderDeliverySchedule").where("orderId", orderId, "orderItemSeqId", "_NA_").queryOne()
// Determine whether the current user can VIEW the order
-checkResult = runService('checkSupplierRelatedOrderPermission', [orderId : orderId, userLogin : session.getAttribute("userLogin"), checkAction : "VIEW"]);
-hasSupplierRelatedPermissionStr = checkResult.hasSupplierRelatedPermission;
+checkResult = runService('checkSupplierRelatedOrderPermission', [orderId : orderId, userLogin : session.getAttribute("userLogin"), checkAction : "VIEW"])
+hasSupplierRelatedPermissionStr = checkResult.hasSupplierRelatedPermission
// Determine what the reuslt is, no result is FALSE
-hasSupplierRelatedPermission = "true".equals(hasSupplierRelatedPermissionStr);
+hasSupplierRelatedPermission = "true".equals(hasSupplierRelatedPermissionStr)
-context.orderId = orderId;
-context.orderItemSeqId = "_NA_";
-context.orderTypeId = orderTypeId;
-context.orderHeader = orderHeader;
-context.schedule = schedule;
-context.hasPermission = hasSupplierRelatedPermission;
\ No newline at end of file
+context.orderId = orderId
+context.orderItemSeqId = "_NA_"
+context.orderTypeId = orderTypeId
+context.orderHeader = orderHeader
+context.schedule = schedule
+context.hasPermission = hasSupplierRelatedPermission
\ No newline at end of file
diff --git a/applications/order/groovyScripts/order/OrderHistory.groovy b/applications/order/groovyScripts/order/OrderHistory.groovy
index dca74aaee3..f8822eaf96 100644
--- a/applications/order/groovyScripts/order/OrderHistory.groovy
+++ b/applications/order/groovyScripts/order/OrderHistory.groovy
@@ -17,114 +17,114 @@
* 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
-orderId = parameters.orderId;
-context.orderId = orderId;
+orderId = parameters.orderId
+context.orderId = orderId
-orderHeader = null;
+orderHeader = null
if (orderId) {
- orderHeader = from("OrderHeader").where(orderId : orderId).queryOne();
+ orderHeader = from("OrderHeader").where(orderId : orderId).queryOne()
}
if (orderHeader) {
shipmentMethodCond = [EntityCondition.makeCondition("changedEntityName", EntityOperator.EQUALS, "OrderItemShipGroup"),
EntityCondition.makeCondition("changedFieldName", EntityOperator.EQUALS, "shipmentMethodTypeId"),
- EntityCondition.makeCondition("pkCombinedValueText", EntityOperator.LIKE, orderId + "%")];
- shipmentMethodHistories = from("EntityAuditLog").where(shipmentMethodCond).orderBy("-changedDate").queryList();
+ EntityCondition.makeCondition("pkCombinedValueText", EntityOperator.LIKE, orderId + "%")]
+ shipmentMethodHistories = from("EntityAuditLog").where(shipmentMethodCond).orderBy("-changedDate").queryList()
carrierPartyCond = [EntityCondition.makeCondition("changedEntityName", EntityOperator.EQUALS, "OrderItemShipGroup"),
EntityCondition.makeCondition("changedFieldName", EntityOperator.EQUALS, "carrierPartyId"),
- EntityCondition.makeCondition("pkCombinedValueText", EntityOperator.LIKE, orderId + "%")];
- carrierPartyHistories = from("EntityAuditLog").where(carrierPartyCond).queryList();
+ EntityCondition.makeCondition("pkCombinedValueText", EntityOperator.LIKE, orderId + "%")]
+ carrierPartyHistories = from("EntityAuditLog").where(carrierPartyCond).queryList()
- orderShipmentHistories = [];
+ orderShipmentHistories = []
shipmentMethodHistories.each { shipmentMethodHistory ->
- orderShipmentHistory = [:];
+ orderShipmentHistory = [:]
if ("shipmentMethodTypeId".equals(shipmentMethodHistory.changedFieldName)) {
- shipmentMethodType = from("ShipmentMethodType").where("shipmentMethodTypeId", shipmentMethodHistory.newValueText).queryOne();
+ shipmentMethodType = from("ShipmentMethodType").where("shipmentMethodTypeId", shipmentMethodHistory.newValueText).queryOne()
if (shipmentMethodType != null){
carrierPartyHistories.each { carrierPartyHistory ->
if (carrierPartyHistory.lastUpdatedTxStamp == shipmentMethodHistory.lastUpdatedTxStamp) {
if ("_NA_".equals(carrierPartyHistory.newValueText)) {
- orderShipmentHistory.shipmentMethod = shipmentMethodType.description;
+ orderShipmentHistory.shipmentMethod = shipmentMethodType.description
} else {
- orderShipmentHistory.shipmentMethod = carrierPartyHistory.newValueText + " " + shipmentMethodType.description;
+ orderShipmentHistory.shipmentMethod = carrierPartyHistory.newValueText + " " + shipmentMethodType.description
}
}
}
}
- orderShipmentHistory.lastUpdated = shipmentMethodHistory.lastUpdatedTxStamp;
- orderShipmentHistory.changedDate = shipmentMethodHistory.changedDate;
- orderShipmentHistory.changedByUser = shipmentMethodHistory.changedByInfo;
- orderShipmentHistories.add(orderShipmentHistory);
+ orderShipmentHistory.lastUpdated = shipmentMethodHistory.lastUpdatedTxStamp
+ orderShipmentHistory.changedDate = shipmentMethodHistory.changedDate
+ orderShipmentHistory.changedByUser = shipmentMethodHistory.changedByInfo
+ orderShipmentHistories.add(orderShipmentHistory)
}
}
- context.orderShipmentHistories = orderShipmentHistories;
+ context.orderShipmentHistories = orderShipmentHistories
changedByInfoCond = [EntityCondition.makeCondition("changedEntityName", EntityOperator.EQUALS, "OrderItem"),
EntityCondition.makeCondition("changedFieldName", EntityOperator.EQUALS, "changeByUserLoginId"),
- EntityCondition.makeCondition("pkCombinedValueText", EntityOperator.LIKE, orderId + "%")];
- changedByInfoHistories = from("EntityAuditLog").where(changedByInfoCond).orderBy("-changedDate").queryList();
+ EntityCondition.makeCondition("pkCombinedValueText", EntityOperator.LIKE, orderId + "%")]
+ changedByInfoHistories = from("EntityAuditLog").where(changedByInfoCond).orderBy("-changedDate").queryList()
- orderUnitPriceHistories = [];
+ orderUnitPriceHistories = []
unitPriceCond = [EntityCondition.makeCondition("changedEntityName", EntityOperator.EQUALS, "OrderItem"),
EntityCondition.makeCondition("changedFieldName", EntityOperator.EQUALS, "unitPrice"),
- EntityCondition.makeCondition("pkCombinedValueText", EntityOperator.LIKE, orderId + "%")];
- unitPriceHistories = from("EntityAuditLog").where(unitPriceCond).orderBy("-changedDate").queryList();
+ EntityCondition.makeCondition("pkCombinedValueText", EntityOperator.LIKE, orderId + "%")]
+ unitPriceHistories = from("EntityAuditLog").where(unitPriceCond).orderBy("-changedDate").queryList()
unitPriceHistories.each { unitPriceHistory ->
- orderUnitPriceHistory = [:];
+ orderUnitPriceHistory = [:]
if ((unitPriceHistory.oldValueText) && (unitPriceHistory.newValueText)) {
if ((Float.valueOf(unitPriceHistory.oldValueText)).compareTo(Float.valueOf(unitPriceHistory.newValueText)) != 0) {
- orderUnitPriceHistory.oldValue = unitPriceHistory.oldValueText;
- orderUnitPriceHistory.newValue = unitPriceHistory.newValueText;
- orderUnitPriceHistory.changedDate = unitPriceHistory.changedDate;
- orderItemSeqId = (unitPriceHistory.pkCombinedValueText).substring((unitPriceHistory.pkCombinedValueText).indexOf("::") + 2, (unitPriceHistory.pkCombinedValueText).length());
- orderItem = from("OrderItem").where("orderId", orderId, "orderItemSeqId", orderItemSeqId).queryOne();
- orderUnitPriceHistory.productId = orderItem.productId;
+ orderUnitPriceHistory.oldValue = unitPriceHistory.oldValueText
+ orderUnitPriceHistory.newValue = unitPriceHistory.newValueText
+ orderUnitPriceHistory.changedDate = unitPriceHistory.changedDate
+ orderItemSeqId = (unitPriceHistory.pkCombinedValueText).substring((unitPriceHistory.pkCombinedValueText).indexOf("::") + 2, (unitPriceHistory.pkCombinedValueText).length())
+ orderItem = from("OrderItem").where("orderId", orderId, "orderItemSeqId", orderItemSeqId).queryOne()
+ orderUnitPriceHistory.productId = orderItem.productId
changedByInfoHistories.each { changedByInfoHistory ->
if (changedByInfoHistory.lastUpdatedTxStamp == unitPriceHistory.lastUpdatedTxStamp) {
if (changedByInfoHistory.newValueText) {
- orderUnitPriceHistory.changedByUser = changedByInfoHistory.newValueText;
+ orderUnitPriceHistory.changedByUser = changedByInfoHistory.newValueText
} else {
- orderUnitPriceHistory.changedByUser = changedByInfoHistory.oldValueText;
+ orderUnitPriceHistory.changedByUser = changedByInfoHistory.oldValueText
}
}
}
- orderUnitPriceHistories.add(orderUnitPriceHistory);
+ orderUnitPriceHistories.add(orderUnitPriceHistory)
}
}
}
- context.orderUnitPriceHistories = orderUnitPriceHistories;
- orderQuantityHistories = [];
+ context.orderUnitPriceHistories = orderUnitPriceHistories
+ orderQuantityHistories = []
quantityCond = [EntityCondition.makeCondition("changedEntityName", EntityOperator.EQUALS, "OrderItem"),
EntityCondition.makeCondition("changedFieldName", EntityOperator.EQUALS, "quantity"),
- EntityCondition.makeCondition("pkCombinedValueText", EntityOperator.LIKE, orderId + "%")];
- quantityHistories = from("EntityAuditLog").where(quantityCond).orderBy("-changedDate").queryList();
+ EntityCondition.makeCondition("pkCombinedValueText", EntityOperator.LIKE, orderId + "%")]
+ quantityHistories = from("EntityAuditLog").where(quantityCond).orderBy("-changedDate").queryList()
quantityHistories.each { quantityHistory ->
- orderQuantityHistory = [:];
+ orderQuantityHistory = [:]
if ((quantityHistory.oldValueText) && (quantityHistory.newValueText)) {
if ((Float.valueOf(quantityHistory.oldValueText)).compareTo(Float.valueOf(quantityHistory.newValueText)) != 0) {
- orderQuantityHistory.oldValue = new BigDecimal(quantityHistory.oldValueText);
- orderQuantityHistory.newValue = quantityHistory.newValueText;
- orderQuantityHistory.changedDate = quantityHistory.changedDate;
- orderItemSeqId = (quantityHistory.pkCombinedValueText).substring((quantityHistory.pkCombinedValueText).indexOf("::") + 2, (quantityHistory.pkCombinedValueText).length());
- orderItem = from("OrderItem").where("orderId", orderId, "orderItemSeqId", orderItemSeqId).queryOne();
- orderQuantityHistory.productId = orderItem.productId;
+ orderQuantityHistory.oldValue = new BigDecimal(quantityHistory.oldValueText)
+ orderQuantityHistory.newValue = quantityHistory.newValueText
+ orderQuantityHistory.changedDate = quantityHistory.changedDate
+ orderItemSeqId = (quantityHistory.pkCombinedValueText).substring((quantityHistory.pkCombinedValueText).indexOf("::") + 2, (quantityHistory.pkCombinedValueText).length())
+ orderItem = from("OrderItem").where("orderId", orderId, "orderItemSeqId", orderItemSeqId).queryOne()
+ orderQuantityHistory.productId = orderItem.productId
changedByInfoHistories.each { changedByInfoHistory ->
if (changedByInfoHistory.lastUpdatedTxStamp == quantityHistory.lastUpdatedTxStamp) {
if(changedByInfoHistory.newValueText) {
- orderQuantityHistory.changedByUser = changedByInfoHistory.newValueText;
+ orderQuantityHistory.changedByUser = changedByInfoHistory.newValueText
} else {
- orderQuantityHistory.changedByUser = changedByInfoHistory.oldValueText;
+ orderQuantityHistory.changedByUser = changedByInfoHistory.oldValueText
}
}
}
- orderQuantityHistories.add(orderQuantityHistory);
+ orderQuantityHistories.add(orderQuantityHistory)
}
}
}
- context.orderQuantityHistories = orderQuantityHistories;
+ context.orderQuantityHistories = orderQuantityHistories
}
diff --git a/applications/order/groovyScripts/order/OrderList.groovy b/applications/order/groovyScripts/order/OrderList.groovy
index 65bf5895a3..809c47476d 100644
--- a/applications/order/groovyScripts/order/OrderList.groovy
+++ b/applications/order/groovyScripts/order/OrderList.groovy
@@ -17,42 +17,42 @@
* 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.order.order.OrderListState;
+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.order.OrderListState
-partyId = request.getParameter("partyId");
-facilityId = request.getParameter("facilityId");
+partyId = request.getParameter("partyId")
+facilityId = request.getParameter("facilityId")
-state = OrderListState.getInstance(request);
-state.update(request);
-context.state = state;
+state = OrderListState.getInstance(request)
+state.update(request)
+context.state = state
// check permission for each order type
-hasPermission = false;
+hasPermission = false
if (security.hasEntityPermission("ORDERMGR", "_VIEW", session)) {
if (state.hasType("view_SALES_ORDER") || (!(state.hasType("view_SALES_ORDER")) && !(state.hasType("view_PURCHASE_ORDER")))) {
- hasPermission = true;
- salesOrdersCondition = EntityCondition.makeCondition("orderTypeId", EntityOperator.EQUALS, "SALES_ORDER");
+ hasPermission = true
+ salesOrdersCondition = EntityCondition.makeCondition("orderTypeId", EntityOperator.EQUALS, "SALES_ORDER")
}
}
if (security.hasEntityPermission("ORDERMGR", "_PURCHASE_VIEW", session)) {
if (state.hasType("view_PURCHASE_ORDER") || (!(state.hasType("view_SALES_ORDER")) && !(state.hasType("view_PURCHASE_ORDER")))) {
- hasPermission = true;
- purchaseOrdersCondition = EntityCondition.makeCondition("orderTypeId", EntityOperator.EQUALS, "PURCHASE_ORDER");
+ hasPermission = true
+ purchaseOrdersCondition = EntityCondition.makeCondition("orderTypeId", EntityOperator.EQUALS, "PURCHASE_ORDER")
}
}
-context.hasPermission = hasPermission;
+context.hasPermission = hasPermission
-orderHeaderList = state.getOrders(facilityId, filterDate, delegator);
-context.orderHeaderList = orderHeaderList;
+orderHeaderList = state.getOrders(facilityId, filterDate, delegator)
+context.orderHeaderList = orderHeaderList
// a list of order type descriptions
-ordertypes = from("OrderType").cache(true).queryList();
+ordertypes = from("OrderType").cache(true).queryList()
ordertypes.each { type ->
- context["descr_" + type.orderTypeId] = type.get("description",locale);
+ context["descr_" + type.orderTypeId] = type.get("description",locale)
}
-context.filterDate = filterDate;
+context.filterDate = filterDate
diff --git a/applications/order/groovyScripts/order/OrderStats.groovy b/applications/order/groovyScripts/order/OrderStats.groovy
index 3b34513d67..d184a01fa1 100644
--- a/applications/order/groovyScripts/order/OrderStats.groovy
+++ b/applications/order/groovyScripts/order/OrderStats.groovy
@@ -17,39 +17,39 @@
* under the License.
*/
-import java.math.BigDecimal;
-import java.util.*;
-import java.sql.Timestamp;
-import org.apache.ofbiz.entity.*;
-import org.apache.ofbiz.entity.condition.*;
-import org.apache.ofbiz.entity.util.*;
-import org.apache.ofbiz.base.util.*;
+import java.math.BigDecimal
+import java.util.*
+import java.sql.Timestamp
+import org.apache.ofbiz.entity.*
+import org.apache.ofbiz.entity.condition.*
+import org.apache.ofbiz.entity.util.*
+import org.apache.ofbiz.base.util.*
BigDecimal calcItemTotal(List headers) {
- BigDecimal total = BigDecimal.ZERO;
+ BigDecimal total = BigDecimal.ZERO
headers.each { header ->
- total = total.plus(header.grandTotal ?: BigDecimal.ZERO);
+ total = total.plus(header.grandTotal ?: BigDecimal.ZERO)
}
- return total;
+ return total
}
double calcItemCount(List items) {
- double count = 0.00;
+ double count = 0.00
items.each { item ->
- count += item.quantity ?: 0.00;
+ count += item.quantity ?: 0.00
}
- return count;
+ return count
}
-dayBegin = UtilDateTime.getDayStart(nowTimestamp, timeZone, locale);
-weekBegin = UtilDateTime.getWeekStart(nowTimestamp, timeZone, locale);
-monthBegin = UtilDateTime.getMonthStart(nowTimestamp, timeZone, locale);
-yearBegin = UtilDateTime.getYearStart(nowTimestamp, timeZone, locale);
+dayBegin = UtilDateTime.getDayStart(nowTimestamp, timeZone, locale)
+weekBegin = UtilDateTime.getWeekStart(nowTimestamp, timeZone, locale)
+monthBegin = UtilDateTime.getMonthStart(nowTimestamp, timeZone, locale)
+yearBegin = UtilDateTime.getYearStart(nowTimestamp, timeZone, locale)
-dayEnd = UtilDateTime.getDayEnd(nowTimestamp, timeZone, locale);
-weekEnd = UtilDateTime.getWeekEnd(nowTimestamp, timeZone, locale);
-monthEnd = UtilDateTime.getMonthEnd(nowTimestamp, timeZone, locale);
-yearEnd = UtilDateTime.getYearEnd(nowTimestamp, timeZone, locale);
+dayEnd = UtilDateTime.getDayEnd(nowTimestamp, timeZone, locale)
+weekEnd = UtilDateTime.getWeekEnd(nowTimestamp, timeZone, locale)
+monthEnd = UtilDateTime.getMonthEnd(nowTimestamp, timeZone, locale)
+yearEnd = UtilDateTime.getYearEnd(nowTimestamp, timeZone, locale)
// order status report
ecl = EntityCondition.makeCondition([
@@ -57,52 +57,52 @@ ecl = EntityCondition.makeCondition([
EntityCondition.makeCondition("orderPaymentPreferenceId", EntityOperator.EQUALS, null),
EntityCondition.makeCondition("statusDatetime", EntityOperator.GREATER_THAN_EQUAL_TO, dayBegin),
EntityCondition.makeCondition("statusDatetime", EntityOperator.LESS_THAN_EQUAL_TO, dayEnd)],
- EntityOperator.AND);
-dayList = from("OrderStatus").where(ecl).queryList();
-context.dayOrder = EntityUtil.filterByAnd(dayList, [statusId : "ORDER_CREATED"]);
-context.dayApprove = EntityUtil.filterByAnd(dayList, [statusId : "ORDER_APPROVED"]);
-context.dayComplete = EntityUtil.filterByAnd(dayList, [statusId : "ORDER_COMPLETED"]);
-context.dayCancelled = EntityUtil.filterByAnd(dayList, [statusId : "ORDER_CANCELLED"]);
-context.dayRejected = EntityUtil.filterByAnd(dayList, [statusId : "ORDER_REJECTED"]);
+ EntityOperator.AND)
+dayList = from("OrderStatus").where(ecl).queryList()
+context.dayOrder = EntityUtil.filterByAnd(dayList, [statusId : "ORDER_CREATED"])
+context.dayApprove = EntityUtil.filterByAnd(dayList, [statusId : "ORDER_APPROVED"])
+context.dayComplete = EntityUtil.filterByAnd(dayList, [statusId : "ORDER_COMPLETED"])
+context.dayCancelled = EntityUtil.filterByAnd(dayList, [statusId : "ORDER_CANCELLED"])
+context.dayRejected = EntityUtil.filterByAnd(dayList, [statusId : "ORDER_REJECTED"])
ecl = EntityCondition.makeCondition([
EntityCondition.makeCondition("orderItemSeqId", EntityOperator.EQUALS, null),
EntityCondition.makeCondition("orderPaymentPreferenceId", EntityOperator.EQUALS, null),
EntityCondition.makeCondition("statusDatetime", EntityOperator.GREATER_THAN_EQUAL_TO, weekBegin),
EntityCondition.makeCondition("statusDatetime", EntityOperator.LESS_THAN_EQUAL_TO, weekEnd)],
- EntityOperator.AND);
-weekList = from("OrderStatus").where(ecl).queryList();
-context.weekOrder = EntityUtil.filterByAnd(weekList, [statusId : "ORDER_CREATED"]);
-context.weekApprove = EntityUtil.filterByAnd(weekList, [statusId: "ORDER_APPROVED"]);
-context.weekComplete = EntityUtil.filterByAnd(weekList, [statusId : "ORDER_COMPLETED"]);
-context.weekCancelled = EntityUtil.filterByAnd(weekList, [statusId : "ORDER_CANCELLED"]);
-context.weekRejected = EntityUtil.filterByAnd(weekList, [statusId : "ORDER_REJECTED"]);
+ EntityOperator.AND)
+weekList = from("OrderStatus").where(ecl).queryList()
+context.weekOrder = EntityUtil.filterByAnd(weekList, [statusId : "ORDER_CREATED"])
+context.weekApprove = EntityUtil.filterByAnd(weekList, [statusId: "ORDER_APPROVED"])
+context.weekComplete = EntityUtil.filterByAnd(weekList, [statusId : "ORDER_COMPLETED"])
+context.weekCancelled = EntityUtil.filterByAnd(weekList, [statusId : "ORDER_CANCELLED"])
+context.weekRejected = EntityUtil.filterByAnd(weekList, [statusId : "ORDER_REJECTED"])
ecl = EntityCondition.makeCondition([
EntityCondition.makeCondition("orderItemSeqId", EntityOperator.EQUALS, null),
EntityCondition.makeCondition("orderPaymentPreferenceId", EntityOperator.EQUALS, null),
EntityCondition.makeCondition("statusDatetime", EntityOperator.GREATER_THAN_EQUAL_TO, monthBegin),
EntityCondition.makeCondition("statusDatetime", EntityOperator.LESS_THAN_EQUAL_TO, monthEnd)],
- EntityOperator.AND);
-monthList = from("OrderStatus").where(ecl).queryList();
-context.monthOrder = EntityUtil.filterByAnd(monthList, [statusId : "ORDER_CREATED"]);
-context.monthApprove = EntityUtil.filterByAnd(monthList, [statusId : "ORDER_APPROVED"]);
-context.monthComplete = EntityUtil.filterByAnd(monthList, [statusId : "ORDER_COMPLETED"]);
-context.monthCancelled = EntityUtil.filterByAnd(monthList, [statusId : "ORDER_CANCELLED"]);
-context.monthRejected = EntityUtil.filterByAnd(monthList, [statusId : "ORDER_REJECTED"]);
+ EntityOperator.AND)
+monthList = from("OrderStatus").where(ecl).queryList()
+context.monthOrder = EntityUtil.filterByAnd(monthList, [statusId : "ORDER_CREATED"])
+context.monthApprove = EntityUtil.filterByAnd(monthList, [statusId : "ORDER_APPROVED"])
+context.monthComplete = EntityUtil.filterByAnd(monthList, [statusId : "ORDER_COMPLETED"])
+context.monthCancelled = EntityUtil.filterByAnd(monthList, [statusId : "ORDER_CANCELLED"])
+context.monthRejected = EntityUtil.filterByAnd(monthList, [statusId : "ORDER_REJECTED"])
ecl = EntityCondition.makeCondition([
EntityCondition.makeCondition("orderItemSeqId", EntityOperator.EQUALS, null),
EntityCondition.makeCondition("orderPaymentPreferenceId", EntityOperator.EQUALS, null),
EntityCondition.makeCondition("statusDatetime", EntityOperator.GREATER_THAN_EQUAL_TO, yearBegin),
EntityCondition.makeCondition("statusDatetime", EntityOperator.LESS_THAN_EQUAL_TO, yearEnd)],
- EntityOperator.AND);
-yearList = from("OrderStatus").where(ecl).queryList();
-context.yearOrder = EntityUtil.filterByAnd(yearList, [statusId : "ORDER_CREATED"]);
-context.yearApprove = EntityUtil.filterByAnd(yearList, [statusId : "ORDER_APPROVED"]);
-context.yearComplete = EntityUtil.filterByAnd(yearList, [statusId : "ORDER_COMPLETED"]);
-context.yearCancelled = EntityUtil.filterByAnd(yearList, [statusId : "ORDER_CANCELLED"]);
-context.yearRejected = EntityUtil.filterByAnd(yearList, [statusId : "ORDER_REJECTED"]);
+ EntityOperator.AND)
+yearList = from("OrderStatus").where(ecl).queryList()
+context.yearOrder = EntityUtil.filterByAnd(yearList, [statusId : "ORDER_CREATED"])
+context.yearApprove = EntityUtil.filterByAnd(yearList, [statusId : "ORDER_APPROVED"])
+context.yearComplete = EntityUtil.filterByAnd(yearList, [statusId : "ORDER_COMPLETED"])
+context.yearCancelled = EntityUtil.filterByAnd(yearList, [statusId : "ORDER_CANCELLED"])
+context.yearRejected = EntityUtil.filterByAnd(yearList, [statusId : "ORDER_REJECTED"])
// order totals and item counts
ecl = EntityCondition.makeCondition([
@@ -111,9 +111,9 @@ ecl = EntityCondition.makeCondition([
EntityCondition.makeCondition("orderDate", EntityOperator.GREATER_THAN_EQUAL_TO, dayBegin),
EntityCondition.makeCondition("orderDate", EntityOperator.LESS_THAN_EQUAL_TO, dayEnd),
EntityCondition.makeCondition("orderTypeId", EntityOperator.EQUALS, "SALES_ORDER")],
- EntityOperator.AND);
-dayItems = from("OrderHeaderAndItems").where(ecl).queryList();
-dayItemsPending = EntityUtil.filterByAnd(dayItems, [itemStatusId : "ITEM_ORDERED"]);
+ EntityOperator.AND)
+dayItems = from("OrderHeaderAndItems").where(ecl).queryList()
+dayItemsPending = EntityUtil.filterByAnd(dayItems, [itemStatusId : "ITEM_ORDERED"])
ecl = EntityCondition.makeCondition([
EntityCondition.makeCondition("statusId", EntityOperator.NOT_EQUAL, "ORDER_REJECTED"),
@@ -121,22 +121,22 @@ ecl = EntityCondition.makeCondition([
EntityCondition.makeCondition("orderDate", EntityOperator.GREATER_THAN_EQUAL_TO, dayBegin),
EntityCondition.makeCondition("orderDate", EntityOperator.LESS_THAN_EQUAL_TO, dayEnd),
EntityCondition.makeCondition("orderTypeId", EntityOperator.EQUALS, "SALES_ORDER")],
- EntityOperator.AND);
-dayHeaders = from("OrderHeader").where(ecl).queryList();
-dayHeadersPending = EntityUtil.filterByAnd(dayHeaders, [statusId : "ORDER_CREATED"]);
+ EntityOperator.AND)
+dayHeaders = from("OrderHeader").where(ecl).queryList()
+dayHeadersPending = EntityUtil.filterByAnd(dayHeaders, [statusId : "ORDER_CREATED"])
-dayItemTotal = calcItemTotal(dayHeaders);
-dayItemCount = calcItemCount(dayItems);
-dayItemTotalPending = calcItemTotal(dayHeadersPending);
-dayItemCountPending = calcItemCount(dayItemsPending);
-dayItemTotalPaid = dayItemTotal - dayItemTotalPending;
-dayItemCountPaid = dayItemCount - dayItemCountPending;
-context.dayItemTotal = dayItemTotal;
-context.dayItemCount = dayItemCount;
-context.dayItemTotalPending = dayItemTotalPending;
-context.dayItemCountPending = dayItemCountPending;
-context.dayItemTotalPaid = dayItemTotalPaid;
-context.dayItemCountPaid = dayItemCountPaid;
+dayItemTotal = calcItemTotal(dayHeaders)
+dayItemCount = calcItemCount(dayItems)
+dayItemTotalPending = calcItemTotal(dayHeadersPending)
+dayItemCountPending = calcItemCount(dayItemsPending)
+dayItemTotalPaid = dayItemTotal - dayItemTotalPending
+dayItemCountPaid = dayItemCount - dayItemCountPending
+context.dayItemTotal = dayItemTotal
+context.dayItemCount = dayItemCount
+context.dayItemTotalPending = dayItemTotalPending
+context.dayItemCountPending = dayItemCountPending
+context.dayItemTotalPaid = dayItemTotalPaid
+context.dayItemCountPaid = dayItemCountPaid
ecl = EntityCondition.makeCondition([
EntityCondition.makeCondition("itemStatusId", EntityOperator.NOT_EQUAL, "ITEM_REJECTED"),
@@ -144,9 +144,9 @@ ecl = EntityCondition.makeCondition([
EntityCondition.makeCondition("orderDate", EntityOperator.GREATER_THAN_EQUAL_TO, weekBegin),
EntityCondition.makeCondition("orderDate", EntityOperator.LESS_THAN_EQUAL_TO, weekEnd),
EntityCondition.makeCondition("orderTypeId", EntityOperator.EQUALS, "SALES_ORDER")],
- EntityOperator.AND);
-weekItems = from("OrderHeaderAndItems").where(ecl).queryList();
-weekItemsPending = EntityUtil.filterByAnd(weekItems, [itemStatusId : "ITEM_ORDERED"]);
+ EntityOperator.AND)
+weekItems = from("OrderHeaderAndItems").where(ecl).queryList()
+weekItemsPending = EntityUtil.filterByAnd(weekItems, [itemStatusId : "ITEM_ORDERED"])
ecl = EntityCondition.makeCondition([
EntityCondition.makeCondition("statusId", EntityOperator.NOT_EQUAL, "ORDER_REJECTED"),
@@ -154,22 +154,22 @@ ecl = EntityCondition.makeCondition([
EntityCondition.makeCondition("orderDate", EntityOperator.GREATER_THAN_EQUAL_TO, weekBegin),
EntityCondition.makeCondition("orderDate", EntityOperator.LESS_THAN_EQUAL_TO, weekEnd),
EntityCondition.makeCondition("orderTypeId", EntityOperator.EQUALS, "SALES_ORDER")],
- EntityOperator.AND);
-weekHeaders = from("OrderHeader").where(ecl).queryList();
-weekHeadersPending = EntityUtil.filterByAnd(weekHeaders, [statusId : "ORDER_CREATED"]);
+ EntityOperator.AND)
+weekHeaders = from("OrderHeader").where(ecl).queryList()
+weekHeadersPending = EntityUtil.filterByAnd(weekHeaders, [statusId : "ORDER_CREATED"])
-weekItemTotal = calcItemTotal(weekHeaders);
-weekItemCount = calcItemCount(weekItems);
-weekItemTotalPending = calcItemTotal(weekHeadersPending);
-weekItemCountPending = calcItemCount(weekItemsPending);
-weekItemTotalPaid = weekItemTotal - weekItemTotalPending;
-weekItemCountPaid = weekItemCount - weekItemCountPending;
-context.weekItemTotal = weekItemTotal;
-context.weekItemCount = weekItemCount;
-context.weekItemTotalPending = weekItemTotalPending;
-context.weekItemCountPending = weekItemCountPending;
-context.weekItemTotalPaid = weekItemTotalPaid;
-context.weekItemCountPaid = weekItemCountPaid;
+weekItemTotal = calcItemTotal(weekHeaders)
+weekItemCount = calcItemCount(weekItems)
+weekItemTotalPending = calcItemTotal(weekHeadersPending)
+weekItemCountPending = calcItemCount(weekItemsPending)
+weekItemTotalPaid = weekItemTotal - weekItemTotalPending
+weekItemCountPaid = weekItemCount - weekItemCountPending
+context.weekItemTotal = weekItemTotal
+context.weekItemCount = weekItemCount
+context.weekItemTotalPending = weekItemTotalPending
+context.weekItemCountPending = weekItemCountPending
+context.weekItemTotalPaid = weekItemTotalPaid
+context.weekItemCountPaid = weekItemCountPaid
ecl = EntityCondition.makeCondition([
EntityCondition.makeCondition("itemStatusId", EntityOperator.NOT_EQUAL, "ITEM_REJECTED"),
@@ -177,9 +177,9 @@ ecl = EntityCondition.makeCondition([
EntityCondition.makeCondition("orderDate", EntityOperator.GREATER_THAN_EQUAL_TO, monthBegin),
EntityCondition.makeCondition("orderDate", EntityOperator.LESS_THAN_EQUAL_TO, monthEnd),
EntityCondition.makeCondition("orderTypeId", EntityOperator.EQUALS, "SALES_ORDER")],
- EntityOperator.AND);
+ EntityOperator.AND)
monthItems = from("OrderHeaderAndItems").where(ecl).queryList()
-monthItemsPending = EntityUtil.filterByAnd(monthItems, [itemStatusId : "ITEM_ORDERED"]);
+monthItemsPending = EntityUtil.filterByAnd(monthItems, [itemStatusId : "ITEM_ORDERED"])
ecl = EntityCondition.makeCondition([
EntityCondition.makeCondition("statusId", EntityOperator.NOT_EQUAL, "ORDER_REJECTED"),
@@ -187,22 +187,22 @@ ecl = EntityCondition.makeCondition([
EntityCondition.makeCondition("orderDate", EntityOperator.GREATER_THAN_EQUAL_TO, monthBegin),
EntityCondition.makeCondition("orderDate", EntityOperator.LESS_THAN_EQUAL_TO, monthEnd),
EntityCondition.makeCondition("orderTypeId", EntityOperator.EQUALS, "SALES_ORDER")],
- EntityOperator.AND);
-monthHeaders = from("OrderHeader").where(ecl).queryList();
-monthHeadersPending = EntityUtil.filterByAnd(monthHeaders, [statusId : "ORDER_CREATED"]);
+ EntityOperator.AND)
+monthHeaders = from("OrderHeader").where(ecl).queryList()
+monthHeadersPending = EntityUtil.filterByAnd(monthHeaders, [statusId : "ORDER_CREATED"])
-monthItemTotal = calcItemTotal(monthHeaders);
-monthItemCount = calcItemCount(monthItems);
-monthItemTotalPending = calcItemTotal(monthHeadersPending);
-monthItemCountPending = calcItemCount(monthItemsPending);
-monthItemTotalPaid = monthItemTotal - monthItemTotalPending;
-monthItemCountPaid = monthItemCount - monthItemCountPending;
-context.monthItemTotal = monthItemTotal;
-context.monthItemCount = monthItemCount;
-context.monthItemTotalPending = monthItemTotalPending;
-context.monthItemCountPending = monthItemCountPending;
-context.monthItemTotalPaid = monthItemTotalPaid;
-context.monthItemCountPaid = monthItemCountPaid;
+monthItemTotal = calcItemTotal(monthHeaders)
+monthItemCount = calcItemCount(monthItems)
+monthItemTotalPending = calcItemTotal(monthHeadersPending)
+monthItemCountPending = calcItemCount(monthItemsPending)
+monthItemTotalPaid = monthItemTotal - monthItemTotalPending
+monthItemCountPaid = monthItemCount - monthItemCountPending
+context.monthItemTotal = monthItemTotal
+context.monthItemCount = monthItemCount
+context.monthItemTotalPending = monthItemTotalPending
+context.monthItemCountPending = monthItemCountPending
+context.monthItemTotalPaid = monthItemTotalPaid
+context.monthItemCountPaid = monthItemCountPaid
ecl = EntityCondition.makeCondition([
EntityCondition.makeCondition("itemStatusId", EntityOperator.NOT_EQUAL, "ITEM_REJECTED"),
@@ -210,9 +210,9 @@ ecl = EntityCondition.makeCondition([
EntityCondition.makeCondition("orderDate", EntityOperator.GREATER_THAN_EQUAL_TO, yearBegin),
EntityCondition.makeCondition("orderDate", EntityOperator.LESS_THAN_EQUAL_TO, yearEnd),
EntityCondition.makeCondition("orderTypeId", EntityOperator.EQUALS, "SALES_ORDER")],
- EntityOperator.AND);
-yearItems = from("OrderHeaderAndItems").where(ecl).queryList();
-yearItemsPending = EntityUtil.filterByAnd(yearItems, [itemStatusId : "ITEM_ORDERED"]);
+ EntityOperator.AND)
+yearItems = from("OrderHeaderAndItems").where(ecl).queryList()
+yearItemsPending = EntityUtil.filterByAnd(yearItems, [itemStatusId : "ITEM_ORDERED"])
ecl = EntityCondition.makeCondition([
EntityCondition.makeCondition("statusId", EntityOperator.NOT_EQUAL, "ORDER_REJECTED"),
@@ -220,29 +220,29 @@ ecl = EntityCondition.makeCondition([
EntityCondition.makeCondition("orderDate", EntityOperator.GREATER_THAN_EQUAL_TO, yearBegin),
EntityCondition.makeCondition("orderDate", EntityOperator.LESS_THAN_EQUAL_TO, yearEnd),
EntityCondition.makeCondition("orderTypeId", EntityOperator.EQUALS, "SALES_ORDER")],
- EntityOperator.AND);
-yearHeaders = from("OrderHeader").where(ecl).queryList();
-yearHeadersPending = EntityUtil.filterByAnd(yearHeaders, [statusId : "ORDER_CREATED"]);
+ EntityOperator.AND)
+yearHeaders = from("OrderHeader").where(ecl).queryList()
+yearHeadersPending = EntityUtil.filterByAnd(yearHeaders, [statusId : "ORDER_CREATED"])
-yearItemTotal = calcItemTotal(yearHeaders);
-yearItemCount = calcItemCount(yearItems);
-yearItemTotalPending = calcItemTotal(yearHeadersPending);
-yearItemCountPending = calcItemCount(yearItemsPending);
-yearItemTotalPaid = yearItemTotal - yearItemTotalPending;
-yearItemCountPaid = yearItemCount - yearItemCountPending;
-context.yearItemTotal = yearItemTotal;
-context.yearItemCount = yearItemCount;
-context.yearItemTotalPending = yearItemTotalPending;
-context.yearItemCountPending = yearItemCountPending;
-context.yearItemTotalPaid = yearItemTotalPaid;
-context.yearItemCountPaid = yearItemCountPaid;
+yearItemTotal = calcItemTotal(yearHeaders)
+yearItemCount = calcItemCount(yearItems)
+yearItemTotalPending = calcItemTotal(yearHeadersPending)
+yearItemCountPending = calcItemCount(yearItemsPending)
+yearItemTotalPaid = yearItemTotal - yearItemTotalPending
+yearItemCountPaid = yearItemCount - yearItemCountPending
+context.yearItemTotal = yearItemTotal
+context.yearItemCount = yearItemCount
+context.yearItemTotalPending = yearItemTotalPending
+context.yearItemCountPending = yearItemCountPending
+context.yearItemTotalPaid = yearItemTotalPaid
+context.yearItemCountPaid = yearItemCountPaid
// order state report
-waitingPayment = from("OrderHeader").where("statusId", "ORDER_CREATED", "orderTypeId", "SALES_ORDER").queryList();
-context.waitingPayment = waitingPayment.size();
+waitingPayment = from("OrderHeader").where("statusId", "ORDER_CREATED", "orderTypeId", "SALES_ORDER").queryList()
+context.waitingPayment = waitingPayment.size()
-waitingApproval = from("OrderHeader").where("statusId", "ORDER_PROCESSING", "orderTypeId", "SALES_ORDER").queryList();
-context.waitingApproval = waitingApproval.size();
+waitingApproval = from("OrderHeader").where("statusId", "ORDER_PROCESSING", "orderTypeId", "SALES_ORDER").queryList()
+context.waitingApproval = waitingApproval.size()
-waitingComplete = from("OrderHeader").where("statusId", "ORDER_APPROVED", "orderTypeId", "SALES_ORDER").queryList();
-context.waitingComplete = waitingComplete.size();
+waitingComplete = from("OrderHeader").where("statusId", "ORDER_APPROVED", "orderTypeId", "SALES_ORDER").queryList()
+context.waitingComplete = waitingComplete.size()
diff --git a/applications/order/groovyScripts/order/OrderView.groovy b/applications/order/groovyScripts/order/OrderView.groovy
index 785a14fa31..b099e29731 100644
--- a/applications/order/groovyScripts/order/OrderView.groovy
+++ b/applications/order/groovyScripts/order/OrderView.groovy
@@ -17,229 +17,229 @@
* under the License.
*/
-import java.math.BigDecimal;
-import java.util.*;
-import java.sql.Timestamp;
-import org.apache.ofbiz.entity.*;
-import org.apache.ofbiz.entity.condition.*;
-import org.apache.ofbiz.entity.util.*;
-import org.apache.ofbiz.base.util.*;
-import org.apache.ofbiz.base.util.collections.*;
-import org.apache.ofbiz.order.order.*;
-import org.apache.ofbiz.party.contact.*;
-import org.apache.ofbiz.product.inventory.InventoryWorker;
-import org.apache.ofbiz.product.catalog.CatalogWorker;
-import org.apache.ofbiz.product.store.ProductStoreWorker;
-import org.apache.ofbiz.accounting.payment.*;
+import java.math.BigDecimal
+import java.util.*
+import java.sql.Timestamp
+import org.apache.ofbiz.entity.*
+import org.apache.ofbiz.entity.condition.*
+import org.apache.ofbiz.entity.util.*
+import org.apache.ofbiz.base.util.*
+import org.apache.ofbiz.base.util.collections.*
+import org.apache.ofbiz.order.order.*
+import org.apache.ofbiz.party.contact.*
+import org.apache.ofbiz.product.inventory.InventoryWorker
+import org.apache.ofbiz.product.catalog.CatalogWorker
+import org.apache.ofbiz.product.store.ProductStoreWorker
+import org.apache.ofbiz.accounting.payment.*
-orderId = parameters.orderId;
-context.orderId = orderId;
+orderId = parameters.orderId
+context.orderId = orderId
-workEffortId = parameters.workEffortId;
-assignPartyId = parameters.partyId;
-assignRoleTypeId = parameters.roleTypeId;
-fromDate = parameters.fromDate;
-delegate = parameters.delegate;
+workEffortId = parameters.workEffortId
+assignPartyId = parameters.partyId
+assignRoleTypeId = parameters.roleTypeId
+fromDate = parameters.fromDate
+delegate = parameters.delegate
if (delegate && fromDate) {
- fromDate = parameters.toFromDate;
+ fromDate = parameters.toFromDate
}
-context.workEffortId = workEffortId;
-context.assignPartyId = assignPartyId;
-context.assignRoleTypeId = assignRoleTypeId;
-context.fromDate = fromDate;
-context.delegate = delegate;
-context.todayDate = new java.sql.Date(System.currentTimeMillis()).toString();
-def partyId = null;
+context.workEffortId = workEffortId
+context.assignPartyId = assignPartyId
+context.assignRoleTypeId = assignRoleTypeId
+context.fromDate = fromDate
+context.delegate = delegate
+context.todayDate = new java.sql.Date(System.currentTimeMillis()).toString()
+def partyId = null
-orderHeader = null;
-orderItems = null;
-orderAdjustments = null;
-comments = null;
+orderHeader = null
+orderItems = null
+orderAdjustments = null
+comments = null
if (orderId) {
- orderHeader = from('OrderHeader').where('orderId', orderId).cache(false).queryFirst();
- comments = select("orderItemSeqId", "changeComments", "changeDatetime", "changeUserLogin").from("OrderItemChange").where(UtilMisc.toList(EntityCondition.makeCondition("orderId", EntityOperator.EQUALS, orderId))).orderBy("-changeDatetime").queryList();
+ orderHeader = from('OrderHeader').where('orderId', orderId).cache(false).queryFirst()
+ comments = select("orderItemSeqId", "changeComments", "changeDatetime", "changeUserLogin").from("OrderItemChange").where(UtilMisc.toList(EntityCondition.makeCondition("orderId", EntityOperator.EQUALS, orderId))).orderBy("-changeDatetime").queryList()
}
if (orderHeader) {
// note these are overridden in the OrderViewWebSecure.groovy script if run
- context.hasPermission = true;
- context.canViewInternalDetails = true;
+ context.hasPermission = true
+ context.canViewInternalDetails = true
- orderReadHelper = new OrderReadHelper(orderHeader);
- orderItems = orderReadHelper.getOrderItems();
- orderAdjustments = orderReadHelper.getAdjustments();
- orderHeaderAdjustments = orderReadHelper.getOrderHeaderAdjustments();
- orderSubTotal = orderReadHelper.getOrderItemsSubTotal();
- orderTerms = orderHeader.getRelated("OrderTerm", null, null, false);
+ orderReadHelper = new OrderReadHelper(orderHeader)
+ orderItems = orderReadHelper.getOrderItems()
+ orderAdjustments = orderReadHelper.getAdjustments()
+ orderHeaderAdjustments = orderReadHelper.getOrderHeaderAdjustments()
+ orderSubTotal = orderReadHelper.getOrderItemsSubTotal()
+ orderTerms = orderHeader.getRelated("OrderTerm", null, null, false)
- context.orderHeader = orderHeader;
- context.comments = comments;
- context.orderReadHelper = orderReadHelper;
- context.orderItems = orderItems;
- context.orderAdjustments = orderAdjustments;
- context.orderHeaderAdjustments = orderHeaderAdjustments;
- context.orderSubTotal = orderSubTotal;
- context.currencyUomId = orderReadHelper.getCurrency();
- context.orderTerms = orderTerms;
+ context.orderHeader = orderHeader
+ context.comments = comments
+ context.orderReadHelper = orderReadHelper
+ context.orderItems = orderItems
+ context.orderAdjustments = orderAdjustments
+ context.orderHeaderAdjustments = orderHeaderAdjustments
+ context.orderSubTotal = orderSubTotal
+ context.currencyUomId = orderReadHelper.getCurrency()
+ context.orderTerms = orderTerms
// get sales reps
- context.salesReps = orderHeader.getRelated("OrderRole", [orderId : orderHeader.orderId, roleTypeId : "SALES_REP"], null, false);
+ context.salesReps = orderHeader.getRelated("OrderRole", [orderId : orderHeader.orderId, roleTypeId : "SALES_REP"], null, false)
// get the order type
- orderType = orderHeader.orderTypeId;
- context.orderType = orderType;
+ orderType = orderHeader.orderTypeId
+ context.orderType = orderType
// get the display party
- displayParty = null;
+ displayParty = null
if ("PURCHASE_ORDER".equals(orderType)) {
- displayParty = orderReadHelper.getSupplierAgent();
+ displayParty = orderReadHelper.getSupplierAgent()
} else {
- displayParty = orderReadHelper.getPlacingParty();
+ displayParty = orderReadHelper.getPlacingParty()
}
if (displayParty) {
- partyId = displayParty.partyId;
- context.displayParty = displayParty;
- context.partyId = partyId;
+ partyId = displayParty.partyId
+ context.displayParty = displayParty
+ context.partyId = partyId
- paymentMethodValueMaps = PaymentWorker.getPartyPaymentMethodValueMaps(delegator, displayParty.partyId, false);
- context.paymentMethodValueMaps = paymentMethodValueMaps;
+ paymentMethodValueMaps = PaymentWorker.getPartyPaymentMethodValueMaps(delegator, displayParty.partyId, false)
+ context.paymentMethodValueMaps = paymentMethodValueMaps
}
- otherAdjAmount = OrderReadHelper.calcOrderAdjustments(orderHeaderAdjustments, orderSubTotal, true, false, false);
- context.otherAdjAmount = otherAdjAmount;
+ otherAdjAmount = OrderReadHelper.calcOrderAdjustments(orderHeaderAdjustments, orderSubTotal, true, false, false)
+ context.otherAdjAmount = otherAdjAmount
- shippingAmount = OrderReadHelper.getAllOrderItemsAdjustmentsTotal(orderItems, orderAdjustments, false, false, true);
- shippingAmount = shippingAmount.add(OrderReadHelper.calcOrderAdjustments(orderHeaderAdjustments, orderSubTotal, false, false, true));
- context.shippingAmount = shippingAmount;
+ shippingAmount = OrderReadHelper.getAllOrderItemsAdjustmentsTotal(orderItems, orderAdjustments, false, false, true)
+ shippingAmount = shippingAmount.add(OrderReadHelper.calcOrderAdjustments(orderHeaderAdjustments, orderSubTotal, false, false, true))
+ context.shippingAmount = shippingAmount
- taxAmount = OrderReadHelper.getOrderTaxByTaxAuthGeoAndParty(orderAdjustments).taxGrandTotal;
- context.taxAmount = taxAmount;
+ taxAmount = OrderReadHelper.getOrderTaxByTaxAuthGeoAndParty(orderAdjustments).taxGrandTotal
+ context.taxAmount = taxAmount
- grandTotal = OrderReadHelper.getOrderGrandTotal(orderItems, orderAdjustments);
- context.grandTotal = grandTotal;
+ grandTotal = OrderReadHelper.getOrderGrandTotal(orderItems, orderAdjustments)
+ context.grandTotal = grandTotal
- orderItemList = orderReadHelper.getOrderItems();
+ orderItemList = orderReadHelper.getOrderItems()
// Retrieve all non-promo items that aren't cancelled
context.orderItemList = orderReadHelper.getOrderItems().findAll { item ->
(item.isPromo == null || item.isPromo == 'N') || !item.statusId.equals('ITEM_CANCELLED')
}
- shippingAddress = orderReadHelper.getShippingAddress();
- context.shippingAddress = shippingAddress;
+ shippingAddress = orderReadHelper.getShippingAddress()
+ context.shippingAddress = shippingAddress
- billingAddress = orderReadHelper.getBillingAddress();
- context.billingAddress = billingAddress;
+ billingAddress = orderReadHelper.getBillingAddress()
+ context.billingAddress = billingAddress
- distributorId = orderReadHelper.getDistributorId();
- context.distributorId = distributorId;
+ distributorId = orderReadHelper.getDistributorId()
+ context.distributorId = distributorId
- affiliateId = orderReadHelper.getAffiliateId();
- context.affiliateId = affiliateId;
+ affiliateId = orderReadHelper.getAffiliateId()
+ context.affiliateId = affiliateId
- billingAccount = orderHeader.getRelatedOne("BillingAccount", false);
- context.billingAccount = billingAccount;
- context.billingAccountMaxAmount = orderReadHelper.getBillingAccountMaxAmount();
+ billingAccount = orderHeader.getRelatedOne("BillingAccount", false)
+ context.billingAccount = billingAccount
+ context.billingAccountMaxAmount = orderReadHelper.getBillingAccountMaxAmount()
// get a list of all shipments, and a list of ItemIssuances per order item
- allShipmentsMap = [:];
- primaryShipments = orderHeader.getRelated("PrimaryShipment", null, null, false);
+ allShipmentsMap = [:]
+ primaryShipments = orderHeader.getRelated("PrimaryShipment", null, null, false)
primaryShipments.each { primaryShipment ->
- allShipmentsMap[primaryShipment.shipmentId] = primaryShipment;
+ allShipmentsMap[primaryShipment.shipmentId] = primaryShipment
}
- itemIssuancesPerItem = [:];
- itemIssuances = orderHeader.getRelated("ItemIssuance", null, ["shipmentId", "shipmentItemSeqId"], false);
+ itemIssuancesPerItem = [:]
+ itemIssuances = orderHeader.getRelated("ItemIssuance", null, ["shipmentId", "shipmentItemSeqId"], false)
itemIssuances.each { itemIssuance ->
if (!allShipmentsMap.containsKey(itemIssuance.shipmentId)) {
- iiShipment = itemIssuance.getRelatedOne("Shipment", false);
+ iiShipment = itemIssuance.getRelatedOne("Shipment", false)
if (iiShipment) {
- allShipmentsMap[iiShipment.shipmentId] = iiShipment;
+ allShipmentsMap[iiShipment.shipmentId] = iiShipment
}
}
- perItemList = itemIssuancesPerItem[itemIssuance.orderItemSeqId];
+ perItemList = itemIssuancesPerItem[itemIssuance.orderItemSeqId]
if (!perItemList) {
- perItemList = [];
- itemIssuancesPerItem[itemIssuance.orderItemSeqId] = perItemList;
+ perItemList = []
+ itemIssuancesPerItem[itemIssuance.orderItemSeqId] = perItemList
}
- perItemList.add(itemIssuance);
+ perItemList.add(itemIssuance)
}
- context.allShipments = allShipmentsMap.values();
- context.itemIssuancesPerItem = itemIssuancesPerItem;
+ context.allShipments = allShipmentsMap.values()
+ context.itemIssuancesPerItem = itemIssuancesPerItem
// get a list of all invoices
- orderBilling = from("OrderItemBilling").where("orderId", orderId).orderBy("invoiceId").queryList();
- context.invoices = orderBilling*.invoiceId.unique();
+ orderBilling = from("OrderItemBilling").where("orderId", orderId).orderBy("invoiceId").queryList()
+ context.invoices = orderBilling*.invoiceId.unique()
ecl = EntityCondition.makeCondition([
EntityCondition.makeCondition("orderId", EntityOperator.EQUALS, orderId),
EntityCondition.makeCondition("statusId", EntityOperator.NOT_EQUAL, "PAYMENT_CANCELLED")],
- EntityOperator.AND);
- orderPaymentPreferences = from("OrderPaymentPreference").where(ecl).queryList();
- context.orderPaymentPreferences = orderPaymentPreferences;
+ EntityOperator.AND)
+ orderPaymentPreferences = from("OrderPaymentPreference").where(ecl).queryList()
+ context.orderPaymentPreferences = orderPaymentPreferences
// ship groups
- shipGroups = from("OrderItemShipGroup").where("orderId", orderId).orderBy("shipGroupSeqId").queryList();
- context.shipGroups = shipGroups;
+ shipGroups = from("OrderItemShipGroup").where("orderId", orderId).orderBy("shipGroupSeqId").queryList()
+ context.shipGroups = shipGroups
- orderItemDatas = [];
+ orderItemDatas = []
orderItemList.each { orderItem ->
- BigDecimal cancelQuantity = orderItem.get("cancelQuantity");
- BigDecimal quantity = orderItem.get("quantity");
+ BigDecimal cancelQuantity = orderItem.get("cancelQuantity")
+ BigDecimal quantity = orderItem.get("quantity")
if ( cancelQuantity != null ) {
- quantityOrdered = quantity.subtract(cancelQuantity);
+ quantityOrdered = quantity.subtract(cancelQuantity)
} else {
- quantityOrdered = quantity;
+ quantityOrdered = quantity
}
- OISGAssContents = [];
+ OISGAssContents = []
shipGroups.each { shipGroup ->
- OISGAssContents.addAll(EntityUtil.filterByAnd(shipGroup.getRelated("OrderItemShipGroupAssoc", null, null, false), UtilMisc.toMap("orderItemSeqId", orderItem.getString("orderItemSeqId"))));
+ OISGAssContents.addAll(EntityUtil.filterByAnd(shipGroup.getRelated("OrderItemShipGroupAssoc", null, null, false), UtilMisc.toMap("orderItemSeqId", orderItem.getString("orderItemSeqId"))))
}
- BigDecimal totalQuantityPlanned = 0;
+ BigDecimal totalQuantityPlanned = 0
OISGAssContents.each { OISGAssContent ->
- BigDecimal cancelQty = OISGAssContent.get("cancelQuantity");
- BigDecimal qty = OISGAssContent.get("quantity");
+ BigDecimal cancelQty = OISGAssContent.get("cancelQuantity")
+ BigDecimal qty = OISGAssContent.get("quantity")
if (qty != null) {
- totalQuantityPlanned = totalQuantityPlanned.add(qty);
+ totalQuantityPlanned = totalQuantityPlanned.add(qty)
}
if (cancelQty != null){
- OISGAssContent.set("quantity", qty.subtract(cancelQty));
+ OISGAssContent.set("quantity", qty.subtract(cancelQty))
} else {
- OISGAssContent.set("quantity", qty);
+ OISGAssContent.set("quantity", qty)
}
}
- totalQuantityToPlan = totalQuantityPlanned - quantityOrdered;
- BigDecimal quantityNotAvailable = 0;
- List oisgirs = orderItem.getRelated("OrderItemShipGrpInvRes", null, null, false);
+ totalQuantityToPlan = totalQuantityPlanned - quantityOrdered
+ BigDecimal quantityNotAvailable = 0
+ List oisgirs = orderItem.getRelated("OrderItemShipGrpInvRes", null, null, false)
for (GenericValue oisgir : oisgirs) {
if (UtilValidate.isNotEmpty(oisgir.get("quantityNotAvailable"))) {
- quantityNotAvailable = quantityNotAvailable.add(oisgir.getBigDecimal("quantityNotAvailable"));
+ quantityNotAvailable = quantityNotAvailable.add(oisgir.getBigDecimal("quantityNotAvailable"))
}
}
- orderItemData = [:];
- orderItemData.put("orderItem", orderItem);
- orderItemData.put("OISGAssContents", OISGAssContents);
- orderItemData.put("product", orderItem.getRelatedOne("Product", false));
- orderItemData.put("quantityOrdered", quantityOrdered);
- orderItemData.put("totalQuantityPlanned", totalQuantityPlanned);
- orderItemData.put("totalQuantityToPlan", totalQuantityToPlan);
- orderItemData.put("quantityNotAvailable", quantityNotAvailable);
- orderItemDatas.add(orderItemData);
+ orderItemData = [:]
+ orderItemData.put("orderItem", orderItem)
+ orderItemData.put("OISGAssContents", OISGAssContents)
+ orderItemData.put("product", orderItem.getRelatedOne("Product", false))
+ orderItemData.put("quantityOrdered", quantityOrdered)
+ orderItemData.put("totalQuantityPlanned", totalQuantityPlanned)
+ orderItemData.put("totalQuantityToPlan", totalQuantityToPlan)
+ orderItemData.put("quantityNotAvailable", quantityNotAvailable)
+ orderItemDatas.add(orderItemData)
}
- context.put("orderItemDatas", orderItemDatas);
+ context.put("orderItemDatas", orderItemDatas)
// create the actualDate for calendar
- actualDateCal = Calendar.getInstance();
- actualDateCal.setTime(new java.util.Date());
- actualDateCal.set(Calendar.HOUR_OF_DAY, actualDateCal.getActualMinimum(Calendar.HOUR_OF_DAY));
- actualDateCal.set(Calendar.MINUTE, actualDateCal.getActualMinimum(Calendar.MINUTE));
- actualDateCal.set(Calendar.SECOND, actualDateCal.getActualMinimum(Calendar.SECOND));
- actualDateCal.set(Calendar.MILLISECOND, actualDateCal.getActualMinimum(Calendar.MILLISECOND));
- actualDateTs = new Timestamp(actualDateCal.getTimeInMillis());
- actualDateStr = actualDateTs.toString();
- actualDateStr = actualDateStr.substring(0, actualDateStr.indexOf('.'));
- context.put("actualDateStr", actualDateStr);
+ actualDateCal = Calendar.getInstance()
+ actualDateCal.setTime(new java.util.Date())
+ actualDateCal.set(Calendar.HOUR_OF_DAY, actualDateCal.getActualMinimum(Calendar.HOUR_OF_DAY))
+ actualDateCal.set(Calendar.MINUTE, actualDateCal.getActualMinimum(Calendar.MINUTE))
+ actualDateCal.set(Calendar.SECOND, actualDateCal.getActualMinimum(Calendar.SECOND))
+ actualDateCal.set(Calendar.MILLISECOND, actualDateCal.getActualMinimum(Calendar.MILLISECOND))
+ actualDateTs = new Timestamp(actualDateCal.getTimeInMillis())
+ actualDateStr = actualDateTs.toString()
+ actualDateStr = actualDateStr.substring(0, actualDateStr.indexOf('.'))
+ context.put("actualDateStr", actualDateStr)
// get Shipment tracking info
orderShipmentInfoSummaryList = select("shipGroupSeqId", "shipmentId", "shipmentRouteSegmentId", "carrierPartyId", "shipmentMethodTypeId", "shipmentPackageSeqId", "trackingCode", "boxNumber")
@@ -247,95 +247,95 @@ if (orderHeader) {
.where("orderId", orderId)
.orderBy("shipmentId", "shipmentRouteSegmentId", "shipmentPackageSeqId")
.distinct()
- .queryList();
- context.orderShipmentInfoSummaryList = orderShipmentInfoSummaryList;
+ .queryList()
+ context.orderShipmentInfoSummaryList = orderShipmentInfoSummaryList
- customerPoNumber = null;
+ customerPoNumber = null
orderItemList.each { orderItem ->
- customerPoNumber = orderItem.correspondingPoId;
+ customerPoNumber = orderItem.correspondingPoId
}
- context.customerPoNumber = customerPoNumber;
+ context.customerPoNumber = customerPoNumber
- statusChange = from("StatusValidChange").where("statusId", orderHeader.statusId).queryList();
- context.statusChange = statusChange;
+ statusChange = from("StatusValidChange").where("statusId", orderHeader.statusId).queryList()
+ context.statusChange = statusChange
- currentStatus = orderHeader.getRelatedOne("StatusItem", false);
- context.currentStatus = currentStatus;
+ currentStatus = orderHeader.getRelatedOne("StatusItem", false)
+ context.currentStatus = currentStatus
- orderHeaderStatuses = orderReadHelper.getOrderHeaderStatuses();
- context.orderHeaderStatuses = orderHeaderStatuses;
+ orderHeaderStatuses = orderReadHelper.getOrderHeaderStatuses()
+ context.orderHeaderStatuses = orderHeaderStatuses
- adjustmentTypes = from("OrderAdjustmentType").orderBy("description").queryList();
- context.orderAdjustmentTypes = adjustmentTypes;
+ adjustmentTypes = from("OrderAdjustmentType").orderBy("description").queryList()
+ context.orderAdjustmentTypes = adjustmentTypes
- notes = from("OrderHeaderNoteView").where("orderId", orderId).orderBy("-noteDateTime").queryList();
- context.orderNotes = notes;
+ notes = from("OrderHeaderNoteView").where("orderId", orderId).orderBy("-noteDateTime").queryList()
+ context.orderNotes = notes
- showNoteHeadingOnPDF = false;
+ showNoteHeadingOnPDF = false
if (notes && EntityUtil.filterByCondition(notes, EntityCondition.makeCondition("internalNote", EntityOperator.EQUALS, "N")).size() > 0) {
- showNoteHeadingOnPDF = true;
+ showNoteHeadingOnPDF = true
}
- context.showNoteHeadingOnPDF = showNoteHeadingOnPDF;
+ context.showNoteHeadingOnPDF = showNoteHeadingOnPDF
- cmvm = ContactMechWorker.getOrderContactMechValueMaps(delegator, orderId);
- context.orderContactMechValueMaps = cmvm;
+ cmvm = ContactMechWorker.getOrderContactMechValueMaps(delegator, orderId)
+ context.orderContactMechValueMaps = cmvm
- orderItemChangeReasons = from("Enumeration").where("enumTypeId", "ODR_ITM_CH_REASON").orderBy("sequenceId").queryList();
- context.orderItemChangeReasons = orderItemChangeReasons;
+ orderItemChangeReasons = from("Enumeration").where("enumTypeId", "ODR_ITM_CH_REASON").orderBy("sequenceId").queryList()
+ context.orderItemChangeReasons = orderItemChangeReasons
if ("PURCHASE_ORDER".equals(orderType)) {
// for purchase orders, we need also the supplier's postal address
- supplier = orderReadHelper.getBillFromParty();
+ supplier = orderReadHelper.getBillFromParty()
if (supplier) {
- supplierContactMechValueMaps = ContactMechWorker.getPartyContactMechValueMaps(delegator, supplier.partyId, false, "POSTAL_ADDRESS");
- context.supplierContactMechValueMaps = supplierContactMechValueMaps;
+ supplierContactMechValueMaps = ContactMechWorker.getPartyContactMechValueMaps(delegator, supplier.partyId, false, "POSTAL_ADDRESS")
+ context.supplierContactMechValueMaps = supplierContactMechValueMaps
supplierContactMechValueMaps.each { supplierContactMechValueMap ->
- contactMechPurposes = supplierContactMechValueMap.partyContactMechPurposes;
+ contactMechPurposes = supplierContactMechValueMap.partyContactMechPurposes
contactMechPurposes.each { contactMechPurpose ->
if (contactMechPurpose.contactMechPurposeTypeId.equals("GENERAL_LOCATION")) {
- context.supplierGeneralContactMechValueMap = supplierContactMechValueMap;
+ context.supplierGeneralContactMechValueMap = supplierContactMechValueMap
} else if (contactMechPurpose.contactMechPurposeTypeId.equals("SHIPPING_LOCATION")) {
- context.supplierShippingContactMechValueMap = supplierContactMechValueMap;
+ context.supplierShippingContactMechValueMap = supplierContactMechValueMap
} else if (contactMechPurpose.contactMechPurposeTypeId.equals("BILLING_LOCATION")) {
- context.supplierBillingContactMechValueMap = supplierContactMechValueMap;
+ context.supplierBillingContactMechValueMap = supplierContactMechValueMap
} else if (contactMechPurpose.contactMechPurposeTypeId.equals("PAYMENT_LOCATION")) {
- context.supplierPaymentContactMechValueMap = supplierContactMechValueMap;
+ context.supplierPaymentContactMechValueMap = supplierContactMechValueMap
}
}
}
}
// get purchase order item types
- purchaseOrderItemTypeList = from("OrderItemType").where("parentTypeId", "PURCHASE_SPECIFIC").cache(true).queryList();
- context.purchaseOrderItemTypeList = purchaseOrderItemTypeList;
+ purchaseOrderItemTypeList = from("OrderItemType").where("parentTypeId", "PURCHASE_SPECIFIC").cache(true).queryList()
+ context.purchaseOrderItemTypeList = purchaseOrderItemTypeList
}
// see if an approved order with all items completed exists
- context.setOrderCompleteOption = false;
+ context.setOrderCompleteOption = false
if ("ORDER_APPROVED".equals(orderHeader.statusId)) {
- expr = EntityCondition.makeCondition("statusId", EntityOperator.NOT_EQUAL, "ITEM_COMPLETED");
- notCreatedItems = orderReadHelper.getOrderItemsByCondition(expr);
+ expr = EntityCondition.makeCondition("statusId", EntityOperator.NOT_EQUAL, "ITEM_COMPLETED")
+ notCreatedItems = orderReadHelper.getOrderItemsByCondition(expr)
if (!notCreatedItems) {
- context.setOrderCompleteOption = true;
+ context.setOrderCompleteOption = true
}
}
// get inventory summary for each shopping cart product item
inventorySummary = runService('getProductInventorySummaryForItems', [orderItems : orderItems])
- context.availableToPromiseMap = inventorySummary.availableToPromiseMap;
- context.quantityOnHandMap = inventorySummary.quantityOnHandMap;
- context.mktgPkgATPMap = inventorySummary.mktgPkgATPMap;
- context.mktgPkgQOHMap = inventorySummary.mktgPkgQOHMap;
+ context.availableToPromiseMap = inventorySummary.availableToPromiseMap
+ context.quantityOnHandMap = inventorySummary.quantityOnHandMap
+ context.mktgPkgATPMap = inventorySummary.mktgPkgATPMap
+ context.mktgPkgQOHMap = inventorySummary.mktgPkgQOHMap
// get inventory summary with respect to facility
- productStore = orderReadHelper.getProductStore();
- context.productStore = productStore;
+ productStore = orderReadHelper.getProductStore()
+ context.productStore = productStore
if (productStore) {
- facility = productStore.getRelatedOne("Facility", false);
+ facility = productStore.getRelatedOne("Facility", false)
if (facility) {
- inventorySummaryByFacility = runService("getProductInventorySummaryForItems", [orderItems : orderItems, facilityId : facility.facilityId]);
- context.availableToPromiseByFacilityMap = inventorySummaryByFacility.availableToPromiseMap;
- context.quantityOnHandByFacilityMap = inventorySummaryByFacility.quantityOnHandMap;
- context.facility = facility;
+ inventorySummaryByFacility = runService("getProductInventorySummaryForItems", [orderItems : orderItems, facilityId : facility.facilityId])
+ context.availableToPromiseByFacilityMap = inventorySummaryByFacility.availableToPromiseMap
+ context.quantityOnHandByFacilityMap = inventorySummaryByFacility.quantityOnHandMap
+ context.facility = facility
}
}
@@ -344,163 +344,163 @@ if (orderHeader) {
// For a given ship group, the allowed facilities are the ones associated
// to the same contact mech of the ship group.
if ("PURCHASE_ORDER".equals(orderType)) {
- facilitiesForShipGroup = [:];
+ facilitiesForShipGroup = [:]
if (orderReadHelper.getBillToParty()) {
- ownerPartyId = orderReadHelper.getBillToParty().partyId;
- Map ownedFacilities = [:];
+ ownerPartyId = orderReadHelper.getBillToParty().partyId
+ Map ownedFacilities = [:]
shipGroups.each { shipGroup ->
- lookupMap = [ownerPartyId : ownerPartyId];
+ lookupMap = [ownerPartyId : ownerPartyId]
if (shipGroup.contactMechId) {
- lookupMap.contactMechId = shipGroup.contactMechId;
+ lookupMap.contactMechId = shipGroup.contactMechId
}
- facilities = from("FacilityAndContactMech").where(lookupMap).cache(true).queryList();
- facilitiesForShipGroup[shipGroup.shipGroupSeqId] = facilities;
+ facilities = from("FacilityAndContactMech").where(lookupMap).cache(true).queryList()
+ facilitiesForShipGroup[shipGroup.shipGroupSeqId] = facilities
facilities.each { facility ->
- ownedFacilities[facility.facilityId] = facility;
+ ownedFacilities[facility.facilityId] = facility
}
}
- context.facilitiesForShipGroup = facilitiesForShipGroup;
+ context.facilitiesForShipGroup = facilitiesForShipGroup
// Now get the list of all the facilities owned by the bill-to-party
- context.ownedFacilities = ownedFacilities.values();
+ context.ownedFacilities = ownedFacilities.values()
}
}
// set the type of return based on type of order
if ("SALES_ORDER".equals(orderType)) {
- context.returnHeaderTypeId = "CUSTOMER_RETURN";
+ context.returnHeaderTypeId = "CUSTOMER_RETURN"
// also set the product store facility Id for sales orders
if (productStore) {
- context.storeFacilityId = productStore.inventoryFacilityId;
+ context.storeFacilityId = productStore.inventoryFacilityId
if (productStore.reqReturnInventoryReceive) {
- context.needsInventoryReceive = productStore.reqReturnInventoryReceive;
+ context.needsInventoryReceive = productStore.reqReturnInventoryReceive
} else {
- context.needsInventoryReceive = "Y";
+ context.needsInventoryReceive = "Y"
}
}
} else {
- context.returnHeaderTypeId = "VENDOR_RETURN";
+ context.returnHeaderTypeId = "VENDOR_RETURN"
}
// QUANTITY: get the returned quantity by order item map
- context.returnQuantityMap = orderReadHelper.getOrderItemReturnedQuantities();
+ context.returnQuantityMap = orderReadHelper.getOrderItemReturnedQuantities()
// INVENTORY: construct a Set of productIds in the order for use in querying for inventory, otherwise these queries can get expensive
- productIds = orderReadHelper.getOrderProductIds();
+ productIds = orderReadHelper.getOrderProductIds()
// INVENTORY: get the production quantity for each product and store the results in a map of productId -> quantity
- productionMap = [:];
+ productionMap = [:]
productIds.each { productId ->
if (productId) { // avoid order items without productIds, such as bulk order items
- resultOutput = runService("getProductManufacturingSummaryByFacility", [productId : productId]);
- manufacturingInQuantitySummaryByFacility = resultOutput.summaryInByFacility;
- Double productionQuantity = 0;
+ resultOutput = runService("getProductManufacturingSummaryByFacility", [productId : productId])
+ manufacturingInQuantitySummaryByFacility = resultOutput.summaryInByFacility
+ Double productionQuantity = 0
manufacturingInQuantitySummaryByFacility.values().each { manQuantity ->
- productionQuantity += manQuantity.estimatedQuantityTotal;
+ productionQuantity += manQuantity.estimatedQuantityTotal
}
- productionMap[productId] = productionQuantity;
+ productionMap[productId] = productionQuantity
}
}
- context.productionProductQuantityMap = productionMap;
+ context.productionProductQuantityMap = productionMap
if (productIds.size() > 0) {
// INVENTORY: find the number of products in outstanding sales orders for the same product store
- requiredMap = InventoryWorker.getOutstandingProductQuantitiesForSalesOrders(productIds, delegator);
- context.requiredProductQuantityMap = requiredMap;
+ requiredMap = InventoryWorker.getOutstandingProductQuantitiesForSalesOrders(productIds, delegator)
+ context.requiredProductQuantityMap = requiredMap
// INVENTORY: find the quantity of each product in outstanding purchase orders
- onOrderMap = InventoryWorker.getOutstandingProductQuantitiesForPurchaseOrders(productIds, delegator);
- context.onOrderProductQuantityMap = onOrderMap;
+ onOrderMap = InventoryWorker.getOutstandingProductQuantitiesForPurchaseOrders(productIds, delegator)
+ context.onOrderProductQuantityMap = onOrderMap
} else {
- context.requiredProductQuantityMap = [:];
- context.onOrderProductQuantityMap = [:];
+ context.requiredProductQuantityMap = [:]
+ context.onOrderProductQuantityMap = [:]
}
// list to find all the POSTAL_ADDRESS for the shipment party.
- orderParty = from("Party").where("partyId", partyId).queryOne();
- shippingContactMechList = ContactHelper.getContactMech(orderParty, "SHIPPING_LOCATION", "POSTAL_ADDRESS", false);
- context.shippingContactMechList = shippingContactMechList;
+ orderParty = from("Party").where("partyId", partyId).queryOne()
+ shippingContactMechList = ContactHelper.getContactMech(orderParty, "SHIPPING_LOCATION", "POSTAL_ADDRESS", false)
+ context.shippingContactMechList = shippingContactMechList
// list to find all the shipmentMethods from the view named "ProductStoreShipmentMethView".
- shipGroupShippingMethods = [:];
+ shipGroupShippingMethods = [:]
shipGroups.each { shipGroup ->
- shipGroupSeqId = shipGroup.shipGroupSeqId;
- shippableItemFeatures = orderReadHelper.getFeatureIdQtyMap(shipGroupSeqId);
- shippableTotal = orderReadHelper.getShippableTotal(shipGroupSeqId);
- shippableWeight = orderReadHelper.getShippableWeight(shipGroupSeqId);
- shippableItemSizes = orderReadHelper.getShippableSizes(shipGroupSeqId);
- shippingAddress = orderReadHelper.getShippingAddress(shipGroupSeqId);
+ shipGroupSeqId = shipGroup.shipGroupSeqId
+ shippableItemFeatures = orderReadHelper.getFeatureIdQtyMap(shipGroupSeqId)
+ shippableTotal = orderReadHelper.getShippableTotal(shipGroupSeqId)
+ shippableWeight = orderReadHelper.getShippableWeight(shipGroupSeqId)
+ shippableItemSizes = orderReadHelper.getShippableSizes(shipGroupSeqId)
+ shippingAddress = orderReadHelper.getShippingAddress(shipGroupSeqId)
List productStoreShipmentMethList = ProductStoreWorker.getAvailableStoreShippingMethods(delegator, orderReadHelper.getProductStoreId(),
- shippingAddress, shippableItemSizes, shippableItemFeatures, shippableWeight, shippableTotal);
- shipGroupShippingMethods.put(shipGroupSeqId, productStoreShipmentMethList);
- context.shipGroupShippingMethods = shipGroupShippingMethods;
+ shippingAddress, shippableItemSizes, shippableItemFeatures, shippableWeight, shippableTotal)
+ shipGroupShippingMethods.put(shipGroupSeqId, productStoreShipmentMethList)
+ context.shipGroupShippingMethods = shipGroupShippingMethods
}
// Get a map of returnable items
- returnableItems = [:];
+ returnableItems = [:]
returnableItemServiceMap = run service: 'getReturnableItems', with: [orderId : orderId]
if (returnableItemServiceMap.returnableItems) {
- returnableItems = returnableItemServiceMap.returnableItems;
+ returnableItems = returnableItemServiceMap.returnableItems
}
- context.returnableItems = returnableItems;
+ context.returnableItems = returnableItems
// get the catalogIds for appending items
if (context.request != null) {
if ("SALES_ORDER".equals(orderType) && productStore) {
- catalogCol = CatalogWorker.getCatalogIdsAvailable(delegator, productStore.productStoreId, partyId);
+ catalogCol = CatalogWorker.getCatalogIdsAvailable(delegator, productStore.productStoreId, partyId)
} else {
- catalogCol = CatalogWorker.getAllCatalogIds(request);
+ catalogCol = CatalogWorker.getAllCatalogIds(request)
}
if (catalogCol) {
- currentCatalogId = catalogCol[0];
- currentCatalogName = CatalogWorker.getCatalogName(request, currentCatalogId);
- context.catalogCol = catalogCol;
- context.currentCatalogId = currentCatalogId;
- context.currentCatalogName = currentCatalogName;
+ currentCatalogId = catalogCol[0]
+ currentCatalogName = CatalogWorker.getCatalogName(request, currentCatalogId)
+ context.catalogCol = catalogCol
+ context.currentCatalogId = currentCatalogId
+ context.currentCatalogName = currentCatalogName
}
}
// list to find all the POSTAL_ADDRESS for the party.
- orderParty = from("Party").where("partyId", partyId).queryOne();
- postalContactMechList = ContactHelper.getContactMechByType(orderParty,"POSTAL_ADDRESS", false);
- context.postalContactMechList = postalContactMechList;
+ orderParty = from("Party").where("partyId", partyId).queryOne()
+ postalContactMechList = ContactHelper.getContactMechByType(orderParty,"POSTAL_ADDRESS", false)
+ context.postalContactMechList = postalContactMechList
// list to find all the TELECOM_NUMBER for the party.
- telecomContactMechList = ContactHelper.getContactMechByType(orderParty,"TELECOM_NUMBER", false);
- context.telecomContactMechList = telecomContactMechList;
+ telecomContactMechList = ContactHelper.getContactMechByType(orderParty,"TELECOM_NUMBER", false)
+ context.telecomContactMechList = telecomContactMechList
// list to find all the EMAIL_ADDRESS for the party.
- emailContactMechList = ContactHelper.getContactMechByType(orderParty,"EMAIL_ADDRESS", false);
- context.emailContactMechList = emailContactMechList;
+ emailContactMechList = ContactHelper.getContactMechByType(orderParty,"EMAIL_ADDRESS", false)
+ context.emailContactMechList = emailContactMechList
}
-paramString = "";
-if (orderId) paramString += "orderId=" + orderId;
-if (workEffortId) paramString += "&workEffortId=" + workEffortId;
-if (assignPartyId) paramString += "&partyId=" + assignPartyId;
-if (assignRoleTypeId) paramString += "&roleTypeId=" + assignRoleTypeId;
-if (fromDate) paramString += "&fromDate=" + fromDate;
-context.paramString = paramString;
+paramString = ""
+if (orderId) paramString += "orderId=" + orderId
+if (workEffortId) paramString += "&workEffortId=" + workEffortId
+if (assignPartyId) paramString += "&partyId=" + assignPartyId
+if (assignRoleTypeId) paramString += "&roleTypeId=" + assignRoleTypeId
+if (fromDate) paramString += "&fromDate=" + fromDate
+context.paramString = paramString
-workEffortStatus = null;
+workEffortStatus = null
if (workEffortId && assignPartyId && assignRoleTypeId && fromDate) {
- wepa = from("WorkEffortPartyAssignment").where("workEffortId", workEffortId, "partyId", assignPartyId, "roleTypeId", assignRoleTypeId, "fromDate", fromDate).queryOne();
+ wepa = from("WorkEffortPartyAssignment").where("workEffortId", workEffortId, "partyId", assignPartyId, "roleTypeId", assignRoleTypeId, "fromDate", fromDate).queryOne()
if ("CAL_ACCEPTED".equals(wepa?.statusId)) {
- workEffort = from("WorkEffort").where("workEffortId", workEffortId).queryOne();
- workEffortStatus = workEffort.currentStatusId;
+ workEffort = from("WorkEffort").where("workEffortId", workEffortId).queryOne()
+ workEffortStatus = workEffort.currentStatusId
if (workEffortStatus) {
- context.workEffortStatus = workEffortStatus;
+ context.workEffortStatus = workEffortStatus
if (workEffortStatus.equals("WF_RUNNING") || workEffortStatus.equals("WF_SUSPENDED"))
- context.inProcess = true;
+ context.inProcess = true
}
if (workEffort) {
if ("true".equals(delegate) || "WF_RUNNING".equals(workEffortStatus)) {
- activity = from("WorkflowActivity").where("packageId", workEffort.workflowPackageId, "packageVersion", workEffort.workflowPackageVersion, "processId", workEffort.workflowProcessId, "processVersion", workEffort.workflowProcessVersion, "activityId", workEffort.workflowActivityId).queryOne();
+ activity = from("WorkflowActivity").where("packageId", workEffort.workflowPackageId, "packageVersion", workEffort.workflowPackageVersion, "processId", workEffort.workflowProcessId, "processVersion", workEffort.workflowProcessVersion, "activityId", workEffort.workflowActivityId).queryOne()
if (activity) {
- transitions = activity.getRelated("FromWorkflowTransition", null, ["-transitionId"], false);
- context.wfTransitions = transitions;
+ transitions = activity.getRelated("FromWorkflowTransition", null, ["-transitionId"], false)
+ context.wfTransitions = transitions
}
}
}
@@ -508,48 +508,48 @@ if (workEffortId && assignPartyId && assignRoleTypeId && fromDate) {
}
if (orderItems) {
- orderItem = EntityUtil.getFirst(orderItems);
- context.orderItem = orderItem;
+ orderItem = EntityUtil.getFirst(orderItems)
+ context.orderItem = orderItem
}
// getting online ship estimates corresponding to this Order from UPS when "Hold" button will be clicked, when user packs from weight package screen.
// This case comes when order's shipping amount is more then or less than default percentage (defined in shipment.properties) of online UPS shipping amount.
-shipments = from("Shipment").where("primaryOrderId", orderId, "statusId", "SHIPMENT_PICKED").queryList();
+shipments = from("Shipment").where("primaryOrderId", orderId, "statusId", "SHIPMENT_PICKED").queryList()
if (shipments) {
- pickedShipmentId = EntityUtil.getFirst(shipments).shipmentId;
- shipmentRouteSegment = from("ShipmentRouteSegment").where("shipmentId", pickedShipmentId).queryFirst();
- context.shipmentRouteSegmentId = shipmentRouteSegment.shipmentRouteSegmentId;
- context.pickedShipmentId = pickedShipmentId;
+ pickedShipmentId = EntityUtil.getFirst(shipments).shipmentId
+ shipmentRouteSegment = from("ShipmentRouteSegment").where("shipmentId", pickedShipmentId).queryFirst()
+ context.shipmentRouteSegmentId = shipmentRouteSegment.shipmentRouteSegmentId
+ context.pickedShipmentId = pickedShipmentId
if (pickedShipmentId && shipmentRouteSegment.trackingIdNumber) {
if ("UPS" == shipmentRouteSegment.carrierPartyId && productStore) {
- resultMap = runService('upsShipmentAlternateRatesEstimate', [productStoreId: productStore.productStoreId, shipmentId: pickedShipmentId]);
- shippingRates = resultMap.shippingRates;
- shippingRateList = [];
+ resultMap = runService('upsShipmentAlternateRatesEstimate', [productStoreId: productStore.productStoreId, shipmentId: pickedShipmentId])
+ shippingRates = resultMap.shippingRates
+ shippingRateList = []
shippingRates.each { shippingRate ->
- shippingMethodAndRate = [:];
- serviceCodes = shippingRate.keySet();
+ shippingMethodAndRate = [:]
+ serviceCodes = shippingRate.keySet()
serviceCodes.each { serviceCode ->
- carrierShipmentMethod = from("CarrierShipmentMethod").where("partyId", "UPS", "carrierServiceCode", serviceCode).queryFirst();
- shipmentMethodTypeId = carrierShipmentMethod.shipmentMethodTypeId;
- rate = shippingRate.get(serviceCode);
- shipmentMethodDescription = EntityUtil.getFirst(carrierShipmentMethod.getRelated("ShipmentMethodType", null, null, false)).description;
- shippingMethodAndRate.shipmentMethodTypeId = carrierShipmentMethod.shipmentMethodTypeId;
- shippingMethodAndRate.rate = rate;
- shippingMethodAndRate.shipmentMethodDescription = shipmentMethodDescription;
- shippingRateList.add(shippingMethodAndRate);
+ carrierShipmentMethod = from("CarrierShipmentMethod").where("partyId", "UPS", "carrierServiceCode", serviceCode).queryFirst()
+ shipmentMethodTypeId = carrierShipmentMethod.shipmentMethodTypeId
+ rate = shippingRate.get(serviceCode)
+ shipmentMethodDescription = EntityUtil.getFirst(carrierShipmentMethod.getRelated("ShipmentMethodType", null, null, false)).description
+ shippingMethodAndRate.shipmentMethodTypeId = carrierShipmentMethod.shipmentMethodTypeId
+ shippingMethodAndRate.rate = rate
+ shippingMethodAndRate.shipmentMethodDescription = shipmentMethodDescription
+ shippingRateList.add(shippingMethodAndRate)
}
}
- context.shippingRateList = shippingRateList;
+ context.shippingRateList = shippingRateList
}
}
}
// get orderAdjustmentId for SHIPPING_CHARGES
-orderAdjustmentId = null;
+orderAdjustmentId = null
orderAdjustments.each { orderAdjustment ->
if(orderAdjustment.orderAdjustmentTypeId.equals("SHIPPING_CHARGES")) {
- orderAdjustmentId = orderAdjustment.orderAdjustmentId;
+ orderAdjustmentId = orderAdjustment.orderAdjustmentId
}
}
-context.orderAdjustmentId = orderAdjustmentId;
+context.orderAdjustmentId = orderAdjustmentId
diff --git a/applications/order/groovyScripts/order/OrderViewWebSecure.groovy b/applications/order/groovyScripts/order/OrderViewWebSecure.groovy
index 5d9f7275cc..2ce00c47ec 100644
--- a/applications/order/groovyScripts/order/OrderViewWebSecure.groovy
+++ b/applications/order/groovyScripts/order/OrderViewWebSecure.groovy
@@ -17,39 +17,39 @@
* under the License.
*/
-import java.util.*;
-import org.apache.ofbiz.base.util.*;
-import org.apache.ofbiz.base.util.collections.*;
-import org.apache.ofbiz.order.order.*;
+import java.util.*
+import org.apache.ofbiz.base.util.*
+import org.apache.ofbiz.base.util.collections.*
+import org.apache.ofbiz.order.order.*
-orderHeader = context.orderHeader;
+orderHeader = context.orderHeader
// if orderHeader is null in OrderView.groovy then it is not null but void here!
if (orderHeader) {
// set hasPermission, must always exist if the orderHeader != null
// hasPermission if: has ORDERMGR_VIEW, ORDERMGR_ROLE_VIEW & associated with order, or is associated in the SUPPLIER_AGENT role
- hasPermission = false;
- canViewInternalDetails = false;
+ hasPermission = false
+ canViewInternalDetails = false
if (("SALES_ORDER".equals(orderHeader.orderTypeId) && security.hasEntityPermission("ORDERMGR", "_VIEW", session))
|| ("PURCHASE_ORDER".equals(orderHeader.orderTypeId) && security.hasEntityPermission("ORDERMGR", "_PURCHASE_VIEW", session))) {
- hasPermission = true;
- canViewInternalDetails = true;
+ hasPermission = true
+ canViewInternalDetails = true
} else if (security.hasEntityPermission("ORDERMGR_ROLE", "_VIEW", session)) {
- currentUserOrderRoles = orderHeader.getRelated("OrderRole", [partyId : userLogin.partyId], null, false);
+ currentUserOrderRoles = orderHeader.getRelated("OrderRole", [partyId : userLogin.partyId], null, false)
if (currentUserOrderRoles) {
- hasPermission = true;
- canViewInternalDetails = true;
+ hasPermission = true
+ canViewInternalDetails = true
}
} else {
// regardless of permission, allow if this is the supplier
- currentUserSupplierOrderRoles = orderHeader.getRelated("OrderRole", [partyId : userLogin.partyId, roleTypeId : "SUPPLIER_AGENT"], null, false);
+ currentUserSupplierOrderRoles = orderHeader.getRelated("OrderRole", [partyId : userLogin.partyId, roleTypeId : "SUPPLIER_AGENT"], null, false)
if (currentUserSupplierOrderRoles) {
- hasPermission = true;
+ hasPermission = true
}
}
- context.hasPermission = hasPermission;
- context.canViewInternalDetails = canViewInternalDetails;
+ context.hasPermission = hasPermission
+ context.canViewInternalDetails = canViewInternalDetails
- orderContentWrapper = OrderContentWrapper.makeOrderContentWrapper(orderHeader, request);
- context.orderContentWrapper = orderContentWrapper;
+ orderContentWrapper = OrderContentWrapper.makeOrderContentWrapper(orderHeader, request)
+ context.orderContentWrapper = orderContentWrapper
}
diff --git a/applications/order/groovyScripts/order/ReceivePayment.groovy b/applications/order/groovyScripts/order/ReceivePayment.groovy
index 38723b8058..db22aac92e 100644
--- a/applications/order/groovyScripts/order/ReceivePayment.groovy
+++ b/applications/order/groovyScripts/order/ReceivePayment.groovy
@@ -17,28 +17,28 @@
* under the License.
*/
-import org.apache.ofbiz.entity.*;
-import org.apache.ofbiz.entity.condition.*;
-import org.apache.ofbiz.base.util.*;
+import org.apache.ofbiz.entity.*
+import org.apache.ofbiz.entity.condition.*
+import org.apache.ofbiz.base.util.*
-orderId = request.getParameter("orderId");
-paymentMethodTypes = from("PaymentMethodType").where(EntityCondition.makeCondition("paymentMethodTypeId", EntityOperator.NOT_EQUAL, "EXT_OFFLINE")).queryList();
-context.paymentMethodTypes = paymentMethodTypes;
+orderId = request.getParameter("orderId")
+paymentMethodTypes = from("PaymentMethodType").where(EntityCondition.makeCondition("paymentMethodTypeId", EntityOperator.NOT_EQUAL, "EXT_OFFLINE")).queryList()
+context.paymentMethodTypes = paymentMethodTypes
-workEffortId = request.getParameter("workEffortId");
-partyId = request.getParameter("partyId");
-roleTypeId = request.getParameter("roleTypeId");
-fromDate = request.getParameter("fromDate");
+workEffortId = request.getParameter("workEffortId")
+partyId = request.getParameter("partyId")
+roleTypeId = request.getParameter("roleTypeId")
+fromDate = request.getParameter("fromDate")
-donePage = request.getParameter("DONE_PAGE") ?: "orderview?orderId=" + orderId;
+donePage = request.getParameter("DONE_PAGE") ?: "orderview?orderId=" + orderId
if (workEffortId)
- donePage += "&workEffortId=" + workEffortId;
+ donePage += "&workEffortId=" + workEffortId
if (partyId)
- donePage += "&partyId=" + partyId;
+ donePage += "&partyId=" + partyId
if (roleTypeId)
- donePage += "&roleTypeId=" + roleTypeId;
+ donePage += "&roleTypeId=" + roleTypeId
if (fromDate)
- donePage += "&fromDate=" + fromDate;
-context.donePage = donePage;
+ donePage += "&fromDate=" + fromDate
+context.donePage = donePage
diff --git a/applications/order/groovyScripts/order/SendConfirmationEmail.groovy b/applications/order/groovyScripts/order/SendConfirmationEmail.groovy
index a69d200f03..986bf81dc3 100644
--- a/applications/order/groovyScripts/order/SendConfirmationEmail.groovy
+++ b/applications/order/groovyScripts/order/SendConfirmationEmail.groovy
@@ -16,32 +16,32 @@
* specific language governing permissions and limitations
* under the License.
*/
-import org.apache.ofbiz.base.util.UtilMisc;
-import org.apache.ofbiz.entity.Delegator;
-import org.apache.ofbiz.entity.GenericValue;
-import org.apache.ofbiz.order.order.OrderReadHelper;
-import org.apache.ofbiz.common.email.NotificationServices;
+import org.apache.ofbiz.base.util.UtilMisc
+import org.apache.ofbiz.entity.Delegator
+import org.apache.ofbiz.entity.GenericValue
+import org.apache.ofbiz.order.order.OrderReadHelper
+import org.apache.ofbiz.common.email.NotificationServices
-orderId = request.getParameter("orderId") ?: parameters.get("orderId");
-context.orderId = orderId;
+orderId = request.getParameter("orderId") ?: parameters.get("orderId")
+context.orderId = orderId
-partyId = request.getParameter("partyId");
-sendTo = request.getParameter("sendTo");
+partyId = request.getParameter("partyId")
+sendTo = request.getParameter("sendTo")
-context.partyId = partyId;
-context.sendTo = sendTo;
+context.partyId = partyId
+context.sendTo = sendTo
-donePage = request.getParameter("DONE_PAGE") ?: "orderview";
-context.donePage = donePage;
+donePage = request.getParameter("DONE_PAGE") ?: "orderview"
+context.donePage = donePage
// Provide the correct order confirmation ProductStoreEmailSetting, if one exists
-orderHeader = from("OrderHeader").where("orderId", orderId).queryOne();
+orderHeader = from("OrderHeader").where("orderId", orderId).queryOne()
if (orderHeader.productStoreId) {
- productStoreEmailSetting = from("ProductStoreEmailSetting").where("productStoreId", orderHeader.productStoreId, "emailType", emailType).queryOne();
+ productStoreEmailSetting = from("ProductStoreEmailSetting").where("productStoreId", orderHeader.productStoreId, "emailType", emailType).queryOne()
if (productStoreEmailSetting) {
- context.productStoreEmailSetting = productStoreEmailSetting;
+ context.productStoreEmailSetting = productStoreEmailSetting
}
}
// set the baseUrl parameter, required by some email bodies
-NotificationServices.setBaseUrl(delegator, context.webSiteId, context);
+NotificationServices.setBaseUrl(delegator, context.webSiteId, context)
diff --git a/applications/order/groovyScripts/order/ShipGroups.groovy b/applications/order/groovyScripts/order/ShipGroups.groovy
index 14b0c275e8..8421a590b2 100644
--- a/applications/order/groovyScripts/order/ShipGroups.groovy
+++ b/applications/order/groovyScripts/order/ShipGroups.groovy
@@ -17,103 +17,103 @@
* under the License.
*/
-import org.apache.ofbiz.base.util.UtilMisc;
-import org.apache.ofbiz.entity.util.EntityTypeUtil;
-import org.apache.ofbiz.entity.util.EntityUtil;
+import org.apache.ofbiz.base.util.UtilMisc
+import org.apache.ofbiz.entity.util.EntityTypeUtil
+import org.apache.ofbiz.entity.util.EntityUtil
-orderId = parameters.orderId;
-if (!orderId) return;
+orderId = parameters.orderId
+if (!orderId) return
-shipGroupSeqId = parameters.shipGroupSeqId;
+shipGroupSeqId = parameters.shipGroupSeqId
// if a particular ship group is requested, we will limit ourselves to it
-findMap = [orderId: orderId];
-if (shipGroupSeqId) findMap.shipGroupSeqId = shipGroupSeqId;
+findMap = [orderId: orderId]
+if (shipGroupSeqId) findMap.shipGroupSeqId = shipGroupSeqId
-shipGroups = from("OrderItemShipGroup").where(findMap).orderBy("shipGroupSeqId").queryList();
-context.shipGroups = shipGroups;
+shipGroups = from("OrderItemShipGroup").where(findMap).orderBy("shipGroupSeqId").queryList()
+context.shipGroups = shipGroups
// method to expand the marketing packages
LinkedList expandProductGroup(product, quantityInGroup, quantityShipped, quantityOpen, assocType) {
- sublines = [];
- associations = product.getRelated("MainProductAssoc", [productAssocTypeId : assocType], null, false);
- associations = EntityUtil.filterByDate(associations);
+ sublines = []
+ associations = product.getRelated("MainProductAssoc", [productAssocTypeId : assocType], null, false)
+ associations = EntityUtil.filterByDate(associations)
associations.each { association ->
- line = [:];
- line.product = association.getRelatedOne("AssocProduct", false);
+ line = [:]
+ line.product = association.getRelatedOne("AssocProduct", false)
// determine the quantities
- quantityComposed = association.quantity ?: 0;
- line.quantityInGroup = quantityInGroup * quantityComposed;
- line.quantityShipped = quantityShipped * quantityComposed;
- line.quantityOpen = quantityOpen * quantityComposed;
+ quantityComposed = association.quantity ?: 0
+ line.quantityInGroup = quantityInGroup * quantityComposed
+ line.quantityShipped = quantityShipped * quantityComposed
+ line.quantityOpen = quantityOpen * quantityComposed
- sublines.add(line);
+ sublines.add(line)
}
- return sublines;
+ return sublines
}
-groupData = [:];
+groupData = [:]
shipGroups.each { shipGroup ->
- data = [:];
+ data = [:]
- address = shipGroup.getRelatedOne("PostalAddress", false);
- data.address = address;
+ address = shipGroup.getRelatedOne("PostalAddress", false)
+ data.address = address
- phoneNumber = shipGroup.getRelatedOne("TelecomTelecomNumber", false);
- data.phoneNumber = phoneNumber;
+ phoneNumber = shipGroup.getRelatedOne("TelecomTelecomNumber", false)
+ data.phoneNumber = phoneNumber
- carrierShipmentMethod = shipGroup.getRelatedOne("CarrierShipmentMethod", false);
+ carrierShipmentMethod = shipGroup.getRelatedOne("CarrierShipmentMethod", false)
if (carrierShipmentMethod) {
- data.carrierShipmentMethod = carrierShipmentMethod;
- data.shipmentMethodType = carrierShipmentMethod.getRelatedOne("ShipmentMethodType", true);
+ data.carrierShipmentMethod = carrierShipmentMethod
+ data.shipmentMethodType = carrierShipmentMethod.getRelatedOne("ShipmentMethodType", true)
}
// the lines in a page, each line being a row of data to display
- lines = [];
+ lines = []
// process the order item to ship group associations, each being a line item for the group
- orderItemAssocs = shipGroup.getRelated("OrderItemShipGroupAssoc", null, ["orderItemSeqId"], false);
+ orderItemAssocs = shipGroup.getRelated("OrderItemShipGroupAssoc", null, ["orderItemSeqId"], false)
orderItemAssocs.each { orderItemAssoc ->
- orderItem = orderItemAssoc.getRelatedOne("OrderItem", false);
- product = orderItem.getRelatedOne("Product", false);
- line = [:];
+ orderItem = orderItemAssoc.getRelatedOne("OrderItem", false)
+ product = orderItem.getRelatedOne("Product", false)
+ line = [:]
// the quantity in group
- quantityInGroup = orderItemAssoc.quantity;
+ quantityInGroup = orderItemAssoc.quantity
if (orderItemAssoc.cancelQuantity) {
- quantityInGroup -= orderItemAssoc.cancelQuantity;
+ quantityInGroup -= orderItemAssoc.cancelQuantity
}
// the quantity shipped
- quantityShipped = 0.0;
- issuances = from("ItemIssuance").where("orderId", orderItem.orderId, "orderItemSeqId", orderItem.orderItemSeqId, "shipGroupSeqId", orderItemAssoc.shipGroupSeqId).queryList();
+ quantityShipped = 0.0
+ issuances = from("ItemIssuance").where("orderId", orderItem.orderId, "orderItemSeqId", orderItem.orderItemSeqId, "shipGroupSeqId", orderItemAssoc.shipGroupSeqId).queryList()
issuances.each { issuance ->
- quantityShipped += issuance.quantity;
+ quantityShipped += issuance.quantity
}
// the quantity open (ordered - shipped)
- quantityOpen = orderItem.quantity;
+ quantityOpen = orderItem.quantity
if (orderItem.cancelQuantity) {
- quantityOpen -= orderItem.cancelQuantity;
+ quantityOpen -= orderItem.cancelQuantity
}
- quantityOpen -= quantityShipped;
+ quantityOpen -= quantityShipped
- line.orderItem = orderItem;
- line.product = product;
- line.quantityInGroup = quantityInGroup;
- line.quantityShipped = quantityShipped;
- line.quantityOpen = quantityOpen;
+ line.orderItem = orderItem
+ line.product = product
+ line.quantityInGroup = quantityInGroup
+ line.quantityShipped = quantityShipped
+ line.quantityOpen = quantityOpen
if (EntityTypeUtil.hasParentType(delegator, "ProductType", "productTypeId", product.productTypeId, "parentTypeId", "MARKETING_PKG")) {
- assocType = EntityTypeUtil.hasParentType(delegator, "ProductType", "productTypeId", product.productTypeId, "parentTypeId", "MARKETING_PKG_AUTO") ? "MANUF_COMPONENT" : "PRODUCT_COMPONENT";
- sublines = expandProductGroup(product, quantityInGroup, quantityShipped, quantityOpen, assocType);
- line.expandedList = sublines;
+ assocType = EntityTypeUtil.hasParentType(delegator, "ProductType", "productTypeId", product.productTypeId, "parentTypeId", "MARKETING_PKG_AUTO") ? "MANUF_COMPONENT" : "PRODUCT_COMPONENT"
+ sublines = expandProductGroup(product, quantityInGroup, quantityShipped, quantityOpen, assocType)
+ line.expandedList = sublines
}
- lines.add(line);
+ lines.add(line)
}
- data.lines = lines;
- groupData[shipGroup.shipGroupSeqId] = data;
+ data.lines = lines
+ groupData[shipGroup.shipGroupSeqId] = data
}
-context.groupData = groupData;
+context.groupData = groupData
diff --git a/applications/order/groovyScripts/order/ViewImage.groovy b/applications/order/groovyScripts/order/ViewImage.groovy
index 132163ffec..877bf8c136 100644
--- a/applications/order/groovyScripts/order/ViewImage.groovy
+++ b/applications/order/groovyScripts/order/ViewImage.groovy
@@ -17,21 +17,21 @@
* under the License.
*/
-import org.apache.ofbiz.base.util.*;
-import org.apache.ofbiz.order.order.*;
+import org.apache.ofbiz.base.util.*
+import org.apache.ofbiz.order.order.*
-orderId = request.getParameter("orderId");
-orderItemSeqId = request.getParameter("orderItemSeqId");
-orderContentTypeId = request.getParameter("orderContentTypeId");
+orderId = request.getParameter("orderId")
+orderItemSeqId = request.getParameter("orderItemSeqId")
+orderContentTypeId = request.getParameter("orderContentTypeId")
-order = null;
+order = null
if (orderId && !orderItemSeqId) {
- order = from("OrderHeader").where("orderId", orderId).queryOne();
+ order = from("OrderHeader").where("orderId", orderId).queryOne()
}
if (orderId && orderItemSeqId) {
- order = from("OrderItem").where("orderId", orderId, "orderItemSeqId", orderItemSeqId).queryOne();
+ order = from("OrderItem").where("orderId", orderId, "orderItemSeqId", orderItemSeqId).queryOne()
}
-wrapper = OrderContentWrapper.makeOrderContentWrapper(order, request);
-context.wrapper = wrapper;
-context.orderContentTypeId = orderContentTypeId;
+wrapper = OrderContentWrapper.makeOrderContentWrapper(order, request)
+context.wrapper = wrapper
+context.orderContentTypeId = orderContentTypeId
diff --git a/applications/order/groovyScripts/quote/GetPartyAddress.groovy b/applications/order/groovyScripts/quote/GetPartyAddress.groovy
index 65b4874d14..fed7ef17c4 100644
--- a/applications/order/groovyScripts/quote/GetPartyAddress.groovy
+++ b/applications/order/groovyScripts/quote/GetPartyAddress.groovy
@@ -17,14 +17,14 @@
* under the License.
*/
-import org.apache.ofbiz.entity.util.EntityUtil;
-import org.apache.ofbiz.party.contact.ContactHelper;
+import org.apache.ofbiz.entity.util.EntityUtil
+import org.apache.ofbiz.party.contact.ContactHelper
if (party) {
- address = EntityUtil.getFirst(ContactHelper.getContactMech(party, "GENERAL_LOCATION", "POSTAL_ADDRESS", false));
+ address = EntityUtil.getFirst(ContactHelper.getContactMech(party, "GENERAL_LOCATION", "POSTAL_ADDRESS", false))
if (address) {
- toPostalAddress = address.getRelatedOne("PostalAddress", false);
- context.toPostalAddress = toPostalAddress;
+ toPostalAddress = address.getRelatedOne("PostalAddress", false)
+ context.toPostalAddress = toPostalAddress
}
}
diff --git a/applications/order/groovyScripts/quote/GetPartyEmailAddress.groovy b/applications/order/groovyScripts/quote/GetPartyEmailAddress.groovy
index 5b06c2cd0b..b1068646b2 100644
--- a/applications/order/groovyScripts/quote/GetPartyEmailAddress.groovy
+++ b/applications/order/groovyScripts/quote/GetPartyEmailAddress.groovy
@@ -17,13 +17,13 @@
* under the License.
*/
-import org.apache.ofbiz.entity.util.EntityUtil;
-import org.apache.ofbiz.party.contact.ContactHelper;
+import org.apache.ofbiz.entity.util.EntityUtil
+import org.apache.ofbiz.party.contact.ContactHelper
if (party) {
- emailAddress = EntityUtil.getFirst(ContactHelper.getContactMech(party, "PRIMARY_EMAIL", "EMAIL_ADDRESS", false));
+ emailAddress = EntityUtil.getFirst(ContactHelper.getContactMech(party, "PRIMARY_EMAIL", "EMAIL_ADDRESS", false))
if (emailAddress) {
- context.sendTo = emailAddress.infoString;
+ context.sendTo = emailAddress.infoString
}
}
diff --git a/applications/order/groovyScripts/quote/ManageQuotePrices.groovy b/applications/order/groovyScripts/quote/ManageQuotePrices.groovy
index a1ecf7666c..46e884b01d 100644
--- a/applications/order/groovyScripts/quote/ManageQuotePrices.groovy
+++ b/applications/order/groovyScripts/quote/ManageQuotePrices.groovy
@@ -17,65 +17,65 @@
* under the License.
*/
-import org.apache.ofbiz.base.util.UtilMisc;
-import org.apache.ofbiz.entity.util.EntityUtil;
+import org.apache.ofbiz.base.util.UtilMisc
+import org.apache.ofbiz.entity.util.EntityUtil
-costMult = 0.0;
+costMult = 0.0
quoteCoefficients.each { quoteCoefficient ->
- value = quoteCoefficient.coeffValue;
+ value = quoteCoefficient.coeffValue
if (value) {
- costMult += value;
+ costMult += value
}
}
-costToPriceMult = 1.0;
+costToPriceMult = 1.0
if (costMult != 100) {
- costToPriceMult = 100 / (100 - costMult);
+ costToPriceMult = 100 / (100 - costMult)
}
-totalCost = 0.0;
-totalPrice = 0.0;
-totalCostMult = 0.0;
-currency = quote.currencyUomId;
-quoteItemAndCostInfos = [];
+totalCost = 0.0
+totalPrice = 0.0
+totalCostMult = 0.0
+currency = quote.currencyUomId
+quoteItemAndCostInfos = []
quoteItems.each { quoteItem ->
- defaultQuoteUnitPrice = 0.0;
- averageCost = 0.0;
- unitPrice = 0.0;
- quantity = 1.0;
- selectedAmount = quoteItem.selectedAmount ?: 1.0;
+ defaultQuoteUnitPrice = 0.0
+ averageCost = 0.0
+ unitPrice = 0.0
+ quantity = 1.0
+ selectedAmount = quoteItem.selectedAmount ?: 1.0
if (quoteItem.quantity != null) {
- quantity = quoteItem.quantity;
+ quantity = quoteItem.quantity
}
if (quoteItem.quoteUnitPrice != null) {
- unitPrice = quoteItem.quoteUnitPrice;
+ unitPrice = quoteItem.quoteUnitPrice
}
try {
if (currency && quoteItem.productId) {
- productPrice = from("ProductPrice").where("productId", quoteItem.productId, "currencyUomId", currency, "productPriceTypeId", "AVERAGE_COST").filterByDate().queryFirst();
+ productPrice = from("ProductPrice").where("productId", quoteItem.productId, "currencyUomId", currency, "productPriceTypeId", "AVERAGE_COST").filterByDate().queryFirst()
if (productPrice?.price != null) {
- averageCost = productPrice.price;
+ averageCost = productPrice.price
}
}
- defaultQuoteUnitPrice = averageCost * costToPriceMult * selectedAmount;
- totalCost += (averageCost * quantity);
- totalPrice += (unitPrice * quantity * selectedAmount);
+ defaultQuoteUnitPrice = averageCost * costToPriceMult * selectedAmount
+ totalCost += (averageCost * quantity)
+ totalPrice += (unitPrice * quantity * selectedAmount)
} catch (Exception exc) {
- Debug.logError("Problems getting the averageCost for quoteItem: " + quoteItem);
+ Debug.logError("Problems getting the averageCost for quoteItem: " + quoteItem)
}
- quoteItemAndCostInfo = new java.util.HashMap(quoteItem);
- quoteItemAndCostInfo.averageCost = averageCost;
- quoteItemAndCostInfo.costToPriceMult = costToPriceMult;
- quoteItemAndCostInfo.defaultQuoteUnitPrice = defaultQuoteUnitPrice;
- quoteItemAndCostInfos.add(quoteItemAndCostInfo);
+ quoteItemAndCostInfo = new java.util.HashMap(quoteItem)
+ quoteItemAndCostInfo.averageCost = averageCost
+ quoteItemAndCostInfo.costToPriceMult = costToPriceMult
+ quoteItemAndCostInfo.defaultQuoteUnitPrice = defaultQuoteUnitPrice
+ quoteItemAndCostInfos.add(quoteItemAndCostInfo)
}
-context.costMult = costMult;
-context.costToPriceMult = costToPriceMult;
-context.quoteItemAndCostInfos = quoteItemAndCostInfos;
+context.costMult = costMult
+context.costToPriceMult = costToPriceMult
+context.quoteItemAndCostInfos = quoteItemAndCostInfos
-context.totalCost = totalCost;
-context.totalPrice = totalPrice;
-context.totalCostMult = (totalCost != 0 ? totalPrice / totalCost : 0);
+context.totalCost = totalCost
+context.totalPrice = totalPrice
+context.totalCostMult = (totalCost != 0 ? totalPrice / totalCost : 0)
diff --git a/applications/order/groovyScripts/quote/ViewQuoteProfit.groovy b/applications/order/groovyScripts/quote/ViewQuoteProfit.groovy
index e950c7fcb4..9c23fbf9c3 100644
--- a/applications/order/groovyScripts/quote/ViewQuoteProfit.groovy
+++ b/applications/order/groovyScripts/quote/ViewQuoteProfit.groovy
@@ -17,71 +17,71 @@
* under the License.
*/
-import java.util.Date;
-import java.sql.Timestamp;
-import org.apache.ofbiz.base.util.UtilDateTime;
-import org.apache.ofbiz.base.util.UtilMisc;
-import org.apache.ofbiz.entity.util.EntityUtil;
-import org.apache.ofbiz.base.util.Debug;
+import java.util.Date
+import java.sql.Timestamp
+import org.apache.ofbiz.base.util.UtilDateTime
+import org.apache.ofbiz.base.util.UtilMisc
+import org.apache.ofbiz.entity.util.EntityUtil
+import org.apache.ofbiz.base.util.Debug
-costMult = 0.0;
+costMult = 0.0
quoteCoefficients.each { quoteCoefficient ->
- value = quoteCoefficient.coeffValue;
+ value = quoteCoefficient.coeffValue
if (value) {
- costMult += value;
+ costMult += value
}
}
-totalProfit = 0.0;
-costToPriceMult = 1.0;
+totalProfit = 0.0
+costToPriceMult = 1.0
if (costMult != 100) {
- costToPriceMult = 100 / (100 - costMult);
+ costToPriceMult = 100 / (100 - costMult)
}
-issueDate = quote.issueDate ?: nowTimestamp;
-totalCost = 0.0;
-totalPrice = 0.0;
-totalCostMult = 0.0;
-currency = quote.currencyUomId;
-quoteItemAndCostInfos = [];
+issueDate = quote.issueDate ?: nowTimestamp
+totalCost = 0.0
+totalPrice = 0.0
+totalCostMult = 0.0
+currency = quote.currencyUomId
+quoteItemAndCostInfos = []
quoteItems.each { quoteItem ->
- defaultQuoteUnitPrice = 0.0;
- averageCost = 0.0;
- unitPrice = quoteItem.quoteUnitPrice ?: 0.0;
- quantity = quoteItem.quantity ?: 1.0;
- selectedAmount = quoteItem.selectedAmount ?: 1.0;
- profit = 0.0;
- percProfit = 0.0;
+ defaultQuoteUnitPrice = 0.0
+ averageCost = 0.0
+ unitPrice = quoteItem.quoteUnitPrice ?: 0.0
+ quantity = quoteItem.quantity ?: 1.0
+ selectedAmount = quoteItem.selectedAmount ?: 1.0
+ profit = 0.0
+ percProfit = 0.0
try {
if (currency && quoteItem.productId) {
productPrice = from("ProductPrice")
.where(productId : quoteItem.productId, currencyUomId : currency, productPriceTypeId : "AVERAGE_COST")
.filterByDate(issueDate)
- .queryFirst();
+ .queryFirst()
if (productPrice?.price != null) {
- averageCost = productPrice.price * selectedAmount;
+ averageCost = productPrice.price * selectedAmount
}
}
- totalCost += (averageCost * quantity);
- totalPrice += (unitPrice * quantity * selectedAmount);
+ totalCost += (averageCost * quantity)
+ totalPrice += (unitPrice * quantity * selectedAmount)
} catch (Exception exc) {
- Debug.logError("Problems getting the averageCost for quoteItem: " + quoteItem);
+ Debug.logError("Problems getting the averageCost for quoteItem: " + quoteItem)
}
- profit = unitPrice - averageCost;
- percProfit = averageCost != 0 ? (profit / unitPrice) * 100.00 : 0.00;
- quoteItemAndCostInfo = new java.util.HashMap(quoteItem);
- quoteItemAndCostInfo.averageCost = averageCost;
- quoteItemAndCostInfo.profit = profit;
- quoteItemAndCostInfo.percProfit = percProfit;
- quoteItemAndCostInfos.add(quoteItemAndCostInfo);
+ profit = unitPrice - averageCost
+ percProfit = averageCost != 0 ? (profit / unitPrice) * 100.00 : 0.00
+ quoteItemAndCostInfo = new java.util.HashMap(quoteItem)
+ quoteItemAndCostInfo.averageCost = averageCost
+ quoteItemAndCostInfo.profit = profit
+ quoteItemAndCostInfo.percProfit = percProfit
+ quoteItemAndCostInfos.add(quoteItemAndCostInfo)
}
-totalProfit = totalPrice - totalCost;
+totalProfit = totalPrice - totalCost
-context.costMult = costMult;
-context.costToPriceMult = costToPriceMult;
-context.quoteItemAndCostInfos = quoteItemAndCostInfos;
+context.costMult = costMult
+context.costToPriceMult = costToPriceMult
+context.quoteItemAndCostInfos = quoteItemAndCostInfos
-context.totalCost = totalCost;
-context.totalPrice = totalPrice;
-context.totalProfit = totalProfit;
-context.totalPercProfit = totalCost != 0 ? (totalProfit / totalPrice) * 100.00: 0.00;
+context.totalCost = totalCost
+context.totalPrice = totalPrice
+context.totalProfit = totalProfit
+context.totalPercProfit = totalCost != 0 ? (totalProfit / totalPrice) * 100.00: 0.00
diff --git a/applications/order/groovyScripts/reports/OpenOrderItemsReport.groovy b/applications/order/groovyScripts/reports/OpenOrderItemsReport.groovy
index 36f2467a15..2862c26f4d 100644
--- a/applications/order/groovyScripts/reports/OpenOrderItemsReport.groovy
+++ b/applications/order/groovyScripts/reports/OpenOrderItemsReport.groovy
@@ -23,37 +23,37 @@
*/
-import org.apache.ofbiz.base.util.UtilMisc;
-import org.apache.ofbiz.entity.condition.*;
-import org.apache.ofbiz.entity.util.*;
-import org.apache.ofbiz.entity.*;
-import org.apache.ofbiz.base.util.*;
+import org.apache.ofbiz.base.util.UtilMisc
+import org.apache.ofbiz.entity.condition.*
+import org.apache.ofbiz.entity.util.*
+import org.apache.ofbiz.entity.*
+import org.apache.ofbiz.base.util.*
-productStoreId = ObjectType.simpleTypeConvert(parameters.productStoreId, "List", null, null);
-orderTypeId = ObjectType.simpleTypeConvert(parameters.orderTypeId, "List", null, null);
-orderStatusId = ObjectType.simpleTypeConvert(parameters.orderStatusId, "List", null, null);
+productStoreId = ObjectType.simpleTypeConvert(parameters.productStoreId, "List", null, null)
+orderTypeId = ObjectType.simpleTypeConvert(parameters.orderTypeId, "List", null, null)
+orderStatusId = ObjectType.simpleTypeConvert(parameters.orderStatusId, "List", null, null)
// search by orderTypeId is mandatory
-conditions = [EntityCondition.makeCondition("orderTypeId", EntityOperator.IN, orderTypeId)];
+conditions = [EntityCondition.makeCondition("orderTypeId", EntityOperator.IN, orderTypeId)]
if (fromOrderDate) {
- conditions.add(EntityCondition.makeCondition("orderDate", EntityOperator.GREATER_THAN_EQUAL_TO, fromOrderDate));
+ conditions.add(EntityCondition.makeCondition("orderDate", EntityOperator.GREATER_THAN_EQUAL_TO, fromOrderDate))
}
if (thruOrderDate) {
- conditions.add(EntityCondition.makeCondition("orderDate", EntityOperator.LESS_THAN_EQUAL_TO, thruOrderDate));
+ conditions.add(EntityCondition.makeCondition("orderDate", EntityOperator.LESS_THAN_EQUAL_TO, thruOrderDate))
}
if (productStoreId) {
- conditions.add(EntityCondition.makeCondition("productStoreId", EntityOperator.IN, productStoreId));
+ conditions.add(EntityCondition.makeCondition("productStoreId", EntityOperator.IN, productStoreId))
// for generating a title (given product store)
- context.productStore = from("ProductStore").where("productStoreId", productStoreId).cache(true).queryOne();
+ context.productStore = from("ProductStore").where("productStoreId", productStoreId).cache(true).queryOne()
} else {
// for generating a title (all stores) TODO: use UtilProperties to internationalize
- context.productStore = [storeName : "All Stores"];
+ context.productStore = [storeName : "All Stores"]
}
if (orderStatusId) {
- conditions.add(EntityCondition.makeCondition("orderStatusId", EntityOperator.IN, orderStatusId));
+ conditions.add(EntityCondition.makeCondition("orderStatusId", EntityOperator.IN, orderStatusId))
} else {
// search all orders that are not completed, cancelled or rejected
conditions.add(
@@ -62,13 +62,13 @@ if (orderStatusId) {
EntityCondition.makeCondition("orderStatusId", EntityOperator.NOT_EQUAL, "ORDER_CANCELLED"),
EntityCondition.makeCondition("orderStatusId", EntityOperator.NOT_EQUAL, "ORDER_REJECTED")
], EntityOperator.AND)
- );
+ )
}
// item conditions
-conditions.add(EntityCondition.makeCondition("orderItemStatusId", EntityOperator.NOT_EQUAL, "ITEM_COMPLETED"));
-conditions.add(EntityCondition.makeCondition("orderItemStatusId", EntityOperator.NOT_EQUAL, "ITEM_CANCELLED"));
-conditions.add(EntityCondition.makeCondition("orderItemStatusId", EntityOperator.NOT_EQUAL, "ITEM_REJECTED"));
+conditions.add(EntityCondition.makeCondition("orderItemStatusId", EntityOperator.NOT_EQUAL, "ITEM_COMPLETED"))
+conditions.add(EntityCondition.makeCondition("orderItemStatusId", EntityOperator.NOT_EQUAL, "ITEM_CANCELLED"))
+conditions.add(EntityCondition.makeCondition("orderItemStatusId", EntityOperator.NOT_EQUAL, "ITEM_REJECTED"))
// get the results as an entity list iterator
listIt = select("orderId", "orderDate", "productId", "quantityOrdered", "quantityIssued", "quantityOpen", "shipBeforeDate", "shipAfterDate", "itemDescription")
@@ -77,52 +77,52 @@ listIt = select("orderId", "orderDate", "productId", "quantityOrdered", "quantit
.orderBy("orderDate DESC")
.cursorScrollInsensitive()
.distinct()
- .queryIterator();
-orderItemList = [];
-totalCostPrice = 0.0;
-totalListPrice = 0.0;
-totalMarkup = 0.0;
-totalDiscount = 0.0;
-totalRetailPrice = 0.0;
-totalquantityOrdered = 0.0;
-totalquantityOpen = 0.0;
+ .queryIterator()
+orderItemList = []
+totalCostPrice = 0.0
+totalListPrice = 0.0
+totalMarkup = 0.0
+totalDiscount = 0.0
+totalRetailPrice = 0.0
+totalquantityOrdered = 0.0
+totalquantityOpen = 0.0
listIt.each { listValue ->
- orderId = listValue.orderId;
- productId = listValue.productId;
- orderDate = listValue.orderDate;
- quantityOrdered = listValue.quantityOrdered;
- quantityOpen = listValue.quantityOpen;
- quantityIssued = listValue.quantityIssued;
- itemDescription = listValue.itemDescription;
- shipAfterDate = listValue.shipAfterDate;
- shipBeforeDate = listValue.shipBeforeDate;
- productIdCondExpr = [EntityCondition.makeCondition("productId", EntityOperator.EQUALS, productId)];
- productPrices = select("price","productPriceTypeId").from("ProductPrice").where(productIdCondExpr).queryList();
- costPrice = 0.0;
- retailPrice = 0.0;
- listPrice = 0.0;
+ orderId = listValue.orderId
+ productId = listValue.productId
+ orderDate = listValue.orderDate
+ quantityOrdered = listValue.quantityOrdered
+ quantityOpen = listValue.quantityOpen
+ quantityIssued = listValue.quantityIssued
+ itemDescription = listValue.itemDescription
+ shipAfterDate = listValue.shipAfterDate
+ shipBeforeDate = listValue.shipBeforeDate
+ productIdCondExpr = [EntityCondition.makeCondition("productId", EntityOperator.EQUALS, productId)]
+ productPrices = select("price","productPriceTypeId").from("ProductPrice").where(productIdCondExpr).queryList()
+ costPrice = 0.0
+ retailPrice = 0.0
+ listPrice = 0.0
productPrices.each { productPriceMap ->
if (productPriceMap.productPriceTypeId.equals("AVERAGE_COST")) {
- costPrice = productPriceMap.price;
+ costPrice = productPriceMap.price
} else if (productPriceMap.productPriceTypeId.equals("DEFAULT_PRICE")) {
- retailPrice = productPriceMap.price;
+ retailPrice = productPriceMap.price
} else if (productPriceMap.productPriceTypeId.equals("LIST_PRICE")) {
- listPrice = productPriceMap.price;
+ listPrice = productPriceMap.price
}
}
- totalListPrice += listPrice;
- totalRetailPrice += retailPrice;
- totalCostPrice += costPrice;
- totalquantityOrdered += quantityOrdered;
- totalquantityOpen += quantityOpen;
- costPriceDividendValue = costPrice;
+ totalListPrice += listPrice
+ totalRetailPrice += retailPrice
+ totalCostPrice += costPrice
+ totalquantityOrdered += quantityOrdered
+ totalquantityOpen += quantityOpen
+ costPriceDividendValue = costPrice
if (costPriceDividendValue) {
- percentMarkup = ((retailPrice - costPrice)/costPrice)*100;
+ percentMarkup = ((retailPrice - costPrice)/costPrice)*100
} else{
- percentMarkup = "";
+ percentMarkup = ""
}
orderItemMap = [orderDate : orderDate,
orderId : orderId,
@@ -138,18 +138,18 @@ listIt.each { listValue ->
listPrice : listPrice,
discount : listPrice - retailPrice,
calculatedMarkup : retailPrice - costPrice,
- percentMarkup : percentMarkup];
- orderItemList.add(orderItemMap);
+ percentMarkup : percentMarkup]
+ orderItemList.add(orderItemMap)
}
-listIt.close();
-totalAmountList = [];
+listIt.close()
+totalAmountList = []
if (orderItemList) {
- totalCostPriceDividendValue = totalCostPrice;
+ totalCostPriceDividendValue = totalCostPrice
if (totalCostPriceDividendValue) {
- totalPercentMarkup = ((totalRetailPrice - totalCostPrice)/totalCostPrice)*100 ;
+ totalPercentMarkup = ((totalRetailPrice - totalCostPrice)/totalCostPrice)*100
} else{
- totalPercentMarkup = "";
+ totalPercentMarkup = ""
}
totalAmountMap = [totalCostPrice : totalCostPrice,
totalListPrice : totalListPrice,
@@ -159,8 +159,8 @@ if (orderItemList) {
totalquantityOpen : totalquantityOpen,
totalDiscount : totalListPrice - totalRetailPrice,
totalMarkup : totalRetailPrice - totalCostPrice,
- totalPercentMarkup : totalPercentMarkup];
- totalAmountList.add(totalAmountMap);
+ totalPercentMarkup : totalPercentMarkup]
+ totalAmountList.add(totalAmountMap)
}
-context.orderItemList = orderItemList;
-context.totalAmountList = totalAmountList;
+context.orderItemList = orderItemList
+context.totalAmountList = totalAmountList
diff --git a/applications/order/groovyScripts/request/GetNextSequenceNum.groovy b/applications/order/groovyScripts/request/GetNextSequenceNum.groovy
index 71dc796109..e4a042ae88 100644
--- a/applications/order/groovyScripts/request/GetNextSequenceNum.groovy
+++ b/applications/order/groovyScripts/request/GetNextSequenceNum.groovy
@@ -17,17 +17,17 @@
* under the License.
*/
-import org.apache.ofbiz.base.util.UtilMisc;
-import org.apache.ofbiz.entity.util.EntityUtil;
-import org.apache.ofbiz.entity.GenericValue;
+import org.apache.ofbiz.base.util.UtilMisc
+import org.apache.ofbiz.entity.util.EntityUtil
+import org.apache.ofbiz.entity.GenericValue
-long nextSequenceNum = 10;
+long nextSequenceNum = 10
if (!custRequestItem && custRequest) {
- items = custRequest.getRelated("CustRequestItem", null, ["-sequenceNum"], false);
- lastItem = EntityUtil.getFirst(items);
+ items = custRequest.getRelated("CustRequestItem", null, ["-sequenceNum"], false)
+ lastItem = EntityUtil.getFirst(items)
if (lastItem?.sequenceNum) {
- lastSequenceNum = lastItem.sequenceNum;
- nextSequenceNum = lastSequenceNum + 10;
+ lastSequenceNum = lastItem.sequenceNum
+ nextSequenceNum = lastSequenceNum + 10
}
}
-context.nextSequenceNum = nextSequenceNum;
+context.nextSequenceNum = nextSequenceNum
diff --git a/applications/order/groovyScripts/request/RequestItemNotes.groovy b/applications/order/groovyScripts/request/RequestItemNotes.groovy
index 4800cbc53b..1997f7c0b1 100644
--- a/applications/order/groovyScripts/request/RequestItemNotes.groovy
+++ b/applications/order/groovyScripts/request/RequestItemNotes.groovy
@@ -17,19 +17,19 @@
* 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.*
-custRequestId = parameters.custRequestId;
-custRequestItemSeqId = parameters.custRequestItemSeqId;
-showAll = parameters.showAll ?: "false";
-context.showAll = showAll;
+custRequestId = parameters.custRequestId
+custRequestItemSeqId = parameters.custRequestItemSeqId
+showAll = parameters.showAll ?: "false"
+context.showAll = showAll
-fields = [custRequestId : custRequestId];
+fields = [custRequestId : custRequestId]
if (showAll.equals("false")) {
- fields.custRequestItemSeqId = custRequestItemSeqId;
+ fields.custRequestItemSeqId = custRequestItemSeqId
}
-notes = from("CustRequestItemNoteView").where(fields).orderBy("-noteDateTime").queryList();
+notes = from("CustRequestItemNoteView").where(fields).orderBy("-noteDateTime").queryList()
if (notes) {
- context.notes = notes;
+ context.notes = notes
}
diff --git a/applications/order/groovyScripts/request/SetRequestQuote.groovy b/applications/order/groovyScripts/request/SetRequestQuote.groovy
index b73de22cd8..e4e8506f2f 100644
--- a/applications/order/groovyScripts/request/SetRequestQuote.groovy
+++ b/applications/order/groovyScripts/request/SetRequestQuote.groovy
@@ -17,13 +17,13 @@
* under the License.
*/
-import org.apache.ofbiz.base.util.UtilMisc;
-import org.apache.ofbiz.entity.util.EntityUtil;
+import org.apache.ofbiz.base.util.UtilMisc
+import org.apache.ofbiz.entity.util.EntityUtil
-custRequestId = parameters.custRequestId;
+custRequestId = parameters.custRequestId
if (custRequestId) {
- requestQuote = from("QuoteItem").where("custRequestId", custRequestId).queryFirst();
+ requestQuote = from("QuoteItem").where("custRequestId", custRequestId).queryFirst()
if (requestQuote) {
- context.quoteId = requestQuote.quoteId;
+ context.quoteId = requestQuote.quoteId
}
}
diff --git a/applications/order/groovyScripts/requirement/ApprovedProductRequirements.groovy b/applications/order/groovyScripts/requirement/ApprovedProductRequirements.groovy
index 6b60234352..cb9e869695 100644
--- a/applications/order/groovyScripts/requirement/ApprovedProductRequirements.groovy
+++ b/applications/order/groovyScripts/requirement/ApprovedProductRequirements.groovy
@@ -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]
}
diff --git a/applications/order/groovyScripts/requirement/ApprovedProductRequirementsByVendor.groovy b/applications/order/groovyScripts/requirement/ApprovedProductRequirementsByVendor.groovy
index 10a9cd2467..87a6ff3695 100644
--- a/applications/order/groovyScripts/requirement/ApprovedProductRequirementsByVendor.groovy
+++ b/applications/order/groovyScripts/requirement/ApprovedProductRequirementsByVendor.groovy
@@ -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
diff --git a/applications/order/groovyScripts/requirement/SelectCreatedProposed.groovy b/applications/order/groovyScripts/requirement/SelectCreatedProposed.groovy
index c3eda58880..31dd456e93 100644
--- a/applications/order/groovyScripts/requirement/SelectCreatedProposed.groovy
+++ b/applications/order/groovyScripts/requirement/SelectCreatedProposed.groovy
@@ -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
diff --git a/applications/order/groovyScripts/return/QuickReturn.groovy b/applications/order/groovyScripts/return/QuickReturn.groovy
index 0cefdc61a7..033a9ff972 100644
--- a/applications/order/groovyScripts/return/QuickReturn.groovy
+++ b/applications/order/groovyScripts/return/QuickReturn.groovy
@@ -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)
diff --git a/applications/order/groovyScripts/return/ReturnHeader.groovy b/applications/order/groovyScripts/return/ReturnHeader.groovy
index dfb766c616..7498e50bb3 100644
--- a/applications/order/groovyScripts/return/ReturnHeader.groovy
+++ b/applications/order/groovyScripts/return/ReturnHeader.groovy
@@ -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()
}
}
}
diff --git a/applications/order/groovyScripts/return/ReturnHistory.groovy b/applications/order/groovyScripts/return/ReturnHistory.groovy
index cb922d5d69..7584e40ecd 100644
--- a/applications/order/groovyScripts/return/ReturnHistory.groovy
+++ b/applications/order/groovyScripts/return/ReturnHistory.groovy
@@ -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
diff --git a/applications/order/groovyScripts/return/ReturnItems.groovy b/applications/order/groovyScripts/return/ReturnItems.groovy
index e7ecd33b6e..e7111ecc21 100644
--- a/applications/order/groovyScripts/return/ReturnItems.groovy
+++ b/applications/order/groovyScripts/return/ReturnItems.groovy
@@ -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;
+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;
+returnId = parameters.returnId
+if (!returnId) return
+context.returnId = returnId
-orderId = parameters.orderId;
-context.orderId = orderId;
+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;
+ 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();
+ 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
diff --git a/applications/order/groovyScripts/setup/PaymentSetup.groovy b/applications/order/groovyScripts/setup/PaymentSetup.groovy
index 3d58a724bf..e0a393e243 100644
--- a/applications/order/groovyScripts/setup/PaymentSetup.groovy
+++ b/applications/order/groovyScripts/setup/PaymentSetup.groovy
@@ -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
diff --git a/applications/order/groovyScripts/task/OrderTaskList.groovy b/applications/order/groovyScripts/task/OrderTaskList.groovy
index 49cab20148..e75b579425 100644
--- a/applications/order/groovyScripts/task/OrderTaskList.groovy
+++ b/applications/order/groovyScripts/task/OrderTaskList.groovy
@@ -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
diff --git a/applications/party/groovyScripts/HasPartyPermissions.groovy b/applications/party/groovyScripts/HasPartyPermissions.groovy
index 3bb46cd59d..6207e9b49b 100644
--- a/applications/party/groovyScripts/HasPartyPermissions.groovy
+++ b/applications/party/groovyScripts/HasPartyPermissions.groovy
@@ -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)
diff --git a/applications/party/groovyScripts/communication/FindCommEventContactMechs.groovy b/applications/party/groovyScripts/communication/FindCommEventContactMechs.groovy
index a102e5caca..ab60d47067 100644
--- a/applications/party/groovyScripts/communication/FindCommEventContactMechs.groovy
+++ b/applications/party/groovyScripts/communication/FindCommEventContactMechs.groovy
@@ -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
}
}
diff --git a/applications/party/groovyScripts/communication/GetMyCommunicationEventRole.groovy b/applications/party/groovyScripts/communication/GetMyCommunicationEventRole.groovy
index 66f80506ae..b2b3cb42af 100644
--- a/applications/party/groovyScripts/communication/GetMyCommunicationEventRole.groovy
+++ b/applications/party/groovyScripts/communication/GetMyCommunicationEventRole.groovy
@@ -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")
}
diff --git a/applications/party/groovyScripts/communication/GetPartyEmailFromCommEventInfo.groovy b/applications/party/groovyScripts/communication/GetPartyEmailFromCommEventInfo.groovy
index c2ce712f29..29073baef1 100644
--- a/applications/party/groovyScripts/communication/GetPartyEmailFromCommEventInfo.groovy
+++ b/applications/party/groovyScripts/communication/GetPartyEmailFromCommEventInfo.groovy
@@ -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
}
}
diff --git a/applications/party/groovyScripts/communication/ListCommunications.groovy b/applications/party/groovyScripts/communication/ListCommunications.groovy
index f1a48aa793..f16a1a508e 100644
--- a/applications/party/groovyScripts/communication/ListCommunications.groovy
+++ b/applications/party/groovyScripts/communication/ListCommunications.groovy
@@ -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();
+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;
+context.eventList = events
+context.eventListSize = events.size()
+context.highIndex = events.size()
+context.viewSize = events.size()
+context.lowIndex = 1
+context.viewIndex = 1
diff --git a/applications/party/groovyScripts/communication/RecentVisitor.groovy b/applications/party/groovyScripts/communication/RecentVisitor.groovy
index 3748cd13fd..3497a2d741 100644
--- a/applications/party/groovyScripts/communication/RecentVisitor.groovy
+++ b/applications/party/groovyScripts/communication/RecentVisitor.groovy
@@ -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", "firstName", "middleName", "lastName",
.from("PartyNameView")
.where(EntityCondition.makeCondition('partyId', EntityOperator.IN, partyIds))
.distinct()
- .queryList();
+ .queryList()
diff --git a/applications/party/groovyScripts/party/EditContactMech.groovy b/applications/party/groovyScripts/party/EditContactMech.groovy
index 6792f976c7..75fbdc5d1a 100644
--- a/applications/party/groovyScripts/party/EditContactMech.groovy
+++ b/applications/party/groovyScripts/party/EditContactMech.groovy
@@ -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
diff --git a/applications/party/groovyScripts/party/EditPaymentMethod.groovy b/applications/party/groovyScripts/party/EditPaymentMethod.groovy
index fb976cbad4..a46bbeb749 100644
--- a/applications/party/groovyScripts/party/EditPaymentMethod.groovy
+++ b/applications/party/groovyScripts/party/EditPaymentMethod.groovy
@@ -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 ?:[:];
+creditCardData = paymentResults.creditCard
+if (!tryEntity) creditCardData = parameters
+context.creditCardData = creditCardData ?:[:]
-giftCardData = paymentResults.giftCard;
-if (!tryEntity) giftCardData = parameters;
-context.giftCardData = giftCardData ?: [:];
+giftCardData = paymentResults.giftCard
+if (!tryEntity) giftCardData = parameters
+context.giftCardData = giftCardData ?: [:]
-eftAccountData = paymentResults.eftAccount;
-if (!tryEntity) eftAccountData = parameters;
-context.eftAccountData = eftAccountData ?: [:];
+eftAccountData = paymentResults.eftAccount
+if (!tryEntity) eftAccountData = parameters
+context.eftAccountData = eftAccountData ?: [:]
-checkAccountData = paymentResults.checkAccount;
-if (!tryEntity) checkAccountData = parameters;
-context.checkAccountData = checkAccountData ?: [:];
+checkAccountData = paymentResults.checkAccount
+if (!tryEntity) checkAccountData = parameters
+context.checkAccountData = checkAccountData ?: [:]
-context.donePage = parameters.DONE_PAGE ?:"viewprofile";
+context.donePage = parameters.DONE_PAGE ?:"viewprofile"
-paymentMethodData = paymentResults.paymentMethod;
-if (!tryEntity.booleanValue()) paymentMethodData = parameters;
-if (!paymentMethodData) paymentMethodData = new HashMap();
-if (paymentMethodData) context.paymentMethodData = paymentMethodData;
+paymentMethodData = paymentResults.paymentMethod
+if (!tryEntity.booleanValue()) paymentMethodData = parameters
+if (!paymentMethodData) paymentMethodData = new HashMap()
+if (paymentMethodData) context.paymentMethodData = paymentMethodData
diff --git a/applications/party/groovyScripts/party/EditShoppingList.groovy b/applications/party/groovyScripts/party/EditShoppingList.groovy
index 4b2abbc97d..d3fcbfadde 100644
--- a/applications/party/groovyScripts/party/EditShoppingList.groovy
+++ b/applications/party/groovyScripts/party/EditShoppingList.groovy
@@ -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;
+ 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;
+ 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;
+ 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
}
}
diff --git a/applications/party/groovyScripts/party/FindLookUp.groovy b/applications/party/groovyScripts/party/FindLookUp.groovy
index ca9038e77c..2c9df06ab2 100644
--- a/applications/party/groovyScripts/party/FindLookUp.groovy
+++ b/applications/party/groovyScripts/party/FindLookUp.groovy
@@ -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
diff --git a/applications/party/groovyScripts/party/FindMatches.groovy b/applications/party/groovyScripts/party/FindMatches.groovy
index 932c467469..42bc008425 100644
--- a/applications/party/groovyScripts/party/FindMatches.groovy
+++ b/applications/party/groovyScripts/party/FindMatches.groovy
@@ -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
}
diff --git a/applications/party/groovyScripts/party/FindParty.groovy b/applications/party/groovyScripts/party/FindParty.groovy
index c04fe8bc90..b42a43d024 100644
--- a/applications/party/groovyScripts/party/FindParty.groovy
+++ b/applications/party/groovyScripts/party/FindParty.groovy
@@ -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
diff --git a/applications/party/groovyScripts/party/GetContactMechs.groovy b/applications/party/groovyScripts/party/GetContactMechs.groovy
index a40f7f9860..6d0e1bf3b5 100644
--- a/applications/party/groovyScripts/party/GetContactMechs.groovy
+++ b/applications/party/groovyScripts/party/GetContactMechs.groovy
@@ -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)
diff --git a/applications/party/groovyScripts/party/GetCurrentCart.groovy b/applications/party/groovyScripts/party/GetCurrentCart.groovy
index c4bb56a403..78bdab15a8 100644
--- a/applications/party/groovyScripts/party/GetCurrentCart.groovy
+++ b/applications/party/groovyScripts/party/GetCurrentCart.groovy
@@ -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)
}
diff --git a/applications/party/groovyScripts/party/GetGeoLocation.groovy b/applications/party/groovyScripts/party/GetGeoLocation.groovy
index f3d975ba79..82115f599b 100644
--- a/applications/party/groovyScripts/party/GetGeoLocation.groovy
+++ b/applications/party/groovyScripts/party/GetGeoLocation.groovy
@@ -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
}
}
diff --git a/applications/party/groovyScripts/party/GetLoyaltyPoints.groovy b/applications/party/groovyScripts/party/GetLoyaltyPoints.groovy
index 02a91f8509..028a98431b 100644
--- a/applications/party/groovyScripts/party/GetLoyaltyPoints.groovy
+++ b/applications/party/groovyScripts/party/GetLoyaltyPoints.groovy
@@ -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
}
diff --git a/applications/party/groovyScripts/party/GetMyCompany.groovy b/applications/party/groovyScripts/party/GetMyCompany.groovy
index aaac8b555c..f0a23fe41d 100644
--- a/applications/party/groovyScripts/party/GetMyCompany.groovy
+++ b/applications/party/groovyScripts/party/GetMyCompany.groovy
@@ -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
}
}
diff --git a/applications/party/groovyScripts/party/GetPaymentMethods.groovy b/applications/party/groovyScripts/party/GetPaymentMethods.groovy
index b5902f9e11..5386a4112e 100644
--- a/applications/party/groovyScripts/party/GetPaymentMethods.groovy
+++ b/applications/party/groovyScripts/party/GetPaymentMethods.groovy
@@ -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)
diff --git a/applications/party/groovyScripts/party/GetPostalAddressTemplate.groovy b/applications/party/groovyScripts/party/GetPostalAddressTemplate.groovy
index 727a182634..ca259a61d4 100644
--- a/applications/party/groovyScripts/party/GetPostalAddressTemplate.groovy
+++ b/applications/party/groovyScripts/party/GetPostalAddressTemplate.groovy
@@ -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
}
}
diff --git a/applications/party/groovyScripts/party/GetUserLoginPrimaryEmail.groovy b/applications/party/groovyScripts/party/GetUserLoginPrimaryEmail.groovy
index 7533c30741..5cffc8ab8f 100644
--- a/applications/party/groovyScripts/party/GetUserLoginPrimaryEmail.groovy
+++ b/applications/party/groovyScripts/party/GetUserLoginPrimaryEmail.groovy
@@ -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)
}
}
}
diff --git a/applications/party/groovyScripts/party/PartyFinancialHistory.groovy b/applications/party/groovyScripts/party/PartyFinancialHistory.groovy
index 8845e50aa4..8226449fe4 100644
--- a/applications/party/groovyScripts/party/PartyFinancialHistory.groovy
+++ b/applications/party/groovyScripts/party/PartyFinancialHistory.groovy
@@ -17,26 +17,26 @@
* under the License.
*/
-import org.apache.ofbiz.base.util.Debug;
-import org.apache.ofbiz.accounting.invoice.InvoiceWorker;
-import org.apache.ofbiz.accounting.payment.PaymentWorker;
-import org.apache.ofbiz.entity.condition.EntityCondition;
-import org.apache.ofbiz.entity.condition.EntityOperator;
-import org.apache.ofbiz.entity.util.EntityTypeUtil;
+import org.apache.ofbiz.base.util.Debug
+import org.apache.ofbiz.accounting.invoice.InvoiceWorker
+import org.apache.ofbiz.accounting.payment.PaymentWorker
+import org.apache.ofbiz.entity.condition.EntityCondition
+import org.apache.ofbiz.entity.condition.EntityOperator
+import org.apache.ofbiz.entity.util.EntityTypeUtil
-Boolean actualCurrency = new Boolean(context.actualCurrency);
+Boolean actualCurrency = new Boolean(context.actualCurrency)
if (actualCurrency == null) {
- actualCurrency = true;
+ actualCurrency = true
}
-actualCurrencyUomId = context.actualCurrencyUomId;
+actualCurrencyUomId = context.actualCurrencyUomId
if (!actualCurrencyUomId) {
- actualCurrencyUomId = context.defaultOrganizationPartyCurrencyUomId;
+ actualCurrencyUomId = context.defaultOrganizationPartyCurrencyUomId
}
//get total/unapplied/applied invoices separated by sales/purch amount:
-totalInvSaApplied = BigDecimal.ZERO;
-totalInvSaNotApplied = BigDecimal.ZERO;
-totalInvPuApplied = BigDecimal.ZERO;
-totalInvPuNotApplied = BigDecimal.ZERO;
+totalInvSaApplied = BigDecimal.ZERO
+totalInvSaNotApplied = BigDecimal.ZERO
+totalInvPuApplied = BigDecimal.ZERO
+totalInvPuNotApplied = BigDecimal.ZERO
invExprs =
EntityCondition.makeCondition([
@@ -53,33 +53,33 @@ invExprs =
EntityCondition.makeCondition("partyIdFrom", EntityOperator.EQUALS, parameters.partyId)
],EntityOperator.AND)
],EntityOperator.OR)
- ],EntityOperator.AND);
+ ],EntityOperator.AND)
-invIterator = from("InvoiceAndType").where(invExprs).cursorScrollInsensitive().distinct().queryIterator();
+invIterator = from("InvoiceAndType").where(invExprs).cursorScrollInsensitive().distinct().queryIterator()
while (invoice = invIterator.next()) {
- Boolean isPurchaseInvoice = EntityTypeUtil.hasParentType(delegator, "InvoiceType", "invoiceTypeId", invoice.getString("invoiceTypeId"), "parentTypeId", "PURCHASE_INVOICE");
- Boolean isSalesInvoice = EntityTypeUtil.hasParentType(delegator, "InvoiceType", "invoiceTypeId", (String) invoice.getString("invoiceTypeId"), "parentTypeId", "SALES_INVOICE");
+ Boolean isPurchaseInvoice = EntityTypeUtil.hasParentType(delegator, "InvoiceType", "invoiceTypeId", invoice.getString("invoiceTypeId"), "parentTypeId", "PURCHASE_INVOICE")
+ Boolean isSalesInvoice = EntityTypeUtil.hasParentType(delegator, "InvoiceType", "invoiceTypeId", (String) invoice.getString("invoiceTypeId"), "parentTypeId", "SALES_INVOICE")
if (isPurchaseInvoice) {
- totalInvPuApplied += InvoiceWorker.getInvoiceApplied(invoice, actualCurrency).setScale(2,BigDecimal.ROUND_HALF_UP);
- totalInvPuNotApplied += InvoiceWorker.getInvoiceNotApplied(invoice, actualCurrency).setScale(2,BigDecimal.ROUND_HALF_UP);
+ totalInvPuApplied += InvoiceWorker.getInvoiceApplied(invoice, actualCurrency).setScale(2,BigDecimal.ROUND_HALF_UP)
+ totalInvPuNotApplied += InvoiceWorker.getInvoiceNotApplied(invoice, actualCurrency).setScale(2,BigDecimal.ROUND_HALF_UP)
}
else if (isSalesInvoice) {
- totalInvSaApplied += InvoiceWorker.getInvoiceApplied(invoice, actualCurrency).setScale(2,BigDecimal.ROUND_HALF_UP);
- totalInvSaNotApplied += InvoiceWorker.getInvoiceNotApplied(invoice, actualCurrency).setScale(2,BigDecimal.ROUND_HALF_UP);
+ totalInvSaApplied += InvoiceWorker.getInvoiceApplied(invoice, actualCurrency).setScale(2,BigDecimal.ROUND_HALF_UP)
+ totalInvSaNotApplied += InvoiceWorker.getInvoiceNotApplied(invoice, actualCurrency).setScale(2,BigDecimal.ROUND_HALF_UP)
}
else {
- Debug.logError("InvoiceType: " + invoice.invoiceTypeId + " without a valid parentTypeId: " + invoice.parentTypeId + " !!!! Should be either PURCHASE_INVOICE or SALES_INVOICE", "");
+ Debug.logError("InvoiceType: " + invoice.invoiceTypeId + " without a valid parentTypeId: " + invoice.parentTypeId + " !!!! Should be either PURCHASE_INVOICE or SALES_INVOICE", "")
}
}
-invIterator.close();
+invIterator.close()
//get total/unapplied/applied payment in/out total amount:
-totalPayInApplied = BigDecimal.ZERO;
-totalPayInNotApplied = BigDecimal.ZERO;
-totalPayOutApplied = BigDecimal.ZERO;
-totalPayOutNotApplied = BigDecimal.ZERO;
+totalPayInApplied = BigDecimal.ZERO
+totalPayInNotApplied = BigDecimal.ZERO
+totalPayOutApplied = BigDecimal.ZERO
+totalPayOutNotApplied = BigDecimal.ZERO
payExprs =
EntityCondition.makeCondition([
@@ -95,38 +95,38 @@ payExprs =
EntityCondition.makeCondition("partyIdFrom", EntityOperator.EQUALS, parameters.partyId)
], EntityOperator.AND)
], EntityOperator.OR)
- ], EntityOperator.AND);
+ ], EntityOperator.AND)
-payIterator = from("PaymentAndType").where(payExprs).cursorScrollInsensitive().distinct().queryIterator();
+payIterator = from("PaymentAndType").where(payExprs).cursorScrollInsensitive().distinct().queryIterator()
while (payment = payIterator.next()) {
if ("DISBURSEMENT".equals(payment.parentTypeId) || "TAX_PAYMENT".equals(payment.parentTypeId)) {
- totalPayOutApplied += PaymentWorker.getPaymentApplied(payment, actualCurrency).setScale(2,BigDecimal.ROUND_HALF_UP);
- totalPayOutNotApplied += PaymentWorker.getPaymentNotApplied(payment, actualCurrency).setScale(2,BigDecimal.ROUND_HALF_UP);
+ totalPayOutApplied += PaymentWorker.getPaymentApplied(payment, actualCurrency).setScale(2,BigDecimal.ROUND_HALF_UP)
+ totalPayOutNotApplied += PaymentWorker.getPaymentNotApplied(payment, actualCurrency).setScale(2,BigDecimal.ROUND_HALF_UP)
}
else if ("RECEIPT".equals(payment.parentTypeId)) {
- totalPayInApplied += PaymentWorker.getPaymentApplied(payment, actualCurrency).setScale(2,BigDecimal.ROUND_HALF_UP);
- totalPayInNotApplied += PaymentWorker.getPaymentNotApplied(payment, actualCurrency).setScale(2,BigDecimal.ROUND_HALF_UP);
+ totalPayInApplied += PaymentWorker.getPaymentApplied(payment, actualCurrency).setScale(2,BigDecimal.ROUND_HALF_UP)
+ totalPayInNotApplied += PaymentWorker.getPaymentNotApplied(payment, actualCurrency).setScale(2,BigDecimal.ROUND_HALF_UP)
}
else {
- Debug.logError("PaymentTypeId: " + payment.paymentTypeId + " without a valid parentTypeId: " + payment.parentTypeId + " !!!! Should be either DISBURSEMENT, TAX_PAYMENT or RECEIPT", "");
+ Debug.logError("PaymentTypeId: " + payment.paymentTypeId + " without a valid parentTypeId: " + payment.parentTypeId + " !!!! Should be either DISBURSEMENT, TAX_PAYMENT or RECEIPT", "")
}
}
-payIterator.close();
+payIterator.close()
-context.finanSummary = [:];
-context.finanSummary.totalSalesInvoice = totalSalesInvoice = totalInvSaApplied.add(totalInvSaNotApplied);
-context.finanSummary.totalPurchaseInvoice = totalPurchaseInvoice = totalInvPuApplied.add(totalInvPuNotApplied);
-context.finanSummary.totalPaymentsIn = totalPaymentsIn = totalPayInApplied.add(totalPayInNotApplied);
-context.finanSummary.totalPaymentsOut = totalPaymentsOut = totalPayOutApplied.add(totalPayOutNotApplied);
-context.finanSummary.totalInvoiceNotApplied = totalInvSaNotApplied.subtract(totalInvPuNotApplied);
-context.finanSummary.totalPaymentNotApplied = totalPayInNotApplied.subtract(totalPayOutNotApplied);
+context.finanSummary = [:]
+context.finanSummary.totalSalesInvoice = totalSalesInvoice = totalInvSaApplied.add(totalInvSaNotApplied)
+context.finanSummary.totalPurchaseInvoice = totalPurchaseInvoice = totalInvPuApplied.add(totalInvPuNotApplied)
+context.finanSummary.totalPaymentsIn = totalPaymentsIn = totalPayInApplied.add(totalPayInNotApplied)
+context.finanSummary.totalPaymentsOut = totalPaymentsOut = totalPayOutApplied.add(totalPayOutNotApplied)
+context.finanSummary.totalInvoiceNotApplied = totalInvSaNotApplied.subtract(totalInvPuNotApplied)
+context.finanSummary.totalPaymentNotApplied = totalPayInNotApplied.subtract(totalPayOutNotApplied)
-transferAmount = totalSalesInvoice.subtract(totalPurchaseInvoice).subtract(totalPaymentsIn).subtract(totalPaymentsOut);
+transferAmount = totalSalesInvoice.subtract(totalPurchaseInvoice).subtract(totalPaymentsIn).subtract(totalPaymentsOut)
if (transferAmount.signum() == -1) { // negative?
- context.finanSummary.totalToBeReceived = transferAmount.negate();
+ context.finanSummary.totalToBeReceived = transferAmount.negate()
} else {
- context.finanSummary.totalToBePaid = transferAmount;
+ context.finanSummary.totalToBePaid = transferAmount
}
diff --git a/applications/party/groovyScripts/party/PartyGeoLocation.groovy b/applications/party/groovyScripts/party/PartyGeoLocation.groovy
index 8351f8d35b..9cb81cec1b 100644
--- a/applications/party/groovyScripts/party/PartyGeoLocation.groovy
+++ b/applications/party/groovyScripts/party/PartyGeoLocation.groovy
@@ -17,45 +17,45 @@
* under the License.
*/
-import org.apache.ofbiz.common.geo.GeoWorker;
-import org.apache.ofbiz.base.util.UtilMisc;
-import org.apache.ofbiz.base.util.UtilValidate;
-import org.apache.ofbiz.base.util.UtilProperties;
+import org.apache.ofbiz.common.geo.GeoWorker
+import org.apache.ofbiz.base.util.UtilMisc
+import org.apache.ofbiz.base.util.UtilValidate
+import org.apache.ofbiz.base.util.UtilProperties
-uiLabelMap = UtilProperties.getResourceBundleMap("PartyUiLabels", locale);
-uiLabelMap.addBottomResourceBundle("CommonUiLabels");
+uiLabelMap = UtilProperties.getResourceBundleMap("PartyUiLabels", locale)
+uiLabelMap.addBottomResourceBundle("CommonUiLabels")
-partyId = parameters.partyId ?: parameters.party_id;
-userLoginId = parameters.userlogin_id ?: parameters.userLoginId;
+partyId = parameters.partyId ?: parameters.party_id
+userLoginId = parameters.userlogin_id ?: parameters.userLoginId
if (!partyId && userLoginId) {
- thisUserLogin = from("UserLogin").where("userLoginId", userLoginId).queryOne();
+ thisUserLogin = from("UserLogin").where("userLoginId", userLoginId).queryOne()
if (thisUserLogin) {
- partyId = thisUserLogin.partyId;
+ partyId = thisUserLogin.partyId
}
}
-geoPointId = parameters.geoPointId;
-context.partyId = partyId;
+geoPointId = parameters.geoPointId
+context.partyId = partyId
if (!geoPointId) {
- latestGeoPoint = GeoWorker.findLatestGeoPoint(delegator, "PartyAndGeoPoint", "partyId", partyId, null, null);
+ latestGeoPoint = GeoWorker.findLatestGeoPoint(delegator, "PartyAndGeoPoint", "partyId", partyId, null, null)
} else {
- latestGeoPoint = from("GeoPoint").where("geoPointId", geoPointId).queryOne();
+ latestGeoPoint = from("GeoPoint").where("geoPointId", geoPointId).queryOne()
}
if (latestGeoPoint) {
- context.latestGeoPoint = latestGeoPoint;
+ context.latestGeoPoint = latestGeoPoint
- List geoCenter = UtilMisc.toList(UtilMisc.toMap("lat", latestGeoPoint.latitude, "lon", latestGeoPoint.longitude, "zoom", "13"));
+ List geoCenter = UtilMisc.toList(UtilMisc.toMap("lat", latestGeoPoint.latitude, "lon", latestGeoPoint.longitude, "zoom", "13"))
if (UtilValidate.isNotEmpty(latestGeoPoint) && latestGeoPoint.containsKey("latitude") && latestGeoPoint.containsKey("longitude")) {
List geoPoints = UtilMisc.toList(UtilMisc.toMap("lat", latestGeoPoint.latitude, "lon", latestGeoPoint.longitude, "partyId", partyId,
- "link", UtilMisc.toMap("url", "viewprofile?partyId="+ partyId, "label", uiLabelMap.PartyProfile + " " + uiLabelMap.CommonOf + " " + partyId)));
+ "link", UtilMisc.toMap("url", "viewprofile?partyId="+ partyId, "label", uiLabelMap.PartyProfile + " " + uiLabelMap.CommonOf + " " + partyId)))
- Map geoChart = UtilMisc.toMap("width", "500px", "height", "450px", "controlUI" , "small", "dataSourceId", latestGeoPoint.dataSourceId, "points", geoPoints);
- context.geoChart = geoChart;
+ Map geoChart = UtilMisc.toMap("width", "500px", "height", "450px", "controlUI" , "small", "dataSourceId", latestGeoPoint.dataSourceId, "points", geoPoints)
+ context.geoChart = geoChart
}
if (latestGeoPoint && latestGeoPoint.elevationUomId) {
- elevationUom = from("Uom").where("uomId", latestGeoPoint.elevationUomId).queryOne();
- context.elevationUomAbbr = elevationUom.abbreviation;
+ elevationUom = from("Uom").where("uomId", latestGeoPoint.elevationUomId).queryOne()
+ context.elevationUomAbbr = elevationUom.abbreviation
}
}
diff --git a/applications/party/groovyScripts/party/SetRoleVars.groovy b/applications/party/groovyScripts/party/SetRoleVars.groovy
index 951a9b7e71..852812b3b3 100644
--- a/applications/party/groovyScripts/party/SetRoleVars.groovy
+++ b/applications/party/groovyScripts/party/SetRoleVars.groovy
@@ -17,26 +17,26 @@
* under the License.
*/
-roleTypeId = parameters.roleTypeId;
-roleTypeAndParty = from("RoleTypeAndParty").where("partyId", parameters.partyId, "roleTypeId", roleTypeId).queryFirst();
+roleTypeId = parameters.roleTypeId
+roleTypeAndParty = from("RoleTypeAndParty").where("partyId", parameters.partyId, "roleTypeId", roleTypeId).queryFirst()
if (roleTypeAndParty) {
if ("ACCOUNT".equals(roleTypeId)) {
- context.accountDescription = roleTypeAndParty.description;
+ context.accountDescription = roleTypeAndParty.description
} else if ("CONTACT".equals(roleTypeId)) {
- context.contactDescription = roleTypeAndParty.description;
+ context.contactDescription = roleTypeAndParty.description
} else if ("LEAD".equals(roleTypeId)) {
- context.leadDescription = roleTypeAndParty.description;
- partyRelationships = from("PartyRelationship").where("partyIdTo", parameters.partyId, "roleTypeIdFrom", "ACCOUNT_LEAD", "roleTypeIdTo", "LEAD", "partyRelationshipTypeId", "EMPLOYMENT").filterByDate().queryFirst();
+ context.leadDescription = roleTypeAndParty.description
+ partyRelationships = from("PartyRelationship").where("partyIdTo", parameters.partyId, "roleTypeIdFrom", "ACCOUNT_LEAD", "roleTypeIdTo", "LEAD", "partyRelationshipTypeId", "EMPLOYMENT").filterByDate().queryFirst()
if (partyRelationships) {
- context.partyGroupId = partyRelationships.partyIdFrom;
- context.partyId = parameters.partyId;
+ context.partyGroupId = partyRelationships.partyIdFrom
+ context.partyId = parameters.partyId
}
} else if ("ACCOUNT_LEAD".equals(roleTypeId)) {
- context.leadDescription = roleTypeAndParty.description;
- partyRelationships = from("PartyRelationship").where("partyIdFrom", parameters.partyId, "roleTypeIdFrom", "ACCOUNT_LEAD", "roleTypeIdTo", "LEAD", "partyRelationshipTypeId", "EMPLOYMENT").filterByDate().queryFirst();
+ context.leadDescription = roleTypeAndParty.description
+ partyRelationships = from("PartyRelationship").where("partyIdFrom", parameters.partyId, "roleTypeIdFrom", "ACCOUNT_LEAD", "roleTypeIdTo", "LEAD", "partyRelationshipTypeId", "EMPLOYMENT").filterByDate().queryFirst()
if (partyRelationships) {
- context.partyGroupId = parameters.partyId;
- context.partyId = partyRelationships.partyIdTo;
+ context.partyGroupId = parameters.partyId
+ context.partyId = partyRelationships.partyIdTo
}
}
}
diff --git a/applications/party/groovyScripts/party/StatusCondition.groovy b/applications/party/groovyScripts/party/StatusCondition.groovy
index e34bfc6d0c..b11b265e55 100644
--- a/applications/party/groovyScripts/party/StatusCondition.groovy
+++ b/applications/party/groovyScripts/party/StatusCondition.groovy
@@ -17,11 +17,11 @@
* 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
exprList = [EntityCondition.makeCondition("statusId", EntityOperator.NOT_EQUAL, "PARTY_DISABLED"),
- EntityCondition.makeCondition("statusId", EntityOperator.NOT_EQUAL, null)];
-condList = EntityCondition.makeCondition(exprList, EntityOperator.AND);
-context.andCondition = EntityCondition.makeCondition([condList, EntityCondition.makeCondition("statusId", EntityOperator.EQUALS, null)], EntityOperator.OR);
+ EntityCondition.makeCondition("statusId", EntityOperator.NOT_EQUAL, null)]
+condList = EntityCondition.makeCondition(exprList, EntityOperator.AND)
+context.andCondition = EntityCondition.makeCondition([condList, EntityCondition.makeCondition("statusId", EntityOperator.EQUALS, null)], EntityOperator.OR)
diff --git a/applications/party/groovyScripts/party/UnAppliedInvoicesForParty.groovy b/applications/party/groovyScripts/party/UnAppliedInvoicesForParty.groovy
index 442a0b6fae..98763e32cc 100644
--- a/applications/party/groovyScripts/party/UnAppliedInvoicesForParty.groovy
+++ b/applications/party/groovyScripts/party/UnAppliedInvoicesForParty.groovy
@@ -16,13 +16,13 @@
* specific language governing permissions and limitations
* under the License.
*/
-import org.apache.ofbiz.accounting.invoice.InvoiceWorker;
-import org.apache.ofbiz.entity.condition.EntityCondition;
-import org.apache.ofbiz.entity.condition.EntityOperator;
+import org.apache.ofbiz.accounting.invoice.InvoiceWorker
+import org.apache.ofbiz.entity.condition.EntityCondition
+import org.apache.ofbiz.entity.condition.EntityOperator
-Boolean actualCurrency = new Boolean(context.actualCurrency);
+Boolean actualCurrency = new Boolean(context.actualCurrency)
if (actualCurrency == null) {
- actualCurrency = true;
+ actualCurrency = true
}
invExprs =
@@ -40,17 +40,17 @@ invExprs =
EntityCondition.makeCondition("partyIdFrom", EntityOperator.EQUALS, parameters.partyId)
],EntityOperator.AND)
],EntityOperator.OR)
- ],EntityOperator.AND);
+ ],EntityOperator.AND)
-invIterator = from("InvoiceAndType").where(invExprs).cursorScrollInsensitive().distinct().queryIterator();
-invoiceList = [];
+invIterator = from("InvoiceAndType").where(invExprs).cursorScrollInsensitive().distinct().queryIterator()
+invoiceList = []
while (invoice = invIterator.next()) {
- unAppliedAmount = InvoiceWorker.getInvoiceNotApplied(invoice, actualCurrency).setScale(2,BigDecimal.ROUND_HALF_UP);
+ unAppliedAmount = InvoiceWorker.getInvoiceNotApplied(invoice, actualCurrency).setScale(2,BigDecimal.ROUND_HALF_UP)
if (unAppliedAmount.signum() == 1) {
if (actualCurrency.equals(true)) {
- invoiceCurrencyUomId = invoice.currencyUomId;
+ invoiceCurrencyUomId = invoice.currencyUomId
} else {
- invoiceCurrencyUomId = context.defaultOrganizationPartyCurrencyUomId;
+ invoiceCurrencyUomId = context.defaultOrganizationPartyCurrencyUomId
}
invoiceList.add([invoiceId : invoice.invoiceId,
invoiceDate : invoice.invoiceDate,
@@ -58,9 +58,9 @@ while (invoice = invIterator.next()) {
invoiceCurrencyUomId : invoiceCurrencyUomId,
amount : InvoiceWorker.getInvoiceTotal(invoice, actualCurrency).setScale(2,BigDecimal.ROUND_HALF_UP),
invoiceTypeId : invoice.invoiceTypeId,
- invoiceParentTypeId : invoice.parentTypeId]);
+ invoiceParentTypeId : invoice.parentTypeId])
}
}
-invIterator.close();
+invIterator.close()
-context.ListUnAppliedInvoices = invoiceList;
+context.ListUnAppliedInvoices = invoiceList
diff --git a/applications/party/groovyScripts/party/UnAppliedPaymentsForParty.groovy b/applications/party/groovyScripts/party/UnAppliedPaymentsForParty.groovy
index 3d88cae268..e23761dbcd 100644
--- a/applications/party/groovyScripts/party/UnAppliedPaymentsForParty.groovy
+++ b/applications/party/groovyScripts/party/UnAppliedPaymentsForParty.groovy
@@ -16,16 +16,16 @@
* specific language governing permissions and limitations
* under the License.
*/
-import org.apache.ofbiz.accounting.payment.PaymentWorker;
-import org.apache.ofbiz.entity.util.EntityFindOptions;
-import org.apache.ofbiz.entity.condition.EntityCondition;
-import org.apache.ofbiz.entity.condition.EntityOperator;
+import org.apache.ofbiz.accounting.payment.PaymentWorker
+import org.apache.ofbiz.entity.util.EntityFindOptions
+import org.apache.ofbiz.entity.condition.EntityCondition
+import org.apache.ofbiz.entity.condition.EntityOperator
-Boolean actualCurrency = new Boolean(context.actualCurrency);
+Boolean actualCurrency = new Boolean(context.actualCurrency)
if (actualCurrency == null) {
- actualCurrency = true;
+ actualCurrency = true
}
-findOpts = new EntityFindOptions(true, EntityFindOptions.TYPE_SCROLL_INSENSITIVE, EntityFindOptions.CONCUR_READ_ONLY, true);
+findOpts = new EntityFindOptions(true, EntityFindOptions.TYPE_SCROLL_INSENSITIVE, EntityFindOptions.CONCUR_READ_ONLY, true)
payExprs =
EntityCondition.makeCondition([
@@ -41,20 +41,20 @@ payExprs =
EntityCondition.makeCondition("partyIdFrom", EntityOperator.EQUALS, parameters.partyId)
], EntityOperator.AND)
], EntityOperator.OR)
- ], EntityOperator.AND);
+ ], EntityOperator.AND)
-paymentList = [];
-payIterator = from("PaymentAndType").where(payExprs).cursorScrollInsensitive().distinct().queryIterator();
+paymentList = []
+payIterator = from("PaymentAndType").where(payExprs).cursorScrollInsensitive().distinct().queryIterator()
while (payment = payIterator.next()) {
- unAppliedAmount = PaymentWorker.getPaymentNotApplied(payment, actualCurrency).setScale(2,BigDecimal.ROUND_HALF_UP);
+ unAppliedAmount = PaymentWorker.getPaymentNotApplied(payment, actualCurrency).setScale(2,BigDecimal.ROUND_HALF_UP)
if (unAppliedAmount.signum() == 1) {
if (actualCurrency.equals(true) && payment.actualCurrencyAmount && payment.actualCurrencyUomId) {
- amount = payment.actualCurrencyAmount;
- paymentCurrencyUomId = payment.actualCurrencyUomId;
+ amount = payment.actualCurrencyAmount
+ paymentCurrencyUomId = payment.actualCurrencyUomId
} else {
- amount = payment.amount;
- paymentCurrencyUomId = payment.currencyUomId;
+ amount = payment.amount
+ paymentCurrencyUomId = payment.currencyUomId
}
paymentList.add([paymentId : payment.paymentId,
effectiveDate : payment.effectiveDate,
@@ -62,9 +62,9 @@ while (payment = payIterator.next()) {
amount : amount,
paymentCurrencyUomId : paymentCurrencyUomId,
paymentTypeId : payment.paymentTypeId,
- paymentParentTypeId : payment.parentTypeId]);
+ paymentParentTypeId : payment.parentTypeId])
}
}
-payIterator.close();
+payIterator.close()
-context.paymentList = paymentList;
+context.paymentList = paymentList
diff --git a/applications/party/groovyScripts/party/ViewProfile.groovy b/applications/party/groovyScripts/party/ViewProfile.groovy
index 8160c0abf9..95f16eed42 100644
--- a/applications/party/groovyScripts/party/ViewProfile.groovy
+++ b/applications/party/groovyScripts/party/ViewProfile.groovy
@@ -17,20 +17,20 @@
* under the License.
*/
-import org.apache.ofbiz.base.util.UtilDateTime;
+import org.apache.ofbiz.base.util.UtilDateTime
-partyId = parameters.partyId ?: parameters.party_id;
-userLoginId = parameters.userlogin_id ?: parameters.userLoginId;
+partyId = parameters.partyId ?: parameters.party_id
+userLoginId = parameters.userlogin_id ?: parameters.userLoginId
if (!partyId && userLoginId) {
- thisUserLogin = from("UserLogin").where("userLoginId", userLoginId).queryOne();
+ thisUserLogin = from("UserLogin").where("userLoginId", userLoginId).queryOne()
if (thisUserLogin) {
- partyId = thisUserLogin.partyId;
- parameters.partyId = partyId;
+ partyId = thisUserLogin.partyId
+ parameters.partyId = partyId
}
}
-context.showOld = "true".equals(parameters.SHOW_OLD);
-context.partyId = partyId;
-context.party = from("Party").where("partyId", partyId).queryOne();
-context.nowStr = UtilDateTime.nowTimestamp().toString();
+context.showOld = "true".equals(parameters.SHOW_OLD)
+context.partyId = partyId
+context.party = from("Party").where("partyId", partyId).queryOne()
+context.nowStr = UtilDateTime.nowTimestamp().toString()
diff --git a/applications/party/groovyScripts/visit/ShowVisits.groovy b/applications/party/groovyScripts/visit/ShowVisits.groovy
index d5ee101ebb..c830ccbd51 100644
--- a/applications/party/groovyScripts/visit/ShowVisits.groovy
+++ b/applications/party/groovyScripts/visit/ShowVisits.groovy
@@ -17,85 +17,85 @@
* under the License.
*/
-import org.apache.ofbiz.entity.transaction.TransactionUtil;
-import org.apache.ofbiz.base.util.Debug;
-import org.apache.ofbiz.entity.util.EntityUtilProperties;
+import org.apache.ofbiz.entity.transaction.TransactionUtil
+import org.apache.ofbiz.base.util.Debug
+import org.apache.ofbiz.entity.util.EntityUtilProperties
-module = "showvisits.groovy";
+module = "showvisits.groovy"
-partyId = parameters.partyId;
-context.partyId = partyId;
+partyId = parameters.partyId
+context.partyId = partyId
-showAll = parameters.showAll ?:"false";
-context.showAll = showAll;
+showAll = parameters.showAll ?:"false"
+context.showAll = showAll
-sort = parameters.sort;
-context.sort = sort;
+sort = parameters.sort
+context.sort = sort
-visitListIt = null;
-sortList = ["-fromDate"];
-if (sort) sortList.add(0, sort);
+visitListIt = null
+sortList = ["-fromDate"]
+if (sort) sortList.add(0, sort)
-boolean beganTransaction = false;
+boolean beganTransaction = false
try {
- beganTransaction = TransactionUtil.begin();
+ beganTransaction = TransactionUtil.begin()
- viewIndex = Integer.valueOf(parameters.VIEW_INDEX ?: 1);
- viewSize = parameters.VIEW_SIZE ?: EntityUtilProperties.getPropertyAsInteger("widget", "widget.form.defaultViewSize", 20);
- context.viewIndex = viewIndex;
- context.viewSize = viewSize;
+ viewIndex = Integer.valueOf(parameters.VIEW_INDEX ?: 1)
+ viewSize = parameters.VIEW_SIZE ?: EntityUtilProperties.getPropertyAsInteger("widget", "widget.form.defaultViewSize", 20)
+ context.viewIndex = viewIndex
+ context.viewSize = viewSize
// get the indexes for the partial list
- lowIndex = (((viewIndex - 1) * viewSize) + 1);
- highIndex = viewIndex * viewSize;
+ lowIndex = (((viewIndex - 1) * viewSize) + 1)
+ highIndex = viewIndex * viewSize
if (partyId) {
- visitListIt = from("Visit").where("partyId", partyId).orderBy(sortList).cursorScrollInsensitive().maxRows(highIndex).distinct().queryIterator();
+ visitListIt = from("Visit").where("partyId", partyId).orderBy(sortList).cursorScrollInsensitive().maxRows(highIndex).distinct().queryIterator()
} else if (showAll.equalsIgnoreCase("true")) {
- visitListIt = from("Visit").orderBy(sortList).cursorScrollInsensitive().maxRows(highIndex).distinct().queryIterator();
+ visitListIt = from("Visit").orderBy(sortList).cursorScrollInsensitive().maxRows(highIndex).distinct().queryIterator()
} else {
// show active visits
- visitListIt = from("Visit").where("thruDate", null).orderBy(sortList).cursorScrollInsensitive().maxRows(highIndex).distinct().queryIterator();
+ visitListIt = from("Visit").where("thruDate", null).orderBy(sortList).cursorScrollInsensitive().maxRows(highIndex).distinct().queryIterator()
}
// get the partial list for this page
- visitList = visitListIt.getPartialList(lowIndex, viewSize);
+ visitList = visitListIt.getPartialList(lowIndex, viewSize)
if (!visitList) {
- visitList = new ArrayList();
+ visitList = new ArrayList()
}
- visitListSize = visitListIt.getResultsSizeAfterPartialList();
+ visitListSize = visitListIt.getResultsSizeAfterPartialList()
if (highIndex > visitListSize) {
- highIndex = visitListSize;
+ highIndex = visitListSize
}
- context.visitSize = visitListSize;
+ context.visitSize = visitListSize
- visitListIt.close();
+ visitListIt.close()
} catch (Exception e) {
- String errMsg = "Failure in operation, rolling back transaction";
- Debug.logError(e, errMsg, module);
+ String errMsg = "Failure in operation, rolling back transaction"
+ Debug.logError(e, errMsg, module)
try {
// only rollback the transaction if we started one...
- TransactionUtil.rollback(beganTransaction, errMsg, e);
+ TransactionUtil.rollback(beganTransaction, errMsg, e)
} catch (Exception e2) {
- Debug.logError(e2, "Could not rollback transaction: " + e2.toString(), module);
+ Debug.logError(e2, "Could not rollback transaction: " + e2.toString(), module)
}
// after rolling back, rethrow the exception
- throw e;
+ throw e
} finally {
// only commit the transaction if we started one... this will throw an exception if it fails
- TransactionUtil.commit(beganTransaction);
+ TransactionUtil.commit(beganTransaction)
}
-context.visitList = visitList;
-listSize = 0;
+context.visitList = visitList
+listSize = 0
if (visitList) {
- listSize = lowIndex + visitList.size();
+ listSize = lowIndex + visitList.size()
}
if (listSize < highIndex) {
- highIndex = listSize;
+ highIndex = listSize
}
-context.lowIndex = lowIndex;
-context.highIndex = highIndex;
-context.listSize = listSize;
+context.lowIndex = lowIndex
+context.highIndex = highIndex
+context.listSize = listSize
diff --git a/applications/party/groovyScripts/visit/VisitDetails.groovy b/applications/party/groovyScripts/visit/VisitDetails.groovy
index e174475c3b..a6cd82481b 100644
--- a/applications/party/groovyScripts/visit/VisitDetails.groovy
+++ b/applications/party/groovyScripts/visit/VisitDetails.groovy
@@ -17,49 +17,49 @@
* under the License.
*/
-partyId = parameters.partyId;
-visitId = parameters.visitId;
+partyId = parameters.partyId
+visitId = parameters.visitId
-visit = null;
-serverHits = null;
+visit = null
+serverHits = null
if (visitId) {
- visit = from("Visit").where("visitId", visitId).queryOne();
+ visit = from("Visit").where("visitId", visitId).queryOne()
if (visit) {
- serverHits = from("ServerHit").where("visitId", visitId).orderBy("-hitStartDateTime").queryList();
+ serverHits = from("ServerHit").where("visitId", visitId).orderBy("-hitStartDateTime").queryList()
}
}
-viewIndex = 0;
+viewIndex = 0
try {
- viewIndex = Integer.valueOf((String) parameters.VIEW_INDEX).intValue();
+ viewIndex = Integer.valueOf((String) parameters.VIEW_INDEX).intValue()
} catch (Exception e) {
- viewIndex = 0;
+ viewIndex = 0
}
-viewSize = 20;
+viewSize = 20
try {
- viewSize = Integer.valueOf((String) parameters.VIEW_SIZE).intValue();
+ viewSize = Integer.valueOf((String) parameters.VIEW_SIZE).intValue()
} catch (Exception e) {
- viewSize = 20;
+ viewSize = 20
}
-listSize = 0;
+listSize = 0
if (serverHits) {
- listSize = serverHits.size();
+ listSize = serverHits.size()
}
-lowIndex = viewIndex * viewSize;
-highIndex = (viewIndex + 1) * viewSize;
+lowIndex = viewIndex * viewSize
+highIndex = (viewIndex + 1) * viewSize
if (listSize < highIndex) {
- highIndex = listSize;
+ highIndex = listSize
}
-context.partyId = partyId;
-context.visitId = visitId;
-context.visit = visit;
-context.serverHits = serverHits;
+context.partyId = partyId
+context.visitId = visitId
+context.visit = visit
+context.serverHits = serverHits
-context.viewIndex = viewIndex;
-context.viewSize = viewSize;
-context.listSize = listSize;
-context.lowIndex = lowIndex;
-context.highIndex = highIndex;
+context.viewIndex = viewIndex
+context.viewSize = viewSize
+context.listSize = listSize
+context.lowIndex = lowIndex
+context.highIndex = highIndex
diff --git a/applications/product/groovyScripts/catalog/ChooseTopCategory.groovy b/applications/product/groovyScripts/catalog/ChooseTopCategory.groovy
index 98db24b285..5d12ae6ecd 100644
--- a/applications/product/groovyScripts/catalog/ChooseTopCategory.groovy
+++ b/applications/product/groovyScripts/catalog/ChooseTopCategory.groovy
@@ -19,6 +19,6 @@
import org.apache.ofbiz.product.category.*
-CategoryWorker.getCategoriesWithNoParent(request, "noParentCategories");
-noParentCategories = request.getAttribute("noParentCategories");
-context.noParentCategories = noParentCategories;
+CategoryWorker.getCategoriesWithNoParent(request, "noParentCategories")
+noParentCategories = request.getAttribute("noParentCategories")
+context.noParentCategories = noParentCategories
diff --git a/applications/product/groovyScripts/catalog/FastLoadCache.groovy b/applications/product/groovyScripts/catalog/FastLoadCache.groovy
index 5fe9e10794..2eceeaba89 100644
--- a/applications/product/groovyScripts/catalog/FastLoadCache.groovy
+++ b/applications/product/groovyScripts/catalog/FastLoadCache.groovy
@@ -21,41 +21,41 @@ import org.apache.ofbiz.base.util.*
import org.apache.ofbiz.entity.*
import org.apache.ofbiz.entity.util.*
-messageList = [];
+messageList = []
-messageList.add("Loading Categories...");
-UtilTimer ctimer = new UtilTimer();
-messageList.add(ctimer.timerString("Before category find"));
-categories = from("ProductCategory").queryIterator();
-messageList.add(ctimer.timerString("Before load all categories into cache"));
+messageList.add("Loading Categories...")
+UtilTimer ctimer = new UtilTimer()
+messageList.add(ctimer.timerString("Before category find"))
+categories = from("ProductCategory").queryIterator()
+messageList.add(ctimer.timerString("Before load all categories into cache"))
-category = null;
-long numCategories = 0;
+category = null
+long numCategories = 0
while ((category = (GenericValue) categories.next())) {
- delegator.putInPrimaryKeyCache(category.getPrimaryKey(), category);
- numCategories++;
+ delegator.putInPrimaryKeyCache(category.getPrimaryKey(), category)
+ numCategories++
}
-categories.close();
+categories.close()
-messageList.add(ctimer.timerString("Finished Categories"));
-messageList.add("Loaded " + numCategories + " Categories");
+messageList.add(ctimer.timerString("Finished Categories"))
+messageList.add("Loaded " + numCategories + " Categories")
-messageList.add(" ");
+messageList.add(" ")
-messageList.add("Loading Products...");
-UtilTimer ptimer = new UtilTimer();
-messageList.add(ptimer.timerString("Before product find"));
-products = from("Product").queryIterator();
-messageList.add(ptimer.timerString("Before load all products into cache"));
-product = null;
-long numProducts = 0;
+messageList.add("Loading Products...")
+UtilTimer ptimer = new UtilTimer()
+messageList.add(ptimer.timerString("Before product find"))
+products = from("Product").queryIterator()
+messageList.add(ptimer.timerString("Before load all products into cache"))
+product = null
+long numProducts = 0
while ((product = (GenericValue) products.next())) {
- delegator.putInPrimaryKeyCache(product.getPrimaryKey(), product);
- numProducts++;
+ delegator.putInPrimaryKeyCache(product.getPrimaryKey(), product)
+ numProducts++
}
-products.close();
+products.close()
-messageList.add(ptimer.timerString("Finished Products"));
-messageList.add("Loaded " + numProducts + " products");
+messageList.add(ptimer.timerString("Finished Products"))
+messageList.add("Loaded " + numProducts + " products")
-context.messageList = messageList;
+context.messageList = messageList
diff --git a/applications/product/groovyScripts/catalog/GetSupplierInventories.groovy b/applications/product/groovyScripts/catalog/GetSupplierInventories.groovy
index 38e378e784..8a349055e7 100644
--- a/applications/product/groovyScripts/catalog/GetSupplierInventories.groovy
+++ b/applications/product/groovyScripts/catalog/GetSupplierInventories.groovy
@@ -1,7 +1,7 @@
-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
exprList = [EntityCondition.makeCondition("availableToPromiseTotal", EntityOperator.GREATER_THAN, BigDecimal.ZERO),
- EntityCondition.makeCondition("partyId", EntityOperator.EQUALS, parameters.partyId)];
-context.andCondition = EntityCondition.makeCondition(exprList, EntityOperator.AND);
+ EntityCondition.makeCondition("partyId", EntityOperator.EQUALS, parameters.partyId)]
+context.andCondition = EntityCondition.makeCondition(exprList, EntityOperator.AND)
\ No newline at end of file
diff --git a/applications/product/groovyScripts/catalog/PrepareCreateShipMeth.groovy b/applications/product/groovyScripts/catalog/PrepareCreateShipMeth.groovy
index c6e64bae00..658ab19041 100644
--- a/applications/product/groovyScripts/catalog/PrepareCreateShipMeth.groovy
+++ b/applications/product/groovyScripts/catalog/PrepareCreateShipMeth.groovy
@@ -17,20 +17,20 @@
* under the License.
*/
-import java.util.StringTokenizer;
-import org.apache.ofbiz.base.util.UtilValidate;
+import java.util.StringTokenizer
+import org.apache.ofbiz.base.util.UtilValidate
-String carrierShipmentString = request.getParameter("carrierShipmentString");
+String carrierShipmentString = request.getParameter("carrierShipmentString")
if (UtilValidate.isNotEmpty(carrierShipmentString)) {
- StringTokenizer st = new StringTokenizer(carrierShipmentString, "|");
+ StringTokenizer st = new StringTokenizer(carrierShipmentString, "|")
if (st.countTokens() != 3) {
- return "error";
+ return "error"
}
- request.setAttribute("addCarrierShipMeth", "Y");
- request.setAttribute("partyId", st.nextToken());
- request.setAttribute("roleTypeId", st.nextToken());
- request.setAttribute("shipmentMethodTypeId", st.nextToken());
- return "success";
+ request.setAttribute("addCarrierShipMeth", "Y")
+ request.setAttribute("partyId", st.nextToken())
+ request.setAttribute("roleTypeId", st.nextToken())
+ request.setAttribute("shipmentMethodTypeId", st.nextToken())
+ return "success"
} else {
- return "error";
+ return "error"
}
diff --git a/applications/product/groovyScripts/catalog/category/CategoryTree.groovy b/applications/product/groovyScripts/catalog/category/CategoryTree.groovy
index 464ab4fa53..541ba55f06 100644
--- a/applications/product/groovyScripts/catalog/category/CategoryTree.groovy
+++ b/applications/product/groovyScripts/catalog/category/CategoryTree.groovy
@@ -21,7 +21,7 @@
* This script is also referenced by the ecommerce's screens and
* should not contain order component's specific code.
*/
-import org.apache.ofbiz.entity.util.EntityUtil;
+import org.apache.ofbiz.entity.util.EntityUtil
// Put the result of CategoryWorker.getRelatedCategories into the separateRootType function as attribute.
// The separateRootType function will return the list of category of given catalog.
@@ -29,55 +29,55 @@ import org.apache.ofbiz.entity.util.EntityUtil;
List separateRootType(roots) {
if(roots) {
- prodRootTypeTree = [];
+ prodRootTypeTree = []
roots.each { root ->
- prodCateMap = [:];
- productCategory = root.getRelatedOne("ProductCategory", false);
- prodCateMap.productCategoryId = productCategory.getString("productCategoryId");
- prodCateMap.categoryName = productCategory.getString("categoryName");
- prodCateMap.isCatalog = false;
- prodCateMap.isCategoryType = true;
- prodRootTypeTree.add(prodCateMap);
+ prodCateMap = [:]
+ productCategory = root.getRelatedOne("ProductCategory", false)
+ prodCateMap.productCategoryId = productCategory.getString("productCategoryId")
+ prodCateMap.categoryName = productCategory.getString("categoryName")
+ prodCateMap.isCatalog = false
+ prodCateMap.isCategoryType = true
+ prodRootTypeTree.add(prodCateMap)
}
- return prodRootTypeTree;
+ return prodRootTypeTree
}
}
-completedTree = [];
+completedTree = []
// Get the Catalogs
-prodCatalogs = from("ProdCatalog").queryList();
+prodCatalogs = from("ProdCatalog").queryList()
if (prodCatalogs) {
prodCatalogs.each { prodCatalog ->
- prodCatalogMap = [:];
- prodCatalogMap.productCategoryId = prodCatalog.getString("prodCatalogId");
- prodCatalogMap.categoryName = prodCatalog.getString("catalogName");
- prodCatalogMap.isCatalog = true;
- prodCatalogMap.isCategoryType = false;
- prodCatalogCategories = from("ProdCatalogCategory").where("prodCatalogId", prodCatalog.prodCatalogId).filterByDate().queryList();
+ prodCatalogMap = [:]
+ prodCatalogMap.productCategoryId = prodCatalog.getString("prodCatalogId")
+ prodCatalogMap.categoryName = prodCatalog.getString("catalogName")
+ prodCatalogMap.isCatalog = true
+ prodCatalogMap.isCategoryType = false
+ prodCatalogCategories = from("ProdCatalogCategory").where("prodCatalogId", prodCatalog.prodCatalogId).filterByDate().queryList()
if (prodCatalogCategories) {
- prodCatalogMap.child = separateRootType(prodCatalogCategories);
+ prodCatalogMap.child = separateRootType(prodCatalogCategories)
}
- completedTree.add(prodCatalogMap);
+ completedTree.add(prodCatalogMap)
}
}
// The complete tree list for the category tree
-context.completedTree = completedTree;
+context.completedTree = completedTree
-stillInCatalogManager = true;
-productCategoryId = null;
-prodCatalogId = null;
-showProductCategoryId = null;
+stillInCatalogManager = true
+productCategoryId = null
+prodCatalogId = null
+showProductCategoryId = null
// Reset tree condition check. Are we still in the Catalog Manager ?. If not , then reset the tree.
if ((parameters.productCategoryId != null) || (parameters.showProductCategoryId != null)) {
- stillInCatalogManager = false;
- productCategoryId = parameters.productCategoryId;
- showProductCategoryId = parameters.showProductCategoryId;
+ stillInCatalogManager = false
+ productCategoryId = parameters.productCategoryId
+ showProductCategoryId = parameters.showProductCategoryId
} else if (parameters.prodCatalogId != null) {
- stillInCatalogManager = false;
- prodCatalogId = parameters.prodCatalogId;
+ stillInCatalogManager = false
+ prodCatalogId = parameters.prodCatalogId
}
-context.stillInCatalogManager = stillInCatalogManager;
-context.productCategoryId = productCategoryId;
-context.prodCatalogId = prodCatalogId;
-context.showProductCategoryId = showProductCategoryId;
+context.stillInCatalogManager = stillInCatalogManager
+context.productCategoryId = productCategoryId
+context.prodCatalogId = prodCatalogId
+context.showProductCategoryId = showProductCategoryId
diff --git a/applications/product/groovyScripts/catalog/category/CreateProductInCategoryCheckExisting.groovy b/applications/product/groovyScripts/catalog/category/CreateProductInCategoryCheckExisting.groovy
index de26f198df..485568fa06 100644
--- a/applications/product/groovyScripts/catalog/category/CreateProductInCategoryCheckExisting.groovy
+++ b/applications/product/groovyScripts/catalog/category/CreateProductInCategoryCheckExisting.groovy
@@ -17,38 +17,38 @@
* under the License.
*/
-import org.apache.ofbiz.base.util.*;
-import org.apache.ofbiz.entity.*;
-import org.apache.ofbiz.product.feature.*;
-import org.apache.ofbiz.product.product.ProductSearch;
-import org.apache.ofbiz.webapp.stats.VisitHandler;
+import org.apache.ofbiz.base.util.*
+import org.apache.ofbiz.entity.*
+import org.apache.ofbiz.product.feature.*
+import org.apache.ofbiz.product.product.ProductSearch
+import org.apache.ofbiz.webapp.stats.VisitHandler
-visitId = VisitHandler.getVisitId(session);
+visitId = VisitHandler.getVisitId(session)
-featureIdByType = ParametricSearch.makeFeatureIdByTypeMap(request);
-featureIdSet = [] as Set;
+featureIdByType = ParametricSearch.makeFeatureIdByTypeMap(request)
+featureIdSet = [] as Set
if (featureIdByType) {
- featureIdSet.addAll(featureIdByType.values());
+ featureIdSet.addAll(featureIdByType.values())
}
-productIds = ProductSearch.parametricKeywordSearch(featureIdSet, null, delegator, productCategoryId, true, visitId, true, true, false);
+productIds = ProductSearch.parametricKeywordSearch(featureIdSet, null, delegator, productCategoryId, true, visitId, true, true, false)
// get the product for each ID
-products = new ArrayList(productIds.size());
+products = new ArrayList(productIds.size())
productIds.each { productId ->
- product = from("Product").where("productId", productId).cache(true).queryOne();
- products.add(product);
+ product = from("Product").where("productId", productId).cache(true).queryOne()
+ products.add(product)
}
-productFeatureAndTypeDatas = new ArrayList(featureIdByType.size());
+productFeatureAndTypeDatas = new ArrayList(featureIdByType.size())
featureIdByType.each { featureIdByTypeEntry ->
- productFeatureType = from("ProductFeatureType").where("productFeatureTypeId", featureIdByTypeEntry.key).cache(true).queryOne();
- productFeature = from("ProductFeature").where("productFeatureId", featureIdByTypeEntry.value).cache(true).queryOne();
- productFeatureAndTypeData = [:];
- productFeatureAndTypeData.productFeatureType = productFeatureType;
- productFeatureAndTypeData.productFeature = productFeature;
- productFeatureAndTypeDatas.add(productFeatureAndTypeData);
+ productFeatureType = from("ProductFeatureType").where("productFeatureTypeId", featureIdByTypeEntry.key).cache(true).queryOne()
+ productFeature = from("ProductFeature").where("productFeatureId", featureIdByTypeEntry.value).cache(true).queryOne()
+ productFeatureAndTypeData = [:]
+ productFeatureAndTypeData.productFeatureType = productFeatureType
+ productFeatureAndTypeData.productFeature = productFeature
+ productFeatureAndTypeDatas.add(productFeatureAndTypeData)
}
-context.productFeatureAndTypeDatas = productFeatureAndTypeDatas;
-context.products = products;
+context.productFeatureAndTypeDatas = productFeatureAndTypeDatas
+context.products = products
diff --git a/applications/product/groovyScripts/catalog/category/EditCategory.groovy b/applications/product/groovyScripts/catalog/category/EditCategory.groovy
index 32a42ee4bd..966161fc77 100644
--- a/applications/product/groovyScripts/catalog/category/EditCategory.groovy
+++ b/applications/product/groovyScripts/catalog/category/EditCategory.groovy
@@ -22,99 +22,99 @@ import org.apache.ofbiz.base.util.string.*
import org.apache.ofbiz.entity.util.EntityUtilProperties
if (productCategory) {
- context.productCategoryType = productCategory.getRelatedOne("ProductCategoryType", false);
+ context.productCategoryType = productCategory.getRelatedOne("ProductCategoryType", false)
}
-primaryParentCategory = null;
-primParentCatIdParam = request.getParameter("primaryParentCategoryId");
+primaryParentCategory = null
+primParentCatIdParam = request.getParameter("primaryParentCategoryId")
if (productCategory) {
- primaryParentCategory = productCategory.getRelatedOne("PrimaryParentProductCategory", false);
+ primaryParentCategory = productCategory.getRelatedOne("PrimaryParentProductCategory", false)
} else if (primParentCatIdParam) {
- primaryParentCategory = from("ProductCategory").where("productCategoryId", primParentCatIdParam).queryOne();
+ primaryParentCategory = from("ProductCategory").where("productCategoryId", primParentCatIdParam).queryOne()
}
-context.primaryParentCategory = primaryParentCategory;
+context.primaryParentCategory = primaryParentCategory
// make the image file formats
-context.tenantId = delegator.getDelegatorTenantId();
-imageFilenameFormat = EntityUtilProperties.getPropertyValue("catalog", "image.filename.format", delegator);
-imageServerPath = FlexibleStringExpander.expandString(EntityUtilProperties.getPropertyValue("catalog", "image.server.path", delegator), context);
-imageUrlPrefix = FlexibleStringExpander.expandString(EntityUtilProperties.getPropertyValue("catalog", "image.url.prefix",delegator), context);
-imageServerPath = imageServerPath.endsWith("/") ? imageServerPath.substring(0, imageServerPath.length()-1) : imageServerPath;
-imageUrlPrefix = imageUrlPrefix.endsWith("/") ? imageUrlPrefix.substring(0, imageUrlPrefix.length()-1) : imageUrlPrefix;
-context.imageFilenameFormat = imageFilenameFormat;
-context.imageServerPath = imageServerPath;
-context.imageUrlPrefix = imageUrlPrefix;
+context.tenantId = delegator.getDelegatorTenantId()
+imageFilenameFormat = EntityUtilProperties.getPropertyValue("catalog", "image.filename.format", delegator)
+imageServerPath = FlexibleStringExpander.expandString(EntityUtilProperties.getPropertyValue("catalog", "image.server.path", delegator), context)
+imageUrlPrefix = FlexibleStringExpander.expandString(EntityUtilProperties.getPropertyValue("catalog", "image.url.prefix",delegator), context)
+imageServerPath = imageServerPath.endsWith("/") ? imageServerPath.substring(0, imageServerPath.length()-1) : imageServerPath
+imageUrlPrefix = imageUrlPrefix.endsWith("/") ? imageUrlPrefix.substring(0, imageUrlPrefix.length()-1) : imageUrlPrefix
+context.imageFilenameFormat = imageFilenameFormat
+context.imageServerPath = imageServerPath
+context.imageUrlPrefix = imageUrlPrefix
-filenameExpander = FlexibleStringExpander.getInstance(imageFilenameFormat);
-context.imageNameCategory = imageUrlPrefix + "/" + filenameExpander.expandString([location : "categories", type : "category", id : productCategoryId]);
-context.imageNameLinkOne = imageUrlPrefix + "/" + filenameExpander.expandString([location : "categories", type : "linkOne", id : productCategoryId]);
-context.imageNameLinkTwo = imageUrlPrefix + "/" + filenameExpander.expandString([location : "categories", type : "linkTwo", id : productCategoryId]);
+filenameExpander = FlexibleStringExpander.getInstance(imageFilenameFormat)
+context.imageNameCategory = imageUrlPrefix + "/" + filenameExpander.expandString([location : "categories", type : "category", id : productCategoryId])
+context.imageNameLinkOne = imageUrlPrefix + "/" + filenameExpander.expandString([location : "categories", type : "linkOne", id : productCategoryId])
+context.imageNameLinkTwo = imageUrlPrefix + "/" + filenameExpander.expandString([location : "categories", type : "linkTwo", id : productCategoryId])
// UPLOADING STUFF
-forLock = new Object();
-contentType = null;
-fileType = request.getParameter("upload_file_type");
+forLock = new Object()
+contentType = null
+fileType = request.getParameter("upload_file_type")
if (fileType) {
- context.fileType = fileType;
+ context.fileType = fileType
- String fileLocation = filenameExpander.expandString([location : "categories", type : fileType, id : productCategoryId]);
- String filePathPrefix = "";
- String filenameToUse = fileLocation;
+ String fileLocation = filenameExpander.expandString([location : "categories", type : fileType, id : productCategoryId])
+ String filePathPrefix = ""
+ String filenameToUse = fileLocation
if (fileLocation.lastIndexOf("/") != -1) {
- filePathPrefix = fileLocation.substring(0, fileLocation.lastIndexOf("/") + 1); // adding 1 to include the trailing slash
- filenameToUse = fileLocation.substring(fileLocation.lastIndexOf("/") + 1);
+ filePathPrefix = fileLocation.substring(0, fileLocation.lastIndexOf("/") + 1) // adding 1 to include the trailing slash
+ filenameToUse = fileLocation.substring(fileLocation.lastIndexOf("/") + 1)
}
- int i1;
+ int i1
if (contentType && (i1 = contentType.indexOf("boundary=")) != -1) {
- contentType = contentType.substring(i1 + 9);
- contentType = "--" + contentType;
+ contentType = contentType.substring(i1 + 9)
+ contentType = "--" + contentType
}
- defaultFileName = filenameToUse + "_temp";
- uploadObject = new HttpRequestFileUpload();
- uploadObject.setOverrideFilename(defaultFileName);
- uploadObject.setSavePath(imageServerPath + "/" + filePathPrefix);
- uploadObject.doUpload(request);
+ defaultFileName = filenameToUse + "_temp"
+ uploadObject = new HttpRequestFileUpload()
+ uploadObject.setOverrideFilename(defaultFileName)
+ uploadObject.setSavePath(imageServerPath + "/" + filePathPrefix)
+ uploadObject.doUpload(request)
- clientFileName = uploadObject.getFilename();
+ clientFileName = uploadObject.getFilename()
if (clientFileName) {
- context.clientFileName = clientFileName;
+ context.clientFileName = clientFileName
}
if (clientFileName) {
if (clientFileName.lastIndexOf(".") > 0 && clientFileName.lastIndexOf(".") < clientFileName.length()) {
- filenameToUse += clientFileName.substring(clientFileName.lastIndexOf("."));
+ filenameToUse += clientFileName.substring(clientFileName.lastIndexOf("."))
} else {
- filenameToUse += ".jpg";
+ filenameToUse += ".jpg"
}
- context.clientFileName = clientFileName;
- context.filenameToUse = filenameToUse;
+ context.clientFileName = clientFileName
+ context.filenameToUse = filenameToUse
- characterEncoding = request.getCharacterEncoding();
- imageUrl = imageUrlPrefix + "/" + filePathPrefix + java.net.URLEncoder.encode(filenameToUse, characterEncoding);
+ characterEncoding = request.getCharacterEncoding()
+ imageUrl = imageUrlPrefix + "/" + filePathPrefix + java.net.URLEncoder.encode(filenameToUse, characterEncoding)
try {
- file = new File(imageServerPath + "/" + filePathPrefix, defaultFileName);
- file1 = new File(imageServerPath + "/" + filePathPrefix, filenameToUse);
+ file = new File(imageServerPath + "/" + filePathPrefix, defaultFileName)
+ file1 = new File(imageServerPath + "/" + filePathPrefix, filenameToUse)
try {
- file1.delete();
+ file1.delete()
} catch (Exception e) {
- System.out.println("error deleting existing file (not neccessarily a problem)");
+ System.out.println("error deleting existing file (not neccessarily a problem)")
}
- file.renameTo(file1);
+ file.renameTo(file1)
} catch (Exception e) {
- e.printStackTrace();
+ e.printStackTrace()
}
if (imageUrl) {
- context.imageUrl = imageUrl;
- productCategory.set(fileType + "ImageUrl", imageUrl);
- productCategory.store();
+ context.imageUrl = imageUrl
+ productCategory.set(fileType + "ImageUrl", imageUrl)
+ productCategory.store()
}
}
}
diff --git a/applications/product/groovyScripts/catalog/category/EditCategoryContentContent.groovy b/applications/product/groovyScripts/catalog/category/EditCategoryContentContent.groovy
index 13939dcbfe..1092b5de5a 100644
--- a/applications/product/groovyScripts/catalog/category/EditCategoryContentContent.groovy
+++ b/applications/product/groovyScripts/catalog/category/EditCategoryContentContent.groovy
@@ -17,48 +17,48 @@
* under the License.
*/
-import org.apache.ofbiz.entity.*;
-import org.apache.ofbiz.entity.util.*;
-import org.apache.ofbiz.base.util.*;
-import java.sql.Timestamp;
+import org.apache.ofbiz.entity.*
+import org.apache.ofbiz.entity.util.*
+import org.apache.ofbiz.base.util.*
+import java.sql.Timestamp
-uiLabelMap = UtilProperties.getResourceBundleMap("ProductUiLabels", locale);
+uiLabelMap = UtilProperties.getResourceBundleMap("ProductUiLabels", locale)
-contentId = parameters.contentId;
+contentId = parameters.contentId
if (!contentId) {
- contentId = null;
+ contentId = null
}
-prodCatContentTypeId = parameters.prodCatContentTypeId;
-context.contentFormName = "EditCategoryContentSimpleText";
-context.contentFormTitle = "${uiLabelMap.ProductUpdateSimpleTextContentCategory}";
+prodCatContentTypeId = parameters.prodCatContentTypeId
+context.contentFormName = "EditCategoryContentSimpleText"
+context.contentFormTitle = "${uiLabelMap.ProductUpdateSimpleTextContentCategory}"
if (("PAGE_TITLE".equals(prodCatContentTypeId))||("META_KEYWORD".equals(prodCatContentTypeId))||("META_DESCRIPTION".equals(prodCatContentTypeId))) {
- context.contentFormName = "EditCategoryContentSEO";
- context.contentFormTitle = "${uiLabelMap.ProductUpdateSEOContentCategory}";
+ context.contentFormName = "EditCategoryContentSEO"
+ context.contentFormTitle = "${uiLabelMap.ProductUpdateSEOContentCategory}"
}
if ("RELATED_URL".equals(prodCatContentTypeId)) {
- contentList = from("ContentDataResourceView").where("contentId", contentId).queryList();
+ contentList = from("ContentDataResourceView").where("contentId", contentId).queryList()
if (contentList) {
- context.contentId = contentList.get(0).contentId;
- context.dataResourceId = contentList.get(0).dataResourceId;
- context.title = contentList.get(0).drDataResourceName;
- context.description = contentList.get(0).description;
- context.url = contentList.get(0).drObjectInfo;
- context.localeString = contentList.get(0).localeString;
+ context.contentId = contentList.get(0).contentId
+ context.dataResourceId = contentList.get(0).dataResourceId
+ context.title = contentList.get(0).drDataResourceName
+ context.description = contentList.get(0).description
+ context.url = contentList.get(0).drObjectInfo
+ context.localeString = contentList.get(0).localeString
}
- context.contentFormName = "EditCategoryContentRelatedUrl";
- context.contentFormTitle = "${uiLabelMap.ProductUpdateRelatedURLContentCategory}";
+ context.contentFormName = "EditCategoryContentRelatedUrl"
+ context.contentFormTitle = "${uiLabelMap.ProductUpdateRelatedURLContentCategory}"
}else if ("VIDEO".equals(prodCatContentTypeId) || "CATEGORY_IMAGE".equals(prodCatContentTypeId)) {
if (UtilValidate.isNotEmpty(content)) {
- context.fileDataResourceId = content.dataResourceId;
+ context.fileDataResourceId = content.dataResourceId
}
if("CATEGORY_IMAGE".equals(prodCatContentTypeId)){
- context.dataResourceTypeId = "IMAGE_OBJECT";
+ context.dataResourceTypeId = "IMAGE_OBJECT"
}else{
- context.dataResourceTypeId = "VIDEO_OBJECT";
+ context.dataResourceTypeId = "VIDEO_OBJECT"
}
- context.contentFormName = "EditCategoryContentDownload";
- context.contentFormTitle = "${uiLabelMap.ProductUpdateDownloadContentCategory}";
+ context.contentFormName = "EditCategoryContentDownload"
+ context.contentFormTitle = "${uiLabelMap.ProductUpdateDownloadContentCategory}"
}
diff --git a/applications/product/groovyScripts/catalog/category/EditCategoryProducts.groovy b/applications/product/groovyScripts/catalog/category/EditCategoryProducts.groovy
index 98c87a6082..f38539bfa1 100644
--- a/applications/product/groovyScripts/catalog/category/EditCategoryProducts.groovy
+++ b/applications/product/groovyScripts/catalog/category/EditCategoryProducts.groovy
@@ -20,24 +20,24 @@
import org.apache.ofbiz.base.util.*
//default this to true, ie only show active
-activeOnly = !"false".equals(request.getParameter("activeOnly"));
-context.activeOnly = activeOnly;
+activeOnly = !"false".equals(request.getParameter("activeOnly"))
+context.activeOnly = activeOnly
-paramInMap = [:];
-paramInMap.productCategoryId = UtilFormatOut.checkNull(request.getParameter("productCategoryId"));
-paramInMap.defaultViewSize = 20;
-paramInMap.limitView = true;
-paramInMap.useCacheForMembers = true;
-paramInMap.checkViewAllow = false;
-paramInMap.activeOnly = activeOnly;
-paramInMap.viewIndexString = parameters.get("VIEW_INDEX");
-paramInMap.viewSizeString = parameters.get("VIEW_SIZE");
+paramInMap = [:]
+paramInMap.productCategoryId = UtilFormatOut.checkNull(request.getParameter("productCategoryId"))
+paramInMap.defaultViewSize = 20
+paramInMap.limitView = true
+paramInMap.useCacheForMembers = true
+paramInMap.checkViewAllow = false
+paramInMap.activeOnly = activeOnly
+paramInMap.viewIndexString = parameters.get("VIEW_INDEX")
+paramInMap.viewSizeString = parameters.get("VIEW_SIZE")
// Returns: viewIndex, viewSize, lowIndex, highIndex, listSize, productCategory, productCategoryMembers
-outMap = runService('getProductCategoryAndLimitedMembers', paramInMap);
-context.viewIndex = outMap.viewIndex;
-context.viewSize = outMap.viewSize;
-context.lowIndex = outMap.lowIndex;
-context.highIndex = outMap.highIndex;
-context.listSize = outMap.listSize;
-context.productCategoryMembers = outMap.productCategoryMembers;
+outMap = runService('getProductCategoryAndLimitedMembers', paramInMap)
+context.viewIndex = outMap.viewIndex
+context.viewSize = outMap.viewSize
+context.lowIndex = outMap.lowIndex
+context.highIndex = outMap.highIndex
+context.listSize = outMap.listSize
+context.productCategoryMembers = outMap.productCategoryMembers
diff --git a/applications/product/groovyScripts/catalog/category/EditCategorySEO.groovy b/applications/product/groovyScripts/catalog/category/EditCategorySEO.groovy
index 60a54cc691..f401417bdf 100644
--- a/applications/product/groovyScripts/catalog/category/EditCategorySEO.groovy
+++ b/applications/product/groovyScripts/catalog/category/EditCategorySEO.groovy
@@ -17,24 +17,24 @@
* under the License.
*/
-productCategoryId = parameters.productCategoryId;
+productCategoryId = parameters.productCategoryId
if (productCategoryId) {
- productCategoryContents = from("ProductCategoryContent").where("productCategoryId", productCategoryId).queryList();
+ productCategoryContents = from("ProductCategoryContent").where("productCategoryId", productCategoryId).queryList()
productCategoryContents.each{ productCategoryContent->
if (productCategoryContent.prodCatContentTypeId == "PAGE_TITLE") {
- contentTitle = from("Content").where("contentId", productCategoryContent.contentId).queryOne();
- dataTextTitle = from("ElectronicText").where("dataResourceId", contentTitle.dataResourceId).queryOne();
- context.title = dataTextTitle.textData;
+ contentTitle = from("Content").where("contentId", productCategoryContent.contentId).queryOne()
+ dataTextTitle = from("ElectronicText").where("dataResourceId", contentTitle.dataResourceId).queryOne()
+ context.title = dataTextTitle.textData
}
if (productCategoryContent.prodCatContentTypeId == "META_KEYWORD") {
- contentMetaKeyword = from("Content").where("contentId", productCategoryContent.contentId).queryOne();
- dataTextMetaKeyword = from("ElectronicText").where("dataResourceId", contentMetaKeyword.dataResourceId).queryOne();
- context.metaKeyword = dataTextMetaKeyword.textData;
+ contentMetaKeyword = from("Content").where("contentId", productCategoryContent.contentId).queryOne()
+ dataTextMetaKeyword = from("ElectronicText").where("dataResourceId", contentMetaKeyword.dataResourceId).queryOne()
+ context.metaKeyword = dataTextMetaKeyword.textData
}
if (productCategoryContent.prodCatContentTypeId == "META_DESCRIPTION") {
- contentMetaDescription = from("Content").where("contentId", productCategoryContent.contentId).queryOne();
- dataTextMetaDescription = from("ElectronicText").where("dataResourceId", contentMetaDescription.dataResourceId).queryOne();
- context.metaDescription = dataTextMetaDescription.textData;
+ contentMetaDescription = from("Content").where("contentId", productCategoryContent.contentId).queryOne()
+ dataTextMetaDescription = from("ElectronicText").where("dataResourceId", contentMetaDescription.dataResourceId).queryOne()
+ context.metaDescription = dataTextMetaDescription.textData
}
}
}
diff --git a/applications/product/groovyScripts/catalog/config/EditProductConfigItemContent.groovy b/applications/product/groovyScripts/catalog/config/EditProductConfigItemContent.groovy
index 990131b233..a75fec3a03 100644
--- a/applications/product/groovyScripts/catalog/config/EditProductConfigItemContent.groovy
+++ b/applications/product/groovyScripts/catalog/config/EditProductConfigItemContent.groovy
@@ -20,111 +20,111 @@
import org.apache.ofbiz.base.util.*
import org.apache.ofbiz.base.util.string.*
import org.apache.ofbiz.entity.*
-import org.apache.ofbiz.entity.util.EntityUtilProperties;
+import org.apache.ofbiz.entity.util.EntityUtilProperties
// make the image file formats
-context.tenantId = delegator.getDelegatorTenantId();
-imageFilenameFormat = "configitems/${configItemId}";
-imageServerPath = FlexibleStringExpander.expandString(EntityUtilProperties.getPropertyValue("catalog", "image.server.path", delegator), context);
-imageUrlPrefix = FlexibleStringExpander.expandString(EntityUtilProperties.getPropertyValue("catalog", "image.url.prefix",delegator), context);
-imageServerPath = imageServerPath.endsWith("/") ? imageServerPath.substring(0, imageServerPath.length()-1) : imageServerPath;
-imageUrlPrefix = imageUrlPrefix.endsWith("/") ? imageUrlPrefix.substring(0, imageUrlPrefix.length()-1) : imageUrlPrefix;
-context.imageFilenameFormat = imageFilenameFormat;
-context.imageServerPath = imageServerPath;
-context.imageUrlPrefix = imageUrlPrefix;
+context.tenantId = delegator.getDelegatorTenantId()
+imageFilenameFormat = "configitems/${configItemId}"
+imageServerPath = FlexibleStringExpander.expandString(EntityUtilProperties.getPropertyValue("catalog", "image.server.path", delegator), context)
+imageUrlPrefix = FlexibleStringExpander.expandString(EntityUtilProperties.getPropertyValue("catalog", "image.url.prefix",delegator), context)
+imageServerPath = imageServerPath.endsWith("/") ? imageServerPath.substring(0, imageServerPath.length()-1) : imageServerPath
+imageUrlPrefix = imageUrlPrefix.endsWith("/") ? imageUrlPrefix.substring(0, imageUrlPrefix.length()-1) : imageUrlPrefix
+context.imageFilenameFormat = imageFilenameFormat
+context.imageServerPath = imageServerPath
+context.imageUrlPrefix = imageUrlPrefix
-filenameExpander = FlexibleStringExpander.getInstance(imageFilenameFormat);
-context.imageNameSmall = imageUrlPrefix + "/" + filenameExpander.expandString([size : 'small', configItemId : configItemId]);
+filenameExpander = FlexibleStringExpander.getInstance(imageFilenameFormat)
+context.imageNameSmall = imageUrlPrefix + "/" + filenameExpander.expandString([size : 'small', configItemId : configItemId])
// Start ProdConfItemContent stuff
-productContent = null;
+productContent = null
if (configItem) {
- productContent = configItem.getRelated("ProdConfItemContent", null, ['confItemContentTypeId'], false);
+ productContent = configItem.getRelated("ProdConfItemContent", null, ['confItemContentTypeId'], false)
}
-context.productContent = productContent;
+context.productContent = productContent
-productContentDatas = [];
+productContentDatas = []
productContent.each { productContent ->
- content = productContent.getRelatedOne("Content", false);
- productContentDatas.add([productContent : productContent, content : content]);
+ content = productContent.getRelatedOne("Content", false)
+ productContentDatas.add([productContent : productContent, content : content])
}
-context.productContentList = productContentDatas;
+context.productContentList = productContentDatas
// End ProductContent stuff
-tryEntity = true;
+tryEntity = true
if (request.getAttribute("_ERROR_MESSAGE_")) {
- tryEntity = false;
+ tryEntity = false
}
if (!configItem) {
- tryEntity = false;
+ tryEntity = false
}
if ("true".equalsIgnoreCase(request.getParameter("tryEntity"))) {
- tryEntity = true;
+ tryEntity = true
}
-context.tryEntity = tryEntity;
+context.tryEntity = tryEntity
// UPLOADING STUFF
-forLock = new Object();
-contentType = null;
-fileType = request.getParameter("upload_file_type");
+forLock = new Object()
+contentType = null
+fileType = request.getParameter("upload_file_type")
if (fileType) {
- context.fileType = fileType;
+ context.fileType = fileType
- fileNameToUse = "productConfigItem." + configItemId;
- fileLocation = filenameExpander.expandString([size : fileType, configItemId : configItemId]);
- filePathPrefix = "";
- filenameToUse = fileLocation;
+ fileNameToUse = "productConfigItem." + configItemId
+ fileLocation = filenameExpander.expandString([size : fileType, configItemId : configItemId])
+ filePathPrefix = ""
+ filenameToUse = fileLocation
if (fileLocation.lastIndexOf("/") != -1) {
- filePathPrefix = fileLocation.substring(0, fileLocation.lastIndexOf("/") + 1); // adding 1 to include the trailing slash
- filenameToUse = fileLocation.substring(fileLocation.lastIndexOf("/") + 1);
+ filePathPrefix = fileLocation.substring(0, fileLocation.lastIndexOf("/") + 1) // adding 1 to include the trailing slash
+ filenameToUse = fileLocation.substring(fileLocation.lastIndexOf("/") + 1)
}
- int i1;
+ int i1
if (contentType && (i1 = contentType.indexOf("boundary=")) != -1) {
- contentType = contentType.substring(i1 + 9);
- contentType = "--" + contentType;
+ contentType = contentType.substring(i1 + 9)
+ contentType = "--" + contentType
}
- defaultFileName = filenameToUse + "_temp";
- uploadObject = new HttpRequestFileUpload();
- uploadObject.setOverrideFilename(defaultFileName);
- uploadObject.setSavePath(imageServerPath + "/" + filePathPrefix);
- uploadObject.doUpload(request);
+ defaultFileName = filenameToUse + "_temp"
+ uploadObject = new HttpRequestFileUpload()
+ uploadObject.setOverrideFilename(defaultFileName)
+ uploadObject.setSavePath(imageServerPath + "/" + filePathPrefix)
+ uploadObject.doUpload(request)
- clientFileName = uploadObject.getFilename();
+ clientFileName = uploadObject.getFilename()
if (clientFileName) {
- context.clientFileName = clientFileName;
+ context.clientFileName = clientFileName
if (clientFileName.lastIndexOf(".") > 0 && clientFileName.lastIndexOf(".") < clientFileName.length()) {
- filenameToUse += clientFileName.substring(clientFileName.lastIndexOf("."));
+ filenameToUse += clientFileName.substring(clientFileName.lastIndexOf("."))
} else {
- filenameToUse += ".jpg";
+ filenameToUse += ".jpg"
}
- context.clientFileName = clientFileName;
- context.filenameToUse = filenameToUse;
+ context.clientFileName = clientFileName
+ context.filenameToUse = filenameToUse
- characterEncoding = request.getCharacterEncoding();
- imageUrl = imageUrlPrefix + "/" + filePathPrefix + java.net.URLEncoder.encode(filenameToUse, characterEncoding);
+ characterEncoding = request.getCharacterEncoding()
+ imageUrl = imageUrlPrefix + "/" + filePathPrefix + java.net.URLEncoder.encode(filenameToUse, characterEncoding)
try {
- file = new File(imageServerPath + "/" + filePathPrefix, defaultFileName);
- file1 = new File(imageServerPath + "/" + filePathPrefix, filenameToUse);
+ file = new File(imageServerPath + "/" + filePathPrefix, defaultFileName)
+ file1 = new File(imageServerPath + "/" + filePathPrefix, filenameToUse)
try {
- file1.delete();
+ file1.delete()
} catch (Exception e) {
- System.out.println("error deleting existing file (not neccessarily a problem)");
+ System.out.println("error deleting existing file (not neccessarily a problem)")
}
- file.renameTo(file1);
+ file.renameTo(file1)
} catch (Exception e) {
- e.printStackTrace();
+ e.printStackTrace()
}
if (imageUrl) {
- context.imageUrl = imageUrl;
- configItem.set("imageUrl", imageUrl);
- configItem.store();
+ context.imageUrl = imageUrl
+ configItem.set("imageUrl", imageUrl)
+ configItem.store()
}
}
}
diff --git a/applications/product/groovyScripts/catalog/config/EditProductConfigItemContentContent.groovy b/applications/product/groovyScripts/catalog/config/EditProductConfigItemContentContent.groovy
index 317fba4519..fda30d22da 100644
--- a/applications/product/groovyScripts/catalog/config/EditProductConfigItemContentContent.groovy
+++ b/applications/product/groovyScripts/catalog/config/EditProductConfigItemContentContent.groovy
@@ -17,54 +17,54 @@
* under the License.
*/
-import org.apache.ofbiz.entity.*;
-import org.apache.ofbiz.entity.util.*;
-import org.apache.ofbiz.base.util.*;
+import org.apache.ofbiz.entity.*
+import org.apache.ofbiz.entity.util.*
+import org.apache.ofbiz.base.util.*
-contentId = request.getParameter("contentId") ?: null;
+contentId = request.getParameter("contentId") ?: null
-confItemContentTypeId = request.getParameter("confItemContentTypeId");
+confItemContentTypeId = request.getParameter("confItemContentTypeId")
-description = request.getParameter("description") ?: null;
+description = request.getParameter("description") ?: null
-productContent = from("ProdConfItemContent").where("contentId", contentId, "configItemId", configItemId, "confItemContentTypeId", confItemContentTypeId, "fromDate", fromDate).queryOne();
+productContent = from("ProdConfItemContent").where("contentId", contentId, "configItemId", configItemId, "confItemContentTypeId", confItemContentTypeId, "fromDate", fromDate).queryOne()
if (!productContent) {
- productContent = [:];
- productContent.configItemId = configItemId;
- productContent.contentId = contentId;
- productContent.confItemContentTypeId = confItemContentTypeId;
- productContent.fromDate = fromDate;
- productContent.thruDate = request.getParameter("thruDate");
+ productContent = [:]
+ productContent.configItemId = configItemId
+ productContent.contentId = contentId
+ productContent.confItemContentTypeId = confItemContentTypeId
+ productContent.fromDate = fromDate
+ productContent.thruDate = request.getParameter("thruDate")
}
-context.productContent = productContent;
+context.productContent = productContent
-productContentData = [:];
-productContentData.putAll(productContent);
-Map content = null;
+productContentData = [:]
+productContentData.putAll(productContent)
+Map content = null
-context.contentId = contentId;
+context.contentId = contentId
if (contentId) {
- content = from("Content").where("contentId", contentId).queryOne();
- context.content = content;
+ content = from("Content").where("contentId", contentId).queryOne()
+ context.content = content
} else {
- content = [:];
+ content = [:]
if (description) {
- content.description = description;
+ content.description = description
}
}
//Assume it is a generic simple text content
-textData = [:];
+textData = [:]
if (contentId && content) {
- textDr = content.getRelatedOne("DataResource", false);
+ textDr = content.getRelatedOne("DataResource", false)
if (textDr) {
- text = textDr.getRelatedOne("ElectronicText", false);
+ text = textDr.getRelatedOne("ElectronicText", false)
if (text) {
- textData.text = text.textData;
- textData.textDataResourceId = text.dataResourceId;
+ textData.text = text.textData
+ textData.textDataResourceId = text.dataResourceId
}
}
}
-context.productContentData = productContentData;
-context.textData = textData;
\ No newline at end of file
+context.productContentData = productContentData
+context.textData = textData
\ No newline at end of file
diff --git a/applications/product/groovyScripts/catalog/feature/EditFeatureCategoryFeatures.groovy b/applications/product/groovyScripts/catalog/feature/EditFeatureCategoryFeatures.groovy
index 0084c10717..94d2958e47 100644
--- a/applications/product/groovyScripts/catalog/feature/EditFeatureCategoryFeatures.groovy
+++ b/applications/product/groovyScripts/catalog/feature/EditFeatureCategoryFeatures.groovy
@@ -23,52 +23,52 @@ import org.apache.ofbiz.entity.util.EntityFindOptions
import org.apache.ofbiz.base.util.*
import org.apache.ofbiz.entity.transaction.*
-module = "EditFeatureCategoryFeatures.groovy";
+module = "EditFeatureCategoryFeatures.groovy"
-context.hasPermission = security.hasEntityPermission("CATALOG", "_VIEW", session);
+context.hasPermission = security.hasEntityPermission("CATALOG", "_VIEW", session)
-context.nowTimestampString = UtilDateTime.nowTimestamp().toString();
+context.nowTimestampString = UtilDateTime.nowTimestamp().toString()
-productId = request.getParameter("productId");
-context.productId = productId;
+productId = request.getParameter("productId")
+context.productId = productId
-productFeatureCategoryId = parameters.get("productFeatureCategoryId");
-context.productFeatureCategoryId = productFeatureCategoryId;
+productFeatureCategoryId = parameters.get("productFeatureCategoryId")
+context.productFeatureCategoryId = productFeatureCategoryId
-context.curProductFeatureCategory = from("ProductFeatureCategory").where("productFeatureCategoryId", productFeatureCategoryId).queryOne();
+context.curProductFeatureCategory = from("ProductFeatureCategory").where("productFeatureCategoryId", productFeatureCategoryId).queryOne()
-context.productFeatureTypes = from("ProductFeatureType").orderBy("description").queryList();
+context.productFeatureTypes = from("ProductFeatureType").orderBy("description").queryList()
-context.productFeatureCategories = from("ProductFeatureCategory").orderBy("description").queryList();
+context.productFeatureCategories = from("ProductFeatureCategory").orderBy("description").queryList()
//we only need these if we will be showing the apply feature to category forms
if (productId) {
- context.productFeatureApplTypes = from("ProductFeatureApplType").orderBy("description").queryList();
+ context.productFeatureApplTypes = from("ProductFeatureApplType").orderBy("description").queryList()
}
-productFeaturesSize = from("ProductFeature").where("productFeatureCategoryId", productFeatureCategoryId).queryCount();
+productFeaturesSize = from("ProductFeature").where("productFeatureCategoryId", productFeatureCategoryId).queryCount()
-highIndex = 0;
-lowIndex = 0;
-listSize = (int) productFeaturesSize;
+highIndex = 0
+lowIndex = 0
+listSize = (int) productFeaturesSize
-viewIndex = (viewIndex) ?: 0;
+viewIndex = (viewIndex) ?: 0
-lowIndex = viewIndex * viewSize;
-highIndex = (viewIndex + 1) * viewSize;
+lowIndex = viewIndex * viewSize
+highIndex = (viewIndex + 1) * viewSize
if (listSize < highIndex) {
- highIndex = listSize;
+ highIndex = listSize
}
-context.viewIndex = viewIndex;
-context.viewSize = viewSize;
-context.listSize = listSize;
-context.lowIndex = lowIndex;
-context.highIndex = highIndex;
+context.viewIndex = viewIndex
+context.viewSize = viewSize
+context.listSize = listSize
+context.lowIndex = lowIndex
+context.highIndex = highIndex
-boolean beganTransaction = false;
+boolean beganTransaction = false
try {
- beganTransaction = TransactionUtil.begin();
+ beganTransaction = TransactionUtil.begin()
productFeaturesEli = from("ProductFeature")
.where("productFeatureCategoryId", productFeatureCategoryId)
@@ -76,38 +76,38 @@ try {
.distinct()
.cursorScrollInsensitive()
.maxRows(highIndex)
- .queryIterator();
- productFeatures = productFeaturesEli.getPartialList(lowIndex + 1, highIndex - lowIndex);
- productFeaturesEli.close();
+ .queryIterator()
+ productFeatures = productFeaturesEli.getPartialList(lowIndex + 1, highIndex - lowIndex)
+ productFeaturesEli.close()
} catch (GenericEntityException e) {
- String errMsg = "Failure in operation, rolling back transaction";
- Debug.logError(e, errMsg, module);
+ String errMsg = "Failure in operation, rolling back transaction"
+ Debug.logError(e, errMsg, module)
try {
// only rollback the transaction if we started one...
- TransactionUtil.rollback(beganTransaction, errMsg, e);
+ TransactionUtil.rollback(beganTransaction, errMsg, e)
} catch (GenericEntityException e2) {
- Debug.logError(e2, "Could not rollback transaction: " + e2.toString(), module);
+ Debug.logError(e2, "Could not rollback transaction: " + e2.toString(), module)
}
// after rolling back, rethrow the exception
- throw e;
+ throw e
} finally {
// only commit the transaction if we started one... this will throw an exception if it fails
- TransactionUtil.commit(beganTransaction);
+ TransactionUtil.commit(beganTransaction)
}
-context.productFeatures = productFeatures;
+context.productFeatures = productFeatures
-productFeatureApplMap = [:];
-productFeatureAppls = null;
-productFeatureIter = productFeatures.iterator();
-productFeatureApplIter = null;
+productFeatureApplMap = [:]
+productFeatureAppls = null
+productFeatureIter = productFeatures.iterator()
+productFeatureApplIter = null
while (productFeatureIter) {
- productFeature = productFeatureIter.next();
- productFeatureAppls = from("ProductFeatureAppl").where("productId", productId, "productFeatureId", productFeature.productFeatureId).queryList();
- productFeatureApplIter = productFeatureAppls.iterator();
+ productFeature = productFeatureIter.next()
+ productFeatureAppls = from("ProductFeatureAppl").where("productId", productId, "productFeatureId", productFeature.productFeatureId).queryList()
+ productFeatureApplIter = productFeatureAppls.iterator()
while (productFeatureApplIter) {
- productFeatureAppl = productFeatureApplIter.next();
- productFeatureApplMap.put(productFeatureAppl.productFeatureId, productFeatureAppl.productFeatureApplTypeId);
+ productFeatureAppl = productFeatureApplIter.next()
+ productFeatureApplMap.put(productFeatureAppl.productFeatureId, productFeatureAppl.productFeatureApplTypeId)
}
}
-context.productFeatureApplMap = productFeatureApplMap;
+context.productFeatureApplMap = productFeatureApplMap
diff --git a/applications/product/groovyScripts/catalog/feature/EditFeatureGroups.groovy b/applications/product/groovyScripts/catalog/feature/EditFeatureGroups.groovy
index 2044a5ce06..221e60ec0c 100644
--- a/applications/product/groovyScripts/catalog/feature/EditFeatureGroups.groovy
+++ b/applications/product/groovyScripts/catalog/feature/EditFeatureGroups.groovy
@@ -19,4 +19,4 @@
context.hasPermission = security.hasEntityPermission("CATALOG", "_VIEW", session)
-context.productFeatureGroups = from("ProductFeatureGroup").queryList();
+context.productFeatureGroups = from("ProductFeatureGroup").queryList()
diff --git a/applications/product/groovyScripts/catalog/feature/QuickAddProductFeatures.groovy b/applications/product/groovyScripts/catalog/feature/QuickAddProductFeatures.groovy
index bb6fb94c41..ff2cdb1bfb 100644
--- a/applications/product/groovyScripts/catalog/feature/QuickAddProductFeatures.groovy
+++ b/applications/product/groovyScripts/catalog/feature/QuickAddProductFeatures.groovy
@@ -17,6 +17,6 @@
* under the License.
*/
-context.productFeatureTypes = from("ProductFeatureType").orderBy("description").cache(true).queryList();
+context.productFeatureTypes = from("ProductFeatureType").orderBy("description").cache(true).queryList()
-context.featureCategory = from("ProductFeatureCategory").where("productFeatureCategoryId", parameters.productFeatureCategoryId).queryOne();
+context.featureCategory = from("ProductFeatureCategory").where("productFeatureCategoryId", parameters.productFeatureCategoryId).queryOne()
diff --git a/applications/product/groovyScripts/catalog/find/AdvancedSearchOptions.groovy b/applications/product/groovyScripts/catalog/find/AdvancedSearchOptions.groovy
index e707356d8d..64f0e34377 100644
--- a/applications/product/groovyScripts/catalog/find/AdvancedSearchOptions.groovy
+++ b/applications/product/groovyScripts/catalog/find/AdvancedSearchOptions.groovy
@@ -21,42 +21,42 @@ import org.apache.ofbiz.entity.condition.*
import org.apache.ofbiz.product.catalog.*
import org.apache.ofbiz.product.feature.*
import org.apache.ofbiz.product.product.*
-import org.apache.ofbiz.product.store.ProductStoreWorker;
-searchCategoryId = parameters.SEARCH_CATEGORY_ID;
-productStoreId = ProductStoreWorker.getProductStoreId(request);
+import org.apache.ofbiz.product.store.ProductStoreWorker
+searchCategoryId = parameters.SEARCH_CATEGORY_ID
+productStoreId = ProductStoreWorker.getProductStoreId(request)
if ((!searchCategoryId || searchCategoryId.length() == 0) && !productStoreId) {
- currentCatalogId = CatalogWorker.getCurrentCatalogId(request);
- searchCategoryId = CatalogWorker.getCatalogSearchCategoryId(request, currentCatalogId);
+ currentCatalogId = CatalogWorker.getCurrentCatalogId(request)
+ searchCategoryId = CatalogWorker.getCatalogSearchCategoryId(request, currentCatalogId)
}
-searchCategory = from("ProductCategory").where("productCategoryId", searchCategoryId).queryOne();
+searchCategory = from("ProductCategory").where("productCategoryId", searchCategoryId).queryOne()
if (searchCategoryId) {
- productFeaturesByTypeMap = ParametricSearch.makeCategoryFeatureLists(searchCategoryId, delegator, 2000);
+ productFeaturesByTypeMap = ParametricSearch.makeCategoryFeatureLists(searchCategoryId, delegator, 2000)
} else {
- productFeaturesByTypeMap = ParametricSearch.getAllFeaturesByType(delegator, 2000);
+ productFeaturesByTypeMap = ParametricSearch.getAllFeaturesByType(delegator, 2000)
}
-productFeatureTypeIdsOrdered = new ArrayList(new TreeSet(productFeaturesByTypeMap.keySet()));
+productFeatureTypeIdsOrdered = new ArrayList(new TreeSet(productFeaturesByTypeMap.keySet()))
-searchOperator = parameters.SEARCH_OPERATOR;
+searchOperator = parameters.SEARCH_OPERATOR
if (!"AND".equals(searchOperator) && !"OR".equals(searchOperator)) {
- searchOperator = "OR";
+ searchOperator = "OR"
}
-searchConstraintStrings = ProductSearchSession.searchGetConstraintStrings(false, session, delegator);
-searchSortOrderString = ProductSearchSession.searchGetSortOrderString(false, request);
+searchConstraintStrings = ProductSearchSession.searchGetConstraintStrings(false, session, delegator)
+searchSortOrderString = ProductSearchSession.searchGetSortOrderString(false, request)
// get suppliers in system
-supplerPartyRoleAndPartyDetails = from("PartyRoleAndPartyDetail").where(roleTypeId : "SUPPLIER").orderBy("groupName", "firstName").queryList();
+supplerPartyRoleAndPartyDetails = from("PartyRoleAndPartyDetail").where(roleTypeId : "SUPPLIER").orderBy("groupName", "firstName").queryList()
// get the GoodIdentification types
-goodIdentificationTypes = from("GoodIdentificationType").orderBy("description").queryList();
+goodIdentificationTypes = from("GoodIdentificationType").orderBy("description").queryList()
-context.searchCategoryId = searchCategoryId;
-context.searchCategory = searchCategory;
-context.productFeaturesByTypeMap = productFeaturesByTypeMap;
-context.productFeatureTypeIdsOrdered = productFeatureTypeIdsOrdered;
-context.searchOperator = searchOperator;
-context.searchConstraintStrings = searchConstraintStrings;
-context.searchSortOrderString = searchSortOrderString;
-context.supplerPartyRoleAndPartyDetails = supplerPartyRoleAndPartyDetails;
-context.goodIdentificationTypes = goodIdentificationTypes;
+context.searchCategoryId = searchCategoryId
+context.searchCategory = searchCategory
+context.productFeaturesByTypeMap = productFeaturesByTypeMap
+context.productFeatureTypeIdsOrdered = productFeatureTypeIdsOrdered
+context.searchOperator = searchOperator
+context.searchConstraintStrings = searchConstraintStrings
+context.searchSortOrderString = searchSortOrderString
+context.supplerPartyRoleAndPartyDetails = supplerPartyRoleAndPartyDetails
+context.goodIdentificationTypes = goodIdentificationTypes
diff --git a/applications/product/groovyScripts/catalog/find/KeywordSearch.groovy b/applications/product/groovyScripts/catalog/find/KeywordSearch.groovy
index bd665c074b..b45139439a 100644
--- a/applications/product/groovyScripts/catalog/find/KeywordSearch.groovy
+++ b/applications/product/groovyScripts/catalog/find/KeywordSearch.groovy
@@ -21,31 +21,31 @@ import org.apache.ofbiz.entity.condition.*
import org.apache.ofbiz.product.catalog.*
import org.apache.ofbiz.product.product.*
-module = "KeywordSearch.groovy";
+module = "KeywordSearch.groovy"
// note: this can be run multiple times in the same request without causing problems, will check to see on its own if it has run again
-ProductSearchSession.processSearchParameters(parameters, request);
-prodCatalogId = CatalogWorker.getCurrentCatalogId(request);
-result = ProductSearchSession.getProductSearchResult(request, delegator, prodCatalogId);
+ProductSearchSession.processSearchParameters(parameters, request)
+prodCatalogId = CatalogWorker.getCurrentCatalogId(request)
+result = ProductSearchSession.getProductSearchResult(request, delegator, prodCatalogId)
-applicationTypes = from("ProductFeatureApplType").orderBy("description").queryList();
+applicationTypes = from("ProductFeatureApplType").orderBy("description").queryList()
expr = EntityCondition.makeCondition(EntityCondition.makeCondition("showInSelect", EntityOperator.EQUALS, null),
EntityOperator.OR,
- EntityCondition.makeCondition("showInSelect", EntityOperator.NOT_EQUAL, "N"));
-productCategories = from("ProductCategory").where(expr).orderBy("description").queryList();
+ EntityCondition.makeCondition("showInSelect", EntityOperator.NOT_EQUAL, "N"))
+productCategories = from("ProductCategory").where(expr).orderBy("description").queryList()
-context.applicationTypes = applicationTypes;
-context.productCategories = productCategories;
+context.applicationTypes = applicationTypes
+context.productCategories = productCategories
-context.noConditionFind = result.noConditionFind;
-context.productIds = result.productIds;
-context.viewIndex = result.viewIndex;
-context.viewSize = result.viewSize;
-context.listSize = result.listSize;
-context.lowIndex = result.lowIndex;
-context.highIndex = result.highIndex;
-context.paging = result.paging;
-context.previousViewSize = result.previousViewSize;
-context.searchConstraintStrings = result.searchConstraintStrings;
-context.searchSortOrderString = result.searchSortOrderString;
+context.noConditionFind = result.noConditionFind
+context.productIds = result.productIds
+context.viewIndex = result.viewIndex
+context.viewSize = result.viewSize
+context.listSize = result.listSize
+context.lowIndex = result.lowIndex
+context.highIndex = result.highIndex
+context.paging = result.paging
+context.previousViewSize = result.previousViewSize
+context.searchConstraintStrings = result.searchConstraintStrings
+context.searchSortOrderString = result.searchSortOrderString
diff --git a/applications/product/groovyScripts/catalog/find/KeywordSearchBox.groovy b/applications/product/groovyScripts/catalog/find/KeywordSearchBox.groovy
index 17bb6f59ab..817e736dbd 100644
--- a/applications/product/groovyScripts/catalog/find/KeywordSearchBox.groovy
+++ b/applications/product/groovyScripts/catalog/find/KeywordSearchBox.groovy
@@ -17,15 +17,15 @@
* under the License.
*/
-state = request.getParameter("SearchProductsState");
-isOpen = true;
+state = request.getParameter("SearchProductsState")
+isOpen = true
if (state) {
- session.setAttribute("SearchProductsState", state);
- isOpen = "open".equals(state);
+ session.setAttribute("SearchProductsState", state)
+ isOpen = "open".equals(state)
} else {
- state = (String) session.getAttribute("SearchProductsState");
+ state = (String) session.getAttribute("SearchProductsState")
if (state) {
- isOpen = "open".equals(state);
+ isOpen = "open".equals(state)
}
}
-context.isOpen = isOpen;
+context.isOpen = isOpen
diff --git a/applications/product/groovyScripts/catalog/find/MiniProductList.groovy b/applications/product/groovyScripts/catalog/find/MiniProductList.groovy
index 0eed80a02d..6924dd700d 100644
--- a/applications/product/groovyScripts/catalog/find/MiniProductList.groovy
+++ b/applications/product/groovyScripts/catalog/find/MiniProductList.groovy
@@ -19,35 +19,35 @@
import org.apache.ofbiz.base.util.*
-state = request.getParameter("CategoryProductsState");
-isOpen = true;
+state = request.getParameter("CategoryProductsState")
+isOpen = true
if (state) {
- session.setAttribute("CategoryProductsState", state);
- isOpen = "open".equals(state);
+ session.setAttribute("CategoryProductsState", state)
+ isOpen = "open".equals(state)
} else {
- state = (String) session.getAttribute("CategoryProductsState");
+ state = (String) session.getAttribute("CategoryProductsState")
if (state) {
- isOpen = "open".equals(state);
+ isOpen = "open".equals(state)
}
}
-context.isOpen = isOpen;
+context.isOpen = isOpen
// Get a list of all products in the current category
if (isOpen) {
- paramInMap = [:];
- paramInMap.productCategoryId = UtilFormatOut.checkNull(request.getParameter("productCategoryId"));
- paramInMap.defaultViewSize = 30;
- paramInMap.limitView = true;
- paramInMap.useCacheForMembers = false;
- paramInMap.checkViewAllow = false;
+ paramInMap = [:]
+ paramInMap.productCategoryId = UtilFormatOut.checkNull(request.getParameter("productCategoryId"))
+ paramInMap.defaultViewSize = 30
+ paramInMap.limitView = true
+ paramInMap.useCacheForMembers = false
+ paramInMap.checkViewAllow = false
// Returns: viewIndex, viewSize, lowIndex, highIndex, listSize, productCategory, productCategoryMembers
- outMap = runService('getProductCategoryAndLimitedMembers', paramInMap);
- context.viewIndex = outMap.viewIndex;
- context.viewSize = outMap.viewSize;
- context.lowIndex = outMap.lowIndex;
- context.highIndex = outMap.highIndex;
- context.listSize = outMap.listSize;
- context.productCategory = outMap.productCategory;
- context.productCategoryMembers = outMap.productCategoryMembers;
+ outMap = runService('getProductCategoryAndLimitedMembers', paramInMap)
+ context.viewIndex = outMap.viewIndex
+ context.viewSize = outMap.viewSize
+ context.lowIndex = outMap.lowIndex
+ context.highIndex = outMap.highIndex
+ context.listSize = outMap.listSize
+ context.productCategory = outMap.productCategory
+ context.productCategoryMembers = outMap.productCategoryMembers
}
diff --git a/applications/product/groovyScripts/catalog/find/SideCatalogs.groovy b/applications/product/groovyScripts/catalog/find/SideCatalogs.groovy
index 7b07b3f186..3442a6e5cb 100644
--- a/applications/product/groovyScripts/catalog/find/SideCatalogs.groovy
+++ b/applications/product/groovyScripts/catalog/find/SideCatalogs.groovy
@@ -17,30 +17,30 @@
* under the License.
*/
-state = request.getParameter("BrowseCatalogsState");
-isOpen = true;
+state = request.getParameter("BrowseCatalogsState")
+isOpen = true
if (state) {
- session.setAttribute("BrowseCatalogsState", state);
- isOpen = "open".equals(state);
+ session.setAttribute("BrowseCatalogsState", state)
+ isOpen = "open".equals(state)
} else {
- state = (String) session.getAttribute("BrowseCatalogsState");
+ state = (String) session.getAttribute("BrowseCatalogsState")
if (state) {
- isOpen = "open".equals(state);
+ isOpen = "open".equals(state)
}
}
-context.isOpen = isOpen;
+context.isOpen = isOpen
//prodCatalogs
if (isOpen) {
- prodCatalogs = from("ProdCatalog").queryList();
- context.prodCatalogs = prodCatalogs;
+ prodCatalogs = from("ProdCatalog").queryList()
+ context.prodCatalogs = prodCatalogs
}
//get the current prodCatalogId
-curProdCatalogId = request.getParameter("prodCatalogId");
+curProdCatalogId = request.getParameter("prodCatalogId")
if (curProdCatalogId) {
- session.setAttribute("curProdCatalogId", curProdCatalogId);
+ session.setAttribute("curProdCatalogId", curProdCatalogId)
} else {
- curProdCatalogId = (String) session.getAttribute("curProdCatalogId");
+ curProdCatalogId = (String) session.getAttribute("curProdCatalogId")
}
-context.curProdCatalogId = curProdCatalogId;
+context.curProdCatalogId = curProdCatalogId
diff --git a/applications/product/groovyScripts/catalog/find/SideDeepCategory.groovy b/applications/product/groovyScripts/catalog/find/SideDeepCategory.groovy
index 717a80daeb..e306ba81c5 100644
--- a/applications/product/groovyScripts/catalog/find/SideDeepCategory.groovy
+++ b/applications/product/groovyScripts/catalog/find/SideDeepCategory.groovy
@@ -20,39 +20,39 @@
import org.apache.ofbiz.base.util.*
import org.apache.ofbiz.entity.*
import org.apache.ofbiz.product.category.*
-import org.apache.ofbiz.entity.util.EntityUtilProperties;
+import org.apache.ofbiz.entity.util.EntityUtilProperties
-state = request.getParameter("BrowseCategoriesState");
-isOpen = true;
+state = request.getParameter("BrowseCategoriesState")
+isOpen = true
if (state) {
- session.setAttribute("BrowseCategoriesState", state);
- isOpen = "open".equals(state);
+ session.setAttribute("BrowseCategoriesState", state)
+ isOpen = "open".equals(state)
} else {
- state = (String) session.getAttribute("BrowseCategoriesState");
+ state = (String) session.getAttribute("BrowseCategoriesState")
if (state) {
- isOpen = "open".equals(state);
+ isOpen = "open".equals(state)
}
}
-context.isOpen = isOpen;
+context.isOpen = isOpen
-requestParameters = UtilHttp.getParameterMap(request);
-defaultTopCategoryId = requestParameters.TOP_CATEGORY ? requestParameters.TOP_CATEGORY : EntityUtilProperties.getPropertyValue("catalog", "top.category.default", delegator);
-currentTopCategoryId = CategoryWorker.getCatalogTopCategory(request, defaultTopCategoryId);
-currentTopCategory = null;
+requestParameters = UtilHttp.getParameterMap(request)
+defaultTopCategoryId = requestParameters.TOP_CATEGORY ? requestParameters.TOP_CATEGORY : EntityUtilProperties.getPropertyValue("catalog", "top.category.default", delegator)
+currentTopCategoryId = CategoryWorker.getCatalogTopCategory(request, defaultTopCategoryId)
+currentTopCategory = null
if (isOpen) {
- CategoryWorker.getRelatedCategories(request, "topLevelList", currentTopCategoryId, false);
- currentTopCategory = from("ProductCategory").where("productCategoryId", currentTopCategoryId).cache(true).queryOne();
- context.topLevelList = request.getAttribute("topLevelList");
+ CategoryWorker.getRelatedCategories(request, "topLevelList", currentTopCategoryId, false)
+ currentTopCategory = from("ProductCategory").where("productCategoryId", currentTopCategoryId).cache(true).queryOne()
+ context.topLevelList = request.getAttribute("topLevelList")
}
-curCategoryId = UtilFormatOut.checkNull(requestParameters.productCategoryId);
-CategoryWorker.setTrail(request, curCategoryId);
+curCategoryId = UtilFormatOut.checkNull(requestParameters.productCategoryId)
+CategoryWorker.setTrail(request, curCategoryId)
-context.curCategoryId = curCategoryId;
-context.currentTopCategory = currentTopCategory;
+context.curCategoryId = curCategoryId
+context.currentTopCategory = currentTopCategory
-categoryList = request.getAttribute("topLevelList");
+categoryList = request.getAttribute("topLevelList")
if (categoryList) {
- catContentWrappers = [:];
- CategoryWorker.getCategoryContentWrappers(catContentWrappers, categoryList, request);
- context.catContentWrappers = catContentWrappers;
+ catContentWrappers = [:]
+ CategoryWorker.getCategoryContentWrappers(catContentWrappers, categoryList, request)
+ context.catContentWrappers = catContentWrappers
}
diff --git a/applications/product/groovyScripts/catalog/imagemanagement/CheckAction.groovy b/applications/product/groovyScripts/catalog/imagemanagement/CheckAction.groovy
index 40eb0ca039..c029a10239 100644
--- a/applications/product/groovyScripts/catalog/imagemanagement/CheckAction.groovy
+++ b/applications/product/groovyScripts/catalog/imagemanagement/CheckAction.groovy
@@ -17,14 +17,14 @@
* under the License.
*/
-import org.apache.ofbiz.base.util.*;
+import org.apache.ofbiz.base.util.*
-Map paramMap = UtilHttp.getParameterMap(request);
+Map paramMap = UtilHttp.getParameterMap(request)
def result
-int rowCount = UtilHttp.getMultiFormRowCount(paramMap);
+int rowCount = UtilHttp.getMultiFormRowCount(paramMap)
if (rowCount > 1) {
for (int i = 0; i < rowCount; i++) {
- String thisSuffix = UtilHttp.MULTI_ROW_DELIMITER + i;
+ String thisSuffix = UtilHttp.MULTI_ROW_DELIMITER + i
if(paramMap.get("action" +thisSuffix)){
result = paramMap.get("action" +thisSuffix)
}
@@ -34,6 +34,6 @@ else {
result = paramMap.get("action_o_0")
}
if (result == null) {
- result = "noAction";
+ result = "noAction"
}
-return result;
+return result
diff --git a/applications/product/groovyScripts/catalog/imagemanagement/CheckRejected.groovy b/applications/product/groovyScripts/catalog/imagemanagement/CheckRejected.groovy
index cce39cbfe2..fcab2ed9bf 100644
--- a/applications/product/groovyScripts/catalog/imagemanagement/CheckRejected.groovy
+++ b/applications/product/groovyScripts/catalog/imagemanagement/CheckRejected.groovy
@@ -17,14 +17,14 @@
* under the License.
*/
-import org.apache.ofbiz.base.util.*;
+import org.apache.ofbiz.base.util.*
-Map paramMap = UtilHttp.getParameterMap(request);
+Map paramMap = UtilHttp.getParameterMap(request)
def rejected = false
-int rowCount = UtilHttp.getMultiFormRowCount(paramMap);
+int rowCount = UtilHttp.getMultiFormRowCount(paramMap)
if (rowCount > 1) {
for (int i = 0; i < rowCount; i++) {
- String thisSuffix = UtilHttp.MULTI_ROW_DELIMITER + i;
+ String thisSuffix = UtilHttp.MULTI_ROW_DELIMITER + i
if(paramMap.get("checkStatusId" +thisSuffix)){
def temp = paramMap.get("checkStatusId" +thisSuffix)
def splitTemp = temp.split("/")
diff --git a/applications/product/groovyScripts/catalog/imagemanagement/ImageFrame.groovy b/applications/product/groovyScripts/catalog/imagemanagement/ImageFrame.groovy
index 01a0582e09..1806aee2ab 100644
--- a/applications/product/groovyScripts/catalog/imagemanagement/ImageFrame.groovy
+++ b/applications/product/groovyScripts/catalog/imagemanagement/ImageFrame.groovy
@@ -17,22 +17,22 @@
* under the License.
*/
-import javax.servlet.http.HttpSession;
-import org.apache.ofbiz.base.util.UtilValidate;
+import javax.servlet.http.HttpSession
+import org.apache.ofbiz.base.util.UtilValidate
-frameContentId = null;
-frameDataResourceId = null;
+frameContentId = null
+frameDataResourceId = null
if (UtilValidate.isNotEmpty(session.getAttribute("frameContentId")) && UtilValidate.isNotEmpty(session.getAttribute("frameDataResourceId"))) {
- frameContentId = session.getAttribute("frameContentId");
- frameDataResourceId = session.getAttribute("frameDataResourceId");
+ frameContentId = session.getAttribute("frameContentId")
+ frameDataResourceId = session.getAttribute("frameDataResourceId")
} else {
- frameContentId = parameters.get("frameContentId");
- frameDataResourceId = parameters.get("frameDataResourceId");
+ frameContentId = parameters.get("frameContentId")
+ frameDataResourceId = parameters.get("frameDataResourceId")
}
-context.frameContentId = frameContentId;
-context.frameDataResourceId = frameDataResourceId;
+context.frameContentId = frameContentId
+context.frameDataResourceId = frameDataResourceId
-session.removeAttribute("frameContentId");
-session.removeAttribute("frameDataResourceId");
\ No newline at end of file
+session.removeAttribute("frameContentId")
+session.removeAttribute("frameDataResourceId")
\ No newline at end of file
diff --git a/applications/product/groovyScripts/catalog/imagemanagement/ImageGallery.groovy b/applications/product/groovyScripts/catalog/imagemanagement/ImageGallery.groovy
index 9e95c23c98..5bf767a89e 100644
--- a/applications/product/groovyScripts/catalog/imagemanagement/ImageGallery.groovy
+++ b/applications/product/groovyScripts/catalog/imagemanagement/ImageGallery.groovy
@@ -22,28 +22,28 @@
* should not contain order component's specific code.
*/
-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.base.util.*
+import org.apache.ofbiz.entity.*
+import org.apache.ofbiz.entity.condition.*
+import org.apache.ofbiz.entity.util.*
-productImageList = [];
-productContentAndInfoImageManamentList = from("ProductContentAndInfo").where("productId", productId, "productContentTypeId", "IMAGE", "statusId", "IM_APPROVED").orderBy("sequenceNum").queryList();
+productImageList = []
+productContentAndInfoImageManamentList = from("ProductContentAndInfo").where("productId", productId, "productContentTypeId", "IMAGE", "statusId", "IM_APPROVED").orderBy("sequenceNum").queryList()
if(productContentAndInfoImageManamentList) {
productContentAndInfoImageManamentList.each { productContentAndInfoImageManament ->
- contentAssocThumb = from("ContentAssoc").where("contentId", productContentAndInfoImageManament.contentId, "contentAssocTypeId", "IMAGE_THUMBNAIL").queryFirst();
+ contentAssocThumb = from("ContentAssoc").where("contentId", productContentAndInfoImageManament.contentId, "contentAssocTypeId", "IMAGE_THUMBNAIL").queryFirst()
if(contentAssocThumb) {
- imageContentThumb = from("Content").where("contentId", contentAssocThumb.contentIdTo).queryOne();
+ imageContentThumb = from("Content").where("contentId", contentAssocThumb.contentIdTo).queryOne()
if(imageContentThumb) {
- productImageThumb = from("ContentDataResourceView").where("contentId", imageContentThumb.contentId, "drDataResourceId", imageContentThumb.dataResourceId).queryOne();
- productImageMap = [:];
- productImageMap.contentId = productContentAndInfoImageManament.contentId;
- productImageMap.dataResourceId = productContentAndInfoImageManament.dataResourceId;
- productImageMap.productImageThumb = productImageThumb.drObjectInfo;
- productImageMap.productImage = productContentAndInfoImageManament.drObjectInfo;
- productImageList.add(productImageMap);
+ productImageThumb = from("ContentDataResourceView").where("contentId", imageContentThumb.contentId, "drDataResourceId", imageContentThumb.dataResourceId).queryOne()
+ productImageMap = [:]
+ productImageMap.contentId = productContentAndInfoImageManament.contentId
+ productImageMap.dataResourceId = productContentAndInfoImageManament.dataResourceId
+ productImageMap.productImageThumb = productImageThumb.drObjectInfo
+ productImageMap.productImage = productContentAndInfoImageManament.drObjectInfo
+ productImageList.add(productImageMap)
}
}
}
- context.productImageList = productImageList;
+ context.productImageList = productImageList
}
diff --git a/applications/product/groovyScripts/catalog/imagemanagement/ImageRecentlyApproved.groovy b/applications/product/groovyScripts/catalog/imagemanagement/ImageRecentlyApproved.groovy
index 802e48c5f7..1149cc8b3a 100644
--- a/applications/product/groovyScripts/catalog/imagemanagement/ImageRecentlyApproved.groovy
+++ b/applications/product/groovyScripts/catalog/imagemanagement/ImageRecentlyApproved.groovy
@@ -17,13 +17,13 @@
* under the License.
*/
-import org.apache.ofbiz.base.util.*;
-import org.apache.ofbiz.entity.util.*;
-import java.text.SimpleDateFormat;
-import java.util.List;
-import java.util.Set;
-import org.apache.ofbiz.entity.condition.EntityCondition;
-import org.apache.ofbiz.entity.condition.EntityOperator;
+import org.apache.ofbiz.base.util.*
+import org.apache.ofbiz.entity.util.*
+import java.text.SimpleDateFormat
+import java.util.List
+import java.util.Set
+import org.apache.ofbiz.entity.condition.EntityCondition
+import org.apache.ofbiz.entity.condition.EntityOperator
import org.apache.ofbiz.entity.util.EntityFindOptions
def limit = 13 // set number of days
@@ -46,10 +46,10 @@ for(i in 0..limit){
exprs.add(EntityCondition.makeCondition("purchaseFromDate", EntityOperator.GREATER_THAN_EQUAL_TO, timeStampDate1))
exprs.add(EntityCondition.makeCondition("purchaseFromDate", EntityOperator.LESS_THAN, timeStampDate2))
// query result
- def productContentAndInfoList = select("productId").from("ProductContentAndInfo").where(exprs).distinct().queryList();
+ def productContentAndInfoList = select("productId").from("ProductContentAndInfo").where(exprs).distinct().queryList()
// finding time
- def timeList = from("ProductContentAndInfo").where(exprs).orderBy("productId").queryList();
+ def timeList = from("ProductContentAndInfo").where(exprs).orderBy("productId").queryList()
def groupByTimeList = timeList.groupBy{it.productId}
def tempTimeList = []
groupByTimeList.each() {
@@ -65,34 +65,34 @@ for(i in 0..limit){
def showDate = sdf2.format(today-i)
switch (i) {
- case 0: context.approved_0 = productContentAndInfoList; context.time_0 = time; context.date0 = showDate;
- context.timeStampDate1_0 = timeStampDate1; context.timeStampDate2_0 = timeStampDate2; break;
- case 1: context.approved_1 = productContentAndInfoList; context.time_1 = time; context.date1 = showDate;
- context.timeStampDate1_1 = timeStampDate1; context.timeStampDate2_1 = timeStampDate2; break;
- case 2: context.approved_2 = productContentAndInfoList; context.time_2 = time; context.date2 = showDate;
- context.timeStampDate1_2 = timeStampDate1; context.timeStampDate2_2 = timeStampDate2; break;
- case 3: context.approved_3 = productContentAndInfoList; context.time_3 = time; context.date3 = showDate;
- context.timeStampDate1_3 = timeStampDate1; context.timeStampDate2_3 = timeStampDate2; break;
- case 4: context.approved_4 = productContentAndInfoList; context.time_4 = time; context.date4 = showDate;
- context.timeStampDate1_4 = timeStampDate1; context.timeStampDate2_4 = timeStampDate2; break;
- case 5: context.approved_5 = productContentAndInfoList; context.time_5 = time; context.date5 = showDate;
- context.timeStampDate1_5 = timeStampDate1; context.timeStampDate2_5 = timeStampDate2; break;
- case 6: context.approved_6 = productContentAndInfoList; context.time_6 = time; context.date6 = showDate;
- context.timeStampDate1_6 = timeStampDate1; context.timeStampDate2_6 = timeStampDate2; break;
- case 7: context.approved_7 = productContentAndInfoList; context.time_7 = time; context.date7 = showDate;
- context.timeStampDate1_7 = timeStampDate1; context.timeStampDate2_7 = timeStampDate2; break;
- case 8: context.approved_8 = productContentAndInfoList; context.time_8 = time; context.date8 = showDate;
- context.timeStampDate1_8 = timeStampDate1; context.timeStampDate2_8 = timeStampDate2; break;
- case 9: context.approved_9 = productContentAndInfoList; context.time_9 = time; context.date9 = showDate;
- context.timeStampDate1_9 = timeStampDate1; context.timeStampDate2_9 = timeStampDate2; break;
- case 10: context.approved_10 = productContentAndInfoList; context.time_10 = time; context.date10 = showDate;
- context.timeStampDate1_10 = timeStampDate1; context.timeStampDate2_10 = timeStampDate2; break;
- case 11: context.approved_11 = productContentAndInfoList; context.time_11 = time; context.date11 = showDate;
- context.timeStampDate1_11 = timeStampDate1; context.timeStampDate2_11 = timeStampDate2; break;
- case 12: context.approved_12 = productContentAndInfoList; context.time_12 = time; context.date12 = showDate;
- context.timeStampDate1_12 = timeStampDate1; context.timeStampDate2_12 = timeStampDate2; break;
- case 13: context.approved_13 = productContentAndInfoList; context.time_13 = time; context.date13 = showDate;
- context.timeStampDate1_13 = timeStampDate1; context.timeStampDate2_13 = timeStampDate2; break;
- default: context.error = "error";
+ case 0: context.approved_0 = productContentAndInfoList; context.time_0 = time; context.date0 = showDate
+ context.timeStampDate1_0 = timeStampDate1; context.timeStampDate2_0 = timeStampDate2; break
+ case 1: context.approved_1 = productContentAndInfoList; context.time_1 = time; context.date1 = showDate
+ context.timeStampDate1_1 = timeStampDate1; context.timeStampDate2_1 = timeStampDate2; break
+ case 2: context.approved_2 = productContentAndInfoList; context.time_2 = time; context.date2 = showDate
+ context.timeStampDate1_2 = timeStampDate1; context.timeStampDate2_2 = timeStampDate2; break
+ case 3: context.approved_3 = productContentAndInfoList; context.time_3 = time; context.date3 = showDate
+ context.timeStampDate1_3 = timeStampDate1; context.timeStampDate2_3 = timeStampDate2; break
+ case 4: context.approved_4 = productContentAndInfoList; context.time_4 = time; context.date4 = showDate
+ context.timeStampDate1_4 = timeStampDate1; context.timeStampDate2_4 = timeStampDate2; break
+ case 5: context.approved_5 = productContentAndInfoList; context.time_5 = time; context.date5 = showDate
+ context.timeStampDate1_5 = timeStampDate1; context.timeStampDate2_5 = timeStampDate2; break
+ case 6: context.approved_6 = productContentAndInfoList; context.time_6 = time; context.date6 = showDate
+ context.timeStampDate1_6 = timeStampDate1; context.timeStampDate2_6 = timeStampDate2; break
+ case 7: context.approved_7 = productContentAndInfoList; context.time_7 = time; context.date7 = showDate
+ context.timeStampDate1_7 = timeStampDate1; context.timeStampDate2_7 = timeStampDate2; break
+ case 8: context.approved_8 = productContentAndInfoList; context.time_8 = time; context.date8 = showDate
+ context.timeStampDate1_8 = timeStampDate1; context.timeStampDate2_8 = timeStampDate2; break
+ case 9: context.approved_9 = productContentAndInfoList; context.time_9 = time; context.date9 = showDate
+ context.timeStampDate1_9 = timeStampDate1; context.timeStampDate2_9 = timeStampDate2; break
+ case 10: context.approved_10 = productContentAndInfoList; context.time_10 = time; context.date10 = showDate
+ context.timeStampDate1_10 = timeStampDate1; context.timeStampDate2_10 = timeStampDate2; break
+ case 11: context.approved_11 = productContentAndInfoList; context.time_11 = time; context.date11 = showDate
+ context.timeStampDate1_11 = timeStampDate1; context.timeStampDate2_11 = timeStampDate2; break
+ case 12: context.approved_12 = productContentAndInfoList; context.time_12 = time; context.date12 = showDate
+ context.timeStampDate1_12 = timeStampDate1; context.timeStampDate2_12 = timeStampDate2; break
+ case 13: context.approved_13 = productContentAndInfoList; context.time_13 = time; context.date13 = showDate
+ context.timeStampDate1_13 = timeStampDate1; context.timeStampDate2_13 = timeStampDate2; break
+ default: context.error = "error"
}
}
diff --git a/applications/product/groovyScripts/catalog/imagemanagement/ImageUpload.groovy b/applications/product/groovyScripts/catalog/imagemanagement/ImageUpload.groovy
index 89bb2c1ed5..5f63db1851 100644
--- a/applications/product/groovyScripts/catalog/imagemanagement/ImageUpload.groovy
+++ b/applications/product/groovyScripts/catalog/imagemanagement/ImageUpload.groovy
@@ -17,133 +17,133 @@
* under the License.
*/
-import org.apache.ofbiz.entity.*;
-import org.apache.ofbiz.base.util.*;
-import org.apache.ofbiz.base.util.string.*;
-import org.apache.ofbiz.entity.util.EntityUtilProperties;
-import org.apache.ofbiz.product.image.ScaleImage;
+import org.apache.ofbiz.entity.*
+import org.apache.ofbiz.base.util.*
+import org.apache.ofbiz.base.util.string.*
+import org.apache.ofbiz.entity.util.EntityUtilProperties
+import org.apache.ofbiz.product.image.ScaleImage
import org.apache.ofbiz.entity.condition.*
-context.nowTimestampString = UtilDateTime.nowTimestamp().toString();
+context.nowTimestampString = UtilDateTime.nowTimestamp().toString()
// make the image file formats
-context.tenantId = delegator.getDelegatorTenantId();
-imageFilenameFormat = EntityUtilProperties.getPropertyValue('catalog', 'image.filename.format', delegator);
-imageServerPath = FlexibleStringExpander.expandString(EntityUtilProperties.getPropertyValue("catalog", "image.server.path", delegator), context);
-imageUrlPrefix = FlexibleStringExpander.expandString(EntityUtilProperties.getPropertyValue("catalog", "image.url.prefix",delegator), context);
-imageServerPath = imageServerPath.endsWith("/") ? imageServerPath.substring(0, imageServerPath.length()-1) : imageServerPath;
-imageUrlPrefix = imageUrlPrefix.endsWith("/") ? imageUrlPrefix.substring(0, imageUrlPrefix.length()-1) : imageUrlPrefix;
-context.imageFilenameFormat = imageFilenameFormat;
-context.imageServerPath = imageServerPath;
-context.imageUrlPrefix = imageUrlPrefix;
+context.tenantId = delegator.getDelegatorTenantId()
+imageFilenameFormat = EntityUtilProperties.getPropertyValue('catalog', 'image.filename.format', delegator)
+imageServerPath = FlexibleStringExpander.expandString(EntityUtilProperties.getPropertyValue("catalog", "image.server.path", delegator), context)
+imageUrlPrefix = FlexibleStringExpander.expandString(EntityUtilProperties.getPropertyValue("catalog", "image.url.prefix",delegator), context)
+imageServerPath = imageServerPath.endsWith("/") ? imageServerPath.substring(0, imageServerPath.length()-1) : imageServerPath
+imageUrlPrefix = imageUrlPrefix.endsWith("/") ? imageUrlPrefix.substring(0, imageUrlPrefix.length()-1) : imageUrlPrefix
+context.imageFilenameFormat = imageFilenameFormat
+context.imageServerPath = imageServerPath
+context.imageUrlPrefix = imageUrlPrefix
-filenameExpander = FlexibleStringExpander.getInstance(imageFilenameFormat);
-context.imageNameSmall = imageUrlPrefix + "/" + filenameExpander.expandString([location : 'products', type : 'small' , id : productId]);
-context.imageNameMedium = imageUrlPrefix + "/" + filenameExpander.expandString([location : 'products', type : 'medium', id : productId]);
-context.imageNameLarge = imageUrlPrefix + "/" + filenameExpander.expandString([location : 'products', type : 'large' , id : productId]);
-context.imageNameDetail = imageUrlPrefix + "/" + filenameExpander.expandString([location : 'products', type : 'detail', id : productId]);
-context.imageNameOriginal = imageUrlPrefix + "/" + filenameExpander.expandString([location : 'products', type : 'original', id : productId]);
+filenameExpander = FlexibleStringExpander.getInstance(imageFilenameFormat)
+context.imageNameSmall = imageUrlPrefix + "/" + filenameExpander.expandString([location : 'products', type : 'small' , id : productId])
+context.imageNameMedium = imageUrlPrefix + "/" + filenameExpander.expandString([location : 'products', type : 'medium', id : productId])
+context.imageNameLarge = imageUrlPrefix + "/" + filenameExpander.expandString([location : 'products', type : 'large' , id : productId])
+context.imageNameDetail = imageUrlPrefix + "/" + filenameExpander.expandString([location : 'products', type : 'detail', id : productId])
+context.imageNameOriginal = imageUrlPrefix + "/" + filenameExpander.expandString([location : 'products', type : 'original', id : productId])
// Start ProductContent stuff
-productContent = null;
+productContent = null
if (product) {
- productContent = product.getRelated('ProductContent', null, ['productContentTypeId'], false);
+ productContent = product.getRelated('ProductContent', null, ['productContentTypeId'], false)
}
-context.productContent = productContent;
+context.productContent = productContent
// End ProductContent stuff
-tryEntity = true;
+tryEntity = true
if (request.getAttribute("_ERROR_MESSAGE_")) {
- tryEntity = false;
+ tryEntity = false
}
if (!product) {
- tryEntity = false;
+ tryEntity = false
}
if ("true".equalsIgnoreCase((String) request.getParameter("tryEntity"))) {
- tryEntity = true;
+ tryEntity = true
}
-context.tryEntity = tryEntity;
+context.tryEntity = tryEntity
// UPLOADING STUFF
-forLock = new Object();
-contentType = null;
-String fileType = request.getParameter("upload_file_type");
+forLock = new Object()
+contentType = null
+String fileType = request.getParameter("upload_file_type")
if (fileType) {
- context.fileType = fileType;
+ context.fileType = fileType
- fileLocation = filenameExpander.expandString([location : 'products', type : fileType, id : productId]);
- filePathPrefix = "";
- filenameToUse = fileLocation;
+ fileLocation = filenameExpander.expandString([location : 'products', type : fileType, id : productId])
+ filePathPrefix = ""
+ filenameToUse = fileLocation
if (fileLocation.lastIndexOf("/") != -1) {
- filePathPrefix = fileLocation.substring(0, fileLocation.lastIndexOf("/") + 1); // adding 1 to include the trailing slash
- filenameToUse = fileLocation.substring(fileLocation.lastIndexOf("/") + 1);
+ filePathPrefix = fileLocation.substring(0, fileLocation.lastIndexOf("/") + 1) // adding 1 to include the trailing slash
+ filenameToUse = fileLocation.substring(fileLocation.lastIndexOf("/") + 1)
}
- int i1;
+ int i1
if (contentType && (i1 = contentType.indexOf("boundary=")) != -1) {
- contentType = contentType.substring(i1 + 9);
- contentType = "--" + contentType;
+ contentType = contentType.substring(i1 + 9)
+ contentType = "--" + contentType
}
- defaultFileName = filenameToUse + "_temp";
- uploadObject = new HttpRequestFileUpload();
- uploadObject.setOverrideFilename(defaultFileName);
- uploadObject.setSavePath(imageServerPath + "/" + filePathPrefix);
- uploadObject.doUpload(request);
+ defaultFileName = filenameToUse + "_temp"
+ uploadObject = new HttpRequestFileUpload()
+ uploadObject.setOverrideFilename(defaultFileName)
+ uploadObject.setSavePath(imageServerPath + "/" + filePathPrefix)
+ uploadObject.doUpload(request)
- clientFileName = uploadObject.getFilename();
+ clientFileName = uploadObject.getFilename()
if (clientFileName) {
- context.clientFileName = clientFileName;
+ context.clientFileName = clientFileName
}
if (clientFileName && clientFileName.length() > 0) {
if (clientFileName.lastIndexOf(".") > 0 && clientFileName.lastIndexOf(".") < clientFileName.length()) {
- filenameToUse += clientFileName.substring(clientFileName.lastIndexOf("."));
+ filenameToUse += clientFileName.substring(clientFileName.lastIndexOf("."))
} else {
- filenameToUse += ".jpg";
+ filenameToUse += ".jpg"
}
- context.clientFileName = clientFileName;
- context.filenameToUse = filenameToUse;
+ context.clientFileName = clientFileName
+ context.filenameToUse = filenameToUse
- characterEncoding = request.getCharacterEncoding();
- imageUrl = imageUrlPrefix + "/" + filePathPrefix + java.net.URLEncoder.encode(filenameToUse, characterEncoding);
+ characterEncoding = request.getCharacterEncoding()
+ imageUrl = imageUrlPrefix + "/" + filePathPrefix + java.net.URLEncoder.encode(filenameToUse, characterEncoding)
try {
- file = new File(imageServerPath + "/" + filePathPrefix, defaultFileName);
- file1 = new File(imageServerPath + "/" + filePathPrefix, filenameToUse);
+ file = new File(imageServerPath + "/" + filePathPrefix, defaultFileName)
+ file1 = new File(imageServerPath + "/" + filePathPrefix, filenameToUse)
try {
- file1.delete();
+ file1.delete()
} catch (Exception e) {
- System.out.println("error deleting existing file (not neccessarily a problem)");
+ System.out.println("error deleting existing file (not neccessarily a problem)")
}
- file.renameTo(file1);
+ file.renameTo(file1)
} catch (Exception e) {
- e.printStackTrace();
+ e.printStackTrace()
}
if (imageUrl && imageUrl.length() > 0) {
- context.imageUrl = imageUrl;
- product.set(fileType + "ImageUrl", imageUrl);
+ context.imageUrl = imageUrl
+ product.set(fileType + "ImageUrl", imageUrl)
// call scaleImageInAllSize
if (fileType.equals("original")) {
- context.delegator = delegator;
- result = ScaleImage.scaleImageInAllSize(context, filenameToUse, "main", "0");
+ context.delegator = delegator
+ result = ScaleImage.scaleImageInAllSize(context, filenameToUse, "main", "0")
if (result.containsKey("responseMessage") && result.get("responseMessage").equals("success")) {
- imgMap = result.get("imageUrlMap");
+ imgMap = result.get("imageUrlMap")
imgMap.each() { key, value ->
- product.set(key + "ImageUrl", value);
+ product.set(key + "ImageUrl", value)
}
}
}
- product.store();
+ product.store()
}
}
}
-context.productFeatures = from("ProductFeature").where("productFeatureTypeId", "SIZE", "productFeatureCategoryId", "IMAGE").queryList();
+context.productFeatures = from("ProductFeature").where("productFeatureTypeId", "SIZE", "productFeatureCategoryId", "IMAGE").queryList()
diff --git a/applications/product/groovyScripts/catalog/imagemanagement/SeoLocales.groovy b/applications/product/groovyScripts/catalog/imagemanagement/SeoLocales.groovy
index 38f3f212b2..024d6a0943 100644
--- a/applications/product/groovyScripts/catalog/imagemanagement/SeoLocales.groovy
+++ b/applications/product/groovyScripts/catalog/imagemanagement/SeoLocales.groovy
@@ -24,50 +24,50 @@ import org.apache.ofbiz.entity.model.*
import javax.servlet.*
import javax.servlet.http.*
-Locale locale = UtilHttp.getLocale(request);
-String serverName = request.getServerName();
-String serverLocal = serverName.substring(serverName.lastIndexOf(".") + 1);
+Locale locale = UtilHttp.getLocale(request)
+String serverName = request.getServerName()
+String serverLocal = serverName.substring(serverName.lastIndexOf(".") + 1)
-def nameLocal;
-def productTextData;
+def nameLocal
+def productTextData
contentAssocs.each { contentAssoc ->
-content = from("Content").where("contentId", contentAssoc.contentIdTo).queryOne();
-localeString = content.localeString;
+content = from("Content").where("contentId", contentAssoc.contentIdTo).queryOne()
+localeString = content.localeString
if (serverLocal == "au") {
- nameLocal = "en_AU";
+ nameLocal = "en_AU"
} else if (serverLocal == "ca") {
- nameLocal = "en_CA";
+ nameLocal = "en_CA"
} else if (serverLocal == "de") {
- nameLocal = "de";
+ nameLocal = "de"
} else if (serverLocal == "ie") {
- nameLocal = "en_IE";
+ nameLocal = "en_IE"
} else if (serverLocal == "fr") {
- nameLocal = "fr";
+ nameLocal = "fr"
} else if (serverLocal == "es") {
- nameLocal = "es";
+ nameLocal = "es"
} else if (serverLocal == "it") {
- nameLocal = "it";
+ nameLocal = "it"
} else if (serverLocal == "uk") {
- nameLocal = "en_GB";
+ nameLocal = "en_GB"
} else if (serverLocal == "sg") {
- nameLocal = "en_SG";
+ nameLocal = "en_SG"
} else {
- nameLocal = "en_US";
+ nameLocal = "en_US"
}
if (localeString == nameLocal) {
- electronicText = from("ElectronicText").where("dataResourceId", content.dataResourceId).queryOne();
- productTextData = electronicText.textData;
+ electronicText = from("ElectronicText").where("dataResourceId", content.dataResourceId).queryOne()
+ productTextData = electronicText.textData
}
}
if (productTextData == null) {
- context.productTextData = product.productName;
+ context.productTextData = product.productName
} else {
- context.productTextData = productTextData;
+ context.productTextData = productTextData
}
diff --git a/applications/product/groovyScripts/catalog/imagemanagement/SetDefaultImage.groovy b/applications/product/groovyScripts/catalog/imagemanagement/SetDefaultImage.groovy
index db1a51a664..fdd0c06569 100644
--- a/applications/product/groovyScripts/catalog/imagemanagement/SetDefaultImage.groovy
+++ b/applications/product/groovyScripts/catalog/imagemanagement/SetDefaultImage.groovy
@@ -17,169 +17,169 @@
* under the License.
*/
-import java.awt.image.BufferedImage;
-import java.awt.image.RenderedImage;
-import java.io.File;
-import java.util.List;
+import java.awt.image.BufferedImage
+import java.awt.image.RenderedImage
+import java.io.File
+import java.util.List
-import javax.imageio.ImageIO;
+import javax.imageio.ImageIO
-import org.apache.ofbiz.entity.*;
-import org.apache.ofbiz.entity.util.EntityUtil;
-import org.apache.ofbiz.entity.util.EntityUtilProperties;
-import org.apache.ofbiz.base.util.*;
-import org.apache.ofbiz.base.util.string.*;
-import org.apache.ofbiz.product.image.ScaleImage;
+import org.apache.ofbiz.entity.*
+import org.apache.ofbiz.entity.util.EntityUtil
+import org.apache.ofbiz.entity.util.EntityUtilProperties
+import org.apache.ofbiz.base.util.*
+import org.apache.ofbiz.base.util.string.*
+import org.apache.ofbiz.product.image.ScaleImage
-context.nowTimestampString = UtilDateTime.nowTimestamp().toString();
+context.nowTimestampString = UtilDateTime.nowTimestamp().toString()
-imageManagementPath = FlexibleStringExpander.expandString(EntityUtilProperties.getPropertyValue("catalog", "image.management.path", delegator), context);
+imageManagementPath = FlexibleStringExpander.expandString(EntityUtilProperties.getPropertyValue("catalog", "image.management.path", delegator), context)
-String fileType = "original";
-String productId = request.getParameter("productId");
+String fileType = "original"
+String productId = request.getParameter("productId")
-productContentList = from("ProductContentAndInfo").where("productId", productId, "productContentTypeId", "DEFAULT_IMAGE").queryList();
+productContentList = from("ProductContentAndInfo").where("productId", productId, "productContentTypeId", "DEFAULT_IMAGE").queryList()
if (productContentList) {
dataResourceName = productContentList.get(0).drDataResourceName
}
// make the image file formats
-context.tenantId = delegator.getDelegatorTenantId();
-imageFilenameFormat = EntityUtilProperties.getPropertyValue('catalog', 'image.filename.format', delegator);
-imageServerPath = FlexibleStringExpander.expandString(EntityUtilProperties.getPropertyValue("catalog", "image.server.path", delegator), context);
-imageUrlPrefix = FlexibleStringExpander.expandString(EntityUtilProperties.getPropertyValue("catalog", "image.url.prefix",delegator), context);
-imageServerPath = imageServerPath.endsWith("/") ? imageServerPath.substring(0, imageServerPath.length()-1) : imageServerPath;
-imageUrlPrefix = imageUrlPrefix.endsWith("/") ? imageUrlPrefix.substring(0, imageUrlPrefix.length()-1) : imageUrlPrefix;
-context.imageFilenameFormat = imageFilenameFormat;
-context.imageServerPath = imageServerPath;
-context.imageUrlPrefix = imageUrlPrefix;
+context.tenantId = delegator.getDelegatorTenantId()
+imageFilenameFormat = EntityUtilProperties.getPropertyValue('catalog', 'image.filename.format', delegator)
+imageServerPath = FlexibleStringExpander.expandString(EntityUtilProperties.getPropertyValue("catalog", "image.server.path", delegator), context)
+imageUrlPrefix = FlexibleStringExpander.expandString(EntityUtilProperties.getPropertyValue("catalog", "image.url.prefix",delegator), context)
+imageServerPath = imageServerPath.endsWith("/") ? imageServerPath.substring(0, imageServerPath.length()-1) : imageServerPath
+imageUrlPrefix = imageUrlPrefix.endsWith("/") ? imageUrlPrefix.substring(0, imageUrlPrefix.length()-1) : imageUrlPrefix
+context.imageFilenameFormat = imageFilenameFormat
+context.imageServerPath = imageServerPath
+context.imageUrlPrefix = imageUrlPrefix
-filenameExpander = FlexibleStringExpander.getInstance(imageFilenameFormat);
-context.imageNameSmall = imageUrlPrefix + "/" + filenameExpander.expandString([location : 'products', id : productId, type : 'small']);
-context.imageNameMedium = imageUrlPrefix + "/" + filenameExpander.expandString([location : 'products', id : productId, type : 'medium']);
-context.imageNameLarge = imageUrlPrefix + "/" + filenameExpander.expandString([location : 'products', id : productId, type : 'large']);
-context.imageNameDetail = imageUrlPrefix + "/" + filenameExpander.expandString([location : 'products', id : productId, type : 'detail']);
-context.imageNameOriginal = imageUrlPrefix + "/" + filenameExpander.expandString([location : 'products', id : productId, type : 'original']);
+filenameExpander = FlexibleStringExpander.getInstance(imageFilenameFormat)
+context.imageNameSmall = imageUrlPrefix + "/" + filenameExpander.expandString([location : 'products', id : productId, type : 'small'])
+context.imageNameMedium = imageUrlPrefix + "/" + filenameExpander.expandString([location : 'products', id : productId, type : 'medium'])
+context.imageNameLarge = imageUrlPrefix + "/" + filenameExpander.expandString([location : 'products', id : productId, type : 'large'])
+context.imageNameDetail = imageUrlPrefix + "/" + filenameExpander.expandString([location : 'products', id : productId, type : 'detail'])
+context.imageNameOriginal = imageUrlPrefix + "/" + filenameExpander.expandString([location : 'products', id : productId, type : 'original'])
// Start ProductContent stuff
if (productId) {
- product = from("Product").where("productId", productId).queryOne();
- context.productId = productId;
+ product = from("Product").where("productId", productId).queryOne()
+ context.productId = productId
}
-productContent = null;
+productContent = null
if (product) {
- productContent = product.getRelated('ProductContent', null, ['productContentTypeId'], false);
+ productContent = product.getRelated('ProductContent', null, ['productContentTypeId'], false)
}
-context.productContent = productContent;
+context.productContent = productContent
// End ProductContent stuff
-tryEntity = true;
+tryEntity = true
if (request.getAttribute("_ERROR_MESSAGE_")) {
- tryEntity = false;
+ tryEntity = false
}
if (!product) {
- tryEntity = false;
+ tryEntity = false
}
if ("true".equalsIgnoreCase((String) request.getParameter("tryEntity"))) {
- tryEntity = true;
+ tryEntity = true
}
-context.tryEntity = tryEntity;
+context.tryEntity = tryEntity
//UPLOADING STUFF
-forLock = new Object();
-contentType = null;
+forLock = new Object()
+contentType = null
if (fileType) {
- context.fileType = fileType;
+ context.fileType = fileType
- fileLocation = filenameExpander.expandString([location : 'products', id : productId, type : fileType]);
- filePathPrefix = "";
- filenameToUse = fileLocation;
+ fileLocation = filenameExpander.expandString([location : 'products', id : productId, type : fileType])
+ filePathPrefix = ""
+ filenameToUse = fileLocation
if (fileLocation.lastIndexOf("/") != -1) {
- filePathPrefix = fileLocation.substring(0, fileLocation.lastIndexOf("/") + 1); // adding 1 to include the trailing slash
- filenameToUse = fileLocation.substring(fileLocation.lastIndexOf("/") + 1);
+ filePathPrefix = fileLocation.substring(0, fileLocation.lastIndexOf("/") + 1) // adding 1 to include the trailing slash
+ filenameToUse = fileLocation.substring(fileLocation.lastIndexOf("/") + 1)
}
- int i1;
+ int i1
if (contentType && (i1 = contentType.indexOf("boundary=")) != -1) {
- contentType = contentType.substring(i1 + 9);
- contentType = "--" + contentType;
+ contentType = contentType.substring(i1 + 9)
+ contentType = "--" + contentType
}
- defaultFileName = "temp_" + dataResourceName;
- checkPathFile = imageManagementPath + "/" + productId + "/" + dataResourceName;
+ defaultFileName = "temp_" + dataResourceName
+ checkPathFile = imageManagementPath + "/" + productId + "/" + dataResourceName
if (checkPathFile.equals(productContentList.get(0).drObjectInfo)) {
- BufferedImage bufImg = ImageIO.read(new File(imageManagementPath + "/" + productId + "/" + dataResourceName));
+ BufferedImage bufImg = ImageIO.read(new File(imageManagementPath + "/" + productId + "/" + dataResourceName))
} else {
- BufferedImage bufImg = ImageIO.read(new File(productContentList.get(0).drObjectInfo));
+ BufferedImage bufImg = ImageIO.read(new File(productContentList.get(0).drObjectInfo))
}
- ImageIO.write((RenderedImage) bufImg, "jpg", new File(imageManagementPath + "/" + productId + "/" + defaultFileName));
+ ImageIO.write((RenderedImage) bufImg, "jpg", new File(imageManagementPath + "/" + productId + "/" + defaultFileName))
- clientFileName = dataResourceName;
+ clientFileName = dataResourceName
if (clientFileName) {
- context.clientFileName = clientFileName;
+ context.clientFileName = clientFileName
}
if (clientFileName && clientFileName.length() > 0) {
if (clientFileName.lastIndexOf(".") > 0 && clientFileName.lastIndexOf(".") < clientFileName.length()) {
- filenameToUse += clientFileName.substring(clientFileName.lastIndexOf("."));
+ filenameToUse += clientFileName.substring(clientFileName.lastIndexOf("."))
} else {
- filenameToUse += ".jpg";
+ filenameToUse += ".jpg"
}
- context.clientFileName = clientFileName;
- context.filenameToUse = filenameToUse;
+ context.clientFileName = clientFileName
+ context.filenameToUse = filenameToUse
- characterEncoding = request.getCharacterEncoding();
- imageUrl = imageUrlPrefix + "/" + filePathPrefix + java.net.URLEncoder.encode(filenameToUse, characterEncoding);
+ characterEncoding = request.getCharacterEncoding()
+ imageUrl = imageUrlPrefix + "/" + filePathPrefix + java.net.URLEncoder.encode(filenameToUse, characterEncoding)
try {
- file = new File(imageManagementPath + "/" + productId + "/" + defaultFileName);
- file1 = new File(imageServerPath + "/" + filePathPrefix, filenameToUse);
+ file = new File(imageManagementPath + "/" + productId + "/" + defaultFileName)
+ file1 = new File(imageServerPath + "/" + filePathPrefix, filenameToUse)
try {
// Delete existing image files
- File targetDir = new File(imageServerPath + "/" + filePathPrefix);
+ File targetDir = new File(imageServerPath + "/" + filePathPrefix)
// Images are ordered by productId (${location}/${id}/${viewtype}/${sizetype})
if (!filenameToUse.startsWith(productId + ".")) {
- File[] files = targetDir.listFiles();
+ File[] files = targetDir.listFiles()
for(File file : files) {
- if (file.isFile() && !file.getName().equals(defaultFileName)) file.delete();
+ if (file.isFile() && !file.getName().equals(defaultFileName)) file.delete()
}
// Images aren't ordered by productId (${location}/${viewtype}/${sizetype}/${id}) !!! BE CAREFUL !!!
} else {
- File[] files = targetDir.listFiles();
+ File[] files = targetDir.listFiles()
for(File file : files) {
- if (file.isFile() && !file.getName().equals(defaultFileName) && file.getName().startsWith(productId + ".")) file.delete();
+ if (file.isFile() && !file.getName().equals(defaultFileName) && file.getName().startsWith(productId + ".")) file.delete()
}
}
} catch (Exception e) {
- System.out.println("error deleting existing file (not neccessarily a problem)");
+ System.out.println("error deleting existing file (not neccessarily a problem)")
}
- file.renameTo(file1);
+ file.renameTo(file1)
} catch (Exception e) {
- e.printStackTrace();
+ e.printStackTrace()
}
if (imageUrl && imageUrl.length() > 0) {
- context.imageUrl = imageUrl;
- product.set(fileType + "ImageUrl", imageUrl);
+ context.imageUrl = imageUrl
+ product.set(fileType + "ImageUrl", imageUrl)
// call scaleImageInAllSize
if (fileType.equals("original")) {
- context.delegator = delegator;
- result = ScaleImage.scaleImageInAllSize(context, filenameToUse, "main", "0");
+ context.delegator = delegator
+ result = ScaleImage.scaleImageInAllSize(context, filenameToUse, "main", "0")
if (result.containsKey("responseMessage") && result.get("responseMessage").equals("success")) {
- imgMap = result.get("imageUrlMap");
+ imgMap = result.get("imageUrlMap")
imgMap.each() { key, value ->
- product.set(key + "ImageUrl", value);
+ product.set(key + "ImageUrl", value)
}
}
}
- product.store();
+ product.store()
}
}
}
diff --git a/applications/product/groovyScripts/catalog/imagemanagement/SortSequenceNum.groovy b/applications/product/groovyScripts/catalog/imagemanagement/SortSequenceNum.groovy
index 2180f073c8..ca04da9a18 100644
--- a/applications/product/groovyScripts/catalog/imagemanagement/SortSequenceNum.groovy
+++ b/applications/product/groovyScripts/catalog/imagemanagement/SortSequenceNum.groovy
@@ -20,12 +20,12 @@
import org.apache.ofbiz.entity.*
import org.apache.ofbiz.base.util.*
-allSequenceNums = from("ProductContent").where("productId", parameters.productId, "productContentTypeId", "IMAGE").queryList();
-nullSequenceNums = from("ProductContent").where("productId", parameters.productId, "productContentTypeId", "IMAGE", "sequenceNum", null).queryList();
+allSequenceNums = from("ProductContent").where("productId", parameters.productId, "productContentTypeId", "IMAGE").queryList()
+nullSequenceNums = from("ProductContent").where("productId", parameters.productId, "productContentTypeId", "IMAGE", "sequenceNum", null).queryList()
productContents = allSequenceNums - nullSequenceNums
def duplicate = 0
if(parameters.sequenceNum){
- findExisted = from("ProductContent").where("productId", parameters.productId, "productContentTypeId", "IMAGE", "sequenceNum", (Long)parameters.sequenceNum).queryList();
+ findExisted = from("ProductContent").where("productId", parameters.productId, "productContentTypeId", "IMAGE", "sequenceNum", (Long)parameters.sequenceNum).queryList()
duplicate = findExisted.size()
}
if(duplicate > 1){
diff --git a/applications/product/groovyScripts/catalog/lookup/LookupVariantProduct.groovy b/applications/product/groovyScripts/catalog/lookup/LookupVariantProduct.groovy
index f3c0fb0ca8..47e787a5e2 100644
--- a/applications/product/groovyScripts/catalog/lookup/LookupVariantProduct.groovy
+++ b/applications/product/groovyScripts/catalog/lookup/LookupVariantProduct.groovy
@@ -17,60 +17,60 @@
* under the License.
*/
-import org.apache.ofbiz.base.util.*;
+import org.apache.ofbiz.base.util.*
-productId = request.getParameter("productId");
-productVariantId = productId + "_";
-productFeatureIds = "";
-product = from("Product").where("productId", productId).queryOne();
+productId = request.getParameter("productId")
+productVariantId = productId + "_"
+productFeatureIds = ""
+product = from("Product").where("productId", productId).queryOne()
-result = runService('getProductFeaturesByType', [productId : productId, productFeatureApplTypeId : "SELECTABLE_FEATURE"]);
-featureTypes = result.productFeatureTypes;
-featuresByTypes = result.productFeaturesByType;
-searchFeatures = [];
-selectedFeatureTypeValues = [];
+result = runService('getProductFeaturesByType', [productId : productId, productFeatureApplTypeId : "SELECTABLE_FEATURE"])
+featureTypes = result.productFeatureTypes
+featuresByTypes = result.productFeaturesByType
+searchFeatures = []
+selectedFeatureTypeValues = []
if (featureTypes) {
featureTypes.each { featureType ->
- featuresByType = featuresByTypes[featureType];
- featureTypeAndValues = [featureType : featureType, features : featuresByType];
- searchFeatures.add(featureTypeAndValues);
+ featuresByType = featuresByTypes[featureType]
+ featureTypeAndValues = [featureType : featureType, features : featuresByType]
+ searchFeatures.add(featureTypeAndValues)
//
- selectedFeatureTypeValue = request.getParameter(featureType);
+ selectedFeatureTypeValue = request.getParameter(featureType)
if (selectedFeatureTypeValue) {
- featureTypeAndValues.selectedFeatureId = selectedFeatureTypeValue;
- selectedFeatureTypeValues.add(selectedFeatureTypeValue);
- feature = from("ProductFeature").where("productFeatureId", selectedFeatureTypeValue).cache(true).queryOne();
- productVariantId += feature.getString("idCode") ?: "";
- productFeatureIds += "|" + selectedFeatureTypeValue;
+ featureTypeAndValues.selectedFeatureId = selectedFeatureTypeValue
+ selectedFeatureTypeValues.add(selectedFeatureTypeValue)
+ feature = from("ProductFeature").where("productFeatureId", selectedFeatureTypeValue).cache(true).queryOne()
+ productVariantId += feature.getString("idCode") ?: ""
+ productFeatureIds += "|" + selectedFeatureTypeValue
}
}
}
-variants = [];
- result = runService('getAllExistingVariants', [productId : productId, productFeatureAppls : selectedFeatureTypeValues]);
- variants = result.variantProductIds;
+variants = []
+ result = runService('getAllExistingVariants', [productId : productId, productFeatureAppls : selectedFeatureTypeValues])
+ variants = result.variantProductIds
// Quick Add Variant
-productFeatureIdsPar = request.getParameter("productFeatureIds");
-productVariantIdPar = request.getParameter("productVariantId");
+productFeatureIdsPar = request.getParameter("productFeatureIds")
+productVariantIdPar = request.getParameter("productVariantId")
if (productVariantIdPar && productFeatureIdsPar) {
- result = runService('quickAddVariant', [productId : productId, productFeatureIds : productFeatureIdsPar, productVariantId : productVariantIdPar]);
+ result = runService('quickAddVariant', [productId : productId, productFeatureIds : productFeatureIdsPar, productVariantId : productVariantIdPar])
}
-context.product = product;
-context.searchFeatures = searchFeatures;
-context.variants = variants;
+context.product = product
+context.searchFeatures = searchFeatures
+context.variants = variants
// also need the variant products themselves
-variantProducts = [];
+variantProducts = []
variants.each { variantId ->
- variantProducts.add(from("Product").where("productId", variantId).cache(true).queryOne());
+ variantProducts.add(from("Product").where("productId", variantId).cache(true).queryOne())
}
-context.variantProducts = variantProducts;
+context.variantProducts = variantProducts
if (security.hasEntityPermission("CATALOG", "_CREATE", session)) {
if (selectedFeatureTypeValues.size() == featureTypes.size() && variants.size() == 0) {
- context.productFeatureIds = productFeatureIds;
- context.productVariantId = productVariantId;
+ context.productFeatureIds = productFeatureIds
+ context.productVariantId = productVariantId
}
}
diff --git a/applications/product/groovyScripts/catalog/price/EditProductPriceRules.groovy b/applications/product/groovyScripts/catalog/price/EditProductPriceRules.groovy
index f75cabf27b..1c4c6ef015 100644
--- a/applications/product/groovyScripts/catalog/price/EditProductPriceRules.groovy
+++ b/applications/product/groovyScripts/catalog/price/EditProductPriceRules.groovy
@@ -18,47 +18,47 @@
*/
import org.apache.ofbiz.entity.condition.*
-import org.apache.ofbiz.entity.util.EntityUtil;
-import org.apache.ofbiz.base.util.UtilMisc;
+import org.apache.ofbiz.entity.util.EntityUtil
+import org.apache.ofbiz.base.util.UtilMisc
-context.inputParamEnums = from("Enumeration").where("enumTypeId", "PROD_PRICE_IN_PARAM").orderBy("sequenceId").cache(true).queryList();
-context.condOperEnums = from("Enumeration").where("enumTypeId", "PROD_PRICE_COND").orderBy("sequenceId").cache(true).queryList();
-context.productPriceActionTypes = from("ProductPriceActionType").orderBy("description").cache(true).queryList();
+context.inputParamEnums = from("Enumeration").where("enumTypeId", "PROD_PRICE_IN_PARAM").orderBy("sequenceId").cache(true).queryList()
+context.condOperEnums = from("Enumeration").where("enumTypeId", "PROD_PRICE_COND").orderBy("sequenceId").cache(true).queryList()
+context.productPriceActionTypes = from("ProductPriceActionType").orderBy("description").cache(true).queryList()
-String priceRuleId = request.getParameter("productPriceRuleId");
+String priceRuleId = request.getParameter("productPriceRuleId")
if (!priceRuleId) {
- priceRuleId = parameters.get("productPriceRuleId");
+ priceRuleId = parameters.get("productPriceRuleId")
}
if (priceRuleId) {
- productPriceRules = [];
- productPriceRules.add(from("ProductPriceRule").where("productPriceRuleId", priceRuleId).queryOne());
- productPriceConds = productPriceRules[0].getRelated("ProductPriceCond", null, ["productPriceCondSeqId"], true);
- productPriceActions = productPriceRules[0].getRelated("ProductPriceAction", null, ["productPriceActionSeqId"], true);
+ productPriceRules = []
+ productPriceRules.add(from("ProductPriceRule").where("productPriceRuleId", priceRuleId).queryOne())
+ productPriceConds = productPriceRules[0].getRelated("ProductPriceCond", null, ["productPriceCondSeqId"], true)
+ productPriceActions = productPriceRules[0].getRelated("ProductPriceAction", null, ["productPriceActionSeqId"], true)
- productPriceCondAdd = [];
- productPriceCondAdd.add(delegator.makeValue("ProductPriceCond"));
- productPriceCondAdd[0].productPriceRuleId = priceRuleId;
- productPriceCondAdd[0].inputParamEnumId = context.inputParamEnums[0].enumId;
- productPriceCondAdd[0].operatorEnumId = context.condOperEnums[0].enumId;
+ productPriceCondAdd = []
+ productPriceCondAdd.add(delegator.makeValue("ProductPriceCond"))
+ productPriceCondAdd[0].productPriceRuleId = priceRuleId
+ productPriceCondAdd[0].inputParamEnumId = context.inputParamEnums[0].enumId
+ productPriceCondAdd[0].operatorEnumId = context.condOperEnums[0].enumId
- productPriceActionAdd = [];
- productPriceActionAdd.add(delegator.makeValue("ProductPriceAction"));
- productPriceActionAdd[0].productPriceRuleId = priceRuleId;
- productPriceActionAdd[0].productPriceActionTypeId = context.productPriceActionTypes[0].productPriceActionTypeId;
- productPriceActionAdd[0].amount = BigDecimal.ZERO;
+ productPriceActionAdd = []
+ productPriceActionAdd.add(delegator.makeValue("ProductPriceAction"))
+ productPriceActionAdd[0].productPriceRuleId = priceRuleId
+ productPriceActionAdd[0].productPriceActionTypeId = context.productPriceActionTypes[0].productPriceActionTypeId
+ productPriceActionAdd[0].amount = BigDecimal.ZERO
- context.productPriceRules = productPriceRules;
- context.productPriceConds = productPriceConds;
- context.productPriceActions = productPriceActions;
- context.productPriceCondAdd = productPriceCondAdd;
- context.productPriceActionAdd = productPriceActionAdd;
+ context.productPriceRules = productPriceRules
+ context.productPriceConds = productPriceConds
+ context.productPriceActions = productPriceActions
+ context.productPriceCondAdd = productPriceCondAdd
+ context.productPriceActionAdd = productPriceActionAdd
} else {
- context.productPriceRules = null;
- context.productPriceConds = null;
- context.productPriceActions = null;
- context.productPriceCondsAdd = null;
- context.productPriceActionsAdd = null;
+ context.productPriceRules = null
+ context.productPriceConds = null
+ context.productPriceActions = null
+ context.productPriceCondsAdd = null
+ context.productPriceActionsAdd = null
}
diff --git a/applications/product/groovyScripts/catalog/price/EditProductPriceRules_old.groovy b/applications/product/groovyScripts/catalog/price/EditProductPriceRules_old.groovy
index 4525f944e0..80313aeca5 100644
--- a/applications/product/groovyScripts/catalog/price/EditProductPriceRules_old.groovy
+++ b/applications/product/groovyScripts/catalog/price/EditProductPriceRules_old.groovy
@@ -19,13 +19,13 @@
import org.apache.ofbiz.entity.condition.*
-String priceRuleId = request.getParameter("productPriceRuleId");
+String priceRuleId = request.getParameter("productPriceRuleId")
if (priceRuleId) {
- context.productPriceRule = from("ProductPriceRule").where("productPriceRuleId", priceRuleId).queryOne();
+ context.productPriceRule = from("ProductPriceRule").where("productPriceRuleId", priceRuleId).queryOne()
}
-context.inputParamEnums = from("Enumeration").where("enumTypeId", 'PROD_PRICE_IN_PARAM').orderBy("sequenceId").cache(true).queryList();
+context.inputParamEnums = from("Enumeration").where("enumTypeId", 'PROD_PRICE_IN_PARAM').orderBy("sequenceId").cache(true).queryList()
-context.condOperEnums = from("Enumeration").where("enumTypeId", "PROD_PRICE_COND").orderBy("sequenceId").cache(true).queryList();
+context.condOperEnums = from("Enumeration").where("enumTypeId", "PROD_PRICE_COND").orderBy("sequenceId").cache(true).queryList()
-context.productPriceActionTypes = from("ProductPriceActionType").orderBy("description").cache(true).queryList();
+context.productPriceActionTypes = from("ProductPriceActionType").orderBy("description").cache(true).queryList()
diff --git a/applications/product/groovyScripts/catalog/product/ApplyFeaturesFromCategory.groovy b/applications/product/groovyScripts/catalog/product/ApplyFeaturesFromCategory.groovy
index 8605dd46b8..4d07781826 100644
--- a/applications/product/groovyScripts/catalog/product/ApplyFeaturesFromCategory.groovy
+++ b/applications/product/groovyScripts/catalog/product/ApplyFeaturesFromCategory.groovy
@@ -23,50 +23,50 @@ import org.apache.ofbiz.entity.util.EntityFindOptions
import org.apache.ofbiz.entity.transaction.*
import org.apache.ofbiz.base.util.*
-module = "ApplyFeaturesFromCategory.groovy";
+module = "ApplyFeaturesFromCategory.groovy"
-context.nowTimestampString = UtilDateTime.nowTimestamp().toString();
+context.nowTimestampString = UtilDateTime.nowTimestamp().toString()
-productFeatureCategoryId = request.getParameter("productFeatureCategoryId");
-context.productFeatureCategoryId = productFeatureCategoryId;
+productFeatureCategoryId = request.getParameter("productFeatureCategoryId")
+context.productFeatureCategoryId = productFeatureCategoryId
-context.selFeatureApplTypeId = request.getParameter("productFeatureApplTypeId");
+context.selFeatureApplTypeId = request.getParameter("productFeatureApplTypeId")
-context.curProductFeatureCategory = from("ProductFeatureCategory").where("productFeatureCategoryId", productFeatureCategoryId).queryOne();
+context.curProductFeatureCategory = from("ProductFeatureCategory").where("productFeatureCategoryId", productFeatureCategoryId).queryOne()
-context.productFeatureTypes = from("ProductFeatureType").orderBy("description").queryList();
+context.productFeatureTypes = from("ProductFeatureType").orderBy("description").queryList()
-context.productFeatureCategories = from("ProductFeatureCategory").orderBy("description").queryList();
+context.productFeatureCategories = from("ProductFeatureCategory").orderBy("description").queryList()
//we only need these if we will be showing the apply feature to category forms
if (productId) {
- context.productFeatureApplTypes = from("ProductFeatureApplType").orderBy("description").queryList();
+ context.productFeatureApplTypes = from("ProductFeatureApplType").orderBy("description").queryList()
}
-productFeaturesSize = from("ProductFeature").where("productFeatureCategoryId", productFeatureCategoryId).queryCount();
+productFeaturesSize = from("ProductFeature").where("productFeatureCategoryId", productFeatureCategoryId).queryCount()
-highIndex = 0;
-lowIndex = 0;
-listSize = (int) productFeaturesSize;
+highIndex = 0
+lowIndex = 0
+listSize = (int) productFeaturesSize
if (viewIndex == null) {
- viewIndex = 0;
+ viewIndex = 0
}
-lowIndex = viewIndex * viewSize;
-highIndex = (viewIndex + 1) * viewSize;
+lowIndex = viewIndex * viewSize
+highIndex = (viewIndex + 1) * viewSize
if (listSize < highIndex) {
- highIndex = listSize;
+ highIndex = listSize
}
-context.viewIndex = viewIndex;
-context.viewSize = viewSize;
-context.listSize = listSize;
-context.lowIndex = lowIndex;
-context.highIndex = highIndex;
+context.viewIndex = viewIndex
+context.viewSize = viewSize
+context.listSize = listSize
+context.lowIndex = lowIndex
+context.highIndex = highIndex
-boolean beganTransaction = false;
+boolean beganTransaction = false
try {
- beganTransaction = TransactionUtil.begin();
+ beganTransaction = TransactionUtil.begin()
productFeaturesEli = from("ProductFeature")
.where("productFeatureCategoryId", productFeatureCategoryId)
@@ -74,38 +74,38 @@ try {
.distinct()
.cursorScrollInsensitive()
.maxRows(highIndex)
- .queryIterator();
- productFeatures = productFeaturesEli.getPartialList(lowIndex + 1, highIndex - lowIndex);
- productFeaturesEli.close();
+ .queryIterator()
+ productFeatures = productFeaturesEli.getPartialList(lowIndex + 1, highIndex - lowIndex)
+ productFeaturesEli.close()
} catch (GenericEntityException e) {
- String errMsg = "Failure in operation, rolling back transaction";
- Debug.logError(e, errMsg, module);
+ String errMsg = "Failure in operation, rolling back transaction"
+ Debug.logError(e, errMsg, module)
try {
// only rollback the transaction if we started one...
- TransactionUtil.rollback(beganTransaction, errMsg, e);
+ TransactionUtil.rollback(beganTransaction, errMsg, e)
} catch (GenericEntityException e2) {
- Debug.logError(e2, "Could not rollback transaction: " + e2.toString(), module);
+ Debug.logError(e2, "Could not rollback transaction: " + e2.toString(), module)
}
// after rolling back, rethrow the exception
- throw e;
+ throw e
} finally {
// only commit the transaction if we started one... this will throw an exception if it fails
- TransactionUtil.commit(beganTransaction);
+ TransactionUtil.commit(beganTransaction)
}
-context.productFeatures = productFeatures;
+context.productFeatures = productFeatures
-productFeatureApplMap = [:];
-productFeatureAppls = null;
-productFeatureIter = productFeatures.iterator();
-productFeatureApplIter = null;
+productFeatureApplMap = [:]
+productFeatureAppls = null
+productFeatureIter = productFeatures.iterator()
+productFeatureApplIter = null
while (productFeatureIter) {
- productFeature = productFeatureIter.next();
- productFeatureAppls = from("ProductFeatureAppl").where("productId", productId, "productFeatureId", productFeature.productFeatureId).queryList();
- productFeatureApplIter = productFeatureAppls.iterator();
+ productFeature = productFeatureIter.next()
+ productFeatureAppls = from("ProductFeatureAppl").where("productId", productId, "productFeatureId", productFeature.productFeatureId).queryList()
+ productFeatureApplIter = productFeatureAppls.iterator()
while (productFeatureApplIter) {
- productFeatureAppl = productFeatureApplIter.next();
- productFeatureApplMap.put(productFeatureAppl.productFeatureId, productFeatureAppl.productFeatureApplTypeId);
+ productFeatureAppl = productFeatureApplIter.next()
+ productFeatureApplMap.put(productFeatureAppl.productFeatureId, productFeatureAppl.productFeatureApplTypeId)
}
}
-context.productFeatureApplMap = productFeatureApplMap;
+context.productFeatureApplMap = productFeatureApplMap
diff --git a/applications/product/groovyScripts/catalog/product/ApplyFeaturesFromGroup.groovy b/applications/product/groovyScripts/catalog/product/ApplyFeaturesFromGroup.groovy
index db6f7ed1ba..54c6a02714 100644
--- a/applications/product/groovyScripts/catalog/product/ApplyFeaturesFromGroup.groovy
+++ b/applications/product/groovyScripts/catalog/product/ApplyFeaturesFromGroup.groovy
@@ -24,21 +24,21 @@
import org.apache.ofbiz.entity.*
-productFeatureGroupId = parameters.get("productFeatureGroupId");
+productFeatureGroupId = parameters.get("productFeatureGroupId")
if (productFeatureGroupId) {
- productFeatureGroup = from("ProductFeatureGroup").where("productFeatureGroupId", productFeatureGroupId).queryOne();
- productFeatures = [];
- productFeatureGroupAppls = productFeatureGroup.getRelated("ProductFeatureGroupAppl", null, ['sequenceNum'], false);
+ productFeatureGroup = from("ProductFeatureGroup").where("productFeatureGroupId", productFeatureGroupId).queryOne()
+ productFeatures = []
+ productFeatureGroupAppls = productFeatureGroup.getRelated("ProductFeatureGroupAppl", null, ['sequenceNum'], false)
for (pFGAi = productFeatureGroupAppls.iterator(); pFGAi;) {
- productFeatureGroupAppl = (GenericEntity)pFGAi.next();
- productFeature = (GenericEntity)productFeatureGroupAppl.getRelatedOne("ProductFeature", false);
- productFeature.set("defaultSequenceNum", productFeatureGroupAppl.getLong("sequenceNum"));
- productFeatures.add(productFeature);
+ productFeatureGroupAppl = (GenericEntity)pFGAi.next()
+ productFeature = (GenericEntity)productFeatureGroupAppl.getRelatedOne("ProductFeature", false)
+ productFeature.set("defaultSequenceNum", productFeatureGroupAppl.getLong("sequenceNum"))
+ productFeatures.add(productFeature)
}
- context.productFeatureGroup = productFeatureGroup;
- context.productFeatures = productFeatures;
+ context.productFeatureGroup = productFeatureGroup
+ context.productFeatures = productFeatures
// this will not break out the product features by view size
- context.listSize = productFeatures.size();
- context.highIndex = productFeatures.size();
+ context.listSize = productFeatures.size()
+ context.highIndex = productFeatures.size()
}
diff --git a/applications/product/groovyScripts/catalog/product/BestProducts.groovy b/applications/product/groovyScripts/catalog/product/BestProducts.groovy
index 0b8376bd26..018162b95e 100644
--- a/applications/product/groovyScripts/catalog/product/BestProducts.groovy
+++ b/applications/product/groovyScripts/catalog/product/BestProducts.groovy
@@ -17,88 +17,88 @@
* under the License.
*/
-import org.apache.ofbiz.base.util.UtilDateTime;
-import org.apache.ofbiz.entity.condition.EntityCondition;
-import org.apache.ofbiz.entity.condition.EntityOperator;
-import org.apache.ofbiz.product.product.ProductContentWrapper;
+import org.apache.ofbiz.base.util.UtilDateTime
+import org.apache.ofbiz.entity.condition.EntityCondition
+import org.apache.ofbiz.entity.condition.EntityOperator
+import org.apache.ofbiz.product.product.ProductContentWrapper
-bestSellingProducts = [];
-exprList = [];
-exprList.add(EntityCondition.makeCondition("orderDate", EntityOperator.GREATER_THAN_EQUAL_TO, UtilDateTime.getDayStart(filterDate)));
-exprList.add(EntityCondition.makeCondition("orderDate", EntityOperator.LESS_THAN_EQUAL_TO, UtilDateTime.getDayEnd(filterDate)));
-exprList.add(EntityCondition.makeCondition("orderTypeId", EntityOperator.EQUALS, "SALES_ORDER"));
-exprList.add(EntityCondition.makeCondition("statusId", EntityOperator.NOT_EQUAL, "ORDER_CANCELLED"));
+bestSellingProducts = []
+exprList = []
+exprList.add(EntityCondition.makeCondition("orderDate", EntityOperator.GREATER_THAN_EQUAL_TO, UtilDateTime.getDayStart(filterDate)))
+exprList.add(EntityCondition.makeCondition("orderDate", EntityOperator.LESS_THAN_EQUAL_TO, UtilDateTime.getDayEnd(filterDate)))
+exprList.add(EntityCondition.makeCondition("orderTypeId", EntityOperator.EQUALS, "SALES_ORDER"))
+exprList.add(EntityCondition.makeCondition("statusId", EntityOperator.NOT_EQUAL, "ORDER_CANCELLED"))
-orderHeaderList = from("OrderHeader").where(exprList).queryList();
+orderHeaderList = from("OrderHeader").where(exprList).queryList()
orderHeaderList.each { orderHeader ->
- exprList.clear();
- exprList.add(EntityCondition.makeCondition("orderId", orderHeader.orderId));
- exprList.add(EntityCondition.makeCondition("orderItemTypeId", "PRODUCT_ORDER_ITEM"));
- exprList.add(EntityCondition.makeCondition("isPromo", "N"));
- exprList.add(EntityCondition.makeCondition("statusId", EntityOperator.NOT_EQUAL, "ITEM_CANCELLED"));
+ exprList.clear()
+ exprList.add(EntityCondition.makeCondition("orderId", orderHeader.orderId))
+ exprList.add(EntityCondition.makeCondition("orderItemTypeId", "PRODUCT_ORDER_ITEM"))
+ exprList.add(EntityCondition.makeCondition("isPromo", "N"))
+ exprList.add(EntityCondition.makeCondition("statusId", EntityOperator.NOT_EQUAL, "ITEM_CANCELLED"))
- orderItemList = from("OrderItem").where(exprList).queryList();
+ orderItemList = from("OrderItem").where(exprList).queryList()
orderItemList.each { orderItem ->
- orderItemDetail = [:];
- qtyOrdered = BigDecimal.ZERO;
- qtyOrdered += orderItem.quantity;
+ orderItemDetail = [:]
+ qtyOrdered = BigDecimal.ZERO
+ qtyOrdered += orderItem.quantity
if (orderItem.cancelQuantity) {
- qtyOrdered -= orderItem.cancelQuantity;
+ qtyOrdered -= orderItem.cancelQuantity
}
- amount = BigDecimal.ZERO;;
- amount = qtyOrdered * orderItem.unitPrice;
+ amount = BigDecimal.ZERO
+ amount = qtyOrdered * orderItem.unitPrice
inListFlag = false
bestSellingProducts.each { bestSellingProduct ->
if ((bestSellingProduct.productId).equals(orderItem.productId) && (bestSellingProduct.currencyUom).equals(orderHeader.currencyUom)) {
- inListFlag = true;
- bestSellingProduct.amount += amount;
- bestSellingProduct.qtyOrdered += qtyOrdered;
+ inListFlag = true
+ bestSellingProduct.amount += amount
+ bestSellingProduct.qtyOrdered += qtyOrdered
}
}
if (inListFlag == false) {
- orderItemDetail.productId = orderItem.productId;
+ orderItemDetail.productId = orderItem.productId
product = from("Product").where("productId", orderItem.productId).queryOne()
- contentWrapper = new ProductContentWrapper(product, request);
- orderItemDetail.productName = contentWrapper.get("PRODUCT_NAME", "html");
- orderItemDetail.amount = amount;
- orderItemDetail.qtyOrdered = qtyOrdered;
- orderItemDetail.currencyUom = orderHeader.currencyUom;
- bestSellingProducts.add(orderItemDetail);
+ contentWrapper = new ProductContentWrapper(product, request)
+ orderItemDetail.productName = contentWrapper.get("PRODUCT_NAME", "html")
+ orderItemDetail.amount = amount
+ orderItemDetail.qtyOrdered = qtyOrdered
+ orderItemDetail.currencyUom = orderHeader.currencyUom
+ bestSellingProducts.add(orderItemDetail)
}
}
}
// Sorting List
-topSellingProducts = [];
-itr = 1;
+topSellingProducts = []
+itr = 1
while (itr <= 5) {
- orderItemDetail = [:];
+ orderItemDetail = [:]
bestSellingProducts.each { bestSellingProduct ->
if (!(orderItemDetail.isEmpty())) {
if (bestSellingProduct.qtyOrdered > orderItemDetail.qtyOrdered) {
- orderItemDetail = bestSellingProduct;
+ orderItemDetail = bestSellingProduct
}
if (bestSellingProduct.qtyOrdered == orderItemDetail.qtyOrdered && bestSellingProduct.amount > orderItemDetail.amount) {
- orderItemDetail = bestSellingProduct;
+ orderItemDetail = bestSellingProduct
}
} else {
- orderItemDetail = bestSellingProduct;
+ orderItemDetail = bestSellingProduct
}
}
if (!orderItemDetail.isEmpty()) {
if (orderItemDetail.amount) {
- orderItemDetail.amount = orderItemDetail.amount.setScale(2, BigDecimal.ROUND_HALF_UP);
+ orderItemDetail.amount = orderItemDetail.amount.setScale(2, BigDecimal.ROUND_HALF_UP)
}
- topSellingProducts.add(orderItemDetail);
- bestSellingProducts.remove(orderItemDetail);
+ topSellingProducts.add(orderItemDetail)
+ bestSellingProducts.remove(orderItemDetail)
}
- itr++;
+ itr++
}
-context.bestSellingProducts = topSellingProducts;
+context.bestSellingProducts = topSellingProducts
-context.now = UtilDateTime.toDateString(UtilDateTime.nowDate());
+context.now = UtilDateTime.toDateString(UtilDateTime.nowDate())
diff --git a/applications/product/groovyScripts/catalog/product/EditProductAssoc.groovy b/applications/product/groovyScripts/catalog/product/EditProductAssoc.groovy
index b6081f4fb3..39e5d35c46 100644
--- a/applications/product/groovyScripts/catalog/product/EditProductAssoc.groovy
+++ b/applications/product/groovyScripts/catalog/product/EditProductAssoc.groovy
@@ -20,22 +20,22 @@
import org.apache.ofbiz.entity.*
import org.apache.ofbiz.base.util.*
-uiLabelMap = UtilProperties.getResourceBundleMap("ProductUiLabels", locale);
+uiLabelMap = UtilProperties.getResourceBundleMap("ProductUiLabels", locale)
-product = from("Product").where("productId", parameters.productId).queryOne();
+product = from("Product").where("productId", parameters.productId).queryOne()
-fromDate = UtilDateTime.nowTimestamp();
+fromDate = UtilDateTime.nowTimestamp()
if (UtilValidate.isNotEmpty(parameters.fromDate)) {
- fromDate = ObjectType.simpleTypeConvert(parameters.fromDate, "Timestamp", null, timeZone, locale, false);
+ fromDate = ObjectType.simpleTypeConvert(parameters.fromDate, "Timestamp", null, timeZone, locale, false)
}
-productAssoc = from("ProductAssoc").where("productId", parameters.productId, "productIdTo", parameters.productIdTo, "productAssocTypeId", parameters.productAssocTypeId, "fromDate", fromDate).queryOne();
-context.productAssoc = productAssoc;
+productAssoc = from("ProductAssoc").where("productId", parameters.productId, "productIdTo", parameters.productIdTo, "productAssocTypeId", parameters.productAssocTypeId, "fromDate", fromDate).queryOne()
+context.productAssoc = productAssoc
if (product) {
- assocFromProducts = product.getRelated("MainProductAssoc", null, ['sequenceNum'], false);
- assocToProducts = product.getRelated("AssocProductAssoc", null, null, false);
- assocFromMap = ["assocProducts" : assocFromProducts, "sectionTitle" : uiLabelMap.ProductAssociationsFromProduct];
- assocToMap = ["assocProducts" : assocToProducts, "sectionTitle" : uiLabelMap.ProductAssociationsToProduct];
- context.assocSections = [assocFromMap, assocToMap];
+ assocFromProducts = product.getRelated("MainProductAssoc", null, ['sequenceNum'], false)
+ assocToProducts = product.getRelated("AssocProductAssoc", null, null, false)
+ assocFromMap = ["assocProducts" : assocFromProducts, "sectionTitle" : uiLabelMap.ProductAssociationsFromProduct]
+ assocToMap = ["assocProducts" : assocToProducts, "sectionTitle" : uiLabelMap.ProductAssociationsToProduct]
+ context.assocSections = [assocFromMap, assocToMap]
}
\ No newline at end of file
diff --git a/applications/product/groovyScripts/catalog/product/EditProductContent.groovy b/applications/product/groovyScripts/catalog/product/EditProductContent.groovy
index 244819de09..7646d160e5 100644
--- a/applications/product/groovyScripts/catalog/product/EditProductContent.groovy
+++ b/applications/product/groovyScripts/catalog/product/EditProductContent.groovy
@@ -17,148 +17,148 @@
* under the License.
*/
-import org.apache.ofbiz.entity.*;
-import org.apache.ofbiz.base.util.*;
-import org.apache.ofbiz.base.util.string.*;
-import org.apache.ofbiz.entity.util.EntityUtilProperties;
-import org.apache.ofbiz.product.image.ScaleImage;
+import org.apache.ofbiz.entity.*
+import org.apache.ofbiz.base.util.*
+import org.apache.ofbiz.base.util.string.*
+import org.apache.ofbiz.entity.util.EntityUtilProperties
+import org.apache.ofbiz.product.image.ScaleImage
-context.nowTimestampString = UtilDateTime.nowTimestamp().toString();
+context.nowTimestampString = UtilDateTime.nowTimestamp().toString()
// make the image file formats
-context.tenantId = delegator.getDelegatorTenantId();
-imageFilenameFormat = EntityUtilProperties.getPropertyValue('catalog', 'image.filename.format', delegator);
-imageServerPath = FlexibleStringExpander.expandString(EntityUtilProperties.getPropertyValue("catalog", "image.server.path", delegator), context);
-imageUrlPrefix = FlexibleStringExpander.expandString(EntityUtilProperties.getPropertyValue("catalog", "image.url.prefix",delegator), context);
-imageServerPath = imageServerPath.endsWith("/") ? imageServerPath.substring(0, imageServerPath.length()-1) : imageServerPath;
-imageUrlPrefix = imageUrlPrefix.endsWith("/") ? imageUrlPrefix.substring(0, imageUrlPrefix.length()-1) : imageUrlPrefix;
-context.imageFilenameFormat = imageFilenameFormat;
-context.imageServerPath = imageServerPath;
-context.imageUrlPrefix = imageUrlPrefix;
+context.tenantId = delegator.getDelegatorTenantId()
+imageFilenameFormat = EntityUtilProperties.getPropertyValue('catalog', 'image.filename.format', delegator)
+imageServerPath = FlexibleStringExpander.expandString(EntityUtilProperties.getPropertyValue("catalog", "image.server.path", delegator), context)
+imageUrlPrefix = FlexibleStringExpander.expandString(EntityUtilProperties.getPropertyValue("catalog", "image.url.prefix",delegator), context)
+imageServerPath = imageServerPath.endsWith("/") ? imageServerPath.substring(0, imageServerPath.length()-1) : imageServerPath
+imageUrlPrefix = imageUrlPrefix.endsWith("/") ? imageUrlPrefix.substring(0, imageUrlPrefix.length()-1) : imageUrlPrefix
+context.imageFilenameFormat = imageFilenameFormat
+context.imageServerPath = imageServerPath
+context.imageUrlPrefix = imageUrlPrefix
-filenameExpander = FlexibleStringExpander.getInstance(imageFilenameFormat);
-context.imageNameSmall = imageUrlPrefix + "/" + filenameExpander.expandString([location : 'products', id : productId, type : 'small']);
-context.imageNameMedium = imageUrlPrefix + "/" + filenameExpander.expandString([location : 'products', id : productId, type : 'medium']);
-context.imageNameLarge = imageUrlPrefix + "/" + filenameExpander.expandString([location : 'products', id : productId, type : 'large']);
-context.imageNameDetail = imageUrlPrefix + "/" + filenameExpander.expandString([location : 'products', id : productId, type : 'detail']);
-context.imageNameOriginal = imageUrlPrefix + "/" + filenameExpander.expandString([location : 'products', id : productId, type : 'original']);
+filenameExpander = FlexibleStringExpander.getInstance(imageFilenameFormat)
+context.imageNameSmall = imageUrlPrefix + "/" + filenameExpander.expandString([location : 'products', id : productId, type : 'small'])
+context.imageNameMedium = imageUrlPrefix + "/" + filenameExpander.expandString([location : 'products', id : productId, type : 'medium'])
+context.imageNameLarge = imageUrlPrefix + "/" + filenameExpander.expandString([location : 'products', id : productId, type : 'large'])
+context.imageNameDetail = imageUrlPrefix + "/" + filenameExpander.expandString([location : 'products', id : productId, type : 'detail'])
+context.imageNameOriginal = imageUrlPrefix + "/" + filenameExpander.expandString([location : 'products', id : productId, type : 'original'])
// Start ProductContent stuff
-productContent = null;
+productContent = null
if (product) {
- productContent = product.getRelated('ProductContent', null, ['productContentTypeId'], false);
+ productContent = product.getRelated('ProductContent', null, ['productContentTypeId'], false)
}
-context.productContent = productContent;
+context.productContent = productContent
// End ProductContent stuff
-tryEntity = true;
+tryEntity = true
if (request.getAttribute("_ERROR_MESSAGE_")) {
- tryEntity = false;
+ tryEntity = false
}
if (!product) {
- tryEntity = false;
+ tryEntity = false
}
if ("true".equalsIgnoreCase((String) request.getParameter("tryEntity"))) {
- tryEntity = true;
+ tryEntity = true
}
-context.tryEntity = tryEntity;
+context.tryEntity = tryEntity
// UPLOADING STUFF
-forLock = new Object();
-contentType = null;
-String fileType = request.getParameter("upload_file_type");
+forLock = new Object()
+contentType = null
+String fileType = request.getParameter("upload_file_type")
if (fileType) {
- context.fileType = fileType;
+ context.fileType = fileType
- fileLocation = filenameExpander.expandString([location : 'products', id : productId, type : fileType]);
- filePathPrefix = "";
- filenameToUse = fileLocation;
+ fileLocation = filenameExpander.expandString([location : 'products', id : productId, type : fileType])
+ filePathPrefix = ""
+ filenameToUse = fileLocation
if (fileLocation.lastIndexOf("/") != -1) {
- filePathPrefix = fileLocation.substring(0, fileLocation.lastIndexOf("/") + 1); // adding 1 to include the trailing slash
- filenameToUse = fileLocation.substring(fileLocation.lastIndexOf("/") + 1);
+ filePathPrefix = fileLocation.substring(0, fileLocation.lastIndexOf("/") + 1) // adding 1 to include the trailing slash
+ filenameToUse = fileLocation.substring(fileLocation.lastIndexOf("/") + 1)
}
- int i1;
+ int i1
if (contentType && (i1 = contentType.indexOf("boundary=")) != -1) {
- contentType = contentType.substring(i1 + 9);
- contentType = "--" + contentType;
+ contentType = contentType.substring(i1 + 9)
+ contentType = "--" + contentType
}
- defaultFileName = filenameToUse + "_temp";
- uploadObject = new HttpRequestFileUpload();
- uploadObject.setOverrideFilename(defaultFileName);
- uploadObject.setSavePath(imageServerPath + "/" + filePathPrefix);
- uploadObject.doUpload(request);
+ defaultFileName = filenameToUse + "_temp"
+ uploadObject = new HttpRequestFileUpload()
+ uploadObject.setOverrideFilename(defaultFileName)
+ uploadObject.setSavePath(imageServerPath + "/" + filePathPrefix)
+ uploadObject.doUpload(request)
- clientFileName = uploadObject.getFilename();
+ clientFileName = uploadObject.getFilename()
if (clientFileName) {
- context.clientFileName = clientFileName;
+ context.clientFileName = clientFileName
}
if (clientFileName && clientFileName.length() > 0) {
if (clientFileName.lastIndexOf(".") > 0 && clientFileName.lastIndexOf(".") < clientFileName.length()) {
- filenameToUse += clientFileName.substring(clientFileName.lastIndexOf("."));
+ filenameToUse += clientFileName.substring(clientFileName.lastIndexOf("."))
} else {
- filenameToUse += ".jpg";
+ filenameToUse += ".jpg"
}
- context.clientFileName = clientFileName;
- context.filenameToUse = filenameToUse;
+ context.clientFileName = clientFileName
+ context.filenameToUse = filenameToUse
- characterEncoding = request.getCharacterEncoding();
- imageUrl = imageUrlPrefix + "/" + filePathPrefix + java.net.URLEncoder.encode(filenameToUse, characterEncoding);
+ characterEncoding = request.getCharacterEncoding()
+ imageUrl = imageUrlPrefix + "/" + filePathPrefix + java.net.URLEncoder.encode(filenameToUse, characterEncoding)
try {
- file = new File(imageServerPath + "/" + filePathPrefix, defaultFileName);
- file1 = new File(imageServerPath + "/" + filePathPrefix, filenameToUse);
+ file = new File(imageServerPath + "/" + filePathPrefix, defaultFileName)
+ file1 = new File(imageServerPath + "/" + filePathPrefix, filenameToUse)
try {
// Delete existing image files
- File targetDir = new File(imageServerPath + "/" + filePathPrefix);
+ File targetDir = new File(imageServerPath + "/" + filePathPrefix)
// Images are ordered by productId (${location}/${id}/${viewtype}/${sizetype})
if (!filenameToUse.startsWith(productId + ".")) {
- File[] files = targetDir.listFiles();
+ File[] files = targetDir.listFiles()
for(File file : files) {
if (file.isFile() && file.getName().contains(filenameToUse.substring(0, filenameToUse.indexOf(".")+1)) && !fileType.equals("original")) {
- file.delete();
+ file.delete()
} else if(file.isFile() && fileType.equals("original") && !file.getName().equals(defaultFileName)) {
- file.delete();
+ file.delete()
}
}
// Images aren't ordered by productId (${location}/${viewtype}/${sizetype}/${id}) !!! BE CAREFUL !!!
} else {
- File[] files = targetDir.listFiles();
+ File[] files = targetDir.listFiles()
for(File file : files) {
- if (file.isFile() && !file.getName().equals(defaultFileName) && file.getName().startsWith(productId + ".")) file.delete();
+ if (file.isFile() && !file.getName().equals(defaultFileName) && file.getName().startsWith(productId + ".")) file.delete()
}
}
} catch (Exception e) {
- System.out.println("error deleting existing file (not neccessarily a problem)");
+ System.out.println("error deleting existing file (not neccessarily a problem)")
}
- file.renameTo(file1);
+ file.renameTo(file1)
} catch (Exception e) {
- e.printStackTrace();
+ e.printStackTrace()
}
if (imageUrl && imageUrl.length() > 0) {
- context.imageUrl = imageUrl;
- product.set(fileType + "ImageUrl", imageUrl);
+ context.imageUrl = imageUrl
+ product.set(fileType + "ImageUrl", imageUrl)
// call scaleImageInAllSize
if (fileType.equals("original")) {
- context.delegator = delegator;
- result = ScaleImage.scaleImageInAllSize(context, filenameToUse, "main", "0");
+ context.delegator = delegator
+ result = ScaleImage.scaleImageInAllSize(context, filenameToUse, "main", "0")
if (result.containsKey("responseMessage") && result.get("responseMessage").equals("success")) {
- imgMap = result.get("imageUrlMap");
+ imgMap = result.get("imageUrlMap")
imgMap.each() { key, value ->
- product.set(key + "ImageUrl", value);
+ product.set(key + "ImageUrl", value)
}
}
}
- product.store();
+ product.store()
}
}
}
diff --git a/applications/product/groovyScripts/catalog/product/EditProductContentContent.groovy b/applications/product/groovyScripts/catalog/product/EditProductContentContent.groovy
index 4b76768706..46daf208b2 100644
--- a/applications/product/groovyScripts/catalog/product/EditProductContentContent.groovy
+++ b/applications/product/groovyScripts/catalog/product/EditProductContentContent.groovy
@@ -17,132 +17,132 @@
* under the License.
*/
-import org.apache.ofbiz.entity.*;
-import org.apache.ofbiz.entity.util.*;
-import org.apache.ofbiz.base.util.*;
-import java.sql.Timestamp;
+import org.apache.ofbiz.entity.*
+import org.apache.ofbiz.entity.util.*
+import org.apache.ofbiz.base.util.*
+import java.sql.Timestamp
import org.apache.ofbiz.base.util.ObjectType
-contentId = parameters.contentId;
+contentId = parameters.contentId
if (!contentId) {
- contentId = null;
+ contentId = null
}
-productContentTypeId = parameters.productContentTypeId;
+productContentTypeId = parameters.productContentTypeId
-fromDate = parameters.fromDate;
+fromDate = parameters.fromDate
if (!fromDate) {
- fromDate = null;
+ fromDate = null
} else {
fromDate = ObjectType.simpleTypeConvert(fromDate, "Timestamp", null, null, false)
}
-description = parameters.description;
+description = parameters.description
if (!description) {
- description = null;
+ description = null
}
-productContent = from("ProductContent").where("contentId", contentId, "productId", productId, "productContentTypeId", productContentTypeId, "fromDate", fromDate).queryOne();
+productContent = from("ProductContent").where("contentId", contentId, "productId", productId, "productContentTypeId", productContentTypeId, "fromDate", fromDate).queryOne()
if (!productContent) {
- productContent = [:];
- productContent.productId = productId;
- productContent.contentId = contentId;
- productContent.productContentTypeId = productContentTypeId;
- productContent.fromDate = fromDate;
- productContent.thruDate = parameters.thruDate;
- productContent.purchaseFromDate = parameters.purchaseFromDate;
- productContent.purchaseThruDate = parameters.purchaseThruDate;
- productContent.useCountLimit = parameters.useCountLimit;
- productContent.useTime = parameters.useTime;
- productContent.useTimeUomId = parameters.useTimeUomId;
- productContent.useRoleTypeId = parameters.useRoleTypeId;
+ productContent = [:]
+ productContent.productId = productId
+ productContent.contentId = contentId
+ productContent.productContentTypeId = productContentTypeId
+ productContent.fromDate = fromDate
+ productContent.thruDate = parameters.thruDate
+ productContent.purchaseFromDate = parameters.purchaseFromDate
+ productContent.purchaseThruDate = parameters.purchaseThruDate
+ productContent.useCountLimit = parameters.useCountLimit
+ productContent.useTime = parameters.useTime
+ productContent.useTimeUomId = parameters.useTimeUomId
+ productContent.useRoleTypeId = parameters.useRoleTypeId
}
-context.productContent = productContent;
+context.productContent = productContent
-productContentData = [:];
-productContentData.putAll(productContent);
+productContentData = [:]
+productContentData.putAll(productContent)
-content = [:];
-context.contentId = contentId;
+content = [:]
+context.contentId = contentId
if (contentId) {
- content = from("Content").where("contentId", contentId).queryOne();
- context.content = content;
+ content = from("Content").where("contentId", contentId).queryOne()
+ context.content = content
} else {
if (description) {
- content.description = description;
+ content.description = description
}
}
//Email
if ("FULFILLMENT_EMAIL".equals(productContentTypeId)) {
- emailData = [:];
+ emailData = [:]
if (contentId && content) {
- subjectDr = content.getRelatedOne("DataResource", false);
+ subjectDr = content.getRelatedOne("DataResource", false)
if (subjectDr) {
- subject = subjectDr.getRelatedOne("ElectronicText", false);
- emailData.subject = subject.textData;
- emailData.subjectDataResourceId = subject.dataResourceId;
+ subject = subjectDr.getRelatedOne("ElectronicText", false)
+ emailData.subject = subject.textData
+ emailData.subjectDataResourceId = subject.dataResourceId
}
- result = runService('findAssocContent', [userLogin : userLogin, contentId : contentId, mapKeys : ['plainBody', 'htmlBody']]);
- contentAssocs = result.get("contentAssocs");
+ result = runService('findAssocContent', [userLogin : userLogin, contentId : contentId, mapKeys : ['plainBody', 'htmlBody']])
+ contentAssocs = result.get("contentAssocs")
if (contentAssocs) {
contentAssocs.each { contentAssoc ->
- bodyContent = contentAssoc.getRelatedOne("ToContent", false);
- bodyDr = bodyContent.getRelatedOne("DataResource", false);
- body = bodyDr.getRelatedOne("ElectronicText", false);
- emailData.put(contentAssoc.mapKey, body.textData);
- emailData.put(contentAssoc.get("mapKey")+"DataResourceId", body.dataResourceId);
+ bodyContent = contentAssoc.getRelatedOne("ToContent", false)
+ bodyDr = bodyContent.getRelatedOne("DataResource", false)
+ body = bodyDr.getRelatedOne("ElectronicText", false)
+ emailData.put(contentAssoc.mapKey, body.textData)
+ emailData.put(contentAssoc.get("mapKey")+"DataResourceId", body.dataResourceId)
}
}
}
- context.contentFormName = "EditProductContentEmail";
- context.emailData = emailData;
+ context.contentFormName = "EditProductContentEmail"
+ context.emailData = emailData
} else if ("DIGITAL_DOWNLOAD".equals(productContentTypeId)) {
- downloadData = [:];
+ downloadData = [:]
if (contentId && content) {
- downloadDr = content.getRelatedOne("DataResource", false);
+ downloadDr = content.getRelatedOne("DataResource", false)
if (downloadDr) {
- download = downloadDr.getRelatedOne("OtherDataResource", false);
+ download = downloadDr.getRelatedOne("OtherDataResource", false)
if (download) {
- downloadData.file = download.dataResourceContent;
- downloadData.fileDataResourceId = download.dataResourceId;
+ downloadData.file = download.dataResourceContent
+ downloadData.fileDataResourceId = download.dataResourceId
}
}
}
- context.contentFormName = "EditProductContentDownload";
- context.downloadData = downloadData;
+ context.contentFormName = "EditProductContentDownload"
+ context.downloadData = downloadData
} else if ("FULFILLMENT_EXTERNAL".equals(productContentTypeId)) {
- context.contentFormName = "EditProductContentExternal";
+ context.contentFormName = "EditProductContentExternal"
} else if (productContentTypeId && productContentTypeId.indexOf("_IMAGE") > -1) {
- context.contentFormName = "EditProductContentImage";
+ context.contentFormName = "EditProductContentImage"
} else {
//Assume it is a generic simple text content
- textData = [:];
+ textData = [:]
if (contentId && content) {
- textDr = content.getRelatedOne("DataResource", false);
+ textDr = content.getRelatedOne("DataResource", false)
if (textDr) {
- text = textDr.getRelatedOne("ElectronicText", false);
+ text = textDr.getRelatedOne("ElectronicText", false)
if (text) {
- textData.text = text.textData;
- textData.textDataResourceId = text.dataResourceId;
+ textData.text = text.textData
+ textData.textDataResourceId = text.dataResourceId
}
}
}
- context.contentFormName = "EditProductContentSimpleText";
- context.textData = textData;
+ context.contentFormName = "EditProductContentSimpleText"
+ context.textData = textData
}
if (productContentTypeId) {
- productContentType = from("ProductContentType").where("productContentTypeId", productContentTypeId).queryOne();
+ productContentType = from("ProductContentType").where("productContentTypeId", productContentTypeId).queryOne()
if (productContentType && "DIGITAL_DOWNLOAD".equals(productContentType.parentTypeId)) {
- context.contentFormName = "EditProductContentDownload";
+ context.contentFormName = "EditProductContentDownload"
}
}
if (("PAGE_TITLE".equals(productContentTypeId))||("META_KEYWORD".equals(productContentTypeId))||("META_DESCRIPTION".equals(productContentTypeId))) {
- context.contentFormName = "EditProductContentSEO";
+ context.contentFormName = "EditProductContentSEO"
}
-context.productContentData = productContentData;
-context.content = content;
-context.contentId = contentId;
+context.productContentData = productContentData
+context.content = content
+context.contentId = contentId
diff --git a/applications/product/groovyScripts/catalog/product/EditProductFeatures.groovy b/applications/product/groovyScripts/catalog/product/EditProductFeatures.groovy
index 5830f29131..829a02ca89 100644
--- a/applications/product/groovyScripts/catalog/product/EditProductFeatures.groovy
+++ b/applications/product/groovyScripts/catalog/product/EditProductFeatures.groovy
@@ -17,14 +17,14 @@
* under the License.
*/
-import org.apache.ofbiz.entity.condition.*;
+import org.apache.ofbiz.entity.condition.*
-context.productFeatureAndAppls = from("ProductFeatureAndAppl").where("productId", productId).orderBy("sequenceNum", "productFeatureApplTypeId", "productFeatureTypeId", "description").queryList();
+context.productFeatureAndAppls = from("ProductFeatureAndAppl").where("productId", productId).orderBy("sequenceNum", "productFeatureApplTypeId", "productFeatureTypeId", "description").queryList()
-context.productFeatureCategories = from("ProductFeatureCategory").orderBy("description").queryList();
+context.productFeatureCategories = from("ProductFeatureCategory").orderBy("description").queryList()
-context.productFeatureApplTypes = from("ProductFeatureApplType").orderBy("description").cache(true).queryList();
+context.productFeatureApplTypes = from("ProductFeatureApplType").orderBy("description").cache(true).queryList()
-context.productFeatureGroups = from("ProductFeatureGroup").orderBy("description").queryList();
+context.productFeatureGroups = from("ProductFeatureGroup").orderBy("description").queryList()
-context.productFeatureTypes = from("ProductFeatureType").orderBy("description").queryList();
+context.productFeatureTypes = from("ProductFeatureType").orderBy("description").queryList()
diff --git a/applications/product/groovyScripts/catalog/product/EditProductInventoryItems.groovy b/applications/product/groovyScripts/catalog/product/EditProductInventoryItems.groovy
index 4db51fc2bd..b38bfece05 100644
--- a/applications/product/groovyScripts/catalog/product/EditProductInventoryItems.groovy
+++ b/applications/product/groovyScripts/catalog/product/EditProductInventoryItems.groovy
@@ -22,142 +22,142 @@ import org.apache.ofbiz.entity.util.EntityTypeUtil
import org.apache.ofbiz.product.inventory.InventoryWorker
if (product) {
- boolean isMarketingPackage = EntityTypeUtil.hasParentType(delegator, "ProductType", "productTypeId", product.productTypeId, "parentTypeId", "MARKETING_PKG");
- context.isMarketingPackage = (isMarketingPackage? "true": "false");
+ boolean isMarketingPackage = EntityTypeUtil.hasParentType(delegator, "ProductType", "productTypeId", product.productTypeId, "parentTypeId", "MARKETING_PKG")
+ context.isMarketingPackage = (isMarketingPackage? "true": "false")
//If product is virtual gather summary data from variants
if (product.isVirtual && "Y".equals(product.isVirtual)) {
//Get the virtual product feature types
- result = runService('getProductFeaturesByType', [productId : productId, productFeatureApplTypeId : 'SELECTABLE_FEATURE']);
- featureTypeIds = result.productFeatureTypes;
+ result = runService('getProductFeaturesByType', [productId : productId, productFeatureApplTypeId : 'SELECTABLE_FEATURE'])
+ featureTypeIds = result.productFeatureTypes
//Get the variants
- result = runService('getAllProductVariants', [productId : productId]);
- variants = result.assocProducts;
- variantIterator = variants.iterator();
- variantInventorySummaries = [];
+ result = runService('getAllProductVariants', [productId : productId])
+ variants = result.assocProducts
+ variantIterator = variants.iterator()
+ variantInventorySummaries = []
while (variantIterator) {
- variant = variantIterator.next();
+ variant = variantIterator.next()
//create a map of each variant id and inventory summary (all facilities)
- inventoryAvailable = runService('getProductInventoryAvailable', [productId : variant.productIdTo]);
+ inventoryAvailable = runService('getProductInventoryAvailable', [productId : variant.productIdTo])
variantInventorySummary = [productId : variant.productIdTo,
availableToPromiseTotal : inventoryAvailable.availableToPromiseTotal,
- quantityOnHandTotal : inventoryAvailable.quantityOnHandTotal];
+ quantityOnHandTotal : inventoryAvailable.quantityOnHandTotal]
//add the applicable features to the map
- featureTypeIdsIterator = featureTypeIds.iterator();
+ featureTypeIdsIterator = featureTypeIds.iterator()
while (featureTypeIdsIterator) {
- featureTypeId = featureTypeIdsIterator.next();
- result = runService('getProductFeatures', [productId : variant.productIdTo, type : 'STANDARD_FEATURE', distinct : featureTypeId]);
- variantFeatures = result.productFeatures;
+ featureTypeId = featureTypeIdsIterator.next()
+ result = runService('getProductFeatures', [productId : variant.productIdTo, type : 'STANDARD_FEATURE', distinct : featureTypeId])
+ variantFeatures = result.productFeatures
if (variantFeatures) {
//there should only be one result in this collection
- variantInventorySummary.put(featureTypeId, variantFeatures.get(0));
+ variantInventorySummary.put(featureTypeId, variantFeatures.get(0))
}
}
- variantInventorySummaries.add(variantInventorySummary);
+ variantInventorySummaries.add(variantInventorySummary)
}
- context.featureTypeIds = featureTypeIds;
- context.variantInventorySummaries = variantInventorySummaries;
+ context.featureTypeIds = featureTypeIds
+ context.variantInventorySummaries = variantInventorySummaries
} else { //Gather information for a non virtual product
- quantitySummaryByFacility = [:];
- manufacturingInQuantitySummaryByFacility = [:];
- manufacturingOutQuantitySummaryByFacility = [:];
+ quantitySummaryByFacility = [:]
+ manufacturingInQuantitySummaryByFacility = [:]
+ manufacturingOutQuantitySummaryByFacility = [:]
// The warehouse list is selected
- showAllFacilities = parameters.showAllFacilities;
+ showAllFacilities = parameters.showAllFacilities
if (showAllFacilities && "Y".equals(showAllFacilities)) {
- facilityList = from("Facility").queryList();
+ facilityList = from("Facility").queryList()
} else {
- facilityList = from("ProductFacility").where("productId", productId).queryList();
+ facilityList = from("ProductFacility").where("productId", productId).queryList()
}
- facilityIterator = facilityList.iterator();
- dispatcher = request.getAttribute("dispatcher");
- Map contextInput = null;
- Map resultOutput = null;
+ facilityIterator = facilityList.iterator()
+ dispatcher = request.getAttribute("dispatcher")
+ Map contextInput = null
+ Map resultOutput = null
// inventory quantity summary by facility: For every warehouse the product's atp and qoh
// are obtained (calling the "getInventoryAvailableByFacility" service)
while (facilityIterator) {
- facility = facilityIterator.next();
- resultOutput = runService('getInventoryAvailableByFacility', [productId : productId, facilityId : facility.facilityId]);
+ facility = facilityIterator.next()
+ resultOutput = runService('getInventoryAvailableByFacility', [productId : productId, facilityId : facility.facilityId])
- quantitySummary = [:];
- quantitySummary.facilityId = facility.facilityId;
- quantitySummary.totalQuantityOnHand = resultOutput.quantityOnHandTotal;
- quantitySummary.totalAvailableToPromise = resultOutput.availableToPromiseTotal;
+ quantitySummary = [:]
+ quantitySummary.facilityId = facility.facilityId
+ quantitySummary.totalQuantityOnHand = resultOutput.quantityOnHandTotal
+ quantitySummary.totalAvailableToPromise = resultOutput.availableToPromiseTotal
// if the product is a MARKETING_PKG_AUTO/PICK, then also get the quantity which can be produced from components
if (isMarketingPackage) {
- resultOutput = runService('getMktgPackagesAvailable', [productId : productId, facilityId : facility.facilityId]);
- quantitySummary.mktgPkgQOH = resultOutput.quantityOnHandTotal;
- quantitySummary.mktgPkgATP = resultOutput.availableToPromiseTotal;
+ resultOutput = runService('getMktgPackagesAvailable', [productId : productId, facilityId : facility.facilityId])
+ quantitySummary.mktgPkgQOH = resultOutput.quantityOnHandTotal
+ quantitySummary.mktgPkgATP = resultOutput.availableToPromiseTotal
}
- quantitySummaryByFacility.put(facility.facilityId, quantitySummary);
+ quantitySummaryByFacility.put(facility.facilityId, quantitySummary)
}
- productInventoryItems = from("InventoryItem").where("productId", productId).orderBy("facilityId", "-datetimeReceived", "-inventoryItemId").queryList();
+ productInventoryItems = from("InventoryItem").where("productId", productId).orderBy("facilityId", "-datetimeReceived", "-inventoryItemId").queryList()
// TODO: get all incoming shipments not yet arrived coming into each facility that this product is in, use a view entity with ShipmentAndItem
- findIncomingShipmentsConds = [];
+ findIncomingShipmentsConds = []
- findIncomingShipmentsConds.add(EntityCondition.makeCondition('productId', EntityOperator.EQUALS, productId));
+ findIncomingShipmentsConds.add(EntityCondition.makeCondition('productId', EntityOperator.EQUALS, productId))
- findIncomingShipmentsTypeConds = [];
- findIncomingShipmentsTypeConds.add(EntityCondition.makeCondition("shipmentTypeId", EntityOperator.EQUALS, "INCOMING_SHIPMENT"));
- findIncomingShipmentsTypeConds.add(EntityCondition.makeCondition("shipmentTypeId", EntityOperator.EQUALS, "PURCHASE_SHIPMENT"));
- findIncomingShipmentsTypeConds.add(EntityCondition.makeCondition("shipmentTypeId", EntityOperator.EQUALS, "SALES_RETURN"));
- findIncomingShipmentsConds.add(EntityCondition.makeCondition(findIncomingShipmentsTypeConds, EntityOperator.OR));
+ findIncomingShipmentsTypeConds = []
+ findIncomingShipmentsTypeConds.add(EntityCondition.makeCondition("shipmentTypeId", EntityOperator.EQUALS, "INCOMING_SHIPMENT"))
+ findIncomingShipmentsTypeConds.add(EntityCondition.makeCondition("shipmentTypeId", EntityOperator.EQUALS, "PURCHASE_SHIPMENT"))
+ findIncomingShipmentsTypeConds.add(EntityCondition.makeCondition("shipmentTypeId", EntityOperator.EQUALS, "SALES_RETURN"))
+ findIncomingShipmentsConds.add(EntityCondition.makeCondition(findIncomingShipmentsTypeConds, EntityOperator.OR))
- findIncomingShipmentsStatusConds = [];
- findIncomingShipmentsStatusConds.add(EntityCondition.makeCondition("statusId", EntityOperator.NOT_EQUAL, "SHIPMENT_DELIVERED"));
- findIncomingShipmentsStatusConds.add(EntityCondition.makeCondition("statusId", EntityOperator.NOT_EQUAL, "SHIPMENT_CANCELLED"));
- findIncomingShipmentsStatusConds.add(EntityCondition.makeCondition("statusId", EntityOperator.NOT_EQUAL, "PURCH_SHIP_RECEIVED"));
- findIncomingShipmentsConds.add(EntityCondition.makeCondition(findIncomingShipmentsStatusConds, EntityOperator.AND));
+ findIncomingShipmentsStatusConds = []
+ findIncomingShipmentsStatusConds.add(EntityCondition.makeCondition("statusId", EntityOperator.NOT_EQUAL, "SHIPMENT_DELIVERED"))
+ findIncomingShipmentsStatusConds.add(EntityCondition.makeCondition("statusId", EntityOperator.NOT_EQUAL, "SHIPMENT_CANCELLED"))
+ findIncomingShipmentsStatusConds.add(EntityCondition.makeCondition("statusId", EntityOperator.NOT_EQUAL, "PURCH_SHIP_RECEIVED"))
+ findIncomingShipmentsConds.add(EntityCondition.makeCondition(findIncomingShipmentsStatusConds, EntityOperator.AND))
- findIncomingShipmentsStatusCondition = EntityCondition.makeCondition(findIncomingShipmentsConds, EntityOperator.AND);
- incomingShipmentAndItems = from("ShipmentAndItem").where(findIncomingShipmentsStatusCondition).orderBy("-estimatedArrivalDate").queryList();
- incomingShipmentAndItemIter = incomingShipmentAndItems.iterator();
+ findIncomingShipmentsStatusCondition = EntityCondition.makeCondition(findIncomingShipmentsConds, EntityOperator.AND)
+ incomingShipmentAndItems = from("ShipmentAndItem").where(findIncomingShipmentsStatusCondition).orderBy("-estimatedArrivalDate").queryList()
+ incomingShipmentAndItemIter = incomingShipmentAndItems.iterator()
while (incomingShipmentAndItemIter) {
- incomingShipmentAndItem = incomingShipmentAndItemIter.next();
- facilityId = incomingShipmentAndItem.destinationFacilityId;
+ incomingShipmentAndItem = incomingShipmentAndItemIter.next()
+ facilityId = incomingShipmentAndItem.destinationFacilityId
- quantitySummary = quantitySummaryByFacility.get(facilityId);
+ quantitySummary = quantitySummaryByFacility.get(facilityId)
if (!quantitySummary) {
- quantitySummary = [:];
- quantitySummary.facilityId = facilityId;
- quantitySummaryByFacility.facilityId = quantitySummary;
+ quantitySummary = [:]
+ quantitySummary.facilityId = facilityId
+ quantitySummaryByFacility.facilityId = quantitySummary
}
- incomingShipmentAndItemList = quantitySummary.incomingShipmentAndItemList;
+ incomingShipmentAndItemList = quantitySummary.incomingShipmentAndItemList
if (!incomingShipmentAndItemList) {
- incomingShipmentAndItemList = [];
- quantitySummary.incomingShipmentAndItemList = incomingShipmentAndItemList;
+ incomingShipmentAndItemList = []
+ quantitySummary.incomingShipmentAndItemList = incomingShipmentAndItemList
}
- incomingShipmentAndItemList.add(incomingShipmentAndItem);
+ incomingShipmentAndItemList.add(incomingShipmentAndItem)
}
// --------------------
// Production Runs
resultOutput = runService('getProductManufacturingSummaryByFacility',
- [productId : productId, userLogin : userLogin]);
+ [productId : productId, userLogin : userLogin])
// incoming products
- manufacturingInQuantitySummaryByFacility = resultOutput.summaryInByFacility;
+ manufacturingInQuantitySummaryByFacility = resultOutput.summaryInByFacility
// outgoing products (materials)
- manufacturingOutQuantitySummaryByFacility = resultOutput.summaryOutByFacility;
+ manufacturingOutQuantitySummaryByFacility = resultOutput.summaryOutByFacility
- showEmpty = "true".equals(request.getParameter("showEmpty"));
+ showEmpty = "true".equals(request.getParameter("showEmpty"))
// Find oustanding purchase orders for this item.
- purchaseOrders = InventoryWorker.getOutstandingPurchaseOrders(productId, delegator);
+ purchaseOrders = InventoryWorker.getOutstandingPurchaseOrders(productId, delegator)
- context.productInventoryItems = productInventoryItems;
- context.quantitySummaryByFacility = quantitySummaryByFacility;
- context.manufacturingInQuantitySummaryByFacility = manufacturingInQuantitySummaryByFacility;
- context.manufacturingOutQuantitySummaryByFacility = manufacturingOutQuantitySummaryByFacility;
- context.showEmpty = showEmpty;
- context.purchaseOrders = purchaseOrders;
+ context.productInventoryItems = productInventoryItems
+ context.quantitySummaryByFacility = quantitySummaryByFacility
+ context.manufacturingInQuantitySummaryByFacility = manufacturingInQuantitySummaryByFacility
+ context.manufacturingOutQuantitySummaryByFacility = manufacturingOutQuantitySummaryByFacility
+ context.showEmpty = showEmpty
+ context.purchaseOrders = purchaseOrders
}
}
diff --git a/applications/product/groovyScripts/catalog/product/EditProductQuickAdmin.groovy b/applications/product/groovyScripts/catalog/product/EditProductQuickAdmin.groovy
index b9b5c81495..d3e5db4ff8 100644
--- a/applications/product/groovyScripts/catalog/product/EditProductQuickAdmin.groovy
+++ b/applications/product/groovyScripts/catalog/product/EditProductQuickAdmin.groovy
@@ -22,296 +22,296 @@ import org.apache.ofbiz.entity.*
import org.apache.ofbiz.entity.condition.*
import org.apache.ofbiz.entity.util.*
import org.apache.ofbiz.product.product.*
-import org.apache.ofbiz.entity.util.EntityUtilProperties;
+import org.apache.ofbiz.entity.util.EntityUtilProperties
-context.nowTimestampString = UtilDateTime.nowTimestamp().toString();
+context.nowTimestampString = UtilDateTime.nowTimestamp().toString()
-context.assocTypes = from("ProductAssocType").queryList();
+context.assocTypes = from("ProductAssocType").queryList()
-context.featureTypes = from("ProductFeatureType").queryList();
+context.featureTypes = from("ProductFeatureType").queryList()
// add/remove feature types
-addedFeatureTypes = (HashMap) session.getAttribute("addedFeatureTypes");
+addedFeatureTypes = (HashMap) session.getAttribute("addedFeatureTypes")
if (addedFeatureTypes == null) {
- addedFeatureTypes = [:];
- session.setAttribute("addedFeatureTypes", addedFeatureTypes);
+ addedFeatureTypes = [:]
+ session.setAttribute("addedFeatureTypes", addedFeatureTypes)
}
-featuresByType = new HashMap();
-String[] addFeatureTypeId = request.getParameterValues("addFeatureTypeId");
-List addFeatureTypeIdList = [];
+featuresByType = new HashMap()
+String[] addFeatureTypeId = request.getParameterValues("addFeatureTypeId")
+List addFeatureTypeIdList = []
if (addFeatureTypeId) {
- addFeatureTypeIdList.addAll(Arrays.asList(addFeatureTypeId));
+ addFeatureTypeIdList.addAll(Arrays.asList(addFeatureTypeId))
}
-addFeatureTypeIdIter = addFeatureTypeIdList.iterator();
+addFeatureTypeIdIter = addFeatureTypeIdList.iterator()
while (addFeatureTypeIdIter) {
- String curFeatureTypeId = addFeatureTypeIdIter.next();
- GenericValue featureType = from("ProductFeatureType").where("productFeatureTypeId", curFeatureTypeId).queryOne();
+ String curFeatureTypeId = addFeatureTypeIdIter.next()
+ GenericValue featureType = from("ProductFeatureType").where("productFeatureTypeId", curFeatureTypeId).queryOne()
if ((featureType) && !addedFeatureTypes.containsKey(curFeatureTypeId)) {
- addedFeatureTypes.put(curFeatureTypeId, featureType);
+ addedFeatureTypes.put(curFeatureTypeId, featureType)
}
}
-String[] removeFeatureTypeId = request.getParameterValues("removeFeatureTypeId");
+String[] removeFeatureTypeId = request.getParameterValues("removeFeatureTypeId")
if (removeFeatureTypeId) {
for (int i = 0; i < removeFeatureTypeId.length; i++) {
- GenericValue featureType = from("ProductFeatureType").where("productFeatureTypeId", addFeatureTypeId[i]).queryOne();
+ GenericValue featureType = from("ProductFeatureType").where("productFeatureTypeId", addFeatureTypeId[i]).queryOne()
if ((featureType) && addedFeatureTypes.containsKey(removeFeatureTypeId[i])) {
- addedFeatureTypes.remove(removeFeatureTypeId[i]);
- featuresByType.remove(removeFeatureTypeId[i]);
+ addedFeatureTypes.remove(removeFeatureTypeId[i])
+ featuresByType.remove(removeFeatureTypeId[i])
}
}
}
-Iterator iter = addedFeatureTypes.values().iterator();
+Iterator iter = addedFeatureTypes.values().iterator()
while (iter) {
- GenericValue featureType = (GenericValue)iter.next();
- featuresByType.put(featureType.productFeatureTypeId, featureType.getRelated("ProductFeature", null, ['description'], false));
+ GenericValue featureType = (GenericValue)iter.next()
+ featuresByType.put(featureType.productFeatureTypeId, featureType.getRelated("ProductFeature", null, ['description'], false))
}
-context.addedFeatureTypeIds = addedFeatureTypes.keySet();
-context.addedFeatureTypes = addedFeatureTypes;
-context.featuresByType = featuresByType;
+context.addedFeatureTypeIds = addedFeatureTypes.keySet()
+context.addedFeatureTypes = addedFeatureTypes
+context.featuresByType = featuresByType
-productId = parameters.get("productId");
+productId = parameters.get("productId")
if (!productId) {
- productId = parameters.get("PRODUCT_ID");
+ productId = parameters.get("PRODUCT_ID")
}
if (!productId) {
- productId = request.getAttribute("productId");
+ productId = request.getAttribute("productId")
}
if (productId) {
- context.productId = productId;
+ context.productId = productId
}
-product = from("Product").where("productId", productId).queryOne();
-assocProducts = [];
-featureFloz = [:];
-featureMl = [:];
-featureNtwt = [:];
-featureGrams = [:];
-featureHazmat = [:];
-featureSalesThru = [:];
-featureThruDate = [:];
-selFeatureDesc = [:];
-BigDecimal floz = null;
-BigDecimal ml = null;
-BigDecimal ntwt = null;
-BigDecimal grams = null;
-String hazmat = "nbsp;";
-String salesthru = null;
-String thrudate = null;
-String productFeatureTypeId = request.getParameter("productFeatureTypeId");
-context.productFeatureTypeId = productFeatureTypeId;
+product = from("Product").where("productId", productId).queryOne()
+assocProducts = []
+featureFloz = [:]
+featureMl = [:]
+featureNtwt = [:]
+featureGrams = [:]
+featureHazmat = [:]
+featureSalesThru = [:]
+featureThruDate = [:]
+selFeatureDesc = [:]
+BigDecimal floz = null
+BigDecimal ml = null
+BigDecimal ntwt = null
+BigDecimal grams = null
+String hazmat = "nbsp;"
+String salesthru = null
+String thrudate = null
+String productFeatureTypeId = request.getParameter("productFeatureTypeId")
+context.productFeatureTypeId = productFeatureTypeId
if (product) {
- context.product = product;
+ context.product = product
// get categories
allCategories = from("ProductCategory").where(EntityCondition.makeCondition(EntityCondition.makeCondition("showInSelect", EntityOperator.EQUALS, null), EntityOperator.OR, EntityCondition.makeCondition("showInSelect", EntityOperator.NOT_EQUAL, "N")))
- .orderBy("description").queryList();
+ .orderBy("description").queryList()
- categoryMembers = product.getRelated("ProductCategoryMember", null, null, false);
- categoryMembers = EntityUtil.filterByDate(categoryMembers);
- context.allCategories = allCategories;
- context.productCategoryMembers = categoryMembers;
+ categoryMembers = product.getRelated("ProductCategoryMember", null, null, false)
+ categoryMembers = EntityUtil.filterByDate(categoryMembers)
+ context.allCategories = allCategories
+ context.productCategoryMembers = categoryMembers
- productFeatureAndAppls = product.getRelated("ProductFeatureAndAppl", null, null, false);
+ productFeatureAndAppls = product.getRelated("ProductFeatureAndAppl", null, null, false)
// get standard features for this product
- standardFeatureAppls = EntityUtil.filterByAnd(productFeatureAndAppls, [productFeatureApplTypeId : "STANDARD_FEATURE"]);
- productFeatureTypeLookup = [:];
- standardFeatureLookup = [:];
- Iterator standardFeatureApplIter = standardFeatureAppls.iterator();
+ standardFeatureAppls = EntityUtil.filterByAnd(productFeatureAndAppls, [productFeatureApplTypeId : "STANDARD_FEATURE"])
+ productFeatureTypeLookup = [:]
+ standardFeatureLookup = [:]
+ Iterator standardFeatureApplIter = standardFeatureAppls.iterator()
while (standardFeatureApplIter) {
- GenericValue standardFeatureAndAppl = (GenericValue) standardFeatureApplIter.next();
- GenericValue featureType = standardFeatureAndAppl.getRelatedOne("ProductFeatureType", true);
- productFeatureTypeLookup.put(standardFeatureAndAppl.getString("productFeatureId"), featureType);
- standardFeatureLookup.put(standardFeatureAndAppl.getString("productFeatureId"), standardFeatureAndAppl);
+ GenericValue standardFeatureAndAppl = (GenericValue) standardFeatureApplIter.next()
+ GenericValue featureType = standardFeatureAndAppl.getRelatedOne("ProductFeatureType", true)
+ productFeatureTypeLookup.put(standardFeatureAndAppl.getString("productFeatureId"), featureType)
+ standardFeatureLookup.put(standardFeatureAndAppl.getString("productFeatureId"), standardFeatureAndAppl)
}
- context.standardFeatureLookup = standardFeatureLookup;
- context.standardFeatureAppls = standardFeatureAppls;
+ context.standardFeatureLookup = standardFeatureLookup
+ context.standardFeatureAppls = standardFeatureAppls
// get selectable features for this product
- List selectableFeatureAppls = EntityUtil.filterByAnd(productFeatureAndAppls, [productFeatureApplTypeId : 'SELECTABLE_FEATURE']);
- selectableFeatureLookup = [:];
+ List selectableFeatureAppls = EntityUtil.filterByAnd(productFeatureAndAppls, [productFeatureApplTypeId : 'SELECTABLE_FEATURE'])
+ selectableFeatureLookup = [:]
// get feature types that are deleteable from selectable features section
- Set selectableFeatureTypes = new HashSet();
+ Set selectableFeatureTypes = new HashSet()
- Iterator selectableFeatureAndApplIter = selectableFeatureAppls.iterator();
+ Iterator selectableFeatureAndApplIter = selectableFeatureAppls.iterator()
while (selectableFeatureAndApplIter) {
- GenericValue selectableFeatureAndAppl = (GenericValue) selectableFeatureAndApplIter.next();
- GenericValue featureType = selectableFeatureAndAppl.getRelatedOne("ProductFeatureType", true);
- productFeatureTypeLookup.put(selectableFeatureAndAppl.productFeatureId, featureType);
- selectableFeatureLookup.put(selectableFeatureAndAppl.productFeatureId, selectableFeatureAndAppl);
- selectableFeatureTypes.add(featureType);
+ GenericValue selectableFeatureAndAppl = (GenericValue) selectableFeatureAndApplIter.next()
+ GenericValue featureType = selectableFeatureAndAppl.getRelatedOne("ProductFeatureType", true)
+ productFeatureTypeLookup.put(selectableFeatureAndAppl.productFeatureId, featureType)
+ selectableFeatureLookup.put(selectableFeatureAndAppl.productFeatureId, selectableFeatureAndAppl)
+ selectableFeatureTypes.add(featureType)
}
- context.selectableFeatureLookup = selectableFeatureLookup;
- context.selectableFeatureAppls = selectableFeatureAppls;
- context.selectableFeatureTypes = selectableFeatureTypes;
+ context.selectableFeatureLookup = selectableFeatureLookup
+ context.selectableFeatureAppls = selectableFeatureAppls
+ context.selectableFeatureTypes = selectableFeatureTypes
if ("Y".equalsIgnoreCase(product.isVariant)) {
- Set distinguishingFeatures = ProductWorker.getVariantDistinguishingFeatures(product);
- context.distinguishingFeatures = distinguishingFeatures;
- Iterator distinguishingFeatureIter = distinguishingFeatures.iterator();
+ Set distinguishingFeatures = ProductWorker.getVariantDistinguishingFeatures(product)
+ context.distinguishingFeatures = distinguishingFeatures
+ Iterator distinguishingFeatureIter = distinguishingFeatures.iterator()
while (distinguishingFeatureIter) {
- distFeature = (GenericValue) distinguishingFeatureIter.next();
- featureType = distFeature.getRelatedOne("ProductFeatureType", true);
+ distFeature = (GenericValue) distinguishingFeatureIter.next()
+ featureType = distFeature.getRelatedOne("ProductFeatureType", true)
if (!productFeatureTypeLookup.containsKey(distFeature.productFeatureId)) {
- productFeatureTypeLookup.put(distFeature.productFeatureId, featureType);
+ productFeatureTypeLookup.put(distFeature.productFeatureId, featureType)
}
}
}
- context.productFeatureTypeLookup = productFeatureTypeLookup;
+ context.productFeatureTypeLookup = productFeatureTypeLookup
// get shipping dimensions and weights for single product
- prodFeaturesFiltered = EntityUtil.filterByAnd(productFeatureAndAppls, [productFeatureTypeId : 'AMOUNT', uomId : 'VLIQ_ozUS']);
+ prodFeaturesFiltered = EntityUtil.filterByAnd(productFeatureAndAppls, [productFeatureTypeId : 'AMOUNT', uomId : 'VLIQ_ozUS'])
if (prodFeaturesFiltered) {
try {
- floz = ((GenericValue)prodFeaturesFiltered.get(0)).getBigDecimal("numberSpecified");
+ floz = ((GenericValue)prodFeaturesFiltered.get(0)).getBigDecimal("numberSpecified")
} catch (Exception e) {
- floz = null;
+ floz = null
}
- context.floz = floz;
+ context.floz = floz
}
- prodFeaturesFiltered = EntityUtil.filterByAnd(productFeatureAndAppls, [productFeatureTypeId : 'AMOUNT', uomId : 'VLIQ_ml']);
+ prodFeaturesFiltered = EntityUtil.filterByAnd(productFeatureAndAppls, [productFeatureTypeId : 'AMOUNT', uomId : 'VLIQ_ml'])
if (prodFeaturesFiltered) {
try {
- ml = ((GenericValue)prodFeaturesFiltered.get(0)).getBigDecimal("numberSpecified");
+ ml = ((GenericValue)prodFeaturesFiltered.get(0)).getBigDecimal("numberSpecified")
} catch (Exception e) {
- ml = null;
+ ml = null
}
- context.ml = ml;
+ context.ml = ml
}
- prodFeaturesFiltered = EntityUtil.filterByAnd(productFeatureAndAppls, [productFeatureTypeId : 'AMOUNT', uomId : 'WT_g']);
+ prodFeaturesFiltered = EntityUtil.filterByAnd(productFeatureAndAppls, [productFeatureTypeId : 'AMOUNT', uomId : 'WT_g'])
if (prodFeaturesFiltered) {
try {
- grams = ((GenericValue)prodFeaturesFiltered.get(0)).getBigDecimal("numberSpecified");
+ grams = ((GenericValue)prodFeaturesFiltered.get(0)).getBigDecimal("numberSpecified")
} catch (Exception e) {
- grams = null;
+ grams = null
}
- context.grams = grams;
+ context.grams = grams
}
- prodFeaturesFiltered = EntityUtil.filterByAnd(productFeatureAndAppls, [productFeatureTypeId : 'AMOUNT', uomId : 'WT_oz']);
+ prodFeaturesFiltered = EntityUtil.filterByAnd(productFeatureAndAppls, [productFeatureTypeId : 'AMOUNT', uomId : 'WT_oz'])
if (prodFeaturesFiltered) {
try {
- ntwt = ((GenericValue)prodFeaturesFiltered.get(0)).getBigDecimal("numberSpecified");
+ ntwt = ((GenericValue)prodFeaturesFiltered.get(0)).getBigDecimal("numberSpecified")
} catch (Exception e) {
- ntwt = null;
+ ntwt = null
}
- context.ntwt = ntwt;
+ context.ntwt = ntwt
}
- prodFeaturesFiltered = EntityUtil.filterByAnd(productFeatureAndAppls, [productFeatureTypeId : 'HAZMAT']);
+ prodFeaturesFiltered = EntityUtil.filterByAnd(productFeatureAndAppls, [productFeatureTypeId : 'HAZMAT'])
if (prodFeaturesFiltered) {
try {
- hazmat = ((GenericValue)prodFeaturesFiltered.get(0)).getString("description");
+ hazmat = ((GenericValue)prodFeaturesFiltered.get(0)).getString("description")
} catch (Exception e) {
- hazmat = "nbsp;";
+ hazmat = "nbsp;"
}
if (hazmat == null) {
- hazmat = "nbsp;";
+ hazmat = "nbsp;"
}
- context.hazmat = hazmat;
+ context.hazmat = hazmat
}
- java.sql.Timestamp salesThru = product.getTimestamp("salesDiscontinuationDate");
+ java.sql.Timestamp salesThru = product.getTimestamp("salesDiscontinuationDate")
if (!salesThru) {
- salesthru = "[ ]";
+ salesthru = "[ ]"
} else if (salesThru.after(new java.util.Date())) {
- salesthru = "[x]";
+ salesthru = "[x]"
} else {
- salesthru = "[x]";
+ salesthru = "[x]"
}
- context.salesthru = salesthru;
- thrudate = "";
- context.thrudate = thrudate;
+ context.salesthru = salesthru
+ thrudate = ""
+ context.thrudate = thrudate
// get all variants - associations first
- productAssocs = product.getRelated("MainProductAssoc", [productAssocTypeId : 'PRODUCT_VARIANT'], null, false);
- Iterator productAssocIter = productAssocs.iterator();
+ productAssocs = product.getRelated("MainProductAssoc", [productAssocTypeId : 'PRODUCT_VARIANT'], null, false)
+ Iterator productAssocIter = productAssocs.iterator()
// get shipping dimensions and weights for all the variants
while (productAssocIter) {
// now get the variant product
- productAssoc = (GenericValue)productAssocIter.next();
- assocProduct = productAssoc.getRelatedOne("AssocProduct", false);
+ productAssoc = (GenericValue)productAssocIter.next()
+ assocProduct = productAssoc.getRelatedOne("AssocProduct", false)
if (assocProduct) {
- assocProducts.add(assocProduct);
- assocProductFeatureAndAppls = assocProduct.getRelated("ProductFeatureAndAppl", null, null, false);
- prodFeaturesFiltered = EntityUtil.filterByAnd(assocProductFeatureAndAppls, [productFeatureTypeId : 'AMOUNT', uomId : 'VLIQ_ozUS']);
+ assocProducts.add(assocProduct)
+ assocProductFeatureAndAppls = assocProduct.getRelated("ProductFeatureAndAppl", null, null, false)
+ prodFeaturesFiltered = EntityUtil.filterByAnd(assocProductFeatureAndAppls, [productFeatureTypeId : 'AMOUNT', uomId : 'VLIQ_ozUS'])
if (prodFeaturesFiltered) {
- featureFloz.put(assocProduct.productId, ((GenericValue)prodFeaturesFiltered.get(0)).getBigDecimal("numberSpecified"));
+ featureFloz.put(assocProduct.productId, ((GenericValue)prodFeaturesFiltered.get(0)).getBigDecimal("numberSpecified"))
}
- prodFeaturesFiltered = EntityUtil.filterByAnd(assocProductFeatureAndAppls, [productFeatureTypeId : 'AMOUNT', uomId : 'VLIQ_ml']);
+ prodFeaturesFiltered = EntityUtil.filterByAnd(assocProductFeatureAndAppls, [productFeatureTypeId : 'AMOUNT', uomId : 'VLIQ_ml'])
if (prodFeaturesFiltered) {
- featureMl.put(assocProduct.productId, ((GenericValue)prodFeaturesFiltered.get(0)).getBigDecimal("numberSpecified"));
+ featureMl.put(assocProduct.productId, ((GenericValue)prodFeaturesFiltered.get(0)).getBigDecimal("numberSpecified"))
}
- prodFeaturesFiltered = EntityUtil.filterByAnd(assocProductFeatureAndAppls, [productFeatureTypeId : 'AMOUNT', uomId : 'WT_g']);
+ prodFeaturesFiltered = EntityUtil.filterByAnd(assocProductFeatureAndAppls, [productFeatureTypeId : 'AMOUNT', uomId : 'WT_g'])
if (prodFeaturesFiltered) {
- featureGrams.put(assocProduct.productId, ((GenericValue)prodFeaturesFiltered.get(0)).getBigDecimal("numberSpecified"));
+ featureGrams.put(assocProduct.productId, ((GenericValue)prodFeaturesFiltered.get(0)).getBigDecimal("numberSpecified"))
}
- prodFeaturesFiltered = EntityUtil.filterByAnd(assocProductFeatureAndAppls, [productFeatureTypeId : 'AMOUNT', uomId : 'WT_oz']);
+ prodFeaturesFiltered = EntityUtil.filterByAnd(assocProductFeatureAndAppls, [productFeatureTypeId : 'AMOUNT', uomId : 'WT_oz'])
if (prodFeaturesFiltered) {
- featureNtwt.put(assocProduct.productId, ((GenericValue)prodFeaturesFiltered.get(0)).getBigDecimal("numberSpecified"));
+ featureNtwt.put(assocProduct.productId, ((GenericValue)prodFeaturesFiltered.get(0)).getBigDecimal("numberSpecified"))
}
- prodFeaturesFiltered = EntityUtil.filterByAnd(assocProductFeatureAndAppls, [productFeatureTypeId : 'HAZMAT']);
+ prodFeaturesFiltered = EntityUtil.filterByAnd(assocProductFeatureAndAppls, [productFeatureTypeId : 'HAZMAT'])
if (prodFeaturesFiltered) {
featureHazmat.put(assocProduct.productId,
- ((GenericValue)prodFeaturesFiltered.get(0)).getString("description"));
+ ((GenericValue)prodFeaturesFiltered.get(0)).getString("description"))
} else {
- featureHazmat.put(assocProduct.productId, " ");
+ featureHazmat.put(assocProduct.productId, " ")
}
- salesThru = assocProduct.getTimestamp("salesDiscontinuationDate");
+ salesThru = assocProduct.getTimestamp("salesDiscontinuationDate")
if (!salesThru) {
- featureSalesThru.put(assocProduct.productId, "[ ]");
+ featureSalesThru.put(assocProduct.productId, "[ ]")
} else if (salesThru.after(new java.util.Date())) {
- featureSalesThru.put(assocProduct.productId, "[x]");
+ featureSalesThru.put(assocProduct.productId, "[x]")
} else {
- featureSalesThru.put(assocProduct.productId, "[x]");
+ featureSalesThru.put(assocProduct.productId, "[x]")
}
- java.sql.Timestamp thruDate = productAssoc.getTimestamp("thruDate");
+ java.sql.Timestamp thruDate = productAssoc.getTimestamp("thruDate")
if (!thruDate) {
- featureThruDate.put(assocProduct.productId, "[ ]");
+ featureThruDate.put(assocProduct.productId, "[ ]")
} else if (thruDate.after(new java.util.Date())) {
- featureThruDate.put(assocProduct.productId, "[x]");
+ featureThruDate.put(assocProduct.productId, "[x]")
} else {
- featureThruDate.put(assocProduct.productId, "[x]");
+ featureThruDate.put(assocProduct.productId, "[x]")
}
- prodFeaturesFiltered = EntityUtil.filterByAnd(assocProductFeatureAndAppls, [productFeatureTypeId : productFeatureTypeId]);
+ prodFeaturesFiltered = EntityUtil.filterByAnd(assocProductFeatureAndAppls, [productFeatureTypeId : productFeatureTypeId])
if (prodFeaturesFiltered) {
// this is used for the selectable feature descriptions section; only include here iff the description is also associated with the virtual product as a selectable feature, ie if this is a distinguishing feature
- String curSelDescription = ((GenericValue) prodFeaturesFiltered.get(0)).getString("description");
- testProductFeatureAndAppls = EntityUtil.filterByAnd(productFeatureAndAppls, [productFeatureTypeId : productFeatureTypeId, description : curSelDescription, productFeatureApplTypeId : 'SELECTABLE_FEATURE']);
+ String curSelDescription = ((GenericValue) prodFeaturesFiltered.get(0)).getString("description")
+ testProductFeatureAndAppls = EntityUtil.filterByAnd(productFeatureAndAppls, [productFeatureTypeId : productFeatureTypeId, description : curSelDescription, productFeatureApplTypeId : 'SELECTABLE_FEATURE'])
if (testProductFeatureAndAppls) {
- selFeatureDesc.put(assocProduct.productId, curSelDescription);
+ selFeatureDesc.put(assocProduct.productId, curSelDescription)
}
}
}
}
- assocProducts = EntityUtil.orderBy(assocProducts, ['internalName']);
- context.assocProducts = assocProducts;
- context.productAssocs = productAssocs;
+ assocProducts = EntityUtil.orderBy(assocProducts, ['internalName'])
+ context.assocProducts = assocProducts
+ context.productAssocs = productAssocs
}
-context.featureFloz = featureFloz;
-context.featureMl = featureMl;
-context.featureNtwt = featureNtwt;
-context.featureGrams = featureGrams;
-context.featureHazmat = featureHazmat;
-context.featureSalesThru = featureSalesThru;
-context.featureThruDate = featureThruDate;
-context.selFeatureDesc = selFeatureDesc;
+context.featureFloz = featureFloz
+context.featureMl = featureMl
+context.featureNtwt = featureNtwt
+context.featureGrams = featureGrams
+context.featureHazmat = featureHazmat
+context.featureSalesThru = featureSalesThru
+context.featureThruDate = featureThruDate
+context.selFeatureDesc = selFeatureDesc
// get "all" category id
-String allCategoryId = EntityUtilProperties.getPropertyValue("catalog", "all.product.category", delegator);
-context.allCategoryId = allCategoryId;
+String allCategoryId = EntityUtilProperties.getPropertyValue("catalog", "all.product.category", delegator)
+context.allCategoryId = allCategoryId
// show the publish or unpublish section
-prodCatMembs = from("ProductCategoryMember").where("productCategoryId", allCategoryId, "productId", productId).queryList();
-//don't filter by date, show all categories: prodCatMembs = EntityUtil.filterByDate(prodCatMembs);
+prodCatMembs = from("ProductCategoryMember").where("productCategoryId", allCategoryId, "productId", productId).queryList()
+//don't filter by date, show all categories: prodCatMembs = EntityUtil.filterByDate(prodCatMembs)
-String showPublish = "false";
+String showPublish = "false"
if (prodCatMembs.size() == 0) {
- showPublish = "true";
+ showPublish = "true"
}
-context.showPublish = showPublish;
+context.showPublish = showPublish
diff --git a/applications/product/groovyScripts/catalog/product/EditProductSEO.groovy b/applications/product/groovyScripts/catalog/product/EditProductSEO.groovy
index b25a60fed7..727bd5d81d 100644
--- a/applications/product/groovyScripts/catalog/product/EditProductSEO.groovy
+++ b/applications/product/groovyScripts/catalog/product/EditProductSEO.groovy
@@ -17,24 +17,24 @@
* under the License.
*/
-productId = parameters.productId;
+productId = parameters.productId
if (productId) {
- productContents = from("ProductContent").where("productId", productId).queryList();
+ productContents = from("ProductContent").where("productId", productId).queryList()
productContents.each{ productContent->
if (productContent.productContentTypeId == "PAGE_TITLE") {
- contentTitle = from("Content").where("contentId", productContent.contentId).queryOne();
- dataTextTitle = from("ElectronicText").where("dataResourceId", contentTitle.dataResourceId).queryOne();
- context.title = dataTextTitle.textData;
+ contentTitle = from("Content").where("contentId", productContent.contentId).queryOne()
+ dataTextTitle = from("ElectronicText").where("dataResourceId", contentTitle.dataResourceId).queryOne()
+ context.title = dataTextTitle.textData
}
if (productContent.productContentTypeId == "META_KEYWORD") {
- contentMetaKeyword = from("Content").where("contentId", productContent.contentId).queryOne();
- dataTextMetaKeyword = from("ElectronicText").where("dataResourceId", contentMetaKeyword.dataResourceId).queryOne();
- context.metaKeyword = dataTextMetaKeyword.textData;
+ contentMetaKeyword = from("Content").where("contentId", productContent.contentId).queryOne()
+ dataTextMetaKeyword = from("ElectronicText").where("dataResourceId", contentMetaKeyword.dataResourceId).queryOne()
+ context.metaKeyword = dataTextMetaKeyword.textData
}
if (productContent.productContentTypeId == "META_DESCRIPTION") {
- contentMetaDescription = from("Content").where("contentId", productContent.contentId).queryOne();
- dataTextMetaDescription = from("ElectronicText").where("dataResourceId", contentMetaDescription.dataResourceId).queryOne();
- context.metaDescription = dataTextMetaDescription.textData;
+ contentMetaDescription = from("Content").where("contentId", productContent.contentId).queryOne()
+ dataTextMetaDescription = from("ElectronicText").where("dataResourceId", contentMetaDescription.dataResourceId).queryOne()
+ context.metaDescription = dataTextMetaDescription.textData
}
}
}
diff --git a/applications/product/groovyScripts/catalog/product/QuickAddVariants.groovy b/applications/product/groovyScripts/catalog/product/QuickAddVariants.groovy
index 49187e1340..5a2b2fe0a4 100644
--- a/applications/product/groovyScripts/catalog/product/QuickAddVariants.groovy
+++ b/applications/product/groovyScripts/catalog/product/QuickAddVariants.groovy
@@ -17,8 +17,8 @@
* under the License.
*/
-result = runService('getProductFeaturesByType', [productId : productId, productFeatureApplTypeId : 'SELECTABLE_FEATURE']);
-context.featureTypes = result.productFeatureTypes;
+result = runService('getProductFeaturesByType', [productId : productId, productFeatureApplTypeId : 'SELECTABLE_FEATURE'])
+context.featureTypes = result.productFeatureTypes
-result = runService('getVariantCombinations', [productId : productId]);
-context.featureCombinationInfos = result.featureCombinations;
+result = runService('getVariantCombinations', [productId : productId])
+context.featureCombinationInfos = result.featureCombinations
diff --git a/applications/product/groovyScripts/catalog/promo/EditProductPromoCode.groovy b/applications/product/groovyScripts/catalog/promo/EditProductPromoCode.groovy
index 40341633c4..ee9403c7a5 100644
--- a/applications/product/groovyScripts/catalog/promo/EditProductPromoCode.groovy
+++ b/applications/product/groovyScripts/catalog/promo/EditProductPromoCode.groovy
@@ -17,34 +17,34 @@
* under the License.
*/
-productPromoCodeId = request.getParameter("productPromoCodeId");
+productPromoCodeId = request.getParameter("productPromoCodeId")
if (!productPromoCodeId) {
- productPromoCodeId = request.getAttribute("productPromoCodeId");
+ productPromoCodeId = request.getAttribute("productPromoCodeId")
}
-productPromoCode = from("ProductPromoCode").where("productPromoCodeId", productPromoCodeId).queryOne();
+productPromoCode = from("ProductPromoCode").where("productPromoCodeId", productPromoCodeId).queryOne()
-productPromoId = null;
+productPromoId = null
if (productPromoCode) {
- productPromoId = productPromoCode.productPromoId;
+ productPromoId = productPromoCode.productPromoId
} else {
- productPromoId = request.getParameter("productPromoId");
+ productPromoId = request.getParameter("productPromoId")
}
-productPromo = null;
+productPromo = null
if (productPromoId) {
- productPromo = from("ProductPromo").where("productPromoId", productPromoId).queryOne();
+ productPromo = from("ProductPromo").where("productPromoId", productPromoId).queryOne()
}
-productPromoCodeEmails = null;
-productPromoCodeParties = null;
+productPromoCodeEmails = null
+productPromoCodeParties = null
if (productPromoCode) {
- productPromoCodeEmails = productPromoCode.getRelated("ProductPromoCodeEmail", null, null, false);
- productPromoCodeParties = productPromoCode.getRelated("ProductPromoCodeParty", null, null, false);
+ productPromoCodeEmails = productPromoCode.getRelated("ProductPromoCodeEmail", null, null, false)
+ productPromoCodeParties = productPromoCode.getRelated("ProductPromoCodeParty", null, null, false)
}
-context.productPromoId = productPromoId;
-context.productPromo = productPromo;
-context.productPromoCodeId = productPromoCodeId;
-context.productPromoCode = productPromoCode;
-context.productPromoCodeEmails = productPromoCodeEmails;
-context.productPromoCodeParties = productPromoCodeParties;
+context.productPromoId = productPromoId
+context.productPromo = productPromo
+context.productPromoCodeId = productPromoCodeId
+context.productPromoCode = productPromoCode
+context.productPromoCodeEmails = productPromoCodeEmails
+context.productPromoCodeParties = productPromoCodeParties
diff --git a/applications/product/groovyScripts/catalog/store/EditProductStorePaySetup.groovy b/applications/product/groovyScripts/catalog/store/EditProductStorePaySetup.groovy
index 59d5756398..f00c1b7996 100644
--- a/applications/product/groovyScripts/catalog/store/EditProductStorePaySetup.groovy
+++ b/applications/product/groovyScripts/catalog/store/EditProductStorePaySetup.groovy
@@ -17,71 +17,71 @@
* under the License.
*/
-import org.apache.ofbiz.entity.condition.*;
-import org.apache.ofbiz.entity.util.*;
+import org.apache.ofbiz.entity.condition.*
+import org.apache.ofbiz.entity.util.*
-paymentMethodTypeId = request.getParameter("paymentMethodTypeId");
-paymentServiceTypeEnumId = request.getParameter("paymentServiceTypeEnumId");
-customMethodsCond = null;
+paymentMethodTypeId = request.getParameter("paymentMethodTypeId")
+paymentServiceTypeEnumId = request.getParameter("paymentServiceTypeEnumId")
+customMethodsCond = null
if (paymentMethodTypeId && paymentServiceTypeEnumId) {
if (paymentMethodTypeId == "CREDIT_CARD" && paymentServiceTypeEnumId == "PRDS_PAY_AUTH" ) {
- customMethodsCond = EntityCondition.makeCondition("customMethodTypeId", EntityOperator.EQUALS, "CC_AUTH");
+ customMethodsCond = EntityCondition.makeCondition("customMethodTypeId", EntityOperator.EQUALS, "CC_AUTH")
} else if (paymentMethodTypeId == "CREDIT_CARD" && paymentServiceTypeEnumId == "PRDS_PAY_CAPTURE" ) {
- customMethodsCond = EntityCondition.makeCondition("customMethodTypeId", EntityOperator.EQUALS, "CC_CAPTURE");
+ customMethodsCond = EntityCondition.makeCondition("customMethodTypeId", EntityOperator.EQUALS, "CC_CAPTURE")
} else if (paymentMethodTypeId == "CREDIT_CARD" && paymentServiceTypeEnumId == "PRDS_PAY_REAUTH" ) {
- customMethodsCond = EntityCondition.makeCondition("customMethodTypeId", EntityOperator.EQUALS, "CC_AUTH");
+ customMethodsCond = EntityCondition.makeCondition("customMethodTypeId", EntityOperator.EQUALS, "CC_AUTH")
} else if (paymentMethodTypeId == "CREDIT_CARD" && paymentServiceTypeEnumId == "PRDS_PAY_REFUND" ) {
- customMethodsCond = EntityCondition.makeCondition("customMethodTypeId", EntityOperator.EQUALS, "CC_REFUND");
+ customMethodsCond = EntityCondition.makeCondition("customMethodTypeId", EntityOperator.EQUALS, "CC_REFUND")
} else if (paymentMethodTypeId == "CREDIT_CARD" && paymentServiceTypeEnumId == "PRDS_PAY_RELEASE" ) {
- customMethodsCond = EntityCondition.makeCondition("customMethodTypeId", EntityOperator.EQUALS, "CC_RELEASE");
+ customMethodsCond = EntityCondition.makeCondition("customMethodTypeId", EntityOperator.EQUALS, "CC_RELEASE")
} else if (paymentMethodTypeId == "EFT_ACCOUNT" && paymentServiceTypeEnumId == "PRDS_PAY_AUTH" ) {
- customMethodsCond = EntityCondition.makeCondition("customMethodTypeId", EntityOperator.EQUALS, "EFT_AUTH");
+ customMethodsCond = EntityCondition.makeCondition("customMethodTypeId", EntityOperator.EQUALS, "EFT_AUTH")
} else if (paymentMethodTypeId == "EFT_ACCOUNT" && paymentServiceTypeEnumId == "PRDS_PAY_RELEASE" ) {
- customMethodsCond = EntityCondition.makeCondition("customMethodTypeId", EntityOperator.EQUALS, "EFT_RELEASE");
+ customMethodsCond = EntityCondition.makeCondition("customMethodTypeId", EntityOperator.EQUALS, "EFT_RELEASE")
} else if (paymentMethodTypeId == "FIN_ACCOUNT" && paymentServiceTypeEnumId == "PRDS_PAY_AUTH" ) {
- customMethodsCond = EntityCondition.makeCondition("customMethodTypeId", EntityOperator.EQUALS, "FIN_AUTH");
+ customMethodsCond = EntityCondition.makeCondition("customMethodTypeId", EntityOperator.EQUALS, "FIN_AUTH")
} else if (paymentMethodTypeId == "FIN_ACCOUNT" && paymentServiceTypeEnumId == "PRDS_PAY_CAPTURE" ) {
- customMethodsCond = EntityCondition.makeCondition("customMethodTypeId", EntityOperator.EQUALS, "FIN_CAPTURE");
+ customMethodsCond = EntityCondition.makeCondition("customMethodTypeId", EntityOperator.EQUALS, "FIN_CAPTURE")
} else if (paymentMethodTypeId == "FIN_ACCOUNT" && paymentServiceTypeEnumId == "PRDS_PAY_REFUND" ) {
- customMethodsCond = EntityCondition.makeCondition("customMethodTypeId", EntityOperator.EQUALS, "FIN_REFUND");
+ customMethodsCond = EntityCondition.makeCondition("customMethodTypeId", EntityOperator.EQUALS, "FIN_REFUND")
} else if (paymentMethodTypeId == "FIN_ACCOUNT" && paymentServiceTypeEnumId == "PRDS_PAY_RELEASE" ) {
- customMethodsCond = EntityCondition.makeCondition("customMethodTypeId", EntityOperator.EQUALS, "FIN_RELEASE");
+ customMethodsCond = EntityCondition.makeCondition("customMethodTypeId", EntityOperator.EQUALS, "FIN_RELEASE")
} else if (paymentMethodTypeId == "GIFT_CARD" && paymentServiceTypeEnumId == "PRDS_PAY_AUTH" ) {
- customMethodsCond = EntityCondition.makeCondition("customMethodTypeId", EntityOperator.EQUALS, "GIFT_AUTH");
+ customMethodsCond = EntityCondition.makeCondition("customMethodTypeId", EntityOperator.EQUALS, "GIFT_AUTH")
} else if (paymentMethodTypeId == "GIFT_CARD" && paymentServiceTypeEnumId == "PRDS_PAY_CAPTURE" ) {
- customMethodsCond = EntityCondition.makeCondition("customMethodTypeId", EntityOperator.EQUALS, "GIFT_CAPTURE");
+ customMethodsCond = EntityCondition.makeCondition("customMethodTypeId", EntityOperator.EQUALS, "GIFT_CAPTURE")
} else if (paymentMethodTypeId == "GIFT_CARD" && paymentServiceTypeEnumId == "PRDS_PAY_REFUND" ) {
- customMethodsCond = EntityCondition.makeCondition("customMethodTypeId", EntityOperator.EQUALS, "GIFT_REFUND");
+ customMethodsCond = EntityCondition.makeCondition("customMethodTypeId", EntityOperator.EQUALS, "GIFT_REFUND")
} else if (paymentMethodTypeId == "GIFT_CARD" && paymentServiceTypeEnumId == "PRDS_PAY_RELEASE" ) {
- customMethodsCond = EntityCondition.makeCondition("customMethodTypeId", EntityOperator.EQUALS, "GIFT_RELEASE");
+ customMethodsCond = EntityCondition.makeCondition("customMethodTypeId", EntityOperator.EQUALS, "GIFT_RELEASE")
}
}
if (!paymentMethodTypeId || !paymentServiceTypeEnumId) {
- customMethods = [];
- customMethods.add(EntityCondition.makeCondition("customMethodTypeId", EntityOperator.EQUALS, "CC_AUTH"));
- customMethods.add(EntityCondition.makeCondition("customMethodTypeId", EntityOperator.EQUALS, "CC_CAPTURE"));
- customMethods.add(EntityCondition.makeCondition("customMethodTypeId", EntityOperator.EQUALS, "CC_REAUTH"));
- customMethods.add(EntityCondition.makeCondition("customMethodTypeId", EntityOperator.EQUALS, "CC_REFUND"));
- customMethods.add(EntityCondition.makeCondition("customMethodTypeId", EntityOperator.EQUALS, "CC_RELEASE"));
- customMethods.add(EntityCondition.makeCondition("customMethodTypeId", EntityOperator.EQUALS, "CC_CREDIT"));
- customMethods.add(EntityCondition.makeCondition("customMethodTypeId", EntityOperator.EQUALS, "EFT_AUTH"));
- customMethods.add(EntityCondition.makeCondition("customMethodTypeId", EntityOperator.EQUALS, "EFT_RELEASE"));
- customMethods.add(EntityCondition.makeCondition("customMethodTypeId", EntityOperator.EQUALS, "FIN_AUTH"));
- customMethods.add(EntityCondition.makeCondition("customMethodTypeId", EntityOperator.EQUALS, "FIN_CAPTURE"));
- customMethods.add(EntityCondition.makeCondition("customMethodTypeId", EntityOperator.EQUALS, "FIN_REFUND"));
- customMethods.add(EntityCondition.makeCondition("customMethodTypeId", EntityOperator.EQUALS, "FIN_RELEASE"));
- customMethods.add(EntityCondition.makeCondition("customMethodTypeId", EntityOperator.EQUALS, "GIFT_AUTH"));
- customMethods.add(EntityCondition.makeCondition("customMethodTypeId", EntityOperator.EQUALS, "GIFT_CAPTURE"));
- customMethods.add(EntityCondition.makeCondition("customMethodTypeId", EntityOperator.EQUALS, "GIFT_REFUND"));
- customMethods.add(EntityCondition.makeCondition("customMethodTypeId", EntityOperator.EQUALS, "GIFT_RELEASE"));
- customMethodsCond = EntityCondition.makeCondition(customMethods, EntityOperator.OR);
+ customMethods = []
+ customMethods.add(EntityCondition.makeCondition("customMethodTypeId", EntityOperator.EQUALS, "CC_AUTH"))
+ customMethods.add(EntityCondition.makeCondition("customMethodTypeId", EntityOperator.EQUALS, "CC_CAPTURE"))
+ customMethods.add(EntityCondition.makeCondition("customMethodTypeId", EntityOperator.EQUALS, "CC_REAUTH"))
+ customMethods.add(EntityCondition.makeCondition("customMethodTypeId", EntityOperator.EQUALS, "CC_REFUND"))
+ customMethods.add(EntityCondition.makeCondition("customMethodTypeId", EntityOperator.EQUALS, "CC_RELEASE"))
+ customMethods.add(EntityCondition.makeCondition("customMethodTypeId", EntityOperator.EQUALS, "CC_CREDIT"))
+ customMethods.add(EntityCondition.makeCondition("customMethodTypeId", EntityOperator.EQUALS, "EFT_AUTH"))
+ customMethods.add(EntityCondition.makeCondition("customMethodTypeId", EntityOperator.EQUALS, "EFT_RELEASE"))
+ customMethods.add(EntityCondition.makeCondition("customMethodTypeId", EntityOperator.EQUALS, "FIN_AUTH"))
+ customMethods.add(EntityCondition.makeCondition("customMethodTypeId", EntityOperator.EQUALS, "FIN_CAPTURE"))
+ customMethods.add(EntityCondition.makeCondition("customMethodTypeId", EntityOperator.EQUALS, "FIN_REFUND"))
+ customMethods.add(EntityCondition.makeCondition("customMethodTypeId", EntityOperator.EQUALS, "FIN_RELEASE"))
+ customMethods.add(EntityCondition.makeCondition("customMethodTypeId", EntityOperator.EQUALS, "GIFT_AUTH"))
+ customMethods.add(EntityCondition.makeCondition("customMethodTypeId", EntityOperator.EQUALS, "GIFT_CAPTURE"))
+ customMethods.add(EntityCondition.makeCondition("customMethodTypeId", EntityOperator.EQUALS, "GIFT_REFUND"))
+ customMethods.add(EntityCondition.makeCondition("customMethodTypeId", EntityOperator.EQUALS, "GIFT_RELEASE"))
+ customMethodsCond = EntityCondition.makeCondition(customMethods, EntityOperator.OR)
}
if (paymentServiceTypeEnumId == "PRDS_PAY_EXTERNAL") {
- context.paymentCustomMethods = null;
+ context.paymentCustomMethods = null
} else if (customMethodsCond) {
- context.paymentCustomMethods = from("CustomMethod").where(customMethodsCond).orderBy("description").queryList();
+ context.paymentCustomMethods = from("CustomMethod").where(customMethodsCond).orderBy("description").queryList()
} else {
- context.paymentCustomMethods = from("CustomMethod").orderBy("description").queryList();
+ context.paymentCustomMethods = from("CustomMethod").orderBy("description").queryList()
}
diff --git a/applications/product/groovyScripts/catalog/store/EditProductStoreSurveys.groovy b/applications/product/groovyScripts/catalog/store/EditProductStoreSurveys.groovy
index c8b81b2173..9a03c5fcff 100644
--- a/applications/product/groovyScripts/catalog/store/EditProductStoreSurveys.groovy
+++ b/applications/product/groovyScripts/catalog/store/EditProductStoreSurveys.groovy
@@ -21,21 +21,21 @@ import org.apache.ofbiz.base.util.*
import org.apache.ofbiz.entity.condition.*
import org.apache.ofbiz.entity.util.*
-context.hasPermission = security.hasEntityPermission("CATALOG", "_VIEW", session);
+context.hasPermission = security.hasEntityPermission("CATALOG", "_VIEW", session)
-productStoreId = request.getParameter("productStoreId");
+productStoreId = request.getParameter("productStoreId")
if (productStoreId) {
- productStore = from("ProductStore").where("productStoreId", productStoreId).queryOne();
- context.productStoreId = productStoreId;
- context.productStore = productStore;
+ productStore = from("ProductStore").where("productStoreId", productStoreId).queryOne()
+ context.productStoreId = productStoreId
+ context.productStore = productStore
}
-context.productStoreSurveys = from("ProductStoreSurveyAppl").where("productStoreId", productStoreId).filterByDate().queryList();
+context.productStoreSurveys = from("ProductStoreSurveyAppl").where("productStoreId", productStoreId).filterByDate().queryList()
-context.surveys = from("Survey").orderBy("description").queryList();
+context.surveys = from("Survey").orderBy("description").queryList()
-context.surveyApplTypes = from("SurveyApplType").orderBy("description").queryList();
+context.surveyApplTypes = from("SurveyApplType").orderBy("description").queryList()
-context.productCategories = from("ProductCategory").orderBy("description").queryList();
+context.productCategories = from("ProductCategory").orderBy("description").queryList()
-context.nowTimestampString = UtilDateTime.nowTimestamp().toString();
+context.nowTimestampString = UtilDateTime.nowTimestamp().toString()
diff --git a/applications/product/groovyScripts/catalog/thesaurus/EditKeywordThesaurus.groovy b/applications/product/groovyScripts/catalog/thesaurus/EditKeywordThesaurus.groovy
index 8137a4f9a9..e9e4ed76de 100644
--- a/applications/product/groovyScripts/catalog/thesaurus/EditKeywordThesaurus.groovy
+++ b/applications/product/groovyScripts/catalog/thesaurus/EditKeywordThesaurus.groovy
@@ -19,55 +19,55 @@
import org.apache.ofbiz.entity.condition.*
-relationshipEnums = from("Enumeration").where("enumTypeId", "KW_THES_REL").orderBy("sequenceId").cache(true).queryList();
+relationshipEnums = from("Enumeration").where("enumTypeId", "KW_THES_REL").orderBy("sequenceId").cache(true).queryList()
-keywordThesauruses = from("KeywordThesaurus").orderBy("enteredKeyword").queryList();
+keywordThesauruses = from("KeywordThesaurus").orderBy("enteredKeyword").queryList()
//if no param sent in make firstLetter 'a' else use firstLetter passed in
-firstLetterString = request.getParameter("firstLetter");
+firstLetterString = request.getParameter("firstLetter")
if (!firstLetterString) {
- firstLetter = 'a';
+ firstLetter = 'a'
}
else {
- firstLetter = firstLetterString.charAt(0);
+ firstLetter = firstLetterString.charAt(0)
}
//add elememts to new list as long as it is smaller then 20,
// but always get all of the first letter
-keywordThesaurusIter = keywordThesauruses.iterator();
-newKeywordThesaurus = [];
-specialCharKeywordThesaurus = [];
-currentLetter = firstLetter;
+keywordThesaurusIter = keywordThesauruses.iterator()
+newKeywordThesaurus = []
+specialCharKeywordThesaurus = []
+currentLetter = firstLetter
if (keywordThesaurusIter) {
while (keywordThesaurusIter) {
- keywordThesaurus = keywordThesaurusIter.next();
+ keywordThesaurus = keywordThesaurusIter.next()
if (keywordThesaurus.get("enteredKeyword").charAt(0)<'a' ||
keywordThesaurus.get("enteredKeyword").charAt(0)>'z') {
- specialCharKeywordThesaurus.add(keywordThesaurus);
+ specialCharKeywordThesaurus.add(keywordThesaurus)
} else if (keywordThesaurus.get("enteredKeyword").charAt(0) >= firstLetter) {
if (keywordThesaurus.get("enteredKeyword").charAt(0) == currentLetter ||
newKeywordThesaurus.size()<20) {
- newKeywordThesaurus.add(keywordThesaurus);
- currentLetter = keywordThesaurus.get("enteredKeyword").charAt(0);
+ newKeywordThesaurus.add(keywordThesaurus)
+ currentLetter = keywordThesaurus.get("enteredKeyword").charAt(0)
}
}
}
}
if ((specialCharKeywordThesaurus.size() > 0 && newKeywordThesaurus.size()<20) || firstLetter=='z') {
- specialCharKeywordThesaurusIter = specialCharKeywordThesaurus.iterator();
+ specialCharKeywordThesaurusIter = specialCharKeywordThesaurus.iterator()
while (specialCharKeywordThesaurusIter) {
- keywordThesaurus = specialCharKeywordThesaurusIter.next();
- newKeywordThesaurus.add(keywordThesaurus);
+ keywordThesaurus = specialCharKeywordThesaurusIter.next()
+ newKeywordThesaurus.add(keywordThesaurus)
}
}
//create list for a-z
-letterList = [];
+letterList = []
for (i='a'; i<='z'; i++) {
- letterList.add(i);
+ letterList.add(i)
}
-context.relationshipEnums = relationshipEnums;
-context.keywordThesauruses = newKeywordThesaurus;
-context.firstLetter = firstLetter;
-context.letterList = letterList;
+context.relationshipEnums = relationshipEnums
+context.keywordThesauruses = newKeywordThesaurus
+context.firstLetter = firstLetter
+context.letterList = letterList
diff --git a/applications/product/groovyScripts/facility/facility/ComputeProductSellThroughData.groovy b/applications/product/groovyScripts/facility/facility/ComputeProductSellThroughData.groovy
index b3723eb37a..4652d8502f 100644
--- a/applications/product/groovyScripts/facility/facility/ComputeProductSellThroughData.groovy
+++ b/applications/product/groovyScripts/facility/facility/ComputeProductSellThroughData.groovy
@@ -17,22 +17,22 @@
* under the License.
*/
-import java.math.MathContext;
-import java.sql.Timestamp;
+import java.math.MathContext
+import java.sql.Timestamp
if (parameters.fromDateSellThrough) {
- Timestamp fromDate = null;
- Timestamp thruDate = null;
+ Timestamp fromDate = null
+ Timestamp thruDate = null
try {
- fromDate = Timestamp.valueOf(parameters.fromDateSellThrough);
- thruDate = Timestamp.valueOf(parameters.thruDateSellThrough);
+ fromDate = Timestamp.valueOf(parameters.fromDateSellThrough)
+ thruDate = Timestamp.valueOf(parameters.thruDateSellThrough)
} catch(Exception e) {}
- inventoryCountResult = runService('countProductInventoryOnHand', [productId : productId, facilityId : facilityId, inventoryCountDate : fromDate, userLogin : userLogin]);
+ inventoryCountResult = runService('countProductInventoryOnHand', [productId : productId, facilityId : facilityId, inventoryCountDate : fromDate, userLogin : userLogin])
if (inventoryCountResult.quantityOnHandTotal && inventoryCountResult.quantityOnHandTotal > 0) {
- inventoryShippedForSalesResult = runService('countProductInventoryShippedForSales', [productId : productId, facilityId : facilityId, fromDate : fromDate, thruDate : thruDate, userLogin : userLogin]);
- context.sellThroughInitialInventory = inventoryCountResult.quantityOnHandTotal;
- context.sellThroughInventorySold = inventoryShippedForSalesResult.quantityOnHandTotal;
- context.sellThroughPercentage = new BigDecimal(inventoryShippedForSalesResult.quantityOnHandTotal / inventoryCountResult.quantityOnHandTotal * 100, new java.math.MathContext(2));
+ inventoryShippedForSalesResult = runService('countProductInventoryShippedForSales', [productId : productId, facilityId : facilityId, fromDate : fromDate, thruDate : thruDate, userLogin : userLogin])
+ context.sellThroughInitialInventory = inventoryCountResult.quantityOnHandTotal
+ context.sellThroughInventorySold = inventoryShippedForSalesResult.quantityOnHandTotal
+ context.sellThroughPercentage = new BigDecimal(inventoryShippedForSalesResult.quantityOnHandTotal / inventoryCountResult.quantityOnHandTotal * 100, new java.math.MathContext(2))
}
}
diff --git a/applications/product/groovyScripts/facility/facility/CountFacilityInventoryByProduct.groovy b/applications/product/groovyScripts/facility/facility/CountFacilityInventoryByProduct.groovy
index 65bc732d74..ee5a3db78b 100644
--- a/applications/product/groovyScripts/facility/facility/CountFacilityInventoryByProduct.groovy
+++ b/applications/product/groovyScripts/facility/facility/CountFacilityInventoryByProduct.groovy
@@ -41,96 +41,96 @@ import org.apache.ofbiz.entity.model.ModelViewEntity.ComplexAlias
import org.apache.ofbiz.entity.model.ModelViewEntity.ComplexAliasField
import org.apache.ofbiz.product.inventory.*
-action = request.getParameter("action");
+action = request.getParameter("action")
-searchParameterString = "action=Y&facilityId=" + facilityId;
+searchParameterString = "action=Y&facilityId=" + facilityId
-offsetQOH = -1;
-offsetATP = -1;
-hasOffsetQOH = false;
-hasOffsetATP = false;
+offsetQOH = -1
+offsetATP = -1
+hasOffsetQOH = false
+hasOffsetATP = false
-EntityListIterator prodsEli = null;
-rows = [] as ArrayList;
+EntityListIterator prodsEli = null
+rows = [] as ArrayList
if (action) {
// ------------------------------
- prodView = new DynamicViewEntity();
- atpDiffComplexAlias = new ComplexAlias("-");
+ prodView = new DynamicViewEntity()
+ atpDiffComplexAlias = new ComplexAlias("-")
- conditionMap = [facilityId : facilityId];
+ conditionMap = [facilityId : facilityId]
if (offsetQOHQty) {
try {
- offsetQOH = Integer.parseInt(offsetQOHQty);
- hasOffsetQOH = true;
- searchParameterString = searchParameterString + "&offsetQOHQty=" + offsetQOH;
+ offsetQOH = Integer.parseInt(offsetQOHQty)
+ hasOffsetQOH = true
+ searchParameterString = searchParameterString + "&offsetQOHQty=" + offsetQOH
} catch (NumberFormatException nfe) {
}
}
if (offsetATPQty) {
try {
- offsetATP = Integer.parseInt(offsetATPQty);
- hasOffsetATP = true;
- searchParameterString = searchParameterString + "&offsetATPQty=" + offsetATP;
+ offsetATP = Integer.parseInt(offsetATPQty)
+ hasOffsetATP = true
+ searchParameterString = searchParameterString + "&offsetATPQty=" + offsetATP
} catch (NumberFormatException nfe) {
}
}
- prodView.addMemberEntity("PRFA", "ProductFacility");
- prodView.addAlias("PRFA", "productId", null, null, null, Boolean.TRUE, null);
- prodView.addAlias("PRFA", "minimumStock", null, null, null, Boolean.TRUE, null);
- prodView.addAlias("PRFA", "reorderQuantity", null, null, null, Boolean.TRUE, null);
- prodView.addAlias("PRFA", "daysToShip", null, null, null, Boolean.TRUE, null);
- prodView.addAlias("PRFA", "facilityId", null, null, null, Boolean.TRUE, null);
+ prodView.addMemberEntity("PRFA", "ProductFacility")
+ prodView.addAlias("PRFA", "productId", null, null, null, Boolean.TRUE, null)
+ prodView.addAlias("PRFA", "minimumStock", null, null, null, Boolean.TRUE, null)
+ prodView.addAlias("PRFA", "reorderQuantity", null, null, null, Boolean.TRUE, null)
+ prodView.addAlias("PRFA", "daysToShip", null, null, null, Boolean.TRUE, null)
+ prodView.addAlias("PRFA", "facilityId", null, null, null, Boolean.TRUE, null)
- prodView.addMemberEntity("PROD", "Product");
- prodView.addViewLink("PROD", "PRFA", Boolean.FALSE, ModelKeyMap.makeKeyMapList("productId"));
- prodView.addAlias("PROD", "internalName", null, null, null, Boolean.TRUE, null);
- prodView.addAlias("PROD", "isVirtual", null, null, null, Boolean.TRUE, null);
- prodView.addAlias("PROD", "salesDiscontinuationDate", null, null, null, Boolean.TRUE, null);
+ prodView.addMemberEntity("PROD", "Product")
+ prodView.addViewLink("PROD", "PRFA", Boolean.FALSE, ModelKeyMap.makeKeyMapList("productId"))
+ prodView.addAlias("PROD", "internalName", null, null, null, Boolean.TRUE, null)
+ prodView.addAlias("PROD", "isVirtual", null, null, null, Boolean.TRUE, null)
+ prodView.addAlias("PROD", "salesDiscontinuationDate", null, null, null, Boolean.TRUE, null)
if (productTypeId) {
- prodView.addAlias("PROD", "productTypeId", null, null, null, Boolean.TRUE, null);
- conditionMap.productTypeId = productTypeId;
- searchParameterString = searchParameterString + "&productTypeId=" + productTypeId;
+ prodView.addAlias("PROD", "productTypeId", null, null, null, Boolean.TRUE, null)
+ conditionMap.productTypeId = productTypeId
+ searchParameterString = searchParameterString + "&productTypeId=" + productTypeId
}
- prodView.addMemberEntity("IITE", "InventoryItem");
- prodView.addViewLink("PRFA", "IITE", Boolean.FALSE, ModelKeyMap.makeKeyMapList("productId", "productId", "facilityId", "facilityId"));
- prodView.addAlias("IITE", "totalQuantityOnHandTotal", "quantityOnHandTotal", null, null, null, "sum");
- prodView.addAlias("IITE", "totalAvailableToPromiseTotal", "availableToPromiseTotal", null, null, null, "sum");
- qohDiffComplexAlias = new ComplexAlias("-");
- qohDiffComplexAlias.addComplexAliasMember(new ComplexAliasField("IITE", "quantityOnHandTotal", null, "sum"));
- qohDiffComplexAlias.addComplexAliasMember(new ComplexAliasField("PRFA", "minimumStock", null, null));
- prodView.addAlias(null, "offsetQOHQtyAvailable", null, null, null, null, null, qohDiffComplexAlias);
- atpDiffComplexAlias = new ComplexAlias("-");
- atpDiffComplexAlias.addComplexAliasMember(new ComplexAliasField("IITE", "availableToPromiseTotal", null, "sum"));
- atpDiffComplexAlias.addComplexAliasMember(new ComplexAliasField("PRFA", "minimumStock", null, null));
- prodView.addAlias(null, "offsetATPQtyAvailable", null, null, null, null, null, atpDiffComplexAlias);
+ prodView.addMemberEntity("IITE", "InventoryItem")
+ prodView.addViewLink("PRFA", "IITE", Boolean.FALSE, ModelKeyMap.makeKeyMapList("productId", "productId", "facilityId", "facilityId"))
+ prodView.addAlias("IITE", "totalQuantityOnHandTotal", "quantityOnHandTotal", null, null, null, "sum")
+ prodView.addAlias("IITE", "totalAvailableToPromiseTotal", "availableToPromiseTotal", null, null, null, "sum")
+ qohDiffComplexAlias = new ComplexAlias("-")
+ qohDiffComplexAlias.addComplexAliasMember(new ComplexAliasField("IITE", "quantityOnHandTotal", null, "sum"))
+ qohDiffComplexAlias.addComplexAliasMember(new ComplexAliasField("PRFA", "minimumStock", null, null))
+ prodView.addAlias(null, "offsetQOHQtyAvailable", null, null, null, null, null, qohDiffComplexAlias)
+ atpDiffComplexAlias = new ComplexAlias("-")
+ atpDiffComplexAlias.addComplexAliasMember(new ComplexAliasField("IITE", "availableToPromiseTotal", null, "sum"))
+ atpDiffComplexAlias.addComplexAliasMember(new ComplexAliasField("PRFA", "minimumStock", null, null))
+ prodView.addAlias(null, "offsetATPQtyAvailable", null, null, null, null, null, atpDiffComplexAlias)
if (searchInProductCategoryId) {
- prodView.addMemberEntity("PRCA", "ProductCategoryMember");
- prodView.addViewLink("PRFA", "PRCA", Boolean.FALSE, ModelKeyMap.makeKeyMapList("productId"));
- prodView.addAlias("PRCA", "productCategoryId", null, null, null, Boolean.TRUE, null);
- conditionMap.productCategoryId = searchInProductCategoryId;
- searchParameterString = searchParameterString + "&searchInProductCategoryId=" + searchInProductCategoryId;
+ prodView.addMemberEntity("PRCA", "ProductCategoryMember")
+ prodView.addViewLink("PRFA", "PRCA", Boolean.FALSE, ModelKeyMap.makeKeyMapList("productId"))
+ prodView.addAlias("PRCA", "productCategoryId", null, null, null, Boolean.TRUE, null)
+ conditionMap.productCategoryId = searchInProductCategoryId
+ searchParameterString = searchParameterString + "&searchInProductCategoryId=" + searchInProductCategoryId
}
if (productSupplierId) {
- prodView.addMemberEntity("SPPR", "SupplierProduct");
- prodView.addViewLink("PRFA", "SPPR", Boolean.FALSE, ModelKeyMap.makeKeyMapList("productId"));
- prodView.addAlias("SPPR", "partyId", null, null, null, Boolean.TRUE, null);
- conditionMap.partyId = productSupplierId;
- searchParameterString = searchParameterString + "&productSupplierId=" + productSupplierId;
+ prodView.addMemberEntity("SPPR", "SupplierProduct")
+ prodView.addViewLink("PRFA", "SPPR", Boolean.FALSE, ModelKeyMap.makeKeyMapList("productId"))
+ prodView.addAlias("SPPR", "partyId", null, null, null, Boolean.TRUE, null)
+ conditionMap.partyId = productSupplierId
+ searchParameterString = searchParameterString + "&productSupplierId=" + productSupplierId
}
// set distinct on so we only get one row per product
- searchCondition = EntityCondition.makeCondition(conditionMap, EntityOperator.AND);
+ searchCondition = EntityCondition.makeCondition(conditionMap, EntityOperator.AND)
notVirtualCondition = EntityCondition.makeCondition(EntityCondition.makeCondition("isVirtual", EntityOperator.EQUALS, null),
EntityOperator.OR,
- EntityCondition.makeCondition("isVirtual", EntityOperator.NOT_EQUAL, "Y"));
+ EntityCondition.makeCondition("isVirtual", EntityOperator.NOT_EQUAL, "Y"))
- whereConditionsList = [searchCondition, notVirtualCondition];
+ whereConditionsList = [searchCondition, notVirtualCondition]
// add the discontinuation date condition
if (productsSoldThruTimestamp) {
discontinuationDateCondition = EntityCondition.makeCondition(
@@ -138,42 +138,42 @@ if (action) {
EntityCondition.makeCondition("salesDiscontinuationDate", EntityOperator.EQUALS, null),
EntityCondition.makeCondition("salesDiscontinuationDate", EntityOperator.GREATER_THAN,productsSoldThruTimestamp)
],
- EntityOperator.OR);
- whereConditionsList.add(discontinuationDateCondition);
- searchParameterString = searchParameterString + "&productsSoldThruTimestamp=" + productsSoldThruTimestamp;
+ EntityOperator.OR)
+ whereConditionsList.add(discontinuationDateCondition)
+ searchParameterString = searchParameterString + "&productsSoldThruTimestamp=" + productsSoldThruTimestamp
}
// add search on internal name
if (internalName) {
- whereConditionsList.add(EntityCondition.makeCondition("internalName", EntityOperator.LIKE, "%" + internalName + "%"));
- searchParameterString = searchParameterString + "&internalName=" + internalName;
+ whereConditionsList.add(EntityCondition.makeCondition("internalName", EntityOperator.LIKE, "%" + internalName + "%"))
+ searchParameterString = searchParameterString + "&internalName=" + internalName
}
// add search on productId
if (productId) {
- whereConditionsList.add(EntityCondition.makeCondition("productId", EntityOperator.LIKE, productId + "%"));
- searchParameterString = searchParameterString + "&productId=" + productId;
+ whereConditionsList.add(EntityCondition.makeCondition("productId", EntityOperator.LIKE, productId + "%"))
+ searchParameterString = searchParameterString + "&productId=" + productId
}
- orderBy = [];
+ orderBy = []
if (hasOffsetATP) {
- orderBy.add("offsetATPQtyAvailable");
+ orderBy.add("offsetATPQtyAvailable")
}
if (hasOffsetQOH) {
- orderBy.add("offsetQOHQtyAvailable");
+ orderBy.add("offsetQOHQtyAvailable")
}
- orderBy.add("productId");
+ orderBy.add("productId")
// If the user has specified a number of months over which to sum usage quantities, define the correct timestamp
- checkTime = null;
- monthsInPastLimitStr = request.getParameter("monthsInPastLimit");
+ checkTime = null
+ monthsInPastLimitStr = request.getParameter("monthsInPastLimit")
if (monthsInPastLimitStr) {
try {
- monthsInPastLimit = Integer.parseInt(monthsInPastLimitStr);
- cal = UtilDateTime.toCalendar(null);
- cal.add(Calendar.MONTH, 0 - monthsInPastLimit);
- checkTime = UtilDateTime.toTimestamp(cal.getTime());
- searchParameterString += "&monthsInPastLimit=" + monthsInPastLimitStr;
+ monthsInPastLimit = Integer.parseInt(monthsInPastLimitStr)
+ cal = UtilDateTime.toCalendar(null)
+ cal.add(Calendar.MONTH, 0 - monthsInPastLimit)
+ checkTime = UtilDateTime.toTimestamp(cal.getTime())
+ searchParameterString += "&monthsInPastLimit=" + monthsInPastLimitStr
} catch (Exception e) {
// Ignore
}
@@ -182,76 +182,76 @@ if (action) {
if (checkTime) {
// Construct a dynamic view entity to search against for sales usage quantities
- salesUsageViewEntity = new DynamicViewEntity();
- salesUsageViewEntity.addMemberEntity("OI", "OrderItem");
- salesUsageViewEntity.addMemberEntity("OH", "OrderHeader");
- salesUsageViewEntity.addMemberEntity("ItIss", "ItemIssuance");
- salesUsageViewEntity.addMemberEntity("InvIt", "InventoryItem");
- salesUsageViewEntity.addViewLink("OI", "OH", false, ModelKeyMap.makeKeyMapList("orderId"));
- salesUsageViewEntity.addViewLink("OI", "ItIss", false, ModelKeyMap.makeKeyMapList("orderId", "orderId", "orderItemSeqId", "orderItemSeqId"));
- salesUsageViewEntity.addViewLink("ItIss", "InvIt", false, ModelKeyMap.makeKeyMapList("inventoryItemId"));
- salesUsageViewEntity.addAlias("OI", "productId");
- salesUsageViewEntity.addAlias("OH", "statusId");
- salesUsageViewEntity.addAlias("OH", "orderTypeId");
- salesUsageViewEntity.addAlias("OH", "orderDate");
- salesUsageViewEntity.addAlias("ItIss", "inventoryItemId");
- salesUsageViewEntity.addAlias("ItIss", "quantity");
- salesUsageViewEntity.addAlias("InvIt", "facilityId");
+ salesUsageViewEntity = new DynamicViewEntity()
+ salesUsageViewEntity.addMemberEntity("OI", "OrderItem")
+ salesUsageViewEntity.addMemberEntity("OH", "OrderHeader")
+ salesUsageViewEntity.addMemberEntity("ItIss", "ItemIssuance")
+ salesUsageViewEntity.addMemberEntity("InvIt", "InventoryItem")
+ salesUsageViewEntity.addViewLink("OI", "OH", false, ModelKeyMap.makeKeyMapList("orderId"))
+ salesUsageViewEntity.addViewLink("OI", "ItIss", false, ModelKeyMap.makeKeyMapList("orderId", "orderId", "orderItemSeqId", "orderItemSeqId"))
+ salesUsageViewEntity.addViewLink("ItIss", "InvIt", false, ModelKeyMap.makeKeyMapList("inventoryItemId"))
+ salesUsageViewEntity.addAlias("OI", "productId")
+ salesUsageViewEntity.addAlias("OH", "statusId")
+ salesUsageViewEntity.addAlias("OH", "orderTypeId")
+ salesUsageViewEntity.addAlias("OH", "orderDate")
+ salesUsageViewEntity.addAlias("ItIss", "inventoryItemId")
+ salesUsageViewEntity.addAlias("ItIss", "quantity")
+ salesUsageViewEntity.addAlias("InvIt", "facilityId")
// Construct a dynamic view entity to search against for production usage quantities
- productionUsageViewEntity = new DynamicViewEntity();
- productionUsageViewEntity.addMemberEntity("WEIA", "WorkEffortInventoryAssign");
- productionUsageViewEntity.addMemberEntity("WE", "WorkEffort");
- productionUsageViewEntity.addMemberEntity("II", "InventoryItem");
- productionUsageViewEntity.addViewLink("WEIA", "WE", false, ModelKeyMap.makeKeyMapList("workEffortId"));
- productionUsageViewEntity.addViewLink("WEIA", "II", false, ModelKeyMap.makeKeyMapList("inventoryItemId"));
- productionUsageViewEntity.addAlias("WEIA", "quantity");
- productionUsageViewEntity.addAlias("WE", "actualCompletionDate");
- productionUsageViewEntity.addAlias("WE", "workEffortTypeId");
- productionUsageViewEntity.addAlias("II", "facilityId");
- productionUsageViewEntity.addAlias("II", "productId");
+ productionUsageViewEntity = new DynamicViewEntity()
+ productionUsageViewEntity.addMemberEntity("WEIA", "WorkEffortInventoryAssign")
+ productionUsageViewEntity.addMemberEntity("WE", "WorkEffort")
+ productionUsageViewEntity.addMemberEntity("II", "InventoryItem")
+ productionUsageViewEntity.addViewLink("WEIA", "WE", false, ModelKeyMap.makeKeyMapList("workEffortId"))
+ productionUsageViewEntity.addViewLink("WEIA", "II", false, ModelKeyMap.makeKeyMapList("inventoryItemId"))
+ productionUsageViewEntity.addAlias("WEIA", "quantity")
+ productionUsageViewEntity.addAlias("WE", "actualCompletionDate")
+ productionUsageViewEntity.addAlias("WE", "workEffortTypeId")
+ productionUsageViewEntity.addAlias("II", "facilityId")
+ productionUsageViewEntity.addAlias("II", "productId")
}
- whereCondition = EntityCondition.makeCondition(whereConditionsList, EntityOperator.AND);
+ whereCondition = EntityCondition.makeCondition(whereConditionsList, EntityOperator.AND)
- beganTransaction = false;
- List prods = null;
+ beganTransaction = false
+ List prods = null
try {
- beganTransaction = TransactionUtil.begin();
+ beganTransaction = TransactionUtil.begin()
// get the indexes for the partial list
- lowIndex = ((viewIndex.intValue() * viewSize.intValue()) + 1);
- highIndex = (viewIndex.intValue() + 1) * viewSize.intValue();
- prodsEli = from(prodView).where(whereCondition).orderBy(orderBy).cursorScrollInsensitive().maxRows(highIndex).distinct().queryIterator();
+ lowIndex = ((viewIndex.intValue() * viewSize.intValue()) + 1)
+ highIndex = (viewIndex.intValue() + 1) * viewSize.intValue()
+ prodsEli = from(prodView).where(whereCondition).orderBy(orderBy).cursorScrollInsensitive().maxRows(highIndex).distinct().queryIterator()
// get the partial list for this page
- prods = prodsEli.getPartialList(lowIndex, highIndex);
- prodsIt = prods.iterator();
+ prods = prodsEli.getPartialList(lowIndex, highIndex)
+ prodsIt = prods.iterator()
while (prodsIt) {
- oneProd = prodsIt.next();
- offsetQOHQtyAvailable = oneProd.getBigDecimal("offsetQOHQtyAvailable");
- offsetATPQtyAvailable = oneProd.getBigDecimal("offsetATPQtyAvailable");
+ oneProd = prodsIt.next()
+ offsetQOHQtyAvailable = oneProd.getBigDecimal("offsetQOHQtyAvailable")
+ offsetATPQtyAvailable = oneProd.getBigDecimal("offsetATPQtyAvailable")
if (hasOffsetATP) {
if (offsetATPQtyAvailable && offsetATPQtyAvailable.doubleValue() > offsetATP) {
- break;
+ break
}
}
if (hasOffsetQOH) {
if (offsetQOHQtyAvailable && offsetQOHQtyAvailable.doubleValue() > offsetQOH) {
- break;
+ break
}
}
- oneInventory = [:];
- oneInventory.productId = oneProd.productId;
- oneInventory.minimumStock = oneProd.getBigDecimal("minimumStock");
- oneInventory.reorderQuantity = oneProd.getBigDecimal("reorderQuantity");
- oneInventory.daysToShip = oneProd.getString("daysToShip");
- oneInventory.totalQuantityOnHand = oneProd.totalQuantityOnHandTotal;
- oneInventory.totalAvailableToPromise = oneProd.totalAvailableToPromiseTotal;
- oneInventory.offsetQOHQtyAvailable = offsetQOHQtyAvailable;
- oneInventory.offsetATPQtyAvailable = offsetATPQtyAvailable;
- oneInventory.quantityOnOrder = InventoryWorker.getOutstandingPurchasedQuantity(oneProd.productId, delegator);
+ oneInventory = [:]
+ oneInventory.productId = oneProd.productId
+ oneInventory.minimumStock = oneProd.getBigDecimal("minimumStock")
+ oneInventory.reorderQuantity = oneProd.getBigDecimal("reorderQuantity")
+ oneInventory.daysToShip = oneProd.getString("daysToShip")
+ oneInventory.totalQuantityOnHand = oneProd.totalQuantityOnHandTotal
+ oneInventory.totalAvailableToPromise = oneProd.totalAvailableToPromiseTotal
+ oneInventory.offsetQOHQtyAvailable = offsetQOHQtyAvailable
+ oneInventory.offsetATPQtyAvailable = offsetATPQtyAvailable
+ oneInventory.quantityOnOrder = InventoryWorker.getOutstandingPurchasedQuantity(oneProd.productId, delegator)
if (checkTime) {
@@ -263,20 +263,20 @@ if (action) {
EntityCondition.makeCondition("statusId", EntityOperator.IN, ['ORDER_COMPLETED', 'ORDER_APPROVED', 'ORDER_HELD']),
EntityCondition.makeCondition("orderTypeId", EntityOperator.EQUALS, "SALES_ORDER"),
EntityCondition.makeCondition("orderDate", EntityOperator.GREATER_THAN_EQUAL_TO, checkTime))
- .queryIterator();
+ .queryIterator()
// Sum the sales usage quantities found
- salesUsageQuantity = 0;
+ salesUsageQuantity = 0
salesUsageIt.each { salesUsageItem ->
if (salesUsageItem.quantity) {
try {
- salesUsageQuantity += salesUsageItem.getDouble("quantity").doubleValue();
+ salesUsageQuantity += salesUsageItem.getDouble("quantity").doubleValue()
} catch (Exception e) {
// Ignore
}
}
}
- salesUsageIt.close();
+ salesUsageIt.close()
// Make a query against the production usage view entity
productionUsageIt = from(productionUsageViewEntity)
@@ -284,78 +284,78 @@ if (action) {
EntityCondition.makeCondition("productId", EntityOperator.EQUALS, oneProd.productId),
EntityCondition.makeCondition("workEffortTypeId", EntityOperator.EQUALS, "PROD_ORDER_TASK"),
EntityCondition.makeCondition("actualCompletionDate", EntityOperator.GREATER_THAN_EQUAL_TO, checkTime))
- .queryIterator();
+ .queryIterator()
// Sum the production usage quantities found
- productionUsageQuantity = 0;
+ productionUsageQuantity = 0
productionUsageIt.each { productionUsageItem ->
if (productionUsageItem.quantity) {
try {
- productionUsageQuantity += productionUsageItem.getDouble("quantity").doubleValue();
+ productionUsageQuantity += productionUsageItem.getDouble("quantity").doubleValue()
} catch (Exception e) {
// Ignore
}
}
}
- productionUsageIt.close();
- oneInventory.usageQuantity = salesUsageQuantity + productionUsageQuantity;
+ productionUsageIt.close()
+ oneInventory.usageQuantity = salesUsageQuantity + productionUsageQuantity
}
- rows.add(oneInventory);
+ rows.add(oneInventory)
}
if (rows.size() < viewSize.intValue()) {
- productListSize = lowIndex + rows.size() - 1;
+ productListSize = lowIndex + rows.size() - 1
} else {
// attempt to get the full size
if (hasOffsetQOH || hasOffsetATP) {
- rowProcessed = 0;
+ rowProcessed = 0
while (nextValue = prodsEli.next()) {
- offsetQOHQtyAvailable = nextValue.getDouble("offsetQOHQtyAvailable");
- offsetATPQtyAvailable = nextValue.getDouble("offsetATPQtyAvailable");
+ offsetQOHQtyAvailable = nextValue.getDouble("offsetQOHQtyAvailable")
+ offsetATPQtyAvailable = nextValue.getDouble("offsetATPQtyAvailable")
if (hasOffsetATP) {
if (offsetATPQtyAvailable && offsetATPQtyAvailable.doubleValue() > offsetATP) {
- break;
+ break
}
}
if (hasOffsetQOH) {
if (offsetQOHQtyAvailable && offsetQOHQtyAvailable.doubleValue() > offsetQOH) {
- break;
+ break
}
}
- rowProcessed++;
+ rowProcessed++
}
- productListSize = lowIndex + rows.size() + rowProcessed - 1;
+ productListSize = lowIndex + rows.size() + rowProcessed - 1
} else {
- productListSize = prodsEli.getResultsSizeAfterPartialList();
+ productListSize = prodsEli.getResultsSizeAfterPartialList()
}
}
- prodsEli.close();
+ prodsEli.close()
if (highIndex > productListSize) {
- highIndex = productListSize;
+ highIndex = productListSize
}
- context.overrideListSize = productListSize;
- context.highIndex = highIndex;
- context.lowIndex = lowIndex;
+ context.overrideListSize = productListSize
+ context.highIndex = highIndex
+ context.lowIndex = lowIndex
} catch (GenericEntityException e) {
- errMsg = "Failure in operation, rolling back transaction";
- Debug.logError(e, errMsg, "ViewFacilityInventoryByProduct");
+ errMsg = "Failure in operation, rolling back transaction"
+ Debug.logError(e, errMsg, "ViewFacilityInventoryByProduct")
try {
// only rollback the transaction if we started one...
- TransactionUtil.rollback(beganTransaction, errMsg, e);
+ TransactionUtil.rollback(beganTransaction, errMsg, e)
} catch (GenericEntityException e2) {
- Debug.logError(e2, "Could not rollback transaction: " + e2.toString(), "ViewFacilityInventoryByProduct");
+ Debug.logError(e2, "Could not rollback transaction: " + e2.toString(), "ViewFacilityInventoryByProduct")
}
// after rolling back, rethrow the exception
- throw e;
+ throw e
} finally {
if (prodsEli != null) {
try {
- prodsEli.close();
+ prodsEli.close()
} catch (Exception exc) {}
}
// only commit the transaction if we started one... this will throw an exception if it fails
- TransactionUtil.commit(beganTransaction);
+ TransactionUtil.commit(beganTransaction)
}
}
-context.inventoryByProduct = rows;
-context.searchParameterString = searchParameterString;
+context.inventoryByProduct = rows
+context.searchParameterString = searchParameterString
diff --git a/applications/product/groovyScripts/facility/facility/EditContactMech.groovy b/applications/product/groovyScripts/facility/facility/EditContactMech.groovy
index 3e7a78d136..0eb7dc5e48 100644
--- a/applications/product/groovyScripts/facility/facility/EditContactMech.groovy
+++ b/applications/product/groovyScripts/facility/facility/EditContactMech.groovy
@@ -17,53 +17,53 @@
* under the License.
*/
-import org.apache.ofbiz.party.contact.*;
+import org.apache.ofbiz.party.contact.*
-facilityId = parameters.facilityId;
-context.facilityId = facilityId;
+facilityId = parameters.facilityId
+context.facilityId = facilityId
-facility = from("Facility").where("facilityId", facilityId).queryOne();
-context.facility = facility;
+facility = from("Facility").where("facilityId", facilityId).queryOne()
+context.facility = facility
-mechMap = [:];
-ContactMechWorker.getFacilityContactMechAndRelated(request, facilityId, mechMap);
-context.mechMap = mechMap;
+mechMap = [:]
+ContactMechWorker.getFacilityContactMechAndRelated(request, facilityId, mechMap)
+context.mechMap = mechMap
-contactMechId = mechMap.contactMechId;
+contactMechId = mechMap.contactMechId
if (contactMechId) {
- context.contactMechId = contactMechId;
+ context.contactMechId = contactMechId
}
-preContactMechTypeId = request.getParameter("preContactMechTypeId");
+preContactMechTypeId = request.getParameter("preContactMechTypeId")
if (preContactMechTypeId) {
- context.preContactMechTypeId = preContactMechTypeId;
+ context.preContactMechTypeId = preContactMechTypeId
}
-paymentMethodId = request.getParameter("paymentMethodId");
+paymentMethodId = request.getParameter("paymentMethodId")
if (!paymentMethodId) {
- paymentMethodId = request.getAttribute("paymentMethodId");
+ paymentMethodId = request.getAttribute("paymentMethodId")
}
if (paymentMethodId) {
- context.paymentMethodId = paymentMethodId;
+ context.paymentMethodId = paymentMethodId
}
-donePage = request.getParameter("DONE_PAGE");
+donePage = request.getParameter("DONE_PAGE")
if (!donePage) {
- donePage = request.getAttribute("DONE_PAGE");
+ donePage = request.getAttribute("DONE_PAGE")
}
if (!donePage || donePage.length() <= 0) {
- donePage = "ViewContactMechs";
+ donePage = "ViewContactMechs"
}
-context.donePage = donePage;
+context.donePage = donePage
-cmNewPurposeTypeId = request.getParameter("contactMechPurposeTypeId");
+cmNewPurposeTypeId = request.getParameter("contactMechPurposeTypeId")
if (!cmNewPurposeTypeId) {
- cmNewPurposeTypeId = mechMap.contactMechPurposeTypeId;
+ cmNewPurposeTypeId = mechMap.contactMechPurposeTypeId
}
if (cmNewPurposeTypeId) {
- context.contactMechPurposeTypeId = cmNewPurposeTypeId;
- contactMechPurposeType = from("ContactMechPurposeType").where("contactMechPurposeTypeId", cmNewPurposeTypeId).queryOne();
+ context.contactMechPurposeTypeId = cmNewPurposeTypeId
+ contactMechPurposeType = from("ContactMechPurposeType").where("contactMechPurposeTypeId", cmNewPurposeTypeId).queryOne()
if (contactMechPurposeType) {
- context.contactMechPurposeType = contactMechPurposeType;
+ context.contactMechPurposeType = contactMechPurposeType
}
}
diff --git a/applications/product/groovyScripts/facility/facility/EditFacility.groovy b/applications/product/groovyScripts/facility/facility/EditFacility.groovy
index 09da3e47ce..5ca182b059 100644
--- a/applications/product/groovyScripts/facility/facility/EditFacility.groovy
+++ b/applications/product/groovyScripts/facility/facility/EditFacility.groovy
@@ -17,34 +17,34 @@
* under the License.
*/
-import org.apache.ofbiz.entity.condition.*;
+import org.apache.ofbiz.entity.condition.*
-facilityId = parameters.facilityId;
+facilityId = parameters.facilityId
if (!facilityId && request.getAttribute("facilityId")) {
- facilityId = request.getAttribute("facilityId");
+ facilityId = request.getAttribute("facilityId")
}
-facility = from("Facility").where("facilityId", facilityId).queryOne();
+facility = from("Facility").where("facilityId", facilityId).queryOne()
if (!facility) {
- facility = delegator.makeValue("Facility");
- facilityType = delegator.makeValue("FacilityType");
+ facility = delegator.makeValue("Facility")
+ facilityType = delegator.makeValue("FacilityType")
} else {
- facilityType = facility.getRelatedOne("FacilityType", false);
+ facilityType = facility.getRelatedOne("FacilityType", false)
}
-context.facility = facility;
-context.facilityType = facilityType;
-context.facilityId = facilityId;
+context.facility = facility
+context.facilityType = facilityType
+context.facilityId = facilityId
//Facility types
-facilityTypes = from("FacilityType").queryList();
+facilityTypes = from("FacilityType").queryList()
if (facilityTypes) {
- context.facilityTypes = facilityTypes;
+ context.facilityTypes = facilityTypes
}
// all possible inventory item types
-context.inventoryItemTypes = from("InventoryItemType").orderBy("description").cache(true).queryList();
+context.inventoryItemTypes = from("InventoryItemType").orderBy("description").cache(true).queryList()
// weight unit of measures
-context.weightUomList = from("Uom").where("uomTypeId", "WEIGHT_MEASURE").cache(true).queryList();
+context.weightUomList = from("Uom").where("uomTypeId", "WEIGHT_MEASURE").cache(true).queryList()
// area unit of measures
-context.areaUomList = from("Uom").where("uomTypeId", "AREA_MEASURE").cache(true).queryList();
+context.areaUomList = from("Uom").where("uomTypeId", "AREA_MEASURE").cache(true).queryList()
diff --git a/applications/product/groovyScripts/facility/facility/EditFacilityLocation.groovy b/applications/product/groovyScripts/facility/facility/EditFacilityLocation.groovy
index 3022a673c1..39de3a842c 100644
--- a/applications/product/groovyScripts/facility/facility/EditFacilityLocation.groovy
+++ b/applications/product/groovyScripts/facility/facility/EditFacilityLocation.groovy
@@ -17,39 +17,39 @@
* under the License.
*/
-import org.apache.ofbiz.entity.condition.*;
+import org.apache.ofbiz.entity.condition.*
-facilityId = request.getParameter("facilityId");
-locationSeqId = request.getParameter("locationSeqId");
-facility = null;
-facilityLocation = null;
+facilityId = request.getParameter("facilityId")
+locationSeqId = request.getParameter("locationSeqId")
+facility = null
+facilityLocation = null
if (!facilityId && request.getAttribute("facilityId")) {
- facilityId = request.getAttribute("facilityId");
+ facilityId = request.getAttribute("facilityId")
}
if (!locationSeqId && request.getAttribute("locationSeqId")) {
- locationSeqId = request.getAttribute("locationSeqId");
+ locationSeqId = request.getAttribute("locationSeqId")
}
if (facilityId && locationSeqId) {
- facilityLocation = from("FacilityLocation").where("facilityId", facilityId, "locationSeqId", locationSeqId).queryOne();
+ facilityLocation = from("FacilityLocation").where("facilityId", facilityId, "locationSeqId", locationSeqId).queryOne()
}
if (facilityId) {
- facility = from("Facility").where("facilityId", facilityId).queryOne();
+ facility = from("Facility").where("facilityId", facilityId).queryOne()
}
-locationTypeEnums = from("Enumeration").where("enumTypeId", "FACLOC_TYPE").queryList();
+locationTypeEnums = from("Enumeration").where("enumTypeId", "FACLOC_TYPE").queryList()
// ProductFacilityLocation stuff
-productFacilityLocations = null;
+productFacilityLocations = null
if (facilityLocation) {
- productFacilityLocations = facilityLocation.getRelated("ProductFacilityLocation", null, ['productId'], false);
+ productFacilityLocations = facilityLocation.getRelated("ProductFacilityLocation", null, ['productId'], false)
}
-context.facilityId = facilityId;
-context.locationSeqId = locationSeqId;
-context.facility = facility;
-context.facilityLocation = facilityLocation;
-context.locationTypeEnums = locationTypeEnums;
-context.productFacilityLocations = productFacilityLocations;
+context.facilityId = facilityId
+context.locationSeqId = locationSeqId
+context.facility = facility
+context.facilityLocation = facilityLocation
+context.locationTypeEnums = locationTypeEnums
+context.productFacilityLocations = productFacilityLocations
diff --git a/applications/product/groovyScripts/facility/facility/FacilityLocationGeoLocation.groovy b/applications/product/groovyScripts/facility/facility/FacilityLocationGeoLocation.groovy
index a5656721f6..f73f65e14c 100644
--- a/applications/product/groovyScripts/facility/facility/FacilityLocationGeoLocation.groovy
+++ b/applications/product/groovyScripts/facility/facility/FacilityLocationGeoLocation.groovy
@@ -17,32 +17,32 @@
* under the License.
*/
- import org.apache.ofbiz.base.util.*;
- import org.apache.ofbiz.common.geo.*;
- import org.apache.ofbiz.entity.*;
+ import org.apache.ofbiz.base.util.*
+ import org.apache.ofbiz.common.geo.*
+ import org.apache.ofbiz.entity.*
facilityId = parameters.facilityId
locationSeqId = parameters.locationSeqId
-uiLabelMap = UtilProperties.getResourceBundleMap("ProductUiLabels", locale);
-uiLabelMap.addBottomResourceBundle("CommonUiLabels");
+uiLabelMap = UtilProperties.getResourceBundleMap("ProductUiLabels", locale)
+uiLabelMap.addBottomResourceBundle("CommonUiLabels")
if (facilityId && locationSeqId) {
latestGeoPoint = GeoWorker.findLatestGeoPoint(delegator, "FacilityLocationAndGeoPoint", "facilityId", facilityId, "locationSeqId", locationSeqId)
- context.latestGeoPoint = latestGeoPoint;
+ context.latestGeoPoint = latestGeoPoint
- List geoCenter = UtilMisc.toList(UtilMisc.toMap("lat", latestGeoPoint.latitude, "lon", latestGeoPoint.longitude, "zoom", "13"));
+ List geoCenter = UtilMisc.toList(UtilMisc.toMap("lat", latestGeoPoint.latitude, "lon", latestGeoPoint.longitude, "zoom", "13"))
if (UtilValidate.isNotEmpty(latestGeoPoint) && latestGeoPoint.containsKey("latitude") && latestGeoPoint.containsKey("longitude")) {
List geoPoints = UtilMisc.toList(UtilMisc.toMap("lat", latestGeoPoint.latitude, "lon", latestGeoPoint.longitude, "facilityId", facilityId,
"link", UtilMisc.toMap("url", "EditFacilityLocation?facilityId="+ facilityId + "&locationSeqId=" + locationSeqId,
- "label", uiLabelMap.ProductFacilityLocation + " " + uiLabelMap.CommonOf + " " + facilityId + "/" + locationSeqId)));
+ "label", uiLabelMap.ProductFacilityLocation + " " + uiLabelMap.CommonOf + " " + facilityId + "/" + locationSeqId)))
- Map geoChart = UtilMisc.toMap("width", "500px", "height", "450px", "controlUI" , "small", "dataSourceId", latestGeoPoint.dataSourceId, "points", geoPoints);
- context.geoChart = geoChart;
+ Map geoChart = UtilMisc.toMap("width", "500px", "height", "450px", "controlUI" , "small", "dataSourceId", latestGeoPoint.dataSourceId, "points", geoPoints)
+ context.geoChart = geoChart
}
if (latestGeoPoint && latestGeoPoint.elevationUomId) {
- elevationUom = from("Uom").where("uomId", latestGeoPoint.elevationUomId).queryOne();
- context.elevationUomAbbr = elevationUom.abbreviation;
+ elevationUom = from("Uom").where("uomId", latestGeoPoint.elevationUomId).queryOne()
+ context.elevationUomAbbr = elevationUom.abbreviation
}
}
diff --git a/applications/product/groovyScripts/facility/facility/FindFacility.groovy b/applications/product/groovyScripts/facility/facility/FindFacility.groovy
index f009039df9..077d958d2c 100644
--- a/applications/product/groovyScripts/facility/facility/FindFacility.groovy
+++ b/applications/product/groovyScripts/facility/facility/FindFacility.groovy
@@ -18,15 +18,15 @@
*/
import org.apache.ofbiz.base.util.*
-findResult = from("Facility").queryList();
-findResultSize = findResult.size();
+findResult = from("Facility").queryList()
+findResultSize = findResult.size()
if (findResultSize == 1) {
- context.showScreen = "one";
- context.facility = findResult.get(0);
- context.parameters.facilityId = context.facility.facilityId;
+ context.showScreen = "one"
+ context.facility = findResult.get(0)
+ context.parameters.facilityId = context.facility.facilityId
}
if ((findResultSize > 1 ) && (findResultSize <= 10)) {
- context.showScreen = "ten";
+ context.showScreen = "ten"
} else if ((findResultSize > 10 ) || (findResultSize <= 0)) {
- context.showScreen = "more";
+ context.showScreen = "more"
}
diff --git a/applications/product/groovyScripts/facility/facility/FindFacilityLocation.groovy b/applications/product/groovyScripts/facility/facility/FindFacilityLocation.groovy
index 07718292f6..6f3aa377a0 100644
--- a/applications/product/groovyScripts/facility/facility/FindFacilityLocation.groovy
+++ b/applications/product/groovyScripts/facility/facility/FindFacilityLocation.groovy
@@ -20,34 +20,34 @@
import org.apache.ofbiz.entity.condition.*
import org.apache.ofbiz.base.util.*
-facilityId = parameters.facilityId;
-context.facilityId = facilityId;
+facilityId = parameters.facilityId
+context.facilityId = facilityId
-lookup = request.getParameter("look_up");
-itemId = request.getParameter("inventoryItemId");
+lookup = request.getParameter("look_up")
+itemId = request.getParameter("inventoryItemId")
if (itemId) {
- session.setAttribute("inventoryItemId", itemId);
+ session.setAttribute("inventoryItemId", itemId)
}
-itemId = session.getAttribute("inventoryItemId");
-context.itemId = itemId;
+itemId = session.getAttribute("inventoryItemId")
+context.itemId = itemId
-facility = from("Facility").where("facilityId", facilityId).queryOne();
-context.facility = facility;
+facility = from("Facility").where("facilityId", facilityId).queryOne()
+context.facility = facility
-UtilHttp.parametersToAttributes(request);
+UtilHttp.parametersToAttributes(request)
if (lookup) {
- reqParamMap = UtilHttp.getParameterMap(request);
- paramMap = new HashMap(reqParamMap);
- paramMap.remove("look_up");
+ reqParamMap = UtilHttp.getParameterMap(request)
+ paramMap = new HashMap(reqParamMap)
+ paramMap.remove("look_up")
reqParamMap.keySet().each { key ->
- value = paramMap.get(key);
+ value = paramMap.get(key)
if (!value || value.length() == 0) {
- paramMap.remove(key);
+ paramMap.remove(key)
}
}
- foundLocations = from("FacilityLocation").where(paramMap).queryList();
+ foundLocations = from("FacilityLocation").where(paramMap).queryList()
if (foundLocations) {
- context.foundLocations = foundLocations;
+ context.foundLocations = foundLocations
}
}
diff --git a/applications/product/groovyScripts/facility/facility/FindFacilityTransfers.groovy b/applications/product/groovyScripts/facility/facility/FindFacilityTransfers.groovy
index 8aa000671b..e6b0f197e2 100644
--- a/applications/product/groovyScripts/facility/facility/FindFacilityTransfers.groovy
+++ b/applications/product/groovyScripts/facility/facility/FindFacilityTransfers.groovy
@@ -17,47 +17,47 @@
* under the License.
*/
-import org.apache.ofbiz.entity.condition.*;
+import org.apache.ofbiz.entity.condition.*
//default this to true, ie only show active
-activeOnly = !"false".equals(request.getParameter("activeOnly"));
-context.activeOnly = activeOnly;
+activeOnly = !"false".equals(request.getParameter("activeOnly"))
+context.activeOnly = activeOnly
// if the completeRequested was set, then we'll lookup only requested status
-completeRequested = "true".equals(request.getParameter("completeRequested"));
-context.completeRequested = completeRequested;
+completeRequested = "true".equals(request.getParameter("completeRequested"))
+context.completeRequested = completeRequested
// get the 'to' this facility transfers
if (activeOnly) {
exprsTo = [EntityCondition.makeCondition("facilityIdTo", EntityOperator.EQUALS, facilityId),
EntityCondition.makeCondition("statusId", EntityOperator.NOT_EQUAL, "IXF_COMPLETE"),
- EntityCondition.makeCondition("statusId", EntityOperator.NOT_EQUAL, "IXF_CANCELLED")];
+ EntityCondition.makeCondition("statusId", EntityOperator.NOT_EQUAL, "IXF_CANCELLED")]
} else {
- exprsTo = [EntityCondition.makeCondition("facilityIdTo", EntityOperator.EQUALS, facilityId)];
+ exprsTo = [EntityCondition.makeCondition("facilityIdTo", EntityOperator.EQUALS, facilityId)]
}
if (completeRequested) {
exprsTo = [EntityCondition.makeCondition("facilityIdTo", EntityOperator.EQUALS, facilityId),
- EntityCondition.makeCondition("statusId", EntityOperator.EQUALS, "IXF_REQUESTED")];
+ EntityCondition.makeCondition("statusId", EntityOperator.EQUALS, "IXF_REQUESTED")]
}
-toTransfers = from("InventoryTransfer").where(exprsTo).orderBy("sendDate").queryList();
+toTransfers = from("InventoryTransfer").where(exprsTo).orderBy("sendDate").queryList()
if (toTransfers) {
- context.toTransfers = toTransfers;
+ context.toTransfers = toTransfers
}
// get the 'from' this facility transfers
if (activeOnly) {
exprsFrom = [EntityCondition.makeCondition("facilityId", EntityOperator.EQUALS, facilityId),
EntityCondition.makeCondition("statusId", EntityOperator.NOT_EQUAL, "IXF_COMPLETE"),
- EntityCondition.makeCondition("statusId", EntityOperator.NOT_EQUAL, "IXF_CANCELLED")];
+ EntityCondition.makeCondition("statusId", EntityOperator.NOT_EQUAL, "IXF_CANCELLED")]
} else {
- exprsFrom = [EntityCondition.makeCondition("facilityId", EntityOperator.EQUALS, facilityId)];
+ exprsFrom = [EntityCondition.makeCondition("facilityId", EntityOperator.EQUALS, facilityId)]
}
if (completeRequested) {
exprsFrom = [EntityCondition.makeCondition("facilityId", EntityOperator.EQUALS, facilityId),
- EntityCondition.makeCondition("statusId", EntityOperator.EQUALS, "IXF_REQUESTED")];
+ EntityCondition.makeCondition("statusId", EntityOperator.EQUALS, "IXF_REQUESTED")]
}
-ecl = EntityCondition.makeCondition(exprsFrom, EntityOperator.AND);
-fromTransfers = from("InventoryTransfer").where(exprsFrom).orderBy("sendDate").queryList();
+ecl = EntityCondition.makeCondition(exprsFrom, EntityOperator.AND)
+fromTransfers = from("InventoryTransfer").where(exprsFrom).orderBy("sendDate").queryList()
if (fromTransfers) {
- context.fromTransfers = fromTransfers;
+ context.fromTransfers = fromTransfers
}
diff --git a/applications/product/groovyScripts/facility/facility/FindInventoryItemsByLabels.groovy b/applications/product/groovyScripts/facility/facility/FindInventoryItemsByLabels.groovy
index 5b81140dd5..6e067bd323 100644
--- a/applications/product/groovyScripts/facility/facility/FindInventoryItemsByLabels.groovy
+++ b/applications/product/groovyScripts/facility/facility/FindInventoryItemsByLabels.groovy
@@ -25,76 +25,76 @@ import org.apache.ofbiz.entity.transaction.*
import org.apache.ofbiz.entity.util.EntityFindOptions
import org.apache.ofbiz.entity.util.EntityListIterator
-facilityId = parameters.facilityId;
+facilityId = parameters.facilityId
-numberOfFields = 0;
-numberOfFieldsStr = parameters.numberOfFields;
+numberOfFields = 0
+numberOfFieldsStr = parameters.numberOfFields
try {
- numberOfFields = Integer.parseInt(numberOfFieldsStr);
+ numberOfFields = Integer.parseInt(numberOfFieldsStr)
} catch (Exception exc) {
- numberOfFields = 0;
+ numberOfFields = 0
}
-inventoryItemAndLabelsView = new DynamicViewEntity();
-inventoryItemAndLabelsView.addMemberEntity("II", "InventoryItem");
-inventoryItemAndLabelsView.addAliasAll("II", null, null);
+inventoryItemAndLabelsView = new DynamicViewEntity()
+inventoryItemAndLabelsView.addMemberEntity("II", "InventoryItem")
+inventoryItemAndLabelsView.addAliasAll("II", null, null)
for (int i = 1; i <= numberOfFields; i++) {
- inventoryItemLabelId = parameters.get("inventoryItemLabelId_" + i);
+ inventoryItemLabelId = parameters.get("inventoryItemLabelId_" + i)
if (inventoryItemLabelId) {
- inventoryItemAndLabelsView.addMemberEntity("IL" + i, "InventoryItemLabelAppl");
- inventoryItemAndLabelsView.addViewLink("II", "IL" + i, new Boolean(false), ModelKeyMap.makeKeyMapList("inventoryItemId"));
+ inventoryItemAndLabelsView.addMemberEntity("IL" + i, "InventoryItemLabelAppl")
+ inventoryItemAndLabelsView.addViewLink("II", "IL" + i, new Boolean(false), ModelKeyMap.makeKeyMapList("inventoryItemId"))
}
}
-andCondition = [EntityCondition.makeCondition("facilityId", EntityOperator.EQUALS, facilityId)];
+andCondition = [EntityCondition.makeCondition("facilityId", EntityOperator.EQUALS, facilityId)]
for (int i = 1; i <= numberOfFields; i++) {
- inventoryItemLabelId = parameters.get("inventoryItemLabelId_" + i);
+ inventoryItemLabelId = parameters.get("inventoryItemLabelId_" + i)
if (inventoryItemLabelId) {
- inventoryItemAndLabelsView.addAlias("IL" + i, "inventoryItemLabelId" + i, "inventoryItemLabelId", null, null, null, null);
- andCondition.add(EntityCondition.makeCondition("inventoryItemLabelId" + i, EntityOperator.EQUALS, inventoryItemLabelId));
+ inventoryItemAndLabelsView.addAlias("IL" + i, "inventoryItemLabelId" + i, "inventoryItemLabelId", null, null, null, null)
+ andCondition.add(EntityCondition.makeCondition("inventoryItemLabelId" + i, EntityOperator.EQUALS, inventoryItemLabelId))
}
}
-EntityListIterator inventoryItemsEli = null;
-beganTransaction = false;
-List inventoryItems = null;
+EntityListIterator inventoryItemsEli = null
+beganTransaction = false
+List inventoryItems = null
if (andCondition.size() > 1) {
try {
// get the indexes for the partial list
- lowIndex = ((viewIndex * viewSize) + 1);
- highIndex = (viewIndex - 1) * viewSize;
+ lowIndex = ((viewIndex * viewSize) + 1)
+ highIndex = (viewIndex - 1) * viewSize
- beganTransaction = TransactionUtil.begin();
- inventoryItemsEli = from(inventoryItemAndLabelsView).where(andCondition).cursorScrollInsensitive().distinct().maxRows(highIndex).queryIterator();
+ beganTransaction = TransactionUtil.begin()
+ inventoryItemsEli = from(inventoryItemAndLabelsView).where(andCondition).cursorScrollInsensitive().distinct().maxRows(highIndex).queryIterator()
- inventoryItemsSize = inventoryItemsEli.getResultsSizeAfterPartialList();
- context.inventoryItemsSize = inventoryItemsSize;
+ inventoryItemsSize = inventoryItemsEli.getResultsSizeAfterPartialList()
+ context.inventoryItemsSize = inventoryItemsSize
if (highIndex > inventoryItemsSize) {
- highIndex = inventoryItemsSize;
+ highIndex = inventoryItemsSize
}
// get the partial list for this page
- inventoryItemsEli.beforeFirst();
+ inventoryItemsEli.beforeFirst()
if (inventoryItemsSize > 0) {
- inventoryItems = inventoryItemsEli.getPartialList(lowIndex, viewSize);
+ inventoryItems = inventoryItemsEli.getPartialList(lowIndex, viewSize)
} else {
- inventoryItems = [] as ArrayList;
+ inventoryItems = [] as ArrayList
}
// close the list iterator
- inventoryItemsEli.close();
+ inventoryItemsEli.close()
} catch (GenericEntityException e) {
- errMsg = "Failure in operation, rolling back transaction";
- Debug.logError(e, errMsg, "findInventoryItemsByLabels");
+ errMsg = "Failure in operation, rolling back transaction"
+ Debug.logError(e, errMsg, "findInventoryItemsByLabels")
try {
// only rollback the transaction if we started one...
- TransactionUtil.rollback(beganTransaction, errMsg, e);
+ TransactionUtil.rollback(beganTransaction, errMsg, e)
} catch (GenericEntityException e2) {
- Debug.logError(e2, "Could not rollback transaction: " + e2.toString(), "findInventoryItemsByLabels");
+ Debug.logError(e2, "Could not rollback transaction: " + e2.toString(), "findInventoryItemsByLabels")
}
// after rolling back, rethrow the exception
- throw e;
+ throw e
} finally {
// only commit the transaction if we started one... this will throw an exception if it fails
- TransactionUtil.commit(beganTransaction);
+ TransactionUtil.commit(beganTransaction)
}
}
-context.inventoryItems = inventoryItems;
+context.inventoryItems = inventoryItems
diff --git a/applications/product/groovyScripts/facility/facility/ViewContactMechs.groovy b/applications/product/groovyScripts/facility/facility/ViewContactMechs.groovy
index c793e7392f..3692121c7e 100644
--- a/applications/product/groovyScripts/facility/facility/ViewContactMechs.groovy
+++ b/applications/product/groovyScripts/facility/facility/ViewContactMechs.groovy
@@ -20,22 +20,22 @@
import org.apache.ofbiz.base.util.*
import org.apache.ofbiz.party.contact.*
-context.nowStr = UtilDateTime.nowTimestamp();
+context.nowStr = UtilDateTime.nowTimestamp()
-facilityId = parameters.facilityId;
-facility = from("Facility").where("facilityId", facilityId).queryOne();
-facilityType = null;
+facilityId = parameters.facilityId
+facility = from("Facility").where("facilityId", facilityId).queryOne()
+facilityType = null
if (!facility) {
- context.facility = delegator.makeValue("Facility", null);
- context.facilityType = delegator.makeValue("FacilityType", null);
+ context.facility = delegator.makeValue("Facility", null)
+ context.facilityType = delegator.makeValue("FacilityType", null)
} else {
- facilityType = facility.getRelatedOne("FacilityType", false);
+ facilityType = facility.getRelatedOne("FacilityType", false)
}
-context.facility = facility;
-context.facilityType = facilityType;
-context.facilityId = facilityId;
+context.facility = facility
+context.facilityType = facilityType
+context.facilityId = facilityId
-showOld = "true".equals(request.getParameter("SHOW_OLD"));
-context.showOld = new Boolean(showOld);
+showOld = "true".equals(request.getParameter("SHOW_OLD"))
+context.showOld = new Boolean(showOld)
-context.contactMeches = ContactMechWorker.getFacilityContactMechValueMaps(delegator, facilityId, showOld, null);
+context.contactMeches = ContactMechWorker.getFacilityContactMechValueMaps(delegator, facilityId, showOld, null)
diff --git a/applications/product/groovyScripts/facility/facility/ViewFacilityInventoryByProduct.groovy b/applications/product/groovyScripts/facility/facility/ViewFacilityInventoryByProduct.groovy
index acb2229958..78ddffc25b 100644
--- a/applications/product/groovyScripts/facility/facility/ViewFacilityInventoryByProduct.groovy
+++ b/applications/product/groovyScripts/facility/facility/ViewFacilityInventoryByProduct.groovy
@@ -28,77 +28,77 @@ import org.apache.ofbiz.entity.model.ModelKeyMap
import org.apache.ofbiz.entity.util.EntityFindOptions
import org.apache.ofbiz.product.inventory.*
-action = request.getParameter("action");
-statusId = request.getParameter("statusId");
-searchParameterString = "";
-searchParameterString = "action=Y&facilityId=" + facilityId;
+action = request.getParameter("action")
+statusId = request.getParameter("statusId")
+searchParameterString = ""
+searchParameterString = "action=Y&facilityId=" + facilityId
-offsetQOH = -1;
-offsetATP = -1;
-hasOffsetQOH = false;
-hasOffsetATP = false;
+offsetQOH = -1
+offsetATP = -1
+hasOffsetQOH = false
+hasOffsetATP = false
-rows = [] as ArrayList;
-int listSize = 0; // The complete size of the list of result (for pagination)
+rows = [] as ArrayList
+int listSize = 0 // The complete size of the list of result (for pagination)
if (action) {
// ------------------------------
- prodView = new DynamicViewEntity();
- conditionMap = [facilityId : facilityId];
+ prodView = new DynamicViewEntity()
+ conditionMap = [facilityId : facilityId]
if (offsetQOHQty) {
try {
- offsetQOH = Integer.parseInt(offsetQOHQty);
- hasOffsetQOH = true;
- searchParameterString = searchParameterString + "&offsetQOHQty=" + offsetQOH;
+ offsetQOH = Integer.parseInt(offsetQOHQty)
+ hasOffsetQOH = true
+ searchParameterString = searchParameterString + "&offsetQOHQty=" + offsetQOH
} catch (NumberFormatException nfe) {
}
}
if (offsetATPQty) {
try {
- offsetATP = Integer.parseInt(offsetATPQty);
- hasOffsetATP = true;
- searchParameterString = searchParameterString + "&offsetATPQty=" + offsetATP;
+ offsetATP = Integer.parseInt(offsetATPQty)
+ hasOffsetATP = true
+ searchParameterString = searchParameterString + "&offsetATPQty=" + offsetATP
} catch (NumberFormatException nfe) {
}
}
- prodView.addMemberEntity("PRFA", "ProductFacility");
- prodView.addAliasAll("PRFA", null, null);
+ prodView.addMemberEntity("PRFA", "ProductFacility")
+ prodView.addAliasAll("PRFA", null, null)
- prodView.addMemberEntity("PROD", "Product");
- prodView.addViewLink("PROD", "PRFA", Boolean.FALSE, ModelKeyMap.makeKeyMapList("productId"));
- prodView.addAlias("PROD", "internalName");
- prodView.addAlias("PROD", "isVirtual");
- prodView.addAlias("PROD", "salesDiscontinuationDate");
+ prodView.addMemberEntity("PROD", "Product")
+ prodView.addViewLink("PROD", "PRFA", Boolean.FALSE, ModelKeyMap.makeKeyMapList("productId"))
+ prodView.addAlias("PROD", "internalName")
+ prodView.addAlias("PROD", "isVirtual")
+ prodView.addAlias("PROD", "salesDiscontinuationDate")
if (productTypeId) {
- prodView.addAlias("PROD", "productTypeId");
- conditionMap.productTypeId = productTypeId;
- searchParameterString = searchParameterString + "&productTypeId=" + productTypeId;
+ prodView.addAlias("PROD", "productTypeId")
+ conditionMap.productTypeId = productTypeId
+ searchParameterString = searchParameterString + "&productTypeId=" + productTypeId
}
if (searchInProductCategoryId) {
- prodView.addMemberEntity("PRCA", "ProductCategoryMember");
- prodView.addViewLink("PRFA", "PRCA", Boolean.FALSE, ModelKeyMap.makeKeyMapList("productId"));
- prodView.addAlias("PRCA", "productCategoryId");
- conditionMap.productCategoryId = searchInProductCategoryId;
- searchParameterString = searchParameterString + "&searchInProductCategoryId=" + searchInProductCategoryId;
+ prodView.addMemberEntity("PRCA", "ProductCategoryMember")
+ prodView.addViewLink("PRFA", "PRCA", Boolean.FALSE, ModelKeyMap.makeKeyMapList("productId"))
+ prodView.addAlias("PRCA", "productCategoryId")
+ conditionMap.productCategoryId = searchInProductCategoryId
+ searchParameterString = searchParameterString + "&searchInProductCategoryId=" + searchInProductCategoryId
}
if (productSupplierId) {
- prodView.addMemberEntity("SPPR", "SupplierProduct");
- prodView.addViewLink("PRFA", "SPPR", Boolean.FALSE, ModelKeyMap.makeKeyMapList("productId"));
- prodView.addAlias("SPPR", "partyId");
- conditionMap.partyId = productSupplierId;
- searchParameterString = searchParameterString + "&productSupplierId=" + productSupplierId;
+ prodView.addMemberEntity("SPPR", "SupplierProduct")
+ prodView.addViewLink("PRFA", "SPPR", Boolean.FALSE, ModelKeyMap.makeKeyMapList("productId"))
+ prodView.addAlias("SPPR", "partyId")
+ conditionMap.partyId = productSupplierId
+ searchParameterString = searchParameterString + "&productSupplierId=" + productSupplierId
}
// set distinct on so we only get one row per product
- searchCondition = EntityCondition.makeCondition(conditionMap, EntityOperator.AND);
+ searchCondition = EntityCondition.makeCondition(conditionMap, EntityOperator.AND)
notVirtualCondition = EntityCondition.makeCondition(EntityCondition.makeCondition("isVirtual", EntityOperator.EQUALS, null),
EntityOperator.OR,
- EntityCondition.makeCondition("isVirtual", EntityOperator.NOT_EQUAL, "Y"));
+ EntityCondition.makeCondition("isVirtual", EntityOperator.NOT_EQUAL, "Y"))
- whereConditionsList = [searchCondition, notVirtualCondition];
+ whereConditionsList = [searchCondition, notVirtualCondition]
// add the discontinuation date condition
if (productsSoldThruTimestamp) {
discontinuationDateCondition = EntityCondition.makeCondition(
@@ -106,104 +106,104 @@ if (action) {
EntityCondition.makeCondition("salesDiscontinuationDate", EntityOperator.EQUALS, null),
EntityCondition.makeCondition("salesDiscontinuationDate", EntityOperator.GREATER_THAN, productsSoldThruTimestamp)
],
- EntityOperator.OR);
- whereConditionsList.add(discontinuationDateCondition);
- searchParameterString = searchParameterString + "&productsSoldThruTimestamp=" + productsSoldThruTimestamp;
+ EntityOperator.OR)
+ whereConditionsList.add(discontinuationDateCondition)
+ searchParameterString = searchParameterString + "&productsSoldThruTimestamp=" + productsSoldThruTimestamp
}
// add search on internal name
if (internalName) {
- whereConditionsList.add(EntityCondition.makeCondition("internalName", EntityOperator.LIKE, "%" + internalName + "%"));
- searchParameterString = searchParameterString + "&internalName=" + internalName;
+ whereConditionsList.add(EntityCondition.makeCondition("internalName", EntityOperator.LIKE, "%" + internalName + "%"))
+ searchParameterString = searchParameterString + "&internalName=" + internalName
}
// add search on productId
if (productId) {
- whereConditionsList.add(EntityCondition.makeCondition("productId", EntityOperator.LIKE, productId + "%"));
- searchParameterString = searchParameterString + "&productId=" + productId;
+ whereConditionsList.add(EntityCondition.makeCondition("productId", EntityOperator.LIKE, productId + "%"))
+ searchParameterString = searchParameterString + "&productId=" + productId
}
- whereCondition = EntityCondition.makeCondition(whereConditionsList, EntityOperator.AND);
+ whereCondition = EntityCondition.makeCondition(whereConditionsList, EntityOperator.AND)
- beganTransaction = false;
+ beganTransaction = false
// get the indexes for the partial list
- lowIndex = ((viewIndex.intValue() * viewSize.intValue()) + 1);
- highIndex = (viewIndex.intValue() + 1) * viewSize.intValue();
- List prods = null;
+ lowIndex = ((viewIndex.intValue() * viewSize.intValue()) + 1)
+ highIndex = (viewIndex.intValue() + 1) * viewSize.intValue()
+ List prods = null
try {
- beganTransaction = TransactionUtil.begin();
- prodsEli = from(prodView).where(whereCondition).orderBy("productId").cursorScrollInsensitive().distinct().queryIterator();
- prods = prodsEli.getPartialList(lowIndex, highIndex);
- listSize = prodsEli.getResultsSizeAfterPartialList();
- prodsEli.close();
+ beganTransaction = TransactionUtil.begin()
+ prodsEli = from(prodView).where(whereCondition).orderBy("productId").cursorScrollInsensitive().distinct().queryIterator()
+ prods = prodsEli.getPartialList(lowIndex, highIndex)
+ listSize = prodsEli.getResultsSizeAfterPartialList()
+ prodsEli.close()
} catch (GenericEntityException e) {
- errMsg = "Failure in operation, rolling back transaction";
- Debug.logError(e, errMsg, "ViewFacilityInventoryByProduct");
+ errMsg = "Failure in operation, rolling back transaction"
+ Debug.logError(e, errMsg, "ViewFacilityInventoryByProduct")
try {
// only rollback the transaction if we started one...
- TransactionUtil.rollback(beganTransaction, errMsg, e);
+ TransactionUtil.rollback(beganTransaction, errMsg, e)
} catch (GenericEntityException e2) {
- Debug.logError(e2, "Could not rollback transaction: " + e2.toString(), "ViewFacilityInventoryByProduct");
+ Debug.logError(e2, "Could not rollback transaction: " + e2.toString(), "ViewFacilityInventoryByProduct")
}
// after rolling back, rethrow the exception
- throw e;
+ throw e
} finally {
// only commit the transaction if we started one... this will throw an exception if it fails
- TransactionUtil.commit(beganTransaction);
+ TransactionUtil.commit(beganTransaction)
}
// If the user has specified a number of months over which to sum usage quantities, define the correct timestamp
- Timestamp checkTime = null;
- monthsInPastLimitStr = request.getParameter("monthsInPastLimit");
+ Timestamp checkTime = null
+ monthsInPastLimitStr = request.getParameter("monthsInPastLimit")
if (monthsInPastLimitStr) {
try {
- monthsInPastLimit = Integer.parseInt(monthsInPastLimitStr);
- cal = UtilDateTime.toCalendar(null);
- cal.add(Calendar.MONTH, 0 - monthsInPastLimit);
- checkTime = UtilDateTime.toTimestamp(cal.getTime());
- searchParameterString += "&monthsInPastLimit=" + monthsInPastLimitStr;
+ monthsInPastLimit = Integer.parseInt(monthsInPastLimitStr)
+ cal = UtilDateTime.toCalendar(null)
+ cal.add(Calendar.MONTH, 0 - monthsInPastLimit)
+ checkTime = UtilDateTime.toTimestamp(cal.getTime())
+ searchParameterString += "&monthsInPastLimit=" + monthsInPastLimitStr
} catch (Exception e) {
// Ignore
}
}
prods.each { oneProd ->
- oneInventory = [:];
- resultMap = [:];
- oneInventory.checkTime = checkTime;
- oneInventory.facilityId = facilityId;
- oneInventory.productId = oneProd.productId;
- minimumStock = oneProd.minimumStock;
- oneInventory.minimumStock = minimumStock;
- oneInventory.reorderQuantity = oneProd.reorderQuantity;
- oneInventory.daysToShip = oneProd.daysToShip;
+ oneInventory = [:]
+ resultMap = [:]
+ oneInventory.checkTime = checkTime
+ oneInventory.facilityId = facilityId
+ oneInventory.productId = oneProd.productId
+ minimumStock = oneProd.minimumStock
+ oneInventory.minimumStock = minimumStock
+ oneInventory.reorderQuantity = oneProd.reorderQuantity
+ oneInventory.daysToShip = oneProd.daysToShip
- resultMap =runService('getProductInventoryAndFacilitySummary', [productId : oneProd.productId, minimumStock : minimumStock, facilityId : oneProd.facilityId, checkTime : checkTime, statusId : statusId]);
+ resultMap =runService('getProductInventoryAndFacilitySummary', [productId : oneProd.productId, minimumStock : minimumStock, facilityId : oneProd.facilityId, checkTime : checkTime, statusId : statusId])
if (resultMap) {
- oneInventory.totalAvailableToPromise = resultMap.totalAvailableToPromise;
- oneInventory.totalQuantityOnHand = resultMap.totalQuantityOnHand;
- oneInventory.quantityOnOrder = resultMap.quantityOnOrder;
- oneInventory.offsetQOHQtyAvailable = resultMap.offsetQOHQtyAvailable;
- oneInventory.offsetATPQtyAvailable = resultMap.offsetATPQtyAvailable;
- oneInventory.quantityUom = resultMap.quantityUomId;
- oneInventory.usageQuantity = resultMap.usageQuantity;
- oneInventory.defaultPrice = resultMap.defaultPrice;
- oneInventory.listPrice = resultMap.listPrice;
- oneInventory.wholeSalePrice = resultMap.wholeSalePrice;
+ oneInventory.totalAvailableToPromise = resultMap.totalAvailableToPromise
+ oneInventory.totalQuantityOnHand = resultMap.totalQuantityOnHand
+ oneInventory.quantityOnOrder = resultMap.quantityOnOrder
+ oneInventory.offsetQOHQtyAvailable = resultMap.offsetQOHQtyAvailable
+ oneInventory.offsetATPQtyAvailable = resultMap.offsetATPQtyAvailable
+ oneInventory.quantityUom = resultMap.quantityUomId
+ oneInventory.usageQuantity = resultMap.usageQuantity
+ oneInventory.defaultPrice = resultMap.defaultPrice
+ oneInventory.listPrice = resultMap.listPrice
+ oneInventory.wholeSalePrice = resultMap.wholeSalePrice
if (offsetQOHQty && offsetATPQty) {
if ((offsetQOHQty && resultMap.offsetQOHQtyAvailable < offsetQOH) && (offsetATPQty && resultMap.offsetATPQtyAvailable < offsetATP)) {
- rows.add(oneInventory);
+ rows.add(oneInventory)
}
}else if (offsetQOHQty || offsetATPQty) {
if ((offsetQOHQty && resultMap.offsetQOHQtyAvailable < offsetQOH) || (offsetATPQty && resultMap.offsetATPQtyAvailable < offsetATP)) {
- rows.add(oneInventory);
+ rows.add(oneInventory)
}
} else {
- rows.add(oneInventory);
+ rows.add(oneInventory)
}
}
}
}
-context.overrideListSize = listSize;
-context.inventoryByProduct = rows;
-context.searchParameterString = searchParameterString;
+context.overrideListSize = listSize
+context.inventoryByProduct = rows
+context.searchParameterString = searchParameterString
diff --git a/applications/product/groovyScripts/facility/inventory/FindFacilityPhysicalInventory.groovy b/applications/product/groovyScripts/facility/inventory/FindFacilityPhysicalInventory.groovy
index 8c363cad5c..a6606a4956 100644
--- a/applications/product/groovyScripts/facility/inventory/FindFacilityPhysicalInventory.groovy
+++ b/applications/product/groovyScripts/facility/inventory/FindFacilityPhysicalInventory.groovy
@@ -20,52 +20,52 @@
import org.apache.ofbiz.service.ServiceUtil
import org.apache.ofbiz.entity.condition.*
-facilityId = parameters.facilityId;
+facilityId = parameters.facilityId
// fields to search by
-productId = parameters.productId ? parameters.productId.trim() : null;
-internalName = parameters.internalName ? parameters.internalName.trim() : null;
+productId = parameters.productId ? parameters.productId.trim() : null
+internalName = parameters.internalName ? parameters.internalName.trim() : null
// build conditions
conditions = [EntityCondition.makeCondition("facilityId", EntityOperator.EQUALS, facilityId),
EntityCondition.makeCondition("inventoryItemTypeId", EntityOperator.EQUALS, "NON_SERIAL_INV_ITEM")
- ];
+ ]
if (productId) {
- conditions.add(EntityCondition.makeCondition("productId", EntityOperator.LIKE, productId + "%"));
+ conditions.add(EntityCondition.makeCondition("productId", EntityOperator.LIKE, productId + "%"))
}
if (internalName) {
- conditions.add(EntityCondition.makeCondition("internalName", EntityOperator.LIKE, internalName + "%"));
+ conditions.add(EntityCondition.makeCondition("internalName", EntityOperator.LIKE, internalName + "%"))
}
if (conditions.size() > 2) {
- physicalInventory = from("ProductInventoryItem").where(conditions).orderBy("productId").queryList();
+ physicalInventory = from("ProductInventoryItem").where(conditions).orderBy("productId").queryList()
// also need the overal product QOH and ATP for each product
- atpMap = [:];
- qohMap = [:];
+ atpMap = [:]
+ qohMap = [:]
// build a list of productIds
- productIds = [] as Set;
+ productIds = [] as Set
physicalInventory.each { iter ->
- productIds.add(iter.productId);
+ productIds.add(iter.productId)
}
// for each product, call the inventory counting service
productIds.each { productId ->
- result = runService('getInventoryAvailableByFacility', [facilityId : facilityId, productId : productId]);
+ result = runService('getInventoryAvailableByFacility', [facilityId : facilityId, productId : productId])
if (!ServiceUtil.isError(result)) {
- atpMap.put(productId, result.availableToPromiseTotal);
- qohMap.put(productId, result.quantityOnHandTotal);
+ atpMap.put(productId, result.availableToPromiseTotal)
+ qohMap.put(productId, result.quantityOnHandTotal)
}
}
// associate the quantities to each row and store the combined data as our list
- physicalInventoryCombined = [];
+ physicalInventoryCombined = []
physicalInventory.each { iter ->
- row = iter.getAllFields();
- row.productATP = atpMap.get(row.productId);
- row.productQOH = qohMap.get(row.productId);
- physicalInventoryCombined.add(row);
+ row = iter.getAllFields()
+ row.productATP = atpMap.get(row.productId)
+ row.productQOH = qohMap.get(row.productId)
+ physicalInventoryCombined.add(row)
}
- context.physicalInventory = physicalInventoryCombined;
+ context.physicalInventory = physicalInventoryCombined
}
diff --git a/applications/product/groovyScripts/facility/inventory/InventoryAverageCosts.groovy b/applications/product/groovyScripts/facility/inventory/InventoryAverageCosts.groovy
index c8554b14cc..9e392ff880 100644
--- a/applications/product/groovyScripts/facility/inventory/InventoryAverageCosts.groovy
+++ b/applications/product/groovyScripts/facility/inventory/InventoryAverageCosts.groovy
@@ -17,36 +17,36 @@
* under the License.
*/
-import java.util.*;
-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.EntityOperator;
-import org.apache.ofbiz.entity.util.EntityUtil;
+import java.util.*
+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.EntityOperator
+import org.apache.ofbiz.entity.util.EntityUtil
-facilityId = context.get("facilityId");
-searchParameterString = "action=Y&facilityId=" + facilityId;
+facilityId = context.get("facilityId")
+searchParameterString = "action=Y&facilityId=" + facilityId
-EntityCondition whereConditions = EntityCondition.makeCondition("facilityId", EntityOperator.EQUALS, facilityId);
-inventoryItems = select("productId").from("InventoryItem").where("facilityId", facilityId).orderBy("productId").queryList();
-inventoryItemProducts = EntityUtil.getFieldListFromEntityList(inventoryItems, "productId", true);
+EntityCondition whereConditions = EntityCondition.makeCondition("facilityId", EntityOperator.EQUALS, facilityId)
+inventoryItems = select("productId").from("InventoryItem").where("facilityId", facilityId).orderBy("productId").queryList()
+inventoryItemProducts = EntityUtil.getFieldListFromEntityList(inventoryItems, "productId", true)
-inventoryAverageCosts = [];
+inventoryAverageCosts = []
inventoryItemProducts.each { productId ->
- productFacility = from("ProductFacility").where("productId", productId, "facilityId", facilityId).queryOne();
+ productFacility = from("ProductFacility").where("productId", productId, "facilityId", facilityId).queryOne()
if (UtilValidate.isNotEmpty(productFacility)) {
- result = runService('calculateProductAverageCost', UtilMisc.toMap("productId": productId, "facilityId": facilityId, "userLogin": userLogin));
- totalQuantityOnHand = result.get("totalQuantityOnHand");
+ result = runService('calculateProductAverageCost', UtilMisc.toMap("productId": productId, "facilityId": facilityId, "userLogin": userLogin))
+ totalQuantityOnHand = result.get("totalQuantityOnHand")
- totalInventoryCost = result.get("totalInventoryCost");
- productAverageCost = result.get("productAverageCost");
- currencyUomId = result.get("currencyUomId");
+ totalInventoryCost = result.get("totalInventoryCost")
+ productAverageCost = result.get("productAverageCost")
+ currencyUomId = result.get("currencyUomId")
if (!totalQuantityOnHand.equals(BigDecimal.ZERO)) {
inventoryAverageCosts.add(UtilMisc.toMap("productId", productId, "totalQuantityOnHand", totalQuantityOnHand,
- "productAverageCost", productAverageCost, "totalInventoryCost", totalInventoryCost, "currencyUomId", currencyUomId));
+ "productAverageCost", productAverageCost, "totalInventoryCost", totalInventoryCost, "currencyUomId", currencyUomId))
}
}
}
-context.searchParameterString = searchParameterString;
-context.inventoryAverageCosts = inventoryAverageCosts;
+context.searchParameterString = searchParameterString
+context.inventoryAverageCosts = inventoryAverageCosts
diff --git a/applications/product/groovyScripts/facility/inventory/InventoryItemTotals.groovy b/applications/product/groovyScripts/facility/inventory/InventoryItemTotals.groovy
index effd4f55cc..64326176de 100644
--- a/applications/product/groovyScripts/facility/inventory/InventoryItemTotals.groovy
+++ b/applications/product/groovyScripts/facility/inventory/InventoryItemTotals.groovy
@@ -21,92 +21,92 @@ import org.apache.ofbiz.entity.*
import org.apache.ofbiz.entity.condition.*
import org.apache.ofbiz.entity.transaction.*
-action = request.getParameter("action");
+action = request.getParameter("action")
-inventoryItemTotals = [];
-qohGrandTotal = 0.0;
-atpGrandTotal = 0.0;
-costPriceGrandTotal = 0.0;
-retailPriceGrandTotal = 0.0;
-totalCostPriceGrandTotal = 0.0;
-totalRetailPriceGrandTotal = 0.0;
-boolean beganTransaction = false;
-searchParameterString = "action=Y&facilityId=" + facilityId;
+inventoryItemTotals = []
+qohGrandTotal = 0.0
+atpGrandTotal = 0.0
+costPriceGrandTotal = 0.0
+retailPriceGrandTotal = 0.0
+totalCostPriceGrandTotal = 0.0
+totalRetailPriceGrandTotal = 0.0
+boolean beganTransaction = false
+searchParameterString = "action=Y&facilityId=" + facilityId
if (action) {
- conditions = [EntityCondition.makeCondition("statusId", EntityOperator.NOT_EQUAL, "INV_DELIVERED")];
- conditions.add(EntityCondition.makeCondition("statusId", EntityOperator.EQUALS, null));
- conditionList = EntityCondition.makeCondition(conditions, EntityOperator.OR);
+ conditions = [EntityCondition.makeCondition("statusId", EntityOperator.NOT_EQUAL, "INV_DELIVERED")]
+ conditions.add(EntityCondition.makeCondition("statusId", EntityOperator.EQUALS, null))
+ conditionList = EntityCondition.makeCondition(conditions, EntityOperator.OR)
try {
- beganTransaction = TransactionUtil.begin();
- invItemListItr = from("InventoryItem").where(conditionList).orderBy("productId").queryIterator();
+ beganTransaction = TransactionUtil.begin()
+ invItemListItr = from("InventoryItem").where(conditionList).orderBy("productId").queryIterator()
while ((inventoryItem = invItemListItr.next()) != null) {
- productId = inventoryItem.productId;
- product = from("Product").where("productId", productId).queryOne();
- productFacility = from("ProductFacility").where("productId", productId, "facilityId", facilityId).queryOne();
+ productId = inventoryItem.productId
+ product = from("Product").where("productId", productId).queryOne()
+ productFacility = from("ProductFacility").where("productId", productId, "facilityId", facilityId).queryOne()
if (productFacility) {
- quantityOnHandTotal = inventoryItem.getDouble("quantityOnHandTotal");
- availableToPromiseTotal = inventoryItem.getDouble("availableToPromiseTotal");
- costPrice = inventoryItem.getDouble("unitCost");
- retailPrice = 0.0;
- totalCostPrice = 0.0;
- totalRetailPrice = 0.0;
- productPrices = product.getRelated("ProductPrice", null, null, false);
+ quantityOnHandTotal = inventoryItem.getDouble("quantityOnHandTotal")
+ availableToPromiseTotal = inventoryItem.getDouble("availableToPromiseTotal")
+ costPrice = inventoryItem.getDouble("unitCost")
+ retailPrice = 0.0
+ totalCostPrice = 0.0
+ totalRetailPrice = 0.0
+ productPrices = product.getRelated("ProductPrice", null, null, false)
if (productPrices) {
productPrices.each { productPrice ->
if (("DEFAULT_PRICE").equals(productPrice.productPriceTypeId)) {
- retailPrice = productPrice.getDouble("price");
+ retailPrice = productPrice.getDouble("price")
}
}
}
if (costPrice && quantityOnHandTotal) {
- totalCostPrice = costPrice * quantityOnHandTotal;
- totalCostPriceGrandTotal += totalCostPrice;
+ totalCostPrice = costPrice * quantityOnHandTotal
+ totalCostPriceGrandTotal += totalCostPrice
}
if (retailPrice && quantityOnHandTotal) {
- totalRetailPrice = retailPrice * quantityOnHandTotal;
- totalRetailPriceGrandTotal += totalRetailPrice;
+ totalRetailPrice = retailPrice * quantityOnHandTotal
+ totalRetailPriceGrandTotal += totalRetailPrice
}
if (quantityOnHandTotal) {
- qohGrandTotal += quantityOnHandTotal;
+ qohGrandTotal += quantityOnHandTotal
}
if (availableToPromiseTotal) {
- atpGrandTotal += availableToPromiseTotal;
+ atpGrandTotal += availableToPromiseTotal
}
if (costPrice) {
- costPriceGrandTotal += costPrice;
+ costPriceGrandTotal += costPrice
}
if (retailPrice) {
- retailPriceGrandTotal += retailPrice;
+ retailPriceGrandTotal += retailPrice
}
resultMap = [productId : product.productId, quantityOnHand : quantityOnHandTotal, availableToPromise : availableToPromiseTotal,
- costPrice : costPrice, retailPrice : retailPrice, totalCostPrice : totalCostPrice, totalRetailPrice : totalRetailPrice];
- inventoryItemTotals.add(resultMap);
+ costPrice : costPrice, retailPrice : retailPrice, totalCostPrice : totalCostPrice, totalRetailPrice : totalRetailPrice]
+ inventoryItemTotals.add(resultMap)
}
}
- invItemListItr.close();
+ invItemListItr.close()
} catch (GenericEntityException e) {
- errMsg = "Failure in operation, rolling back transaction";
- Debug.logError(e, errMsg, "findInventoryItemsByLabels");
+ errMsg = "Failure in operation, rolling back transaction"
+ Debug.logError(e, errMsg, "findInventoryItemsByLabels")
try {
// only rollback the transaction if we started one...
- TransactionUtil.rollback(beganTransaction, errMsg, e);
+ TransactionUtil.rollback(beganTransaction, errMsg, e)
} catch (GenericEntityException e2) {
- Debug.logError(e2, "Could not rollback transaction: " + e2.toString(), "findInventoryItemsByLabels");
+ Debug.logError(e2, "Could not rollback transaction: " + e2.toString(), "findInventoryItemsByLabels")
}
// after rolling back, rethrow the exception
- throw e;
+ throw e
} finally {
// only commit the transaction if we started one... this will throw an exception if it fails
- TransactionUtil.commit(beganTransaction);
+ TransactionUtil.commit(beganTransaction)
}
}
-inventoryItemGrandTotals = [];
+inventoryItemGrandTotals = []
inventoryItemGrandTotals.add([qohGrandTotal : qohGrandTotal, atpGrandTotal : atpGrandTotal,
- totalCostPriceGrandTotal : totalCostPriceGrandTotal, totalRetailPriceGrandTotal : totalRetailPriceGrandTotal]);
+ totalCostPriceGrandTotal : totalCostPriceGrandTotal, totalRetailPriceGrandTotal : totalRetailPriceGrandTotal])
-context.searchParameterString = searchParameterString;
-context.inventoryItemTotals = inventoryItemTotals;
-context.inventoryItemGrandTotals = inventoryItemGrandTotals;
+context.searchParameterString = searchParameterString
+context.inventoryItemTotals = inventoryItemTotals
+context.inventoryItemGrandTotals = inventoryItemGrandTotals
diff --git a/applications/product/groovyScripts/facility/inventory/LookupInventoryItems.groovy b/applications/product/groovyScripts/facility/inventory/LookupInventoryItems.groovy
index 44e69e7aa2..f521825b70 100644
--- a/applications/product/groovyScripts/facility/inventory/LookupInventoryItems.groovy
+++ b/applications/product/groovyScripts/facility/inventory/LookupInventoryItems.groovy
@@ -16,35 +16,35 @@
* specific language governing permissions and limitations
* under the License.
*/
-import org.apache.ofbiz.entity.condition.EntityCondition;
-import org.apache.ofbiz.entity.condition.EntityOperator;
-orderId = parameters.orderId;
-partyId = parameters.partyId;
-productId = parameters.productId;
+import org.apache.ofbiz.entity.condition.EntityCondition
+import org.apache.ofbiz.entity.condition.EntityOperator
+orderId = parameters.orderId
+partyId = parameters.partyId
+productId = parameters.productId
if (orderId && productId) {
- shipmentReceiptAndItems = from("ShipmentReceiptAndItem").where("orderId", orderId, "productId", productId).queryList();
- context.inventoryItemsForPo = shipmentReceiptAndItems;
- context.orderId = orderId;
+ shipmentReceiptAndItems = from("ShipmentReceiptAndItem").where("orderId", orderId, "productId", productId).queryList()
+ context.inventoryItemsForPo = shipmentReceiptAndItems
+ context.orderId = orderId
}
exprList = [EntityCondition.makeCondition("productId", EntityOperator.EQUALS, productId),
- EntityCondition.makeCondition("availableToPromiseTotal", EntityOperator.GREATER_THAN, BigDecimal.ZERO)];
+ EntityCondition.makeCondition("availableToPromiseTotal", EntityOperator.GREATER_THAN, BigDecimal.ZERO)]
if (partyId && productId) {
- orderRoles = from("OrderRole").where("partyId", partyId, "roleTypeId", "BILL_FROM_VENDOR").queryList();
- inventoryItemsForSupplier = [];
+ orderRoles = from("OrderRole").where("partyId", partyId, "roleTypeId", "BILL_FROM_VENDOR").queryList()
+ inventoryItemsForSupplier = []
orderRoles.each { orderRole ->
shipmentReceiptAndItems = from("ShipmentReceiptAndItem").where(EntityCondition.makeCondition(exprList, EntityOperator.AND),
- EntityCondition.makeCondition("orderId", EntityOperator.EQUALS, orderRole.orderId)).queryList();
- inventoryItemsForSupplier.addAll(shipmentReceiptAndItems);
+ EntityCondition.makeCondition("orderId", EntityOperator.EQUALS, orderRole.orderId)).queryList()
+ inventoryItemsForSupplier.addAll(shipmentReceiptAndItems)
}
- context.inventoryItemsForSupplier = inventoryItemsForSupplier;
- context.partyId = partyId;
+ context.inventoryItemsForSupplier = inventoryItemsForSupplier
+ context.partyId = partyId
}
if (productId) {
- inventoryItems = from("InventoryItem").where(EntityCondition.makeCondition(exprList, EntityOperator.AND)).queryList();
- context.inventoryItemsForProduct = inventoryItems;
- context.productId = productId;
- product = from("Product").where("productId", productId).queryOne();
- context.internalName = product.internalName;
+ inventoryItems = from("InventoryItem").where(EntityCondition.makeCondition(exprList, EntityOperator.AND)).queryList()
+ context.inventoryItemsForProduct = inventoryItems
+ context.productId = productId
+ product = from("Product").where("productId", productId).queryOne()
+ context.internalName = product.internalName
}
\ No newline at end of file
diff --git a/applications/product/groovyScripts/facility/inventory/PhysicalInventoryVariance.groovy b/applications/product/groovyScripts/facility/inventory/PhysicalInventoryVariance.groovy
index e5394a9b7f..b17885f52d 100644
--- a/applications/product/groovyScripts/facility/inventory/PhysicalInventoryVariance.groovy
+++ b/applications/product/groovyScripts/facility/inventory/PhysicalInventoryVariance.groovy
@@ -17,20 +17,20 @@
* under the License.
*/
-import org.apache.ofbiz.entity.condition.EntityCondition;
+import org.apache.ofbiz.entity.condition.EntityCondition
// get physicalInventoryAndVarianceDatas if this is a NON_SERIAL_INV_ITEM
if (inventoryItem && "NON_SERIAL_INV_ITEM".equals(inventoryItem.inventoryItemTypeId)) {
- physicalInventoryAndVariances = from("PhysicalInventoryAndVariance").where("inventoryItemId", inventoryItemId).orderBy("-physicalInventoryDate", "-physicalInventoryId").queryList();
- physicalInventoryAndVarianceDatas = new ArrayList(physicalInventoryAndVariances.size());
+ physicalInventoryAndVariances = from("PhysicalInventoryAndVariance").where("inventoryItemId", inventoryItemId).orderBy("-physicalInventoryDate", "-physicalInventoryId").queryList()
+ physicalInventoryAndVarianceDatas = new ArrayList(physicalInventoryAndVariances.size())
physicalInventoryAndVariances.each { physicalInventoryAndVariance ->
- physicalInventoryAndVarianceData = [:];
- physicalInventoryAndVarianceDatas.add(physicalInventoryAndVarianceData);
+ physicalInventoryAndVarianceData = [:]
+ physicalInventoryAndVarianceDatas.add(physicalInventoryAndVarianceData)
- physicalInventoryAndVarianceData.physicalInventoryAndVariance = physicalInventoryAndVariance;
- physicalInventoryAndVarianceData.varianceReason = physicalInventoryAndVariance.getRelatedOne("VarianceReason", true);
- physicalInventoryAndVarianceData.person = physicalInventoryAndVariance.getRelatedOne("Person", false);
- physicalInventoryAndVarianceData.partyGroup = physicalInventoryAndVariance.getRelatedOne("PartyGroup", false);
+ physicalInventoryAndVarianceData.physicalInventoryAndVariance = physicalInventoryAndVariance
+ physicalInventoryAndVarianceData.varianceReason = physicalInventoryAndVariance.getRelatedOne("VarianceReason", true)
+ physicalInventoryAndVarianceData.person = physicalInventoryAndVariance.getRelatedOne("Person", false)
+ physicalInventoryAndVarianceData.partyGroup = physicalInventoryAndVariance.getRelatedOne("PartyGroup", false)
}
- context.physicalInventoryAndVarianceDatas = physicalInventoryAndVarianceDatas;
+ context.physicalInventoryAndVarianceDatas = physicalInventoryAndVarianceDatas
}
diff --git a/applications/product/groovyScripts/facility/inventory/ReceiveInventory.groovy b/applications/product/groovyScripts/facility/inventory/ReceiveInventory.groovy
index bacf6d0082..a3314a39b4 100644
--- a/applications/product/groovyScripts/facility/inventory/ReceiveInventory.groovy
+++ b/applications/product/groovyScripts/facility/inventory/ReceiveInventory.groovy
@@ -17,219 +17,219 @@
* under the License.
*/
-import org.apache.ofbiz.base.util.UtilMisc;
+import org.apache.ofbiz.base.util.UtilMisc
import org.apache.ofbiz.entity.util.*
import org.apache.ofbiz.entity.condition.*
import org.apache.ofbiz.service.ServiceUtil
-facilityId = request.getParameter("facilityId");
-purchaseOrderId = request.getParameter("purchaseOrderId");
-productId = request.getParameter("productId");
-shipmentId = request.getParameter("shipmentId");
+facilityId = request.getParameter("facilityId")
+purchaseOrderId = request.getParameter("purchaseOrderId")
+productId = request.getParameter("productId")
+shipmentId = request.getParameter("shipmentId")
-partialReceive = parameters.partialReceive;
+partialReceive = parameters.partialReceive
if (partialReceive) {
- context.partialReceive = partialReceive;
+ context.partialReceive = partialReceive
}
-facility = null;
+facility = null
if (facilityId) {
- facility = from("Facility").where("facilityId", facilityId).queryOne();
+ facility = from("Facility").where("facilityId", facilityId).queryOne()
}
-ownerAcctgPref = null;
+ownerAcctgPref = null
if (facility) {
- owner = facility.getRelatedOne("OwnerParty", false);
+ owner = facility.getRelatedOne("OwnerParty", false)
if (owner) {
- result = runService('getPartyAccountingPreferences', [organizationPartyId : owner.partyId, userLogin : request.getAttribute("userLogin")]);
+ result = runService('getPartyAccountingPreferences', [organizationPartyId : owner.partyId, userLogin : request.getAttribute("userLogin")])
if (!ServiceUtil.isError(result) && result.partyAccountingPreference) {
- ownerAcctgPref = result.partyAccountingPreference;
+ ownerAcctgPref = result.partyAccountingPreference
}
}
}
-purchaseOrder = null;
+purchaseOrder = null
if (purchaseOrderId) {
- purchaseOrder = from("OrderHeader").where("orderId", purchaseOrderId).queryOne();
+ purchaseOrder = from("OrderHeader").where("orderId", purchaseOrderId).queryOne()
if (purchaseOrder && !"PURCHASE_ORDER".equals(purchaseOrder.orderTypeId)) {
- purchaseOrder = null;
+ purchaseOrder = null
}
}
-product = null;
+product = null
if (productId) {
- product = from("Product").where("productId", productId).queryOne();
- context.supplierPartyIds = EntityUtil.getFieldListFromEntityList(from("SupplierProduct").where("productId", productId).orderBy("partyId").filterByDate(nowTimestamp, "availableFromDate", "availableThruDate").queryList(), "partyId", true);
+ product = from("Product").where("productId", productId).queryOne()
+ context.supplierPartyIds = EntityUtil.getFieldListFromEntityList(from("SupplierProduct").where("productId", productId).orderBy("partyId").filterByDate(nowTimestamp, "availableFromDate", "availableThruDate").queryList(), "partyId", true)
}
-shipments = null;
+shipments = null
if (purchaseOrder && !shipmentId) {
- orderShipments = from("OrderShipment").where("orderId", purchaseOrderId).queryList();
+ orderShipments = from("OrderShipment").where("orderId", purchaseOrderId).queryList()
if (orderShipments) {
- shipments = [] as TreeSet;
+ shipments = [] as TreeSet
orderShipments.each { orderShipment ->
- shipment = orderShipment.getRelatedOne("Shipment", false);
+ shipment = orderShipment.getRelatedOne("Shipment", false)
if (!"PURCH_SHIP_RECEIVED".equals(shipment.statusId) &&
!"SHIPMENT_CANCELLED".equals(shipment.statusId) &&
(!shipment.destinationFacilityId || facilityId.equals(shipment.destinationFacilityId))) {
- shipments.add(shipment);
+ shipments.add(shipment)
}
}
}
// This is here for backward compatibility: ItemIssuances are no more created for purchase shipments.
- issuances = from("ItemIssuance").where("orderId", purchaseOrderId).queryList();
+ issuances = from("ItemIssuance").where("orderId", purchaseOrderId).queryList()
if (issuances) {
- shipments = [] as TreeSet;
+ shipments = [] as TreeSet
issuances.each { issuance ->
- shipment = issuance.getRelatedOne("Shipment", false);
+ shipment = issuance.getRelatedOne("Shipment", false)
if (!"PURCH_SHIP_RECEIVED".equals(shipment.statusId) &&
!"SHIPMENT_CANCELLED".equals(shipment.statusId) &&
(!shipment.destinationFacilityId || facilityId.equals(shipment.destinationFacilityId))) {
- shipments.add(shipment);
+ shipments.add(shipment)
}
}
}
}
-shipment = null;
+shipment = null
if (shipmentId && !shipmentId.equals("_NA_")) {
- shipment = from("Shipment").where("shipmentId", shipmentId).queryOne();
+ shipment = from("Shipment").where("shipmentId", shipmentId).queryOne()
}
-shippedQuantities = [:];
-purchaseOrderItems = null;
+shippedQuantities = [:]
+purchaseOrderItems = null
if (purchaseOrder) {
if (product) {
- purchaseOrderItems = purchaseOrder.getRelated("OrderItem", [productId : productId], null, false);
+ purchaseOrderItems = purchaseOrder.getRelated("OrderItem", [productId : productId], null, false)
} else if (shipment) {
- orderItems = purchaseOrder.getRelated("OrderItem", null, null, false);
- exprs = [] as ArrayList;
- orderShipments = shipment.getRelated("OrderShipment", [orderId : purchaseOrderId], null, false);
+ orderItems = purchaseOrder.getRelated("OrderItem", null, null, false)
+ exprs = [] as ArrayList
+ orderShipments = shipment.getRelated("OrderShipment", [orderId : purchaseOrderId], null, false)
if (orderShipments) {
orderShipments.each { orderShipment ->
- exprs.add(EntityCondition.makeCondition("orderItemSeqId", EntityOperator.EQUALS, orderShipment.orderItemSeqId));
- double orderShipmentQty = orderShipment.getDouble("quantity").doubleValue();
+ exprs.add(EntityCondition.makeCondition("orderItemSeqId", EntityOperator.EQUALS, orderShipment.orderItemSeqId))
+ double orderShipmentQty = orderShipment.getDouble("quantity").doubleValue()
if (shippedQuantities.containsKey(orderShipment.orderItemSeqId)) {
- orderShipmentQty += ((Double)shippedQuantities.get(orderShipment.orderItemSeqId)).doubleValue();
+ orderShipmentQty += ((Double)shippedQuantities.get(orderShipment.orderItemSeqId)).doubleValue()
}
- shippedQuantities.put(orderShipment.orderItemSeqId, orderShipmentQty);
+ shippedQuantities.put(orderShipment.orderItemSeqId, orderShipmentQty)
}
} else {
// this is here for backward compatibility only: ItemIssuances are no more created for purchase shipments.
- issuances = shipment.getRelated("ItemIssuance", [orderId : purchaseOrderId], null, false);
+ issuances = shipment.getRelated("ItemIssuance", [orderId : purchaseOrderId], null, false)
issuances.each { issuance ->
- exprs.add(EntityCondition.makeCondition("orderItemSeqId", EntityOperator.EQUALS, issuance.orderItemSeqId));
- double issuanceQty = issuance.getDouble("quantity").doubleValue();
+ exprs.add(EntityCondition.makeCondition("orderItemSeqId", EntityOperator.EQUALS, issuance.orderItemSeqId))
+ double issuanceQty = issuance.getDouble("quantity").doubleValue()
if (shippedQuantities.containsKey(issuance.orderItemSeqId)) {
- issuanceQty += ((Double)shippedQuantities.get(issuance.orderItemSeqId)).doubleValue();
+ issuanceQty += ((Double)shippedQuantities.get(issuance.orderItemSeqId)).doubleValue()
}
- shippedQuantities.put(issuance.orderItemSeqId, issuanceQty);
+ shippedQuantities.put(issuance.orderItemSeqId, issuanceQty)
}
}
- purchaseOrderItems = EntityUtil.filterByOr(orderItems, exprs);
+ purchaseOrderItems = EntityUtil.filterByOr(orderItems, exprs)
} else {
- purchaseOrderItems = purchaseOrder.getRelated("OrderItem", null, null, false);
+ purchaseOrderItems = purchaseOrder.getRelated("OrderItem", null, null, false)
}
- purchaseOrderItems = EntityUtil.filterByAnd(purchaseOrderItems, [EntityCondition.makeCondition("statusId", EntityOperator.NOT_EQUAL, "ITEM_CANCELLED")]);
+ purchaseOrderItems = EntityUtil.filterByAnd(purchaseOrderItems, [EntityCondition.makeCondition("statusId", EntityOperator.NOT_EQUAL, "ITEM_CANCELLED")])
}
// convert the unit prices to that of the facility owner's currency
-orderCurrencyUnitPriceMap = [:];
+orderCurrencyUnitPriceMap = [:]
if (purchaseOrder && facility) {
if (ownerAcctgPref) {
- ownerCurrencyUomId = ownerAcctgPref.baseCurrencyUomId;
- orderCurrencyUomId = purchaseOrder.currencyUom;
+ ownerCurrencyUomId = ownerAcctgPref.baseCurrencyUomId
+ orderCurrencyUomId = purchaseOrder.currencyUom
if (!orderCurrencyUomId.equals(ownerCurrencyUomId)) {
purchaseOrderItems.each { item ->
- orderCurrencyUnitPriceMap.(item.orderItemSeqId) = item.unitPrice;
+ orderCurrencyUnitPriceMap.(item.orderItemSeqId) = item.unitPrice
serviceResults = runService('convertUom',
- [uomId : orderCurrencyUomId, uomIdTo : ownerCurrencyUomId, originalValue : item.unitPrice]);
+ [uomId : orderCurrencyUomId, uomIdTo : ownerCurrencyUomId, originalValue : item.unitPrice])
if (ServiceUtil.isError(serviceResults)) {
- request.setAttribute("_ERROR_MESSAGE_", ServiceUtil.getErrorMessage(serviceResults));
- return;
+ request.setAttribute("_ERROR_MESSAGE_", ServiceUtil.getErrorMessage(serviceResults))
+ return
} else {
- convertedValue = serviceResults.convertedValue;
+ convertedValue = serviceResults.convertedValue
if (convertedValue) {
- item.unitPrice = convertedValue;
+ item.unitPrice = convertedValue
}
}
}
}
// put the pref currency in the map for display and form use
- context.currencyUomId = ownerCurrencyUomId;
- context.orderCurrencyUomId = orderCurrencyUomId;
+ context.currencyUomId = ownerCurrencyUomId
+ context.orderCurrencyUomId = orderCurrencyUomId
} else {
- request.setAttribute("_ERROR_MESSAGE_", "Either no owner party was set for this facility, or no accounting preferences were set for this owner party.");
+ request.setAttribute("_ERROR_MESSAGE_", "Either no owner party was set for this facility, or no accounting preferences were set for this owner party.")
}
}
-context.orderCurrencyUnitPriceMap = orderCurrencyUnitPriceMap;
+context.orderCurrencyUnitPriceMap = orderCurrencyUnitPriceMap
-receivedQuantities = [:];
-salesOrderItems = [:];
+receivedQuantities = [:]
+salesOrderItems = [:]
if (purchaseOrderItems) {
- context.firstOrderItem = EntityUtil.getFirst(purchaseOrderItems);
- context.purchaseOrderItemsSize = purchaseOrderItems.size();
+ context.firstOrderItem = EntityUtil.getFirst(purchaseOrderItems)
+ context.purchaseOrderItemsSize = purchaseOrderItems.size()
purchaseOrderItems.each { thisItem ->
- totalReceived = 0.0;
- receipts = thisItem.getRelated("ShipmentReceipt", null, null, false);
+ totalReceived = 0.0
+ receipts = thisItem.getRelated("ShipmentReceipt", null, null, false)
if (receipts) {
receipts.each { rec ->
if (!shipment || (rec.shipmentId && rec.shipmentId.equals(shipment.shipmentId))) {
- accepted = rec.getDouble("quantityAccepted");
- rejected = rec.getDouble("quantityRejected");
+ accepted = rec.getDouble("quantityAccepted")
+ rejected = rec.getDouble("quantityRejected")
if (accepted) {
- totalReceived += accepted.doubleValue();
+ totalReceived += accepted.doubleValue()
}
if (rejected) {
- totalReceived += rejected.doubleValue();
+ totalReceived += rejected.doubleValue()
}
}
}
}
- receivedQuantities.put(thisItem.orderItemSeqId, new Double(totalReceived));
+ receivedQuantities.put(thisItem.orderItemSeqId, new Double(totalReceived))
//----------------------
- salesOrderItemAssocs = from("OrderItemAssoc").where(orderItemAssocTypeId : 'PURCHASE_ORDER', toOrderId : thisItem.orderId, toOrderItemSeqId : thisItem.orderItemSeqId).queryList();
+ salesOrderItemAssocs = from("OrderItemAssoc").where(orderItemAssocTypeId : 'PURCHASE_ORDER', toOrderId : thisItem.orderId, toOrderItemSeqId : thisItem.orderItemSeqId).queryList()
if (salesOrderItemAssocs) {
- salesOrderItem = EntityUtil.getFirst(salesOrderItemAssocs);
- salesOrderItems.put(thisItem.orderItemSeqId, salesOrderItem);
+ salesOrderItem = EntityUtil.getFirst(salesOrderItemAssocs)
+ salesOrderItems.put(thisItem.orderItemSeqId, salesOrderItem)
}
}
}
-receivedItems = null;
+receivedItems = null
if (purchaseOrder) {
- receivedItems = from("ShipmentReceiptAndItem").where("orderId", purchaseOrderId, "facilityId", facilityId).queryList();
- context.receivedItems = receivedItems;
+ receivedItems = from("ShipmentReceiptAndItem").where("orderId", purchaseOrderId, "facilityId", facilityId).queryList()
+ context.receivedItems = receivedItems
}
-invalidProductId = null;
+invalidProductId = null
if (productId && !product) {
- invalidProductId = "No product found with product ID: [" + productId + "]";
- context.invalidProductId = invalidProductId;
+ invalidProductId = "No product found with product ID: [" + productId + "]"
+ context.invalidProductId = invalidProductId
}
// reject reasons
-rejectReasons = from("RejectionReason").queryList();
+rejectReasons = from("RejectionReason").queryList()
// inv item types
-inventoryItemTypes = from("InventoryItemType").queryList();
+inventoryItemTypes = from("InventoryItemType").queryList()
// facilities
-facilities = from("Facility").queryList();
+facilities = from("Facility").queryList()
// default per unit cost for both shipment or individual product
-standardCosts = [:];
+standardCosts = [:]
if (ownerAcctgPref) {
// get the unit cost of the products in a shipment
if (purchaseOrderItems) {
purchaseOrderItems.each { orderItem ->
- productId = orderItem.productId;
+ productId = orderItem.productId
if (productId) {
result = runService('getProductCost', [productId : productId, currencyUomId : ownerAcctgPref.baseCurrencyUomId,
- costComponentTypePrefix : 'EST_STD', userLogin : request.getAttribute("userLogin")]);
+ costComponentTypePrefix : 'EST_STD', userLogin : request.getAttribute("userLogin")])
if (!ServiceUtil.isError(result)) {
- standardCosts.put(productId, result.productCost);
+ standardCosts.put(productId, result.productCost)
}
}
}
@@ -238,24 +238,24 @@ if (ownerAcctgPref) {
// get the unit cost of a single product
if (productId) {
result = runService('getProductCost', [productId : productId, currencyUomId : ownerAcctgPref.baseCurrencyUomId,
- costComponentTypePrefix : 'EST_STD', userLogin : request.getAttribute("userLogin")]);
+ costComponentTypePrefix : 'EST_STD', userLogin : request.getAttribute("userLogin")])
if (!ServiceUtil.isError(result)) {
- standardCosts.put(productId, result.productCost);
+ standardCosts.put(productId, result.productCost)
}
}
}
-context.facilityId = facilityId;
-context.facility = facility;
-context.purchaseOrder = purchaseOrder;
-context.product = product;
-context.shipments = shipments;
-context.shipment = shipment;
-context.shippedQuantities = shippedQuantities;
-context.purchaseOrderItems = purchaseOrderItems;
-context.receivedQuantities = receivedQuantities;
-context.salesOrderItems = salesOrderItems;
-context.rejectReasons = rejectReasons;
-context.inventoryItemTypes = inventoryItemTypes;
-context.facilities = facilities;
-context.standardCosts = standardCosts;
+context.facilityId = facilityId
+context.facility = facility
+context.purchaseOrder = purchaseOrder
+context.product = product
+context.shipments = shipments
+context.shipment = shipment
+context.shippedQuantities = shippedQuantities
+context.purchaseOrderItems = purchaseOrderItems
+context.receivedQuantities = receivedQuantities
+context.salesOrderItems = salesOrderItems
+context.rejectReasons = rejectReasons
+context.inventoryItemTypes = inventoryItemTypes
+context.facilities = facilities
+context.standardCosts = standardCosts
diff --git a/applications/product/groovyScripts/facility/inventory/TransferInventoryItem.groovy b/applications/product/groovyScripts/facility/inventory/TransferInventoryItem.groovy
index 3aba0a942f..ef154d0d8a 100644
--- a/applications/product/groovyScripts/facility/inventory/TransferInventoryItem.groovy
+++ b/applications/product/groovyScripts/facility/inventory/TransferInventoryItem.groovy
@@ -20,80 +20,80 @@
import org.apache.ofbiz.entity.condition.*
import org.apache.ofbiz.entity.util.*
-facilityId = request.getParameter("facilityId");
+facilityId = request.getParameter("facilityId")
-inventoryTransferId = request.getParameter("inventoryTransferId");
-context.inventoryTransferId = inventoryTransferId;
+inventoryTransferId = request.getParameter("inventoryTransferId")
+context.inventoryTransferId = inventoryTransferId
-inventoryItemId = request.getParameter("inventoryItemId");
-inventoryTransfer = null;
+inventoryItemId = request.getParameter("inventoryItemId")
+inventoryTransfer = null
if (inventoryTransferId) {
- inventoryTransfer = from("InventoryTransfer").where("inventoryTransferId", inventoryTransferId).queryOne();
+ inventoryTransfer = from("InventoryTransfer").where("inventoryTransferId", inventoryTransferId).queryOne()
if (inventoryTransfer) {
- context.inventoryTransfer = inventoryTransfer;
+ context.inventoryTransfer = inventoryTransfer
if (!facilityId) {
- facilityId = inventoryTransfer.facilityId;
- parameters.facilityId = facilityId;
+ facilityId = inventoryTransfer.facilityId
+ parameters.facilityId = facilityId
}
if (!inventoryItemId) {
- inventoryItemId = inventoryTransfer.inventoryItemId;
+ inventoryItemId = inventoryTransfer.inventoryItemId
}
}
}
-facility = from("Facility").where("facilityId", facilityId).queryOne();
-context.facilityId = facilityId;
-context.facility = facility;
-context.inventoryItemId = inventoryItemId;
+facility = from("Facility").where("facilityId", facilityId).queryOne()
+context.facilityId = facilityId
+context.facility = facility
+context.inventoryItemId = inventoryItemId
if (facilityId) {
- facility = from("Facility").where("facilityId", facilityId).queryOne();
+ facility = from("Facility").where("facilityId", facilityId).queryOne()
}
-String illegalInventoryItem = null;
+String illegalInventoryItem = null
if (inventoryItemId) {
- inventoryItem = from("InventoryItem").where("inventoryItemId", inventoryItemId).queryOne();
+ inventoryItem = from("InventoryItem").where("inventoryItemId", inventoryItemId).queryOne()
if (facilityId && inventoryItem && inventoryItem.facilityId && !inventoryItem.facilityId.equals(facilityId)) {
- illegalInventoryItem = "Inventory item not found for this facility.";
- inventoryItem = null;
+ illegalInventoryItem = "Inventory item not found for this facility."
+ inventoryItem = null
}
if (inventoryItem) {
- context.inventoryItem = inventoryItem;
- inventoryItemType = inventoryItem.getRelatedOne("InventoryItemType", false);
+ context.inventoryItem = inventoryItem
+ inventoryItemType = inventoryItem.getRelatedOne("InventoryItemType", false)
if (inventoryItemType) {
- context.inventoryItemType = inventoryItemType;
+ context.inventoryItemType = inventoryItemType
}
if (inventoryItem.statusId) {
- inventoryStatus = inventoryItem.getRelatedOne("StatusItem", false);
+ inventoryStatus = inventoryItem.getRelatedOne("StatusItem", false)
if (inventoryStatus) {
- context.inventoryStatus = inventoryStatus;
+ context.inventoryStatus = inventoryStatus
}
}
}
}
// facilities
-context.facilities = from("Facility").queryList();
+context.facilities = from("Facility").queryList()
// status items
if (inventoryTransfer && inventoryTransfer.statusId) {
- statusChange = from("StatusValidChange").where("statusId", inventoryTransfer.statusId).queryList();
+ statusChange = from("StatusValidChange").where("statusId", inventoryTransfer.statusId).queryList()
if (statusChange) {
- statusItems = [] as ArrayList;
+ statusItems = [] as ArrayList
statusChange.each { curStatusChange ->
- curStatusItem = from("StatusItem").where("statusId", curStatusChange.statusIdTo).queryOne();
+ curStatusItem = from("StatusItem").where("statusId", curStatusChange.statusIdTo).queryOne()
if (curStatusItem) {
- statusItems.add(curStatusItem);
+ statusItems.add(curStatusItem)
}
}
- statusItem = EntityUtil.orderBy(statusItems, ['sequenceId']);
- context.statusItems = statusItems;
+ statusItem = EntityUtil.orderBy(statusItems, ['sequenceId'])
+ context.statusItems = statusItems
}
} else {
- statusItems = from("StatusItem").where("statusTypeId", "INVENTORY_XFER_STTS").orderBy("sequenceId").queryList();
+ statusItems = from("StatusItem").where("statusTypeId", "INVENTORY_XFER_STTS").orderBy("sequenceId").queryList()
if (statusItems) {
- context.statusItems = statusItems;
+ context.statusItems = statusItems
}
}
diff --git a/applications/product/groovyScripts/facility/returns/ReceiveReturn.groovy b/applications/product/groovyScripts/facility/returns/ReceiveReturn.groovy
index 9147eee61f..23a0bdf5c0 100644
--- a/applications/product/groovyScripts/facility/returns/ReceiveReturn.groovy
+++ b/applications/product/groovyScripts/facility/returns/ReceiveReturn.groovy
@@ -17,73 +17,73 @@
* under the License.
*/
-import org.apache.ofbiz.entity.*;
-import org.apache.ofbiz.entity.condition.EntityCondition;
-import org.apache.ofbiz.entity.util.*;
-import org.apache.ofbiz.base.util.*;
+import org.apache.ofbiz.entity.*
+import org.apache.ofbiz.entity.condition.EntityCondition
+import org.apache.ofbiz.entity.util.*
+import org.apache.ofbiz.base.util.*
-facilityId = request.getParameter("facilityId");
-returnId = request.getParameter("returnId");
+facilityId = request.getParameter("facilityId")
+returnId = request.getParameter("returnId")
-facility = null;
+facility = null
if (facilityId) {
- facility = from("Facility").where("facilityId", facilityId).queryOne();
+ facility = from("Facility").where("facilityId", facilityId).queryOne()
}
-returnHeader = null;
-returnItems = null;
+returnHeader = null
+returnItems = null
if (returnId) {
- returnHeader = from("ReturnHeader").where("returnId", returnId).queryOne();
+ returnHeader = from("ReturnHeader").where("returnId", returnId).queryOne()
if (returnHeader) {
if ("RETURN_ACCEPTED".equals(returnHeader.statusId)) {
- returnItems = returnHeader.getRelated("ReturnItem", null, null, false);
+ returnItems = returnHeader.getRelated("ReturnItem", null, null, false)
} else if ("RETURN_REQUESTED".equals(returnHeader.statusId)) {
- uiLabelMap = UtilProperties.getResourceBundleMap("ProductErrorUiLabels", locale);
- ProductReturnRequestedOK = uiLabelMap.ProductReturnRequestedOK;
- request.setAttribute("_EVENT_MESSAGE_", ProductReturnRequestedOK + " (#" + returnId.toString() + ")" );
+ uiLabelMap = UtilProperties.getResourceBundleMap("ProductErrorUiLabels", locale)
+ ProductReturnRequestedOK = uiLabelMap.ProductReturnRequestedOK
+ request.setAttribute("_EVENT_MESSAGE_", ProductReturnRequestedOK + " (#" + returnId.toString() + ")" )
} else if ("RETURN_RECEIVED".equals(!returnHeader.statusId)) {
- uiLabelMap = UtilProperties.getResourceBundleMap("ProductErrorUiLabels", locale);
- ProductReturnNotYetAcceptedOrAlreadyReceived = uiLabelMap.ProductReturnNotYetAcceptedOrAlreadyReceived;
- request.setAttribute("_ERROR_MESSAGE_", ProductReturnNotYetAcceptedOrAlreadyReceived + " (#" + returnId.toString() + ")" );
+ uiLabelMap = UtilProperties.getResourceBundleMap("ProductErrorUiLabels", locale)
+ ProductReturnNotYetAcceptedOrAlreadyReceived = uiLabelMap.ProductReturnNotYetAcceptedOrAlreadyReceived
+ request.setAttribute("_ERROR_MESSAGE_", ProductReturnNotYetAcceptedOrAlreadyReceived + " (#" + returnId.toString() + ")" )
}
}
}
-receivedQuantities = [:];
+receivedQuantities = [:]
if (returnItems) {
- context.firstOrderItem = EntityUtil.getFirst(returnItems);
- context.returnItemsSize = returnItems.size();
+ context.firstOrderItem = EntityUtil.getFirst(returnItems)
+ context.returnItemsSize = returnItems.size()
returnItems.each { thisItem ->
- totalReceived = 0.0;
- receipts = thisItem.getRelated("ShipmentReceipt", null, null, false);
+ totalReceived = 0.0
+ receipts = thisItem.getRelated("ShipmentReceipt", null, null, false)
if (receipts) {
receipts.each { rec ->
- accepted = rec.getDouble("quantityAccepted");
- rejected = rec.getDouble("quantityRejected");
+ accepted = rec.getDouble("quantityAccepted")
+ rejected = rec.getDouble("quantityRejected")
if (accepted)
- totalReceived += accepted.doubleValue();
+ totalReceived += accepted.doubleValue()
if (rejected)
- totalReceived += rejected.doubleValue();
+ totalReceived += rejected.doubleValue()
}
}
- receivedQuantities[thisItem.returnItemSeqId] = new Double(totalReceived);
+ receivedQuantities[thisItem.returnItemSeqId] = new Double(totalReceived)
}
}
if (returnHeader) {
- context.receivedItems = from("ShipmentReceiptAndItem").where("returnId", returnId).queryList();
+ context.receivedItems = from("ShipmentReceiptAndItem").where("returnId", returnId).queryList()
}
// facilities
-facilities = from("Facility").queryList();
+facilities = from("Facility").queryList()
//all possible inventory item types
-inventoryItemTypes = from("InventoryItemType").orderBy("description").cache(true).queryList();
+inventoryItemTypes = from("InventoryItemType").orderBy("description").cache(true).queryList()
-context.facilityId = facilityId;
-context.facility = facility;
-context.returnHeader = returnHeader;
-context.returnItems = returnItems;
-context.receivedQuantities = receivedQuantities;
-context.facilities = facilities;
-context.inventoryItemTypes = inventoryItemTypes;
+context.facilityId = facilityId
+context.facility = facility
+context.returnHeader = returnHeader
+context.returnItems = returnItems
+context.receivedQuantities = receivedQuantities
+context.facilities = facilities
+context.inventoryItemTypes = inventoryItemTypes
diff --git a/applications/product/groovyScripts/facility/shipment/AddItemsFromInventory.groovy b/applications/product/groovyScripts/facility/shipment/AddItemsFromInventory.groovy
index 4c1ac48127..aeb24bc241 100644
--- a/applications/product/groovyScripts/facility/shipment/AddItemsFromInventory.groovy
+++ b/applications/product/groovyScripts/facility/shipment/AddItemsFromInventory.groovy
@@ -17,33 +17,33 @@
* under the License.
*/
-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.entity.util.EntityUtil
+import org.apache.ofbiz.entity.condition.EntityCondition
+import org.apache.ofbiz.entity.condition.EntityOperator
-shipmentId = parameters.shipmentId;
-items = [];
-shipment = from("Shipment").where("shipmentId", shipmentId).queryOne();
-partyId = shipment.partyIdTo;
-shipmentItems = shipment.getRelated("ShipmentItem", null, null, false);
+shipmentId = parameters.shipmentId
+items = []
+shipment = from("Shipment").where("shipmentId", shipmentId).queryOne()
+partyId = shipment.partyIdTo
+shipmentItems = shipment.getRelated("ShipmentItem", null, null, false)
shipmentItems.each { shipmentItem ->
- productId = shipmentItem.productId;
- internalName = shipmentItem.getRelated("Product", null, null, false).internalName;
+ productId = shipmentItem.productId
+ internalName = shipmentItem.getRelated("Product", null, null, false).internalName
EntityCondition cond = EntityCondition.makeCondition([EntityCondition.makeCondition("returnId", shipment.primaryReturnId),
- EntityCondition.makeCondition("productId", productId)], EntityOperator.AND);
- returnItem = from("ReturnItem").where("returnId", shipment.primaryReturnId, "productId", productId).cache(true).queryFirst();
- returnQuantity = Double.valueOf(returnItem.returnQuantity);
+ EntityCondition.makeCondition("productId", productId)], EntityOperator.AND)
+ returnItem = from("ReturnItem").where("returnId", shipment.primaryReturnId, "productId", productId).cache(true).queryFirst()
+ returnQuantity = Double.valueOf(returnItem.returnQuantity)
- shipmentItemQty = Double.valueOf(shipmentItem.quantity);
- itemIssuances = shipmentItem.getRelated("ItemIssuance", [shipmentId : shipmentId, shipmentItemSeqId : shipmentItem.shipmentItemSeqId], ["inventoryItemId"], false);
- totalQtyIssued = 0;
- issuedItems = [];
+ shipmentItemQty = Double.valueOf(shipmentItem.quantity)
+ itemIssuances = shipmentItem.getRelated("ItemIssuance", [shipmentId : shipmentId, shipmentItemSeqId : shipmentItem.shipmentItemSeqId], ["inventoryItemId"], false)
+ totalQtyIssued = 0
+ issuedItems = []
itemIssuances.each { itemIssuance ->
- totalQtyIssued = totalQtyIssued + Double.valueOf(itemIssuance.quantity);
+ totalQtyIssued = totalQtyIssued + Double.valueOf(itemIssuance.quantity)
issuedItems.add([inventoryItemId : itemIssuance.inventoryItemId,
- quantity : itemIssuance.quantity]);
+ quantity : itemIssuance.quantity])
}
- qtyStillNeedToBeIssued = returnQuantity - totalQtyIssued;
+ qtyStillNeedToBeIssued = returnQuantity - totalQtyIssued
items.add([shipmentId : shipmentId,
shipmentItemSeqId : shipmentItem.shipmentItemSeqId,
returnId : returnItem.returnId,
@@ -57,7 +57,7 @@ shipmentItems.each { shipmentItem ->
totalQtyIssued : totalQtyIssued,
issuedItems : issuedItems,
qtyStillNeedToBeIssued : qtyStillNeedToBeIssued,
- ]);
+ ])
}
-context.shipmentId = shipmentId;
-context.items = items;
+context.shipmentId = shipmentId
+context.items = items
diff --git a/applications/product/groovyScripts/facility/shipment/AddItemsFromOrder.groovy b/applications/product/groovyScripts/facility/shipment/AddItemsFromOrder.groovy
index 1e29f354cb..2a29c72de9 100644
--- a/applications/product/groovyScripts/facility/shipment/AddItemsFromOrder.groovy
+++ b/applications/product/groovyScripts/facility/shipment/AddItemsFromOrder.groovy
@@ -19,195 +19,195 @@
import org.apache.ofbiz.entity.*
import org.apache.ofbiz.entity.util.*
-import org.apache.ofbiz.entity.condition.EntityCondition;
+import org.apache.ofbiz.entity.condition.EntityCondition
-shipmentId = request.getParameter("shipmentId");
-orderId = request.getParameter("orderId");
-shipGroupSeqId = request.getParameter("shipGroupSeqId");
-selectFromShipmentPlan = request.getParameter("selectFromShipmentPlan");
+shipmentId = request.getParameter("shipmentId")
+orderId = request.getParameter("orderId")
+shipGroupSeqId = request.getParameter("shipGroupSeqId")
+selectFromShipmentPlan = request.getParameter("selectFromShipmentPlan")
-shipment = from("Shipment").where("shipmentId", shipmentId).queryOne();
+shipment = from("Shipment").where("shipmentId", shipmentId).queryOne()
if (shipment) {
- context.originFacility = shipment.getRelatedOne("OriginFacility", false);
- context.destinationFacility = shipment.getRelatedOne("DestinationFacility", false);
+ context.originFacility = shipment.getRelatedOne("OriginFacility", false)
+ context.destinationFacility = shipment.getRelatedOne("DestinationFacility", false)
}
if (!orderId && shipment && !selectFromShipmentPlan) {
- orderId = shipment.primaryOrderId;
+ orderId = shipment.primaryOrderId
}
if (!shipGroupSeqId && shipment) {
- shipGroupSeqId = shipment.primaryShipGroupSeqId;
+ shipGroupSeqId = shipment.primaryShipGroupSeqId
}
if (orderId && shipment) {
- orderHeader = from("OrderHeader").where("orderId", orderId).queryOne();
- context.orderHeader = orderHeader;
+ orderHeader = from("OrderHeader").where("orderId", orderId).queryOne()
+ context.orderHeader = orderHeader
if (orderHeader) {
- context.orderHeaderStatus = orderHeader.getRelatedOne("StatusItem", false);
- context.orderType = orderHeader.getRelatedOne("OrderType", false);
+ context.orderHeaderStatus = orderHeader.getRelatedOne("StatusItem", false)
+ context.orderType = orderHeader.getRelatedOne("OrderType", false)
- isSalesOrder = "SALES_ORDER".equals(orderHeader.orderTypeId);
- context.isSalesOrder = isSalesOrder;
+ isSalesOrder = "SALES_ORDER".equals(orderHeader.orderTypeId)
+ context.isSalesOrder = isSalesOrder
- orderItemShipGroup = null;
+ orderItemShipGroup = null
if (shipGroupSeqId) {
- orderItemShipGroup = from("OrderItemShipGroup").where("orderId", orderId, "shipGroupSeqId", shipGroupSeqId).queryOne();
- context.orderItemShipGroup = orderItemShipGroup;
+ orderItemShipGroup = from("OrderItemShipGroup").where("orderId", orderId, "shipGroupSeqId", shipGroupSeqId).queryOne()
+ context.orderItemShipGroup = orderItemShipGroup
}
- oiasgaLimitMap = null;
+ oiasgaLimitMap = null
if (orderItemShipGroup) {
- oiasgaLimitMap = [shipGroupSeqId : shipGroupSeqId];
+ oiasgaLimitMap = [shipGroupSeqId : shipGroupSeqId]
}
- orderItems = orderHeader.getRelated("OrderItemAndShipGroupAssoc", oiasgaLimitMap, ['shipGroupSeqId', 'orderItemSeqId'], false);
- orderItemDatas = [] as LinkedList;
+ orderItems = orderHeader.getRelated("OrderItemAndShipGroupAssoc", oiasgaLimitMap, ['shipGroupSeqId', 'orderItemSeqId'], false)
+ orderItemDatas = [] as LinkedList
orderItems.each { orderItemAndShipGroupAssoc ->
- orderItemData = [:];
- product = orderItemAndShipGroupAssoc.getRelatedOne("Product", false);
+ orderItemData = [:]
+ product = orderItemAndShipGroupAssoc.getRelatedOne("Product", false)
- itemIssuances = orderItemAndShipGroupAssoc.getRelated("ItemIssuance", null, null, false);
- totalQuantityIssued = 0;
+ itemIssuances = orderItemAndShipGroupAssoc.getRelated("ItemIssuance", null, null, false)
+ totalQuantityIssued = 0
itemIssuances.each { itemIssuance ->
if (itemIssuance.quantity) {
- totalQuantityIssued += itemIssuance.getDouble("quantity");
+ totalQuantityIssued += itemIssuance.getDouble("quantity")
}
if (itemIssuance.cancelQuantity) {
- totalQuantityIssued -= itemIssuance.getDouble("cancelQuantity");
+ totalQuantityIssued -= itemIssuance.getDouble("cancelQuantity")
}
}
if (isSalesOrder) {
- oisgirLimitMap = null;
+ oisgirLimitMap = null
if (orderItemShipGroup) {
- oisgirLimitMap = [shipGroupSeqId : shipGroupSeqId];
+ oisgirLimitMap = [shipGroupSeqId : shipGroupSeqId]
}
- orderItemShipGrpInvResList = orderItemAndShipGroupAssoc.getRelated("OrderItemShipGrpInvRes", oisgirLimitMap, ['reservedDatetime'], false);
- orderItemShipGrpInvResDatas = [] as LinkedList;
- totalQuantityReserved = 0;
+ orderItemShipGrpInvResList = orderItemAndShipGroupAssoc.getRelated("OrderItemShipGrpInvRes", oisgirLimitMap, ['reservedDatetime'], false)
+ orderItemShipGrpInvResDatas = [] as LinkedList
+ totalQuantityReserved = 0
orderItemShipGrpInvResList.each { orderItemShipGrpInvRes ->
- inventoryItem = orderItemShipGrpInvRes.getRelatedOne("InventoryItem", false);
- orderItemShipGrpInvResData = [:];
- orderItemShipGrpInvResData.orderItemShipGrpInvRes = orderItemShipGrpInvRes;
- orderItemShipGrpInvResData.inventoryItem = inventoryItem;
- orderItemShipGrpInvResData.inventoryItemFacility = inventoryItem.getRelatedOne("Facility", false);
- orderItemShipGrpInvResDatas.add(orderItemShipGrpInvResData);
+ inventoryItem = orderItemShipGrpInvRes.getRelatedOne("InventoryItem", false)
+ orderItemShipGrpInvResData = [:]
+ orderItemShipGrpInvResData.orderItemShipGrpInvRes = orderItemShipGrpInvRes
+ orderItemShipGrpInvResData.inventoryItem = inventoryItem
+ orderItemShipGrpInvResData.inventoryItemFacility = inventoryItem.getRelatedOne("Facility", false)
+ orderItemShipGrpInvResDatas.add(orderItemShipGrpInvResData)
if (orderItemShipGrpInvRes.quantity) {
- totalQuantityReserved += orderItemShipGrpInvRes.getDouble("quantity");
+ totalQuantityReserved += orderItemShipGrpInvRes.getDouble("quantity")
}
}
- orderItemData.orderItemShipGrpInvResDatas = orderItemShipGrpInvResDatas;
- orderItemData.totalQuantityReserved = totalQuantityReserved;
- orderItemData.totalQuantityIssuedAndReserved = totalQuantityReserved + totalQuantityIssued;
+ orderItemData.orderItemShipGrpInvResDatas = orderItemShipGrpInvResDatas
+ orderItemData.totalQuantityReserved = totalQuantityReserved
+ orderItemData.totalQuantityIssuedAndReserved = totalQuantityReserved + totalQuantityIssued
}
- orderItemData.orderItemAndShipGroupAssoc = orderItemAndShipGroupAssoc;
- orderItemData.product = product;
- orderItemData.itemIssuances = itemIssuances;
- orderItemData.totalQuantityIssued = totalQuantityIssued;
- orderItemDatas.add(orderItemData);
+ orderItemData.orderItemAndShipGroupAssoc = orderItemAndShipGroupAssoc
+ orderItemData.product = product
+ orderItemData.itemIssuances = itemIssuances
+ orderItemData.totalQuantityIssued = totalQuantityIssued
+ orderItemDatas.add(orderItemData)
}
- context.orderItemDatas = orderItemDatas;
+ context.orderItemDatas = orderItemDatas
}
}
if (shipment && selectFromShipmentPlan) {
- shipmentPlans = from("OrderShipment").where("shipmentId", shipment.shipmentId).orderBy("orderId", "orderItemSeqId").queryList();
- orderItemDatas = [] as LinkedList;
+ shipmentPlans = from("OrderShipment").where("shipmentId", shipment.shipmentId).orderBy("orderId", "orderItemSeqId").queryList()
+ orderItemDatas = [] as LinkedList
- context.isSalesOrder = true;
+ context.isSalesOrder = true
shipmentPlans.each { shipmentPlan ->
- orderItemData = [:];
- orderItem = shipmentPlan.getRelatedOne("OrderItem", false);
+ orderItemData = [:]
+ orderItem = shipmentPlan.getRelatedOne("OrderItem", false)
- orderItemShipGroup = null;
+ orderItemShipGroup = null
if (shipGroupSeqId) {
- orderItemShipGroup = from("OrderItemShipGroup").where("orderId", orderItem.orderId, "shipGroupSeqId", shipGroupSeqId).queryOne();
- context.orderItemShipGroup = orderItemShipGroup;
+ orderItemShipGroup = from("OrderItemShipGroup").where("orderId", orderItem.orderId, "shipGroupSeqId", shipGroupSeqId).queryOne()
+ context.orderItemShipGroup = orderItemShipGroup
}
- oiasgaLimitMap = null;
+ oiasgaLimitMap = null
if (orderItemShipGroup) {
- oiasgaLimitMap = [shipGroupSeqId : shipGroupSeqId];
+ oiasgaLimitMap = [shipGroupSeqId : shipGroupSeqId]
}
- orderItemShipGroupAssoc = null;
- orderItemShipGroupAssocs = orderItem.getRelated("OrderItemShipGroupAssoc", oiasgaLimitMap, null, false);
+ orderItemShipGroupAssoc = null
+ orderItemShipGroupAssocs = orderItem.getRelated("OrderItemShipGroupAssoc", oiasgaLimitMap, null, false)
if (orderItemShipGroupAssocs) {
- orderItemShipGroupAssoc = EntityUtil.getFirst(orderItemShipGroupAssocs);
+ orderItemShipGroupAssoc = EntityUtil.getFirst(orderItemShipGroupAssocs)
}
- plannedQuantity = shipmentPlan.getDouble("quantity");
- totalProposedQuantity = 0.0;
+ plannedQuantity = shipmentPlan.getDouble("quantity")
+ totalProposedQuantity = 0.0
- product = orderItem.getRelatedOne("Product", false);
+ product = orderItem.getRelatedOne("Product", false)
- itemIssuances = orderItem.getRelated("ItemIssuance", null, null, false);
- totalQuantityIssued = 0;
- totalQuantityIssuedInShipment = 0;
+ itemIssuances = orderItem.getRelated("ItemIssuance", null, null, false)
+ totalQuantityIssued = 0
+ totalQuantityIssuedInShipment = 0
itemIssuances.each { itemIssuance ->
if (itemIssuance.quantity) {
- totalQuantityIssued += itemIssuance.getDouble("quantity");
+ totalQuantityIssued += itemIssuance.getDouble("quantity")
}
if (itemIssuance.cancelQuantity) {
- totalQuantityIssued -= itemIssuance.getDouble("cancelQuantity");
+ totalQuantityIssued -= itemIssuance.getDouble("cancelQuantity")
}
if (itemIssuance.shipmentId && itemIssuance.shipmentId.equals(shipmentId)) {
- totalQuantityIssuedInShipment += itemIssuance.getDouble("quantity");
+ totalQuantityIssuedInShipment += itemIssuance.getDouble("quantity")
if (itemIssuance.cancelQuantity) {
- totalQuantityIssuedInShipment -= itemIssuance.getDouble("cancelQuantity");
+ totalQuantityIssuedInShipment -= itemIssuance.getDouble("cancelQuantity")
}
}
}
- orderItemShipGrpInvResList = orderItem.getRelated("OrderItemShipGrpInvRes", null, ['reservedDatetime'], false);
- orderItemShipGrpInvResDatas = [] as LinkedList;
- totalQuantityReserved = 0;
+ orderItemShipGrpInvResList = orderItem.getRelated("OrderItemShipGrpInvRes", null, ['reservedDatetime'], false)
+ orderItemShipGrpInvResDatas = [] as LinkedList
+ totalQuantityReserved = 0
orderItemShipGrpInvResList.each { orderItemShipGrpInvRes ->
- inventoryItem = orderItemShipGrpInvRes.getRelatedOne("InventoryItem", false);
- orderItemShipGrpInvResData = [:];
- orderItemShipGrpInvResData.orderItemShipGrpInvRes = orderItemShipGrpInvRes;
- orderItemShipGrpInvResData.inventoryItem = inventoryItem;
- orderItemShipGrpInvResData.inventoryItemFacility = inventoryItem.getRelatedOne("Facility", false);
- orderItemShipGrpInvResDatas.add(orderItemShipGrpInvResData);
+ inventoryItem = orderItemShipGrpInvRes.getRelatedOne("InventoryItem", false)
+ orderItemShipGrpInvResData = [:]
+ orderItemShipGrpInvResData.orderItemShipGrpInvRes = orderItemShipGrpInvRes
+ orderItemShipGrpInvResData.inventoryItem = inventoryItem
+ orderItemShipGrpInvResData.inventoryItemFacility = inventoryItem.getRelatedOne("Facility", false)
+ orderItemShipGrpInvResDatas.add(orderItemShipGrpInvResData)
- reservedQuantity = 0.0;
- quantityNotAvailable = 0.0;
- proposedQuantity = 0.0;
+ reservedQuantity = 0.0
+ quantityNotAvailable = 0.0
+ proposedQuantity = 0.0
if (orderItemShipGrpInvRes.quantity) {
- reservedQuantity = orderItemShipGrpInvRes.getDouble("quantity");
- totalQuantityReserved += reservedQuantity;
+ reservedQuantity = orderItemShipGrpInvRes.getDouble("quantity")
+ totalQuantityReserved += reservedQuantity
}
if (orderItemShipGrpInvRes.quantityNotAvailable) {
- quantityNotAvailable = orderItemShipGrpInvRes.getDouble("quantityNotAvailable");
+ quantityNotAvailable = orderItemShipGrpInvRes.getDouble("quantityNotAvailable")
}
- proposedQuantity = reservedQuantity - quantityNotAvailable;
+ proposedQuantity = reservedQuantity - quantityNotAvailable
if (plannedQuantity - totalProposedQuantity < proposedQuantity) {
- proposedQuantity = plannedQuantity - totalProposedQuantity;
+ proposedQuantity = plannedQuantity - totalProposedQuantity
}
if (proposedQuantity < 0) {
- proposedQuantity = 0.0;
+ proposedQuantity = 0.0
}
- totalProposedQuantity += proposedQuantity;
- orderItemShipGrpInvResData.shipmentPlanQuantity = proposedQuantity;
+ totalProposedQuantity += proposedQuantity
+ orderItemShipGrpInvResData.shipmentPlanQuantity = proposedQuantity
}
- orderItemShipGroupAssocMap = new HashMap(orderItemShipGroupAssoc);
- orderItemShipGroupAssocMap.quantity = orderItemShipGroupAssoc.getDouble("quantity");
- orderItemData.orderItemAndShipGroupAssoc = orderItemShipGroupAssocMap;
- orderItemData.orderItemShipGrpInvResDatas = orderItemShipGrpInvResDatas;
- orderItemData.totalQuantityReserved = totalQuantityReserved;
- orderItemData.totalQuantityIssuedAndReserved = totalQuantityReserved + totalQuantityIssued;
- orderItemData.orderItem = orderItem;
- orderItemData.product = product;
- orderItemData.itemIssuances = itemIssuances;
- orderItemData.totalQuantityIssued = totalQuantityIssued;
- orderItemDatas.add(orderItemData);
+ orderItemShipGroupAssocMap = new HashMap(orderItemShipGroupAssoc)
+ orderItemShipGroupAssocMap.quantity = orderItemShipGroupAssoc.getDouble("quantity")
+ orderItemData.orderItemAndShipGroupAssoc = orderItemShipGroupAssocMap
+ orderItemData.orderItemShipGrpInvResDatas = orderItemShipGrpInvResDatas
+ orderItemData.totalQuantityReserved = totalQuantityReserved
+ orderItemData.totalQuantityIssuedAndReserved = totalQuantityReserved + totalQuantityIssued
+ orderItemData.orderItem = orderItem
+ orderItemData.product = product
+ orderItemData.itemIssuances = itemIssuances
+ orderItemData.totalQuantityIssued = totalQuantityIssued
+ orderItemDatas.add(orderItemData)
}
- context.orderItemDatas = orderItemDatas;
+ context.orderItemDatas = orderItemDatas
}
-context.shipmentId = shipmentId;
-context.shipment = shipment;
-context.orderId = orderId;
-context.shipGroupSeqId = shipGroupSeqId;
+context.shipmentId = shipmentId
+context.shipment = shipment
+context.orderId = orderId
+context.shipGroupSeqId = shipGroupSeqId
diff --git a/applications/product/groovyScripts/facility/shipment/EditShipment.groovy b/applications/product/groovyScripts/facility/shipment/EditShipment.groovy
index eea96682d5..6bda4b64b8 100644
--- a/applications/product/groovyScripts/facility/shipment/EditShipment.groovy
+++ b/applications/product/groovyScripts/facility/shipment/EditShipment.groovy
@@ -19,42 +19,42 @@
import org.apache.ofbiz.entity.condition.*
-shipmentId = parameters.shipmentId;
-shipment = from("Shipment").where("shipmentId", shipmentId).queryOne();
+shipmentId = parameters.shipmentId
+shipment = from("Shipment").where("shipmentId", shipmentId).queryOne()
// orderHeader is needed here to determine type of order and hence types of shipment status
if (!shipment) {
- primaryOrderId = request.getParameter("primaryOrderId");
+ primaryOrderId = request.getParameter("primaryOrderId")
} else {
- primaryOrderId = shipment.primaryOrderId;
+ primaryOrderId = shipment.primaryOrderId
}
-orderHeader = from("OrderHeader").where(orderId : primaryOrderId).queryOne();
+orderHeader = from("OrderHeader").where(orderId : primaryOrderId).queryOne()
// the kind of StatusItem to use is based on the type of order
-statusItemTypeId = "SHIPMENT_STATUS";
+statusItemTypeId = "SHIPMENT_STATUS"
if (orderHeader && "PURCHASE_ORDER".equals(orderHeader.orderTypeId)) {
- statusItemTypeId = "PURCH_SHIP_STATUS";
+ statusItemTypeId = "PURCH_SHIP_STATUS"
}
-context.statusItemTypeId = statusItemTypeId;
+context.statusItemTypeId = statusItemTypeId
-context.shipmentId = shipmentId;
-context.shipment = shipment;
+context.shipmentId = shipmentId
+context.shipment = shipment
if (shipment) {
- currentStatus = shipment.getRelatedOne("StatusItem", false);
- originPostalAddress = shipment.getRelatedOne("OriginPostalAddress", false);
- destinationPostalAddress = shipment.getRelatedOne("DestinationPostalAddress", false);
- originTelecomNumber = shipment.getRelatedOne("OriginTelecomNumber", false);
- destinationTelecomNumber = shipment.getRelatedOne("DestinationTelecomNumber", false);
+ currentStatus = shipment.getRelatedOne("StatusItem", false)
+ originPostalAddress = shipment.getRelatedOne("OriginPostalAddress", false)
+ destinationPostalAddress = shipment.getRelatedOne("DestinationPostalAddress", false)
+ originTelecomNumber = shipment.getRelatedOne("OriginTelecomNumber", false)
+ destinationTelecomNumber = shipment.getRelatedOne("DestinationTelecomNumber", false)
if (orderHeader) {
- context.productStoreId = orderHeader.productStoreId;
+ context.productStoreId = orderHeader.productStoreId
}
- context.currentStatus = currentStatus;
- context.originPostalAddress = originPostalAddress;
- context.destinationPostalAddress = destinationPostalAddress;
- context.originTelecomNumber = originTelecomNumber;
- context.destinationTelecomNumber = destinationTelecomNumber;
+ context.currentStatus = currentStatus
+ context.originPostalAddress = originPostalAddress
+ context.destinationPostalAddress = destinationPostalAddress
+ context.originTelecomNumber = originTelecomNumber
+ context.destinationTelecomNumber = destinationTelecomNumber
}
diff --git a/applications/product/groovyScripts/facility/shipment/EditShipmentItems.groovy b/applications/product/groovyScripts/facility/shipment/EditShipmentItems.groovy
index 17d37e0605..97e1a08d82 100644
--- a/applications/product/groovyScripts/facility/shipment/EditShipmentItems.groovy
+++ b/applications/product/groovyScripts/facility/shipment/EditShipmentItems.groovy
@@ -20,49 +20,49 @@
import org.apache.ofbiz.entity.*
import org.apache.ofbiz.base.util.*
-shipmentId = request.getParameter("shipmentId");
+shipmentId = request.getParameter("shipmentId")
if (!shipmentId) {
- shipmentId = context.shipmentId;
+ shipmentId = context.shipmentId
}
-shipment = null;
+shipment = null
if (shipmentId) {
- shipment = from("Shipment").where("shipmentId", shipmentId).queryOne();
+ shipment = from("Shipment").where("shipmentId", shipmentId).queryOne()
}
if (shipment) {
- shipmentItems = shipment.getRelated("ShipmentItem", null, ['shipmentItemSeqId'], false);
- shipmentItemDatas = [] as LinkedList;
+ shipmentItems = shipment.getRelated("ShipmentItem", null, ['shipmentItemSeqId'], false)
+ shipmentItemDatas = [] as LinkedList
if (shipmentItems) {
shipmentItems.each { shipmentItem ->
- shipmentPackageContents = shipmentItem.getRelated("ShipmentPackageContent", null, null, false);
- totalQuantityPackaged = 0;
+ shipmentPackageContents = shipmentItem.getRelated("ShipmentPackageContent", null, null, false)
+ totalQuantityPackaged = 0
shipmentPackageContents.each { shipmentPackageContent ->
if (shipmentPackageContent.quantity) {
- totalQuantityPackaged += shipmentPackageContent.getDouble("quantity");
+ totalQuantityPackaged += shipmentPackageContent.getDouble("quantity")
}
}
- totalQuantityToPackage = 0;
+ totalQuantityToPackage = 0
if (shipmentItem.quantity) {
- totalQuantityToPackage = shipmentItem.getDouble("quantity") - totalQuantityPackaged;
+ totalQuantityToPackage = shipmentItem.getDouble("quantity") - totalQuantityPackaged
}
- shipmentItemData = [:];
- shipmentItemData.shipmentItem = shipmentItem;
- shipmentItemData.shipmentPackageContents = shipmentPackageContents;
- shipmentItemData.itemIssuances = shipmentItem.getRelated("ItemIssuance", null, null, false);
- shipmentItemData.orderShipments = shipmentItem.getRelated("OrderShipment", null, null, false);
- shipmentItemData.product = shipmentItem.getRelatedOne("Product", false);
- shipmentItemData.totalQuantityPackaged = totalQuantityPackaged;
- shipmentItemData.totalQuantityToPackage = totalQuantityToPackage;
- shipmentItemDatas.add(shipmentItemData);
+ shipmentItemData = [:]
+ shipmentItemData.shipmentItem = shipmentItem
+ shipmentItemData.shipmentPackageContents = shipmentPackageContents
+ shipmentItemData.itemIssuances = shipmentItem.getRelated("ItemIssuance", null, null, false)
+ shipmentItemData.orderShipments = shipmentItem.getRelated("OrderShipment", null, null, false)
+ shipmentItemData.product = shipmentItem.getRelatedOne("Product", false)
+ shipmentItemData.totalQuantityPackaged = totalQuantityPackaged
+ shipmentItemData.totalQuantityToPackage = totalQuantityToPackage
+ shipmentItemDatas.add(shipmentItemData)
}
}
- shipmentPackages = shipment.getRelated("ShipmentPackage", null, ['shipmentPackageSeqId'], false);
+ shipmentPackages = shipment.getRelated("ShipmentPackage", null, ['shipmentPackageSeqId'], false)
- context.shipment = shipment;
- context.shipmentItemDatas = shipmentItemDatas;
- context.shipmentPackages = shipmentPackages;
+ context.shipment = shipment
+ context.shipmentItemDatas = shipmentItemDatas
+ context.shipmentPackages = shipmentPackages
}
-context.shipmentId = shipmentId;
+context.shipmentId = shipmentId
diff --git a/applications/product/groovyScripts/facility/shipment/EditShipmentPackages.groovy b/applications/product/groovyScripts/facility/shipment/EditShipmentPackages.groovy
index ac6900d73a..de23115926 100644
--- a/applications/product/groovyScripts/facility/shipment/EditShipmentPackages.groovy
+++ b/applications/product/groovyScripts/facility/shipment/EditShipmentPackages.groovy
@@ -19,40 +19,40 @@
import org.apache.ofbiz.entity.condition.*
-shipmentId = request.getParameter("shipmentId");
+shipmentId = request.getParameter("shipmentId")
if (!shipmentId) {
- shipmentId = context.shipmentId;
+ shipmentId = context.shipmentId
}
-shipment = null;
+shipment = null
if (shipmentId) {
- shipment = from("Shipment").where("shipmentId", shipmentId).queryOne();
+ shipment = from("Shipment").where("shipmentId", shipmentId).queryOne()
}
if (shipment) {
- shipmentPackages = shipment.getRelated("ShipmentPackage", null, ['shipmentPackageSeqId'], false);
- shipmentPackageDatas = [] as LinkedList;
+ shipmentPackages = shipment.getRelated("ShipmentPackage", null, ['shipmentPackageSeqId'], false)
+ shipmentPackageDatas = [] as LinkedList
if (shipmentPackages) {
shipmentPackages.each { shipmentPackage ->
- shipmentPackageData = [:];
- shipmentPackageData.shipmentPackage = shipmentPackage;
- shipmentPackageData.shipmentPackageContents = shipmentPackage.getRelated("ShipmentPackageContent", null, null, false);
- shipmentPackageData.shipmentPackageRouteSegs = shipmentPackage.getRelated("ShipmentPackageRouteSeg", null, null, false);
- shipmentPackageData.weightUom = shipmentPackage.getRelatedOne("WeightUom", false);
- shipmentPackageDatas.add(shipmentPackageData);
+ shipmentPackageData = [:]
+ shipmentPackageData.shipmentPackage = shipmentPackage
+ shipmentPackageData.shipmentPackageContents = shipmentPackage.getRelated("ShipmentPackageContent", null, null, false)
+ shipmentPackageData.shipmentPackageRouteSegs = shipmentPackage.getRelated("ShipmentPackageRouteSeg", null, null, false)
+ shipmentPackageData.weightUom = shipmentPackage.getRelatedOne("WeightUom", false)
+ shipmentPackageDatas.add(shipmentPackageData)
}
}
- shipmentItems = shipment.getRelated("ShipmentItem", null, ['shipmentItemSeqId'], false);
- shipmentRouteSegments = shipment.getRelated("ShipmentRouteSegment", null, ['shipmentRouteSegmentId'], false);
- weightUoms = from("Uom").where("uomTypeId", "WEIGHT_MEASURE").orderBy("description").queryList();
- boxTypes = from("ShipmentBoxType").queryList();
+ shipmentItems = shipment.getRelated("ShipmentItem", null, ['shipmentItemSeqId'], false)
+ shipmentRouteSegments = shipment.getRelated("ShipmentRouteSegment", null, ['shipmentRouteSegmentId'], false)
+ weightUoms = from("Uom").where("uomTypeId", "WEIGHT_MEASURE").orderBy("description").queryList()
+ boxTypes = from("ShipmentBoxType").queryList()
- context.shipment = shipment;
- context.shipmentPackageDatas = shipmentPackageDatas;
- context.shipmentItems = shipmentItems;
- context.shipmentRouteSegments = shipmentRouteSegments;
- context.weightUoms = weightUoms;
- context.boxTypes = boxTypes;
+ context.shipment = shipment
+ context.shipmentPackageDatas = shipmentPackageDatas
+ context.shipmentItems = shipmentItems
+ context.shipmentRouteSegments = shipmentRouteSegments
+ context.weightUoms = weightUoms
+ context.boxTypes = boxTypes
}
-context.shipmentId = shipmentId;
+context.shipmentId = shipmentId
diff --git a/applications/product/groovyScripts/facility/shipment/EditShipmentPlan.groovy b/applications/product/groovyScripts/facility/shipment/EditShipmentPlan.groovy
index d18f5a8865..28e0921836 100644
--- a/applications/product/groovyScripts/facility/shipment/EditShipmentPlan.groovy
+++ b/applications/product/groovyScripts/facility/shipment/EditShipmentPlan.groovy
@@ -17,149 +17,149 @@
* under the License.
*/
-import org.apache.ofbiz.entity.condition.EntityCondition;
+import org.apache.ofbiz.entity.condition.EntityCondition
-shipmentId = request.getParameter("shipmentId");
-orderId = request.getParameter("orderId");
-shipGroupSeqId = request.getParameter("shipGroupSeqId");
+shipmentId = request.getParameter("shipmentId")
+orderId = request.getParameter("orderId")
+shipGroupSeqId = request.getParameter("shipGroupSeqId")
if (!shipmentId) {
- shipmentId = context.shipmentId;
+ shipmentId = context.shipmentId
}
-action = request.getParameter("action");
+action = request.getParameter("action")
-shipment = null;
+shipment = null
if (shipmentId) {
- shipment = from("Shipment").where("shipmentId", shipmentId).queryOne();
+ shipment = from("Shipment").where("shipmentId", shipmentId).queryOne()
}
// **************************************
// Order Items are searched also by shipGroupSeqId and put in orderItemShipGroupAssocs
// **************************************
-orderItemShipGroupAssocs = null;
+orderItemShipGroupAssocs = null
// **************************************
// Search method: search by productId
// **************************************
if (action && orderId) {
if (shipGroupSeqId) {
- orderItemShipGroupAssocs = from("OrderItemShipGroupAssoc").where("orderId", orderId, "shipGroupSeqId", shipGroupSeqId).queryList();
+ orderItemShipGroupAssocs = from("OrderItemShipGroupAssoc").where("orderId", orderId, "shipGroupSeqId", shipGroupSeqId).queryList()
} else {
- orderItemShipGroupAssocs = from("OrderItemShipGroupAssoc").where("orderId", orderId).queryList();
+ orderItemShipGroupAssocs = from("OrderItemShipGroupAssoc").where("orderId", orderId).queryList()
}
}
// **************************************
// ShipmentPlan list form
// **************************************
-totWeight = 0;
-totVolume = 0;
-shipmentPlans = null;
-shipmentPlansIt = null;
-rows = [] as ArrayList;
+totWeight = 0
+totVolume = 0
+shipmentPlans = null
+shipmentPlansIt = null
+rows = [] as ArrayList
if (shipment) {
- shipmentPlans = from("OrderShipment").where("shipmentId", shipment.shipmentId).queryList();
+ shipmentPlans = from("OrderShipment").where("shipmentId", shipment.shipmentId).queryList()
}
if (shipmentPlans) {
shipmentPlans.each { shipmentPlan ->
- oneRow = new HashMap(shipmentPlan);
- orderItem = shipmentPlan.getRelatedOne("OrderItem", false);
- oneRow.productId = orderItem.productId;
- orderedQuantity = orderItem.getDouble("quantity");
- canceledQuantity = orderItem.getDouble("cancelQuantity");
+ oneRow = new HashMap(shipmentPlan)
+ orderItem = shipmentPlan.getRelatedOne("OrderItem", false)
+ oneRow.productId = orderItem.productId
+ orderedQuantity = orderItem.getDouble("quantity")
+ canceledQuantity = orderItem.getDouble("cancelQuantity")
if (canceledQuantity) {
- orderedQuantity = Double.valueOf(orderedQuantity.doubleValue() - canceledQuantity.doubleValue());
+ orderedQuantity = Double.valueOf(orderedQuantity.doubleValue() - canceledQuantity.doubleValue())
}
- oneRow.totOrderedQuantity = orderedQuantity.intValue();
+ oneRow.totOrderedQuantity = orderedQuantity.intValue()
// Total quantity issued
- issuedQuantity = 0.0;
- qtyIssuedInShipment = [:];
- issuances = orderItem.getRelated("ItemIssuance", null, null, false);
+ issuedQuantity = 0.0
+ qtyIssuedInShipment = [:]
+ issuances = orderItem.getRelated("ItemIssuance", null, null, false)
issuances.each { issuance ->
if (issuance.quantity) {
- issuedQuantity += issuance.getDouble("quantity");
+ issuedQuantity += issuance.getDouble("quantity")
if (issuance.cancelQuantity) {
- issuedQuantity -= issuance.getDouble("cancelQuantity");
+ issuedQuantity -= issuance.getDouble("cancelQuantity")
}
if (qtyIssuedInShipment.containsKey(issuance.shipmentId)) {
- qtyInShipment = ((Double)qtyIssuedInShipment.get(issuance.shipmentId)).doubleValue();
- qtyInShipment += issuance.getDouble("quantity");
+ qtyInShipment = ((Double)qtyIssuedInShipment.get(issuance.shipmentId)).doubleValue()
+ qtyInShipment += issuance.getDouble("quantity")
if (issuance.cancelQuantity) {
- qtyInShipment -= issuance.getDouble("cancelQuantity");
+ qtyInShipment -= issuance.getDouble("cancelQuantity")
}
- qtyIssuedInShipment.put(issuance.shipmentId, qtyInShipment);
+ qtyIssuedInShipment.put(issuance.shipmentId, qtyInShipment)
} else {
- qtyInShipment = issuance.getDouble("quantity");
+ qtyInShipment = issuance.getDouble("quantity")
if (issuance.cancelQuantity) {
- qtyInShipment -= issuance.getDouble("cancelQuantity");
+ qtyInShipment -= issuance.getDouble("cancelQuantity")
}
- qtyIssuedInShipment.put(issuance.shipmentId, qtyInShipment);
+ qtyIssuedInShipment.put(issuance.shipmentId, qtyInShipment)
}
}
}
- oneRow.totIssuedQuantity = issuedQuantity;
+ oneRow.totIssuedQuantity = issuedQuantity
// Total quantity planned not issued
- plannedQuantity = 0.0;
- qtyPlannedInShipment = [:];
- plans = from("OrderShipment").where("orderId", orderItem.orderId, "orderItemSeqId", orderItem.orderItemSeqId).queryList();
+ plannedQuantity = 0.0
+ qtyPlannedInShipment = [:]
+ plans = from("OrderShipment").where("orderId", orderItem.orderId, "orderItemSeqId", orderItem.orderItemSeqId).queryList()
plans.each { plan ->
if (plan.quantity) {
- netPlanQty = plan.getDouble("quantity");
+ netPlanQty = plan.getDouble("quantity")
if (qtyIssuedInShipment.containsKey(plan.shipmentId)) {
- qtyInShipment = ((Double)qtyIssuedInShipment.get(plan.shipmentId)).doubleValue();
+ qtyInShipment = ((Double)qtyIssuedInShipment.get(plan.shipmentId)).doubleValue()
if (netPlanQty > qtyInShipment) {
- netPlanQty -= qtyInShipment;
+ netPlanQty -= qtyInShipment
} else {
- netPlanQty = 0;
+ netPlanQty = 0
}
}
- plannedQuantity += netPlanQty;
+ plannedQuantity += netPlanQty
if (qtyPlannedInShipment.containsKey(plan.shipmentId)) {
- qtyInShipment = ((Double)qtyPlannedInShipment.get(plan.shipmentId)).doubleValue();
- qtyInShipment += netPlanQty;
- qtyPlannedInShipment.put(plan.shipmentId, qtyInShipment);
+ qtyInShipment = ((Double)qtyPlannedInShipment.get(plan.shipmentId)).doubleValue()
+ qtyInShipment += netPlanQty
+ qtyPlannedInShipment.put(plan.shipmentId, qtyInShipment)
} else {
- qtyPlannedInShipment.put(plan.shipmentId, netPlanQty);
+ qtyPlannedInShipment.put(plan.shipmentId, netPlanQty)
}
}
}
- oneRow.totPlannedQuantity = plannedQuantity;
+ oneRow.totPlannedQuantity = plannedQuantity
if (qtyIssuedInShipment.containsKey(shipmentId)) {
- oneRow.issuedQuantity = qtyIssuedInShipment.get(shipmentId);
+ oneRow.issuedQuantity = qtyIssuedInShipment.get(shipmentId)
} else {
- oneRow.issuedQuantity = "";
+ oneRow.issuedQuantity = ""
}
// Reserved and Not Available quantity
- reservedQuantity = 0.0;
- reservedNotAvailable = 0.0;
- reservations = orderItem.getRelated("OrderItemShipGrpInvRes", null, null, false);
+ reservedQuantity = 0.0
+ reservedNotAvailable = 0.0
+ reservations = orderItem.getRelated("OrderItemShipGrpInvRes", null, null, false)
reservations.each { reservation ->
if (reservation.quantity) {
- reservedQuantity += reservation.getDouble("quantity");
+ reservedQuantity += reservation.getDouble("quantity")
}
if (reservation.quantityNotAvailable) {
- reservedNotAvailable += reservation.getDouble("quantityNotAvailable");
+ reservedNotAvailable += reservation.getDouble("quantityNotAvailable")
}
}
- oneRow.notAvailableQuantity = reservedNotAvailable;
+ oneRow.notAvailableQuantity = reservedNotAvailable
// Planned Weight and Volume
- product = orderItem.getRelatedOne("Product", false);
- weight = 0.0;
- quantity = 0.0;
+ product = orderItem.getRelatedOne("Product", false)
+ weight = 0.0
+ quantity = 0.0
if (shipmentPlan.getDouble("quantity")) {
- quantity = shipmentPlan.getDouble("quantity");
+ quantity = shipmentPlan.getDouble("quantity")
}
if (product.getDouble("productWeight")) {
- weight = product.getDouble("productWeight") * quantity;
+ weight = product.getDouble("productWeight") * quantity
}
- oneRow.weight = weight;
+ oneRow.weight = weight
if (product.weightUomId) {
- weightUom = from("Uom").where("uomId", product.weightUomId).queryOne();
- oneRow.weightUom = weightUom.abbreviation;
+ weightUom = from("Uom").where("uomId", product.weightUomId).queryOne()
+ oneRow.weightUom = weightUom.abbreviation
}
- volume = 0.0;
+ volume = 0.0
if (product.getDouble("productHeight") &&
product.getDouble("productWidth") &&
product.getDouble("productDepth")) {
@@ -167,120 +167,120 @@ if (shipmentPlans) {
volume = product.getDouble("productHeight") *
product.getDouble("productWidth") *
product.getDouble("productDepth") *
- quantity;
+ quantity
}
- oneRow.volume = volume;
+ oneRow.volume = volume
if (product.heightUomId && product.widthUomId && product.depthUomId) {
- heightUom = from("Uom").where("uomId", product.heightUomId).cache(true).queryOne();
- widthUom = from("Uom").where("uomId", product.widthUomId).cache(true).queryOne();
- depthUom = from("Uom").where("uomId", product.depthUomId).cache(true).queryOne();
- oneRow.volumeUom = heightUom.abbreviation + "x" + widthUom.abbreviation + "x" + depthUom.abbreviation;
+ heightUom = from("Uom").where("uomId", product.heightUomId).cache(true).queryOne()
+ widthUom = from("Uom").where("uomId", product.widthUomId).cache(true).queryOne()
+ depthUom = from("Uom").where("uomId", product.depthUomId).cache(true).queryOne()
+ oneRow.volumeUom = heightUom.abbreviation + "x" + widthUom.abbreviation + "x" + depthUom.abbreviation
}
- totWeight += weight;
- totVolume += volume;
- rows.add(oneRow);
+ totWeight += weight
+ totVolume += volume
+ rows.add(oneRow)
}
}
// **************************************
// ShipmentPlan add form
// **************************************
-addRows = [] as ArrayList;
+addRows = [] as ArrayList
if (orderItemShipGroupAssocs) {
orderItemShipGroupAssocs.each { orderItemShipGroupAssoc ->
- orderItem = orderItemShipGroupAssoc.getRelatedOne("OrderItem", false);
- oneRow = [:];
- oneRow.shipmentId = shipmentId;
- oneRow.orderId = orderItemShipGroupAssoc.orderId;
- oneRow.orderItemSeqId = orderItemShipGroupAssoc.orderItemSeqId;
- oneRow.shipGroupSeqId = orderItemShipGroupAssoc.shipGroupSeqId;
- oneRow.productId = orderItem.productId;
- orderedQuantity = orderItemShipGroupAssoc.getDouble("quantity");
- canceledQuantity = orderItemShipGroupAssoc.getDouble("cancelQuantity");
+ orderItem = orderItemShipGroupAssoc.getRelatedOne("OrderItem", false)
+ oneRow = [:]
+ oneRow.shipmentId = shipmentId
+ oneRow.orderId = orderItemShipGroupAssoc.orderId
+ oneRow.orderItemSeqId = orderItemShipGroupAssoc.orderItemSeqId
+ oneRow.shipGroupSeqId = orderItemShipGroupAssoc.shipGroupSeqId
+ oneRow.productId = orderItem.productId
+ orderedQuantity = orderItemShipGroupAssoc.getDouble("quantity")
+ canceledQuantity = orderItemShipGroupAssoc.getDouble("cancelQuantity")
if (canceledQuantity) {
- orderedQuantity = Double.valueOf(orderedQuantity.doubleValue() - canceledQuantity.doubleValue());
+ orderedQuantity = Double.valueOf(orderedQuantity.doubleValue() - canceledQuantity.doubleValue())
}
- oneRow.orderedQuantity = orderedQuantity;
+ oneRow.orderedQuantity = orderedQuantity
// Total quantity issued
- issuedQuantity = 0.0;
- qtyIssuedInShipment = [:];
- issuances = orderItem.getRelated("ItemIssuance", null, null, false);
+ issuedQuantity = 0.0
+ qtyIssuedInShipment = [:]
+ issuances = orderItem.getRelated("ItemIssuance", null, null, false)
issuances.each { issuance ->
if (issuance.quantity) {
- issuedQuantity += issuance.getDouble("quantity");
+ issuedQuantity += issuance.getDouble("quantity")
if (issuance.cancelQuantity) {
- issuedQuantity -= issuance.getDouble("cancelQuantity");
+ issuedQuantity -= issuance.getDouble("cancelQuantity")
}
if (qtyIssuedInShipment.containsKey(issuance.shipmentId)) {
- qtyInShipment = ((Double)qtyIssuedInShipment.get(issuance.shipmentId)).doubleValue();
- qtyInShipment += issuance.getDouble("quantity");
- qtyIssuedInShipment.put(issuance.shipmentId, qtyInShipment);
+ qtyInShipment = ((Double)qtyIssuedInShipment.get(issuance.shipmentId)).doubleValue()
+ qtyInShipment += issuance.getDouble("quantity")
+ qtyIssuedInShipment.put(issuance.shipmentId, qtyInShipment)
} else {
- qtyInShipment = issuance.getDouble("quantity");
+ qtyInShipment = issuance.getDouble("quantity")
if (issuance.cancelQuantity) {
- qtyInShipment -= issuance.getDouble("cancelQuantity");
+ qtyInShipment -= issuance.getDouble("cancelQuantity")
}
- qtyIssuedInShipment.put(issuance.shipmentId, qtyInShipment);
+ qtyIssuedInShipment.put(issuance.shipmentId, qtyInShipment)
}
}
}
- oneRow.issuedQuantity = issuedQuantity;
+ oneRow.issuedQuantity = issuedQuantity
// Total quantity planned not issued
- plannedQuantity = 0.0;
- EntityCondition orderShipmentCondition = null;
+ plannedQuantity = 0.0
+ EntityCondition orderShipmentCondition = null
if (shipGroupSeqId) {
- orderShipmentCondition = EntityCondition.makeCondition([orderId : orderItemShipGroupAssoc.orderId, orderItemSeqId : orderItemShipGroupAssoc.orderItemSeqId, shipGroupSeqId : orderItemShipGroupAssoc.shipGroupSeqId]);
+ orderShipmentCondition = EntityCondition.makeCondition([orderId : orderItemShipGroupAssoc.orderId, orderItemSeqId : orderItemShipGroupAssoc.orderItemSeqId, shipGroupSeqId : orderItemShipGroupAssoc.shipGroupSeqId])
} else {
- orderShipmentCondition = EntityCondition.makeCondition([orderId : orderItemShipGroupAssoc.orderId, orderItemSeqId : orderItemShipGroupAssoc.orderItemSeqId]);
+ orderShipmentCondition = EntityCondition.makeCondition([orderId : orderItemShipGroupAssoc.orderId, orderItemSeqId : orderItemShipGroupAssoc.orderItemSeqId])
}
- plans = from("OrderShipment").where(orderShipmentCondition).queryList();
+ plans = from("OrderShipment").where(orderShipmentCondition).queryList()
plans.each { plan ->
if (plan.quantity) {
- netPlanQty = plan.getDouble("quantity");
- plannedQuantity += netPlanQty;
+ netPlanQty = plan.getDouble("quantity")
+ plannedQuantity += netPlanQty
}
}
- oneRow.plannedQuantity = plannedQuantity;
+ oneRow.plannedQuantity = plannedQuantity
// (default) quantity for plan
- planQuantity = (orderedQuantity - plannedQuantity - issuedQuantity > 0? orderedQuantity - plannedQuantity - issuedQuantity: 0);
- oneRow.quantity = planQuantity;
+ planQuantity = (orderedQuantity - plannedQuantity - issuedQuantity > 0? orderedQuantity - plannedQuantity - issuedQuantity: 0)
+ oneRow.quantity = planQuantity
// Planned (unitary) Weight and Volume
- weight = new Double(0);
- product = orderItem.getRelatedOne("Product", false);
+ weight = new Double(0)
+ product = orderItem.getRelatedOne("Product", false)
if (product.getDouble("productWeight")) {
- weight = product.getDouble("productWeight");
+ weight = product.getDouble("productWeight")
}
- oneRow.weight = weight;
+ oneRow.weight = weight
if (product.weightUomId) {
- weightUom = from("Uom").where("uomId", product.weightUomId).cache(true).queryOne();
- oneRow.weightUom = weightUom.abbreviation;
+ weightUom = from("Uom").where("uomId", product.weightUomId).cache(true).queryOne()
+ oneRow.weightUom = weightUom.abbreviation
}
- volume = 0.0;
+ volume = 0.0
if (product.getDouble("productHeight") && product.getDouble("productWidth") && product.getDouble("productDepth")) {
// TODO: check if uom conversion is needed
volume = product.getDouble("productHeight") *
product.getDouble("productWidth") *
- product.getDouble("productDepth");
+ product.getDouble("productDepth")
}
- oneRow.volume = volume;
+ oneRow.volume = volume
if (product.heightUomId && product.widthUomId && product.depthUomId) {
- heightUom = from("Uom").where("uomId", product.heightUomId).cache(true).queryOne();
- widthUom = from("Uom").where("uomId", product.widthUomId).cache(true).queryOne();
- depthUom = from("Uom").where("uomId", product.depthUomId).cache(true).queryOne();
- oneRow.volumeUom = heightUom.abbreviation + "x" + widthUom.abbreviation + "x" + depthUom.abbreviation;
+ heightUom = from("Uom").where("uomId", product.heightUomId).cache(true).queryOne()
+ widthUom = from("Uom").where("uomId", product.widthUomId).cache(true).queryOne()
+ depthUom = from("Uom").where("uomId", product.depthUomId).cache(true).queryOne()
+ oneRow.volumeUom = heightUom.abbreviation + "x" + widthUom.abbreviation + "x" + depthUom.abbreviation
}
- addRows.add(oneRow);
+ addRows.add(oneRow)
}
}
-context.listShipmentPlanRows = rows;
-context.addToShipmentPlanRows = addRows;
-context.rowCount = addRows.size();
-context.shipmentId = shipmentId;
-context.shipment = shipment;
-context.totWeight = totWeight;
-context.totVolume = totVolume;
+context.listShipmentPlanRows = rows
+context.addToShipmentPlanRows = addRows
+context.rowCount = addRows.size()
+context.shipmentId = shipmentId
+context.shipment = shipment
+context.totWeight = totWeight
+context.totVolume = totVolume
diff --git a/applications/product/groovyScripts/facility/shipment/EditShipmentRouteSegments.groovy b/applications/product/groovyScripts/facility/shipment/EditShipmentRouteSegments.groovy
index 5a20f8ad1a..472b2de2fc 100644
--- a/applications/product/groovyScripts/facility/shipment/EditShipmentRouteSegments.groovy
+++ b/applications/product/groovyScripts/facility/shipment/EditShipmentRouteSegments.groovy
@@ -18,72 +18,72 @@
*/
import org.apache.ofbiz.base.util.*
-import org.apache.ofbiz.entity.condition.EntityCondition;
+import org.apache.ofbiz.entity.condition.EntityCondition
-shipmentId = request.getParameter("shipmentId");
+shipmentId = request.getParameter("shipmentId")
if (!shipmentId) {
- shipmentId = context.shipmentId;
+ shipmentId = context.shipmentId
}
-shipment = null;
+shipment = null
if (shipmentId) {
- shipment = from("Shipment").where("shipmentId", shipmentId).queryOne();
+ shipment = from("Shipment").where("shipmentId", shipmentId).queryOne()
}
if (shipment) {
- shipmentRouteSegments = shipment.getRelated("ShipmentRouteSegment", null, ['shipmentRouteSegmentId'], false);
- shipmentRouteSegmentDatas = [] as LinkedList;
+ shipmentRouteSegments = shipment.getRelated("ShipmentRouteSegment", null, ['shipmentRouteSegmentId'], false)
+ shipmentRouteSegmentDatas = [] as LinkedList
if (shipmentRouteSegments) {
shipmentRouteSegments.each { shipmentRouteSegment ->
- shipmentRouteSegmentData = [:];
- shipmentRouteSegmentData.shipmentRouteSegment = shipmentRouteSegment;
- shipmentRouteSegmentData.originFacility = shipmentRouteSegment.getRelatedOne("OriginFacility", false);
- shipmentRouteSegmentData.destFacility = shipmentRouteSegment.getRelatedOne("DestFacility", false);
- shipmentRouteSegmentData.originPostalAddress = shipmentRouteSegment.getRelatedOne("OriginPostalAddress", false);
- shipmentRouteSegmentData.originTelecomNumber = shipmentRouteSegment.getRelatedOne("OriginTelecomNumber", false);
- shipmentRouteSegmentData.destPostalAddress = shipmentRouteSegment.getRelatedOne("DestPostalAddress", false);
- shipmentRouteSegmentData.destTelecomNumber = shipmentRouteSegment.getRelatedOne("DestTelecomNumber", false);
- shipmentRouteSegmentData.shipmentMethodType = shipmentRouteSegment.getRelatedOne("ShipmentMethodType", false);
- shipmentRouteSegmentData.carrierPerson = shipmentRouteSegment.getRelatedOne("CarrierPerson", false);
- shipmentRouteSegmentData.carrierPartyGroup = shipmentRouteSegment.getRelatedOne("CarrierPartyGroup", false);
- shipmentRouteSegmentData.shipmentPackageRouteSegs = shipmentRouteSegment.getRelated("ShipmentPackageRouteSeg", null, null, false);
- shipmentRouteSegmentData.carrierServiceStatusItem = shipmentRouteSegment.getRelatedOne("CarrierServiceStatusItem", false);
- shipmentRouteSegmentData.currencyUom = shipmentRouteSegment.getRelatedOne("CurrencyUom", false);
- shipmentRouteSegmentData.billingWeightUom = shipmentRouteSegment.getRelatedOne("BillingWeightUom", false);
+ shipmentRouteSegmentData = [:]
+ shipmentRouteSegmentData.shipmentRouteSegment = shipmentRouteSegment
+ shipmentRouteSegmentData.originFacility = shipmentRouteSegment.getRelatedOne("OriginFacility", false)
+ shipmentRouteSegmentData.destFacility = shipmentRouteSegment.getRelatedOne("DestFacility", false)
+ shipmentRouteSegmentData.originPostalAddress = shipmentRouteSegment.getRelatedOne("OriginPostalAddress", false)
+ shipmentRouteSegmentData.originTelecomNumber = shipmentRouteSegment.getRelatedOne("OriginTelecomNumber", false)
+ shipmentRouteSegmentData.destPostalAddress = shipmentRouteSegment.getRelatedOne("DestPostalAddress", false)
+ shipmentRouteSegmentData.destTelecomNumber = shipmentRouteSegment.getRelatedOne("DestTelecomNumber", false)
+ shipmentRouteSegmentData.shipmentMethodType = shipmentRouteSegment.getRelatedOne("ShipmentMethodType", false)
+ shipmentRouteSegmentData.carrierPerson = shipmentRouteSegment.getRelatedOne("CarrierPerson", false)
+ shipmentRouteSegmentData.carrierPartyGroup = shipmentRouteSegment.getRelatedOne("CarrierPartyGroup", false)
+ shipmentRouteSegmentData.shipmentPackageRouteSegs = shipmentRouteSegment.getRelated("ShipmentPackageRouteSeg", null, null, false)
+ shipmentRouteSegmentData.carrierServiceStatusItem = shipmentRouteSegment.getRelatedOne("CarrierServiceStatusItem", false)
+ shipmentRouteSegmentData.currencyUom = shipmentRouteSegment.getRelatedOne("CurrencyUom", false)
+ shipmentRouteSegmentData.billingWeightUom = shipmentRouteSegment.getRelatedOne("BillingWeightUom", false)
if (shipmentRouteSegment.carrierServiceStatusId) {
- shipmentRouteSegmentData.carrierServiceStatusValidChangeToDetails = from("StatusValidChangeToDetail").where("statusId", shipmentRouteSegment.carrierServiceStatusId).orderBy("sequenceId").queryList();
+ shipmentRouteSegmentData.carrierServiceStatusValidChangeToDetails = from("StatusValidChangeToDetail").where("statusId", shipmentRouteSegment.carrierServiceStatusId).orderBy("sequenceId").queryList()
} else {
- shipmentRouteSegmentData.carrierServiceStatusValidChangeToDetails = from("StatusValidChangeToDetail").where("statusId", "SHRSCS_NOT_STARTED").orderBy("sequenceId").queryList();
+ shipmentRouteSegmentData.carrierServiceStatusValidChangeToDetails = from("StatusValidChangeToDetail").where("statusId", "SHRSCS_NOT_STARTED").orderBy("sequenceId").queryList()
}
- shipmentRouteSegmentDatas.add(shipmentRouteSegmentData);
+ shipmentRouteSegmentDatas.add(shipmentRouteSegmentData)
}
}
- shipmentPackages = shipment.getRelated("ShipmentPackage", null, ['shipmentPackageSeqId'], false);
- facilities = from("Facility").orderBy("facilityName").queryList();
- shipmentMethodTypes = from("ShipmentMethodType").orderBy("description").queryList();
- weightUoms = from("Uom").where("uomTypeId", "WEIGHT_MEASURE").queryList();
- currencyUoms = from("Uom").where("uomTypeId", "CURRENCY_MEASURE").queryList();
+ shipmentPackages = shipment.getRelated("ShipmentPackage", null, ['shipmentPackageSeqId'], false)
+ facilities = from("Facility").orderBy("facilityName").queryList()
+ shipmentMethodTypes = from("ShipmentMethodType").orderBy("description").queryList()
+ weightUoms = from("Uom").where("uomTypeId", "WEIGHT_MEASURE").queryList()
+ currencyUoms = from("Uom").where("uomTypeId", "CURRENCY_MEASURE").queryList()
- carrierPartyRoles = from("PartyRole").where("roleTypeId", "CARRIER").queryList();
- carrierPartyDatas = [] as LinkedList;
+ carrierPartyRoles = from("PartyRole").where("roleTypeId", "CARRIER").queryList()
+ carrierPartyDatas = [] as LinkedList
carrierPartyRoles.each { carrierPartyRole ->
- party = carrierPartyRole.getRelatedOne("Party", false);
- carrierPartyData = [:];
- carrierPartyData.party = party;
- carrierPartyData.person = party.getRelatedOne("Person", false);
- carrierPartyData.partyGroup = party.getRelatedOne("PartyGroup", false);
- carrierPartyDatas.add(carrierPartyData);
+ party = carrierPartyRole.getRelatedOne("Party", false)
+ carrierPartyData = [:]
+ carrierPartyData.party = party
+ carrierPartyData.person = party.getRelatedOne("Person", false)
+ carrierPartyData.partyGroup = party.getRelatedOne("PartyGroup", false)
+ carrierPartyDatas.add(carrierPartyData)
}
- context.shipment = shipment;
- context.shipmentRouteSegmentDatas = shipmentRouteSegmentDatas;
- context.shipmentPackages = shipmentPackages;
- context.facilities = facilities;
- context.shipmentMethodTypes = shipmentMethodTypes;
- context.weightUoms = weightUoms;
- context.currencyUoms = currencyUoms;
- context.carrierPartyDatas = carrierPartyDatas;
+ context.shipment = shipment
+ context.shipmentRouteSegmentDatas = shipmentRouteSegmentDatas
+ context.shipmentPackages = shipmentPackages
+ context.facilities = facilities
+ context.shipmentMethodTypes = shipmentMethodTypes
+ context.weightUoms = weightUoms
+ context.currencyUoms = currencyUoms
+ context.carrierPartyDatas = carrierPartyDatas
}
-context.shipmentId = shipmentId;
-context.nowTimestampString = UtilDateTime.nowTimestamp().toString();
+context.shipmentId = shipmentId
+context.nowTimestampString = UtilDateTime.nowTimestamp().toString()
diff --git a/applications/product/groovyScripts/facility/shipment/PackOrder.groovy b/applications/product/groovyScripts/facility/shipment/PackOrder.groovy
index ad2225b60a..660d015984 100644
--- a/applications/product/groovyScripts/facility/shipment/PackOrder.groovy
+++ b/applications/product/groovyScripts/facility/shipment/PackOrder.groovy
@@ -17,39 +17,39 @@
* under the License.
*/
-import org.apache.ofbiz.base.util.*;
-import org.apache.ofbiz.order.order.*;
-import org.apache.ofbiz.entity.util.EntityUtil;
-import org.apache.ofbiz.entity.util.EntityUtilProperties;
-import org.apache.ofbiz.entity.condition.EntityCondition;
+import org.apache.ofbiz.base.util.*
+import org.apache.ofbiz.order.order.*
+import org.apache.ofbiz.entity.util.EntityUtil
+import org.apache.ofbiz.entity.util.EntityUtilProperties
+import org.apache.ofbiz.entity.condition.EntityCondition
-facilityId = parameters.facilityId;
+facilityId = parameters.facilityId
if (facilityId) {
- facility = from("Facility").where("facilityId", facilityId).queryOne();
- context.facilityId = facilityId;
- context.facility = facility;
+ facility = from("Facility").where("facilityId", facilityId).queryOne()
+ context.facilityId = facilityId
+ context.facility = facility
}
// order based packing
-orderId = parameters.orderId;
-shipGroupSeqId = parameters.shipGroupSeqId;
-shipmentId = parameters.shipmentId;
+orderId = parameters.orderId
+shipGroupSeqId = parameters.shipGroupSeqId
+shipmentId = parameters.shipmentId
if (!shipmentId) {
- shipmentId = request.getAttribute("shipmentId");
+ shipmentId = request.getAttribute("shipmentId")
}
-context.shipmentId = shipmentId;
+context.shipmentId = shipmentId
// If a shipment exists, provide the IDs of any related invoices
-invoiceIds = null;
+invoiceIds = null
if (shipmentId) {
// Get the primaryOrderId from the shipment
- shipment = from("Shipment").where("shipmentId", shipmentId).queryOne();
+ shipment = from("Shipment").where("shipmentId", shipmentId).queryOne()
if (shipment && shipment.primaryOrderId) {
- orderItemBillingList = from("OrderItemBilling").where("orderId", shipment.primaryOrderId).orderBy("invoiceId").queryList();
- invoiceIds = EntityUtil.getFieldListFromEntityList(orderItemBillingList, "invoiceId", true);
+ orderItemBillingList = from("OrderItemBilling").where("orderId", shipment.primaryOrderId).orderBy("invoiceId").queryList()
+ invoiceIds = EntityUtil.getFieldListFromEntityList(orderItemBillingList, "invoiceId", true)
if (invoiceIds) {
- context.invoiceIds = invoiceIds;
+ context.invoiceIds = invoiceIds
}
}
}
@@ -57,85 +57,85 @@ if (shipmentId) {
// validate order information
if (orderId && !shipGroupSeqId && orderId.indexOf("/") > -1) {
// split the orderID/shipGroupSeqID
- idSplit = orderId.split("\\/");
- orderId = idSplit[0];
- shipGroupSeqId = idSplit[1];
+ idSplit = orderId.split("\\/")
+ orderId = idSplit[0]
+ shipGroupSeqId = idSplit[1]
} else if (orderId && !shipGroupSeqId) {
- shipGroupSeqId = "00001";
+ shipGroupSeqId = "00001"
}
// setup the packing session
-packSession = session.getAttribute("packingSession");
-clear = parameters.clear;
+packSession = session.getAttribute("packingSession")
+clear = parameters.clear
if (!packSession) {
- packSession = new org.apache.ofbiz.shipment.packing.PackingSession(dispatcher, userLogin);
- session.setAttribute("packingSession", packSession);
- Debug.log("Created NEW packing session!!");
+ packSession = new org.apache.ofbiz.shipment.packing.PackingSession(dispatcher, userLogin)
+ session.setAttribute("packingSession", packSession)
+ Debug.log("Created NEW packing session!!")
} else {
if (packSession.getStatus() == 0) {
- OrderReadHelper orh = new OrderReadHelper(delegator, orderId);
- shipGrp = orh.getOrderItemShipGroup(shipGroupSeqId);
- context.shippedShipGroupSeqId = shipGroupSeqId;
- context.shippedOrderId = orderId;
- context.shippedCarrier = shipGrp.carrierPartyId;
+ OrderReadHelper orh = new OrderReadHelper(delegator, orderId)
+ shipGrp = orh.getOrderItemShipGroup(shipGroupSeqId)
+ context.shippedShipGroupSeqId = shipGroupSeqId
+ context.shippedOrderId = orderId
+ context.shippedCarrier = shipGrp.carrierPartyId
- packSession.clear();
- shipGroupSeqId = null;
- orderId = null;
+ packSession.clear()
+ shipGroupSeqId = null
+ orderId = null
} else if (clear) {
- packSession.clear();
+ packSession.clear()
}
}
-packSession.clearItemInfos();
+packSession.clearItemInfos()
// picklist based packing information
-picklistBinId = parameters.picklistBinId;
+picklistBinId = parameters.picklistBinId
// see if the bin ID is already set
if (!picklistBinId) {
- picklistBinId = packSession.getPicklistBinId();
+ picklistBinId = packSession.getPicklistBinId()
}
if (picklistBinId) {
- bin = from("PicklistBin").where("picklistBinId", picklistBinId).queryOne();
+ bin = from("PicklistBin").where("picklistBinId", picklistBinId).queryOne()
if (bin) {
- orderId = bin.primaryOrderId;
- shipGroupSeqId = bin.primaryShipGroupSeqId;
- packSession.addItemInfo(bin.getRelated("PicklistItem", [itemStatusId : 'PICKITEM_PENDING'], null, false));
+ orderId = bin.primaryOrderId
+ shipGroupSeqId = bin.primaryShipGroupSeqId
+ packSession.addItemInfo(bin.getRelated("PicklistItem", [itemStatusId : 'PICKITEM_PENDING'], null, false))
}
} else {
- picklistBinId = null;
+ picklistBinId = null
}
// make sure we always re-set the infos
-packSession.setPrimaryShipGroupSeqId(shipGroupSeqId);
-packSession.setPrimaryOrderId(orderId);
-packSession.setPicklistBinId(picklistBinId);
-packSession.setFacilityId(facilityId);
+packSession.setPrimaryShipGroupSeqId(shipGroupSeqId)
+packSession.setPrimaryOrderId(orderId)
+packSession.setPicklistBinId(picklistBinId)
+packSession.setFacilityId(facilityId)
if (invoiceIds) {
- orderId = null;
+ orderId = null
}
-shipment = from("Shipment").where("primaryOrderId", orderId, "statusId", "SHIPMENT_PICKED").queryFirst();
-context.shipment = shipment;
+shipment = from("Shipment").where("primaryOrderId", orderId, "statusId", "SHIPMENT_PICKED").queryFirst()
+context.shipment = shipment
-context.packingSession = packSession;
-context.orderId = orderId;
-context.shipGroupSeqId = shipGroupSeqId;
-context.picklistBinId = picklistBinId;
+context.packingSession = packSession
+context.orderId = orderId
+context.shipGroupSeqId = shipGroupSeqId
+context.picklistBinId = picklistBinId
// grab the order information
if (orderId) {
- orderHeader = from("OrderHeader").where("orderId", orderId).queryOne();
+ orderHeader = from("OrderHeader").where("orderId", orderId).queryOne()
if (orderHeader) {
- OrderReadHelper orh = new OrderReadHelper(orderHeader);
- context.orderId = orderId;
- context.orderHeader = orderHeader;
- context.orderReadHelper = orh;
- orderItemShipGroup = orh.getOrderItemShipGroup(shipGroupSeqId);
- context.orderItemShipGroup = orderItemShipGroup;
- carrierPartyId = orderItemShipGroup.carrierPartyId;
- carrierShipmentBoxTypes = from("CarrierShipmentBoxType").where("partyId", carrierPartyId).queryList();
+ OrderReadHelper orh = new OrderReadHelper(orderHeader)
+ context.orderId = orderId
+ context.orderHeader = orderHeader
+ context.orderReadHelper = orh
+ orderItemShipGroup = orh.getOrderItemShipGroup(shipGroupSeqId)
+ context.orderItemShipGroup = orderItemShipGroup
+ carrierPartyId = orderItemShipGroup.carrierPartyId
+ carrierShipmentBoxTypes = from("CarrierShipmentBoxType").where("partyId", carrierPartyId).queryList()
if (carrierShipmentBoxTypes) {
- context.carrierShipmentBoxTypes = carrierShipmentBoxTypes;
+ context.carrierShipmentBoxTypes = carrierShipmentBoxTypes
}
if ("ORDER_APPROVED".equals(orderHeader.statusId)) {
@@ -143,41 +143,41 @@ if (orderId) {
if (!shipment) {
// Generate the shipment cost estimate for the ship group
- productStoreId = orh.getProductStoreId();
- shippableItemInfo = orh.getOrderItemAndShipGroupAssoc(shipGroupSeqId);
- shippableItems = from("OrderItemAndShipGrpInvResAndItemSum").where("orderId", orderId, "shipGroupSeqId", shipGroupSeqId).queryList();
- shippableTotal = new Double(orh.getShippableTotal(shipGroupSeqId).doubleValue());
- shippableWeight = new Double(orh.getShippableWeight(shipGroupSeqId).doubleValue());
- shippableQuantity = new Double(orh.getShippableQuantity(shipGroupSeqId).doubleValue());
+ productStoreId = orh.getProductStoreId()
+ shippableItemInfo = orh.getOrderItemAndShipGroupAssoc(shipGroupSeqId)
+ shippableItems = from("OrderItemAndShipGrpInvResAndItemSum").where("orderId", orderId, "shipGroupSeqId", shipGroupSeqId).queryList()
+ shippableTotal = new Double(orh.getShippableTotal(shipGroupSeqId).doubleValue())
+ shippableWeight = new Double(orh.getShippableWeight(shipGroupSeqId).doubleValue())
+ shippableQuantity = new Double(orh.getShippableQuantity(shipGroupSeqId).doubleValue())
if (orderItemShipGroup.contactMechId && orderItemShipGroup.shipmentMethodTypeId && orderItemShipGroup.carrierPartyId && orderItemShipGroup.carrierRoleTypeId) {
- shipmentCostEstimate = packSession.getShipmentCostEstimate(orderItemShipGroup, productStoreId, shippableItemInfo, shippableTotal, shippableWeight, shippableQuantity);
- context.shipmentCostEstimateForShipGroup = shipmentCostEstimate;
+ shipmentCostEstimate = packSession.getShipmentCostEstimate(orderItemShipGroup, productStoreId, shippableItemInfo, shippableTotal, shippableWeight, shippableQuantity)
+ context.shipmentCostEstimateForShipGroup = shipmentCostEstimate
}
- context.productStoreId = productStoreId;
+ context.productStoreId = productStoreId
if (!picklistBinId) {
- packSession.addItemInfo(shippableItems);
+ packSession.addItemInfo(shippableItems)
}
} else {
- request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage("OrderErrorUiLabels", "OrderErrorOrderHasBeenAlreadyVerified", [orderId : orderId], locale));
+ request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage("OrderErrorUiLabels", "OrderErrorOrderHasBeenAlreadyVerified", [orderId : orderId], locale))
}
} else {
- request.setAttribute("errorMessageList", ['No ship group sequence ID. Cannot process.']);
+ request.setAttribute("errorMessageList", ['No ship group sequence ID. Cannot process.'])
}
} else {
- request.setAttribute("errorMessageList", ["Order #" + orderId + " is not approved for packing."]);
+ request.setAttribute("errorMessageList", ["Order #" + orderId + " is not approved for packing."])
}
} else {
- request.setAttribute("errorMessageList", ["Order #" + orderId + " cannot be found."]);
+ request.setAttribute("errorMessageList", ["Order #" + orderId + " cannot be found."])
}
}
// Try to get the defaultWeightUomId first from the facility, then from the shipment properties, and finally defaulting to kilos
-defaultWeightUomId = null;
+defaultWeightUomId = null
if (facility) {
- defaultWeightUomId = facility.defaultWeightUomId;
+ defaultWeightUomId = facility.defaultWeightUomId
}
if (!defaultWeightUomId) {
- defaultWeightUomId = EntityUtilProperties.getPropertyValue("shipment", "shipment.default.weight.uom", "WT_kg", delegator);
+ defaultWeightUomId = EntityUtilProperties.getPropertyValue("shipment", "shipment.default.weight.uom", "WT_kg", delegator)
}
-context.defaultWeightUomId = defaultWeightUomId;
+context.defaultWeightUomId = defaultWeightUomId
diff --git a/applications/product/groovyScripts/facility/shipment/PackingSlip.groovy b/applications/product/groovyScripts/facility/shipment/PackingSlip.groovy
index 407fbad8cd..08eb3f62ea 100644
--- a/applications/product/groovyScripts/facility/shipment/PackingSlip.groovy
+++ b/applications/product/groovyScripts/facility/shipment/PackingSlip.groovy
@@ -19,32 +19,32 @@
// This script gets shipment items grouped by package for use in the packing slip PDF or any screens that require by-package layout
-import org.apache.ofbiz.base.util.*;
-import org.apache.ofbiz.entity.condition.*;
+import org.apache.ofbiz.base.util.*
+import org.apache.ofbiz.entity.condition.*
import org.apache.ofbiz.entity.util.EntityTypeUtil
// Since this script is run after ViewShipment, we will re-use the shipment in the context
-shipment = context.shipment;
+shipment = context.shipment
if (!shipment) {
- return;
+ return
}
// get the packages related to this shipment in order of packages
-shipmentPackages = shipment.getRelated("ShipmentPackage", null, ['shipmentPackageSeqId'], false);
+shipmentPackages = shipment.getRelated("ShipmentPackage", null, ['shipmentPackageSeqId'], false)
// first we scan the shipment items and count the quantity of each product that is being shipped
-quantityShippedByProduct = [:];
-quantityInShipmentByProduct = [:];
-shipmentItems = shipment.getRelated("ShipmentItem", null, null, false);
+quantityShippedByProduct = [:]
+quantityInShipmentByProduct = [:]
+shipmentItems = shipment.getRelated("ShipmentItem", null, null, false)
shipmentItems.each { shipmentItem ->
- productId = shipmentItem.productId;
- shipped = quantityShippedByProduct.get(productId);
+ productId = shipmentItem.productId
+ shipped = quantityShippedByProduct.get(productId)
if (!shipped) {
- shipped = 0 as Double;
+ shipped = 0 as Double
}
- shipped += shipmentItem.getDouble("quantity").doubleValue();
- quantityShippedByProduct.put(productId, shipped);
- quantityInShipmentByProduct.put(productId, shipped);
+ shipped += shipmentItem.getDouble("quantity").doubleValue()
+ quantityShippedByProduct.put(productId, shipped)
+ quantityInShipmentByProduct.put(productId, shipped)
}
// Add in the total of all previously shipped items
@@ -57,74 +57,74 @@ previousShipmentIter = from("Shipment")
ObjectType.simpleTypeConvert(shipment.getString("createdDate"), "Timestamp", null, null))
),
EntityOperator.AND))
- .queryIterator();
+ .queryIterator()
while (previousShipmentItem = previousShipmentIter.next()) {
if (!previousShipmentItem.shipmentId.equals(shipment.shipmentId)) {
- previousShipmentItems = previousShipmentItem.getRelated("ShipmentItem", null, null, false);
+ previousShipmentItems = previousShipmentItem.getRelated("ShipmentItem", null, null, false)
previousShipmentItems.each { shipmentItem ->
- productId = shipmentItem.productId;
- shipped = quantityShippedByProduct.get(productId);
+ productId = shipmentItem.productId
+ shipped = quantityShippedByProduct.get(productId)
if (!shipped) {
- shipped = new Double(0);
+ shipped = new Double(0)
}
- shipped += shipmentItem.getDouble("quantity").doubleValue();
- quantityShippedByProduct.put(productId, shipped);
+ shipped += shipmentItem.getDouble("quantity").doubleValue()
+ quantityShippedByProduct.put(productId, shipped)
}
}
}
-previousShipmentIter.close();
+previousShipmentIter.close()
// next scan the order items (via issuances) to count the quantity of each product requested
-quantityRequestedByProduct = [:];
-countedOrderItems = [:]; // this map is only used to keep track of the order items already counted
-order = shipment.getRelatedOne("PrimaryOrderHeader", false);
-issuances = order.getRelated("ItemIssuance", null, null, false);
+quantityRequestedByProduct = [:]
+countedOrderItems = [:] // this map is only used to keep track of the order items already counted
+order = shipment.getRelatedOne("PrimaryOrderHeader", false)
+issuances = order.getRelated("ItemIssuance", null, null, false)
issuances.each { issuance ->
- orderItem = issuance.getRelatedOne("OrderItem", false);
- productId = orderItem.productId;
+ orderItem = issuance.getRelatedOne("OrderItem", false)
+ productId = orderItem.productId
if (!countedOrderItems.containsKey(orderItem.orderId + orderItem.orderItemSeqId)) {
- countedOrderItems.put(orderItem.orderId + orderItem.orderItemSeqId, null);
- requested = quantityRequestedByProduct.get(productId);
+ countedOrderItems.put(orderItem.orderId + orderItem.orderItemSeqId, null)
+ requested = quantityRequestedByProduct.get(productId)
if (!requested) {
- requested = new Double(0);
+ requested = new Double(0)
}
- cancelQuantity = orderItem.getDouble("cancelQuantity");
- quantity = orderItem.getDouble("quantity");
- requested += quantity.doubleValue() - (cancelQuantity ? cancelQuantity.doubleValue() : 0);
- quantityRequestedByProduct.put(productId, requested);
+ cancelQuantity = orderItem.getDouble("cancelQuantity")
+ quantity = orderItem.getDouble("quantity")
+ requested += quantity.doubleValue() - (cancelQuantity ? cancelQuantity.doubleValue() : 0)
+ quantityRequestedByProduct.put(productId, requested)
}
}
// for each package, we want to list the quantities and details of each product
-packages = []; // note we assume that the package number is simply the index + 1 of this list
+packages = [] // note we assume that the package number is simply the index + 1 of this list
shipmentPackages.each { shipmentPackage ->
- contents = shipmentPackage.getRelated("ShipmentPackageContent", null, ['shipmentItemSeqId'], false);
+ contents = shipmentPackage.getRelated("ShipmentPackageContent", null, ['shipmentItemSeqId'], false)
// each line is one logical Product and the quantities associated with it
- lines = [];
+ lines = []
contents.each { content ->
- shipmentItem = content.getRelatedOne("ShipmentItem", false);
- product = shipmentItem.getRelatedOne("Product", false);
- productTypeId = product.get("productTypeId");
+ shipmentItem = content.getRelatedOne("ShipmentItem", false)
+ product = shipmentItem.getRelatedOne("Product", false)
+ productTypeId = product.get("productTypeId")
- line = [:];
- line.product = product;
- line.quantityRequested = quantityRequestedByProduct.get(product.productId);
- line.quantityInPackage = content.quantity;
+ line = [:]
+ line.product = product
+ line.quantityRequested = quantityRequestedByProduct.get(product.productId)
+ line.quantityInPackage = content.quantity
if (EntityTypeUtil.hasParentType(delegator, "ProductType", "productTypeId", productTypeId, "parentTypeId", "MARKETING_PKG_PICK") && line.quantityInPackage > line.quantityRequested) {
- line.quantityInPackage = line.quantityRequested;
+ line.quantityInPackage = line.quantityRequested
}
- line.quantityInShipment = quantityInShipmentByProduct.get(product.productId);
+ line.quantityInShipment = quantityInShipmentByProduct.get(product.productId)
if (EntityTypeUtil.hasParentType(delegator, "ProductType", "productTypeId", productTypeId, "parentTypeId", "MARKETING_PKG_PICK") && line.quantityInShipment > line.quantityRequested) {
- line.quantityInShipment = line.quantityRequested;
+ line.quantityInShipment = line.quantityRequested
}
- line.quantityShipped = quantityShippedByProduct.get(product.productId);
+ line.quantityShipped = quantityShippedByProduct.get(product.productId)
if (EntityTypeUtil.hasParentType(delegator, "ProductType", "productTypeId", productTypeId, "parentTypeId", "MARKETING_PKG_PICK") && line.quantityShipped > line.quantityRequested) {
- line.quantityShipped = line.quantityRequested;
+ line.quantityShipped = line.quantityRequested
}
- lines.add(line);
+ lines.add(line)
}
- packages.add(lines);
+ packages.add(lines)
}
-context.packages = packages;
+context.packages = packages
diff --git a/applications/product/groovyScripts/facility/shipment/PrintPickSheets.groovy b/applications/product/groovyScripts/facility/shipment/PrintPickSheets.groovy
index 9d68a1b849..6040b3760b 100644
--- a/applications/product/groovyScripts/facility/shipment/PrintPickSheets.groovy
+++ b/applications/product/groovyScripts/facility/shipment/PrintPickSheets.groovy
@@ -17,115 +17,115 @@
* under the License.
*/
-import org.apache.ofbiz.order.order.OrderReadHelper;
-import org.apache.ofbiz.entity.condition.EntityCondition;
-import org.apache.ofbiz.entity.util.EntityUtil;
-import org.apache.ofbiz.base.util.UtilHttp;
+import org.apache.ofbiz.order.order.OrderReadHelper
+import org.apache.ofbiz.entity.condition.EntityCondition
+import org.apache.ofbiz.entity.util.EntityUtil
+import org.apache.ofbiz.base.util.UtilHttp
-toPrintOrders = [];
-maxNumberOfOrders = parameters.maxNumberOfOrdersToPrint;
-int maxNumberOfOrders = maxNumberOfOrders.toInteger();
-int printListCounter = 0;
-printGroupName = parameters.printGroupName;
+toPrintOrders = []
+maxNumberOfOrders = parameters.maxNumberOfOrdersToPrint
+int maxNumberOfOrders = maxNumberOfOrders.toInteger()
+int printListCounter = 0
+printGroupName = parameters.printGroupName
if (printGroupName != null) {
pickMoveInfoList.each { pickMoveInfo ->
- groupName = pickMoveInfo.groupName ;
+ groupName = pickMoveInfo.groupName
if (groupName == printGroupName) {
- toPrintOrders.add(pickMoveInfo.orderReadyToPickInfoList);
+ toPrintOrders.add(pickMoveInfo.orderReadyToPickInfoList)
}
}
}
else {
pickMoveInfoList.each { pickMoveInfo ->
- toPrintOrders.add(pickMoveInfo.orderReadyToPickInfoList);
+ toPrintOrders.add(pickMoveInfo.orderReadyToPickInfoList)
}
}
if (toPrintOrders) {
- orderList = [];
- orderInfoList = [];
- itemInfoList = [];
- orderHeaderList = [];
- orderChargeList =[];
+ orderList = []
+ orderInfoList = []
+ itemInfoList = []
+ orderHeaderList = []
+ orderChargeList =[]
toPrintOrders.each { toPrintOrder ->
if(toPrintOrder) {
- orderHeaders = toPrintOrder.orderHeader;
- orderItemShipGroups = toPrintOrder.orderItemShipGroup;
- orderItemShipGrpInvResList = toPrintOrder.orderItemShipGrpInvResList;
- orderItemShipGrpInvResInfoList = toPrintOrder.orderItemShipGrpInvResInfoList;
+ orderHeaders = toPrintOrder.orderHeader
+ orderItemShipGroups = toPrintOrder.orderItemShipGroup
+ orderItemShipGrpInvResList = toPrintOrder.orderItemShipGrpInvResList
+ orderItemShipGrpInvResInfoList = toPrintOrder.orderItemShipGrpInvResInfoList
orderHeaders.each { orderHeader ->
- printListCounter = ++printListCounter;
+ printListCounter = ++printListCounter
if (printListCounter <= maxNumberOfOrders) {
- orderMap = [:];
- orderId = orderHeader.orderId;
- orderMap.orderId = orderId;
- orderMap.orderDate = orderHeader.orderDate;
- billingOrderContactMechs = [];
- billingOrderContactMechs = from("OrderContactMech").where("orderId", orderId, "contactMechPurposeTypeId", "BILLING_LOCATION").queryList();
+ orderMap = [:]
+ orderId = orderHeader.orderId
+ orderMap.orderId = orderId
+ orderMap.orderDate = orderHeader.orderDate
+ billingOrderContactMechs = []
+ billingOrderContactMechs = from("OrderContactMech").where("orderId", orderId, "contactMechPurposeTypeId", "BILLING_LOCATION").queryList()
if (billingOrderContactMechs.size() > 0) {
- billingContactMechId = EntityUtil.getFirst(billingOrderContactMechs).contactMechId;
- billingAddress = from("PostalAddress").where("contactMechId", billingContactMechId).queryOne();
+ billingContactMechId = EntityUtil.getFirst(billingOrderContactMechs).contactMechId
+ billingAddress = from("PostalAddress").where("contactMechId", billingContactMechId).queryOne()
}
- shippingContactMechId = from("OrderContactMech").where("orderId", orderId, "contactMechPurposeTypeId", "SHIPPING_LOCATION").queryFirst().contactMechId;
- shippingAddress = from("PostalAddress").where("contactMechId", shippingContactMechId).queryOne();
+ shippingContactMechId = from("OrderContactMech").where("orderId", orderId, "contactMechPurposeTypeId", "SHIPPING_LOCATION").queryFirst().contactMechId
+ shippingAddress = from("PostalAddress").where("contactMechId", shippingContactMechId).queryOne()
orderItemShipGroups.each { orderItemShipGroup ->
if (orderItemShipGroup.orderId == orderId) {
- orderMap.shipmentMethodType = EntityUtil.getFirst(orderItemShipGroup.getRelated("ShipmentMethodType", null, null, false)).description;
- orderMap.carrierPartyId = orderItemShipGroup.carrierPartyId;
- orderMap.shipGroupSeqId = orderItemShipGroup.shipGroupSeqId;
- orderMap.carrierPartyId = orderItemShipGroup.carrierPartyId;
- orderMap.isGift = orderItemShipGroup.isGift;
- orderMap.giftMessage = orderItemShipGroup.giftMessage;
+ orderMap.shipmentMethodType = EntityUtil.getFirst(orderItemShipGroup.getRelated("ShipmentMethodType", null, null, false)).description
+ orderMap.carrierPartyId = orderItemShipGroup.carrierPartyId
+ orderMap.shipGroupSeqId = orderItemShipGroup.shipGroupSeqId
+ orderMap.carrierPartyId = orderItemShipGroup.carrierPartyId
+ orderMap.isGift = orderItemShipGroup.isGift
+ orderMap.giftMessage = orderItemShipGroup.giftMessage
}
- orderMap.shippingAddress = shippingAddress;
+ orderMap.shippingAddress = shippingAddress
if (billingOrderContactMechs.size() > 0) {
- orderMap.billingAddress = billingAddress;
+ orderMap.billingAddress = billingAddress
}
- orderInfoMap = [:];
- orderInfoMap.(orderHeader.orderId) = orderMap;
+ orderInfoMap = [:]
+ orderInfoMap.(orderHeader.orderId) = orderMap
}
- addInMap = "true";
- orderItemMap = [:];
+ addInMap = "true"
+ orderItemMap = [:]
orderItemShipGrpInvResInfoList.each { orderItemShipGrpInvResInfos ->
orderItemShipGrpInvResInfos.each { orderItemShipGrpInvResInfo ->
if (orderItemShipGrpInvResInfo.orderItemShipGrpInvRes.orderId == orderId && addInMap == "true") {
- orderItemMap.(orderHeader.orderId) = orderItemShipGrpInvResInfos;
- addInMap = "false";
+ orderItemMap.(orderHeader.orderId) = orderItemShipGrpInvResInfos
+ addInMap = "false"
}
}
}
- orderChargeMap = [:];
- orderReadHelper = new OrderReadHelper(orderHeader);
- orderItems = orderReadHelper.getOrderItems();
- orderAdjustments = orderReadHelper.getAdjustments();
- orderHeaderAdjustments = orderReadHelper.getOrderHeaderAdjustments();
- context.orderHeaderAdjustments = orderHeaderAdjustments;
- orderSubTotal = orderReadHelper.getOrderItemsSubTotal();
- context.orderSubTotal = orderSubTotal;
- otherAdjAmount = orderReadHelper.calcOrderAdjustments(orderHeaderAdjustments, orderSubTotal, true, false, false);
- shippingAmount = orderReadHelper.getAllOrderItemsAdjustmentsTotal(orderItems, orderAdjustments, false, false, true);
- shippingAmount = shippingAmount.add(orderReadHelper.calcOrderAdjustments(orderHeaderAdjustments, orderSubTotal, false, false, true));
- taxAmount = orderReadHelper.getAllOrderItemsAdjustmentsTotal(orderItems, orderAdjustments, false, true, false);
- taxAmount = taxAmount.add(orderReadHelper.calcOrderAdjustments(orderHeaderAdjustments, orderSubTotal, false, true, false));
- grandTotal = orderReadHelper.getOrderGrandTotal(orderItems, orderAdjustments);
- orderChargeMap.orderSubTotal = orderSubTotal;
- orderChargeMap.taxAmount = taxAmount;
- orderChargeMap.shippingAmount = shippingAmount;
- orderChargeMap.otherAdjAmount = otherAdjAmount;
- orderChargeMap.grandTotal = grandTotal;
- orderChargeMap.totalItem = orderItems.size();
- orderCharges = [:];
- orderCharges.(orderHeader.orderId) = orderChargeMap;
- orderChargeList.add(orderCharges);
- itemInfoList.add(orderItemMap);
- orderInfoList.add(orderInfoMap);
- orderList.add(orderHeader);
- context.orderHeaderList = orderList;
- context.orderInfoList = orderInfoList;
- context.itemInfoList = itemInfoList;
- context.orderChargeList = orderChargeList;
+ orderChargeMap = [:]
+ orderReadHelper = new OrderReadHelper(orderHeader)
+ orderItems = orderReadHelper.getOrderItems()
+ orderAdjustments = orderReadHelper.getAdjustments()
+ orderHeaderAdjustments = orderReadHelper.getOrderHeaderAdjustments()
+ context.orderHeaderAdjustments = orderHeaderAdjustments
+ orderSubTotal = orderReadHelper.getOrderItemsSubTotal()
+ context.orderSubTotal = orderSubTotal
+ otherAdjAmount = orderReadHelper.calcOrderAdjustments(orderHeaderAdjustments, orderSubTotal, true, false, false)
+ shippingAmount = orderReadHelper.getAllOrderItemsAdjustmentsTotal(orderItems, orderAdjustments, false, false, true)
+ shippingAmount = shippingAmount.add(orderReadHelper.calcOrderAdjustments(orderHeaderAdjustments, orderSubTotal, false, false, true))
+ taxAmount = orderReadHelper.getAllOrderItemsAdjustmentsTotal(orderItems, orderAdjustments, false, true, false)
+ taxAmount = taxAmount.add(orderReadHelper.calcOrderAdjustments(orderHeaderAdjustments, orderSubTotal, false, true, false))
+ grandTotal = orderReadHelper.getOrderGrandTotal(orderItems, orderAdjustments)
+ orderChargeMap.orderSubTotal = orderSubTotal
+ orderChargeMap.taxAmount = taxAmount
+ orderChargeMap.shippingAmount = shippingAmount
+ orderChargeMap.otherAdjAmount = otherAdjAmount
+ orderChargeMap.grandTotal = grandTotal
+ orderChargeMap.totalItem = orderItems.size()
+ orderCharges = [:]
+ orderCharges.(orderHeader.orderId) = orderChargeMap
+ orderChargeList.add(orderCharges)
+ itemInfoList.add(orderItemMap)
+ orderInfoList.add(orderInfoMap)
+ orderList.add(orderHeader)
+ context.orderHeaderList = orderList
+ context.orderInfoList = orderInfoList
+ context.itemInfoList = itemInfoList
+ context.orderChargeList = orderChargeList
}
}
}
}
- UtilHttp.setContentDisposition(response, "orderPickSheet.pdf");
+ UtilHttp.setContentDisposition(response, "orderPickSheet.pdf")
}
diff --git a/applications/product/groovyScripts/facility/shipment/QuickShipOrder.groovy b/applications/product/groovyScripts/facility/shipment/QuickShipOrder.groovy
index 0427b89cda..bfd55a852c 100644
--- a/applications/product/groovyScripts/facility/shipment/QuickShipOrder.groovy
+++ b/applications/product/groovyScripts/facility/shipment/QuickShipOrder.groovy
@@ -19,60 +19,60 @@
import org.apache.ofbiz.base.util.*
import org.apache.ofbiz.order.order.*
-import org.apache.ofbiz.entity.util.EntityUtilProperties;
+import org.apache.ofbiz.entity.util.EntityUtilProperties
-facilityId = parameters.facilityId;
+facilityId = parameters.facilityId
if (facilityId) {
- facility = from("Facility").where("facilityId", facilityId).queryOne();
- context.facilityId = facilityId;
- context.facility = facility;
+ facility = from("Facility").where("facilityId", facilityId).queryOne()
+ context.facilityId = facilityId
+ context.facility = facility
}
orderId = parameters.orderId
if (orderId) {
- orderHeader = from("OrderHeader").where("orderId", orderId).queryOne();
+ orderHeader = from("OrderHeader").where("orderId", orderId).queryOne()
if (orderHeader) {
- OrderReadHelper orh = new OrderReadHelper(orderHeader);
- context.orderId = orderId;
- context.orderHeader = orderHeader;
- context.orderReadHelper = orh;
+ OrderReadHelper orh = new OrderReadHelper(orderHeader)
+ context.orderId = orderId
+ context.orderHeader = orderHeader
+ context.orderReadHelper = orh
} else {
- request.setAttribute("_ERROR_MESSAGE_", "Order #" + orderId + " cannot be found.");
+ request.setAttribute("_ERROR_MESSAGE_", "Order #" + orderId + " cannot be found.")
}
}
-shipmentId = parameters.shipmentId;
+shipmentId = parameters.shipmentId
if (shipmentId) {
- shipment = from("Shipment").where("shipmentId", shipmentId).queryOne();
+ shipment = from("Shipment").where("shipmentId", shipmentId).queryOne()
if (shipment) {
// nuke event message - throws off the flow
- request.setAttribute("_EVENT_MESSAGE_", null);
+ request.setAttribute("_EVENT_MESSAGE_", null)
// set the shipment context info
- context.shipmentType = shipment.getRelatedOne("ShipmentType", true);
- context.statusItem = shipment.getRelatedOne("StatusItem", false);
- context.primaryOrderHeader = shipment.getRelatedOne("PrimaryOrderHeader", false);
- context.toPerson = shipment.getRelatedOne("ToPerson", false);
- context.toPartyGroup = shipment.getRelatedOne("ToPartyGroup", false);
- context.fromPerson = shipment.getRelatedOne("FromPerson", false);
- context.fromPartyGroup = shipment.getRelatedOne("FromPartyGroup", false);
- context.originFacility = shipment.getRelatedOne("OriginFacility", false);
- context.destinationFacility = shipment.getRelatedOne("DestinationFacility", false);
- context.originPostalAddress = shipment.getRelatedOne("OriginPostalAddress", false);
- context.destinationPostalAddress = shipment.getRelatedOne("DestinationPostalAddress", false);
- context.shipmentPackages = shipment.getRelated("ShipmentPackage", null, ['shipmentPackageSeqId'], false);
- context.shipmentRoutes = shipment.getRelated("ShipmentRouteSegment", null, ['shipmentRouteSegmentId'], false);
- context.shipment = shipment;
- context.shipmentId = shipmentId;
+ context.shipmentType = shipment.getRelatedOne("ShipmentType", true)
+ context.statusItem = shipment.getRelatedOne("StatusItem", false)
+ context.primaryOrderHeader = shipment.getRelatedOne("PrimaryOrderHeader", false)
+ context.toPerson = shipment.getRelatedOne("ToPerson", false)
+ context.toPartyGroup = shipment.getRelatedOne("ToPartyGroup", false)
+ context.fromPerson = shipment.getRelatedOne("FromPerson", false)
+ context.fromPartyGroup = shipment.getRelatedOne("FromPartyGroup", false)
+ context.originFacility = shipment.getRelatedOne("OriginFacility", false)
+ context.destinationFacility = shipment.getRelatedOne("DestinationFacility", false)
+ context.originPostalAddress = shipment.getRelatedOne("OriginPostalAddress", false)
+ context.destinationPostalAddress = shipment.getRelatedOne("DestinationPostalAddress", false)
+ context.shipmentPackages = shipment.getRelated("ShipmentPackage", null, ['shipmentPackageSeqId'], false)
+ context.shipmentRoutes = shipment.getRelated("ShipmentRouteSegment", null, ['shipmentRouteSegmentId'], false)
+ context.shipment = shipment
+ context.shipmentId = shipmentId
- weightUoms = from("Uom").where("uomTypeId", "WEIGHT_MEASURE").orderBy("description").queryList();
- defaultWeightUom = EntityUtilProperties.getPropertyValue("shipment", "shipment.default.weight.uom", delegator);
+ weightUoms = from("Uom").where("uomTypeId", "WEIGHT_MEASURE").orderBy("description").queryList()
+ defaultWeightUom = EntityUtilProperties.getPropertyValue("shipment", "shipment.default.weight.uom", delegator)
if (defaultWeightUom) {
- defaultWeight = from("Uom").where("uomId", defaultWeightUom).queryOne();
+ defaultWeight = from("Uom").where("uomId", defaultWeightUom).queryOne()
if (defaultWeight) {
- weightUoms.add(0, defaultWeight);
+ weightUoms.add(0, defaultWeight)
}
}
- context.weightUomList = weightUoms;
+ context.weightUomList = weightUoms
}
}
diff --git a/applications/product/groovyScripts/facility/shipment/ReceiveInventoryAgainstPurchaseOrder.groovy b/applications/product/groovyScripts/facility/shipment/ReceiveInventoryAgainstPurchaseOrder.groovy
index 2f7a9f49b7..2532d9e9eb 100644
--- a/applications/product/groovyScripts/facility/shipment/ReceiveInventoryAgainstPurchaseOrder.groovy
+++ b/applications/product/groovyScripts/facility/shipment/ReceiveInventoryAgainstPurchaseOrder.groovy
@@ -22,148 +22,148 @@ import org.apache.ofbiz.entity.util.*
import org.apache.ofbiz.service.ServiceUtil
import org.apache.ofbiz.base.util.*
-shipmentId = request.getParameter("shipmentId");
-orderId = request.getParameter("purchaseOrderId");
-shipGroupSeqId = request.getParameter("shipGroupSeqId");
-context.shipmentId = shipmentId;
-context.shipGroupSeqId = shipGroupSeqId;
+shipmentId = request.getParameter("shipmentId")
+orderId = request.getParameter("purchaseOrderId")
+shipGroupSeqId = request.getParameter("shipGroupSeqId")
+context.shipmentId = shipmentId
+context.shipGroupSeqId = shipGroupSeqId
// Retrieve the map resident in session which stores order item quantities to receive
-itemQuantitiesToReceive = session.getAttribute("purchaseOrderItemQuantitiesToReceive");
+itemQuantitiesToReceive = session.getAttribute("purchaseOrderItemQuantitiesToReceive")
if (itemQuantitiesToReceive) {
- sessionShipmentId = itemQuantitiesToReceive._shipmentId;
- sessionOrderId = itemQuantitiesToReceive._orderId;
+ sessionShipmentId = itemQuantitiesToReceive._shipmentId
+ sessionOrderId = itemQuantitiesToReceive._orderId
if ((sessionShipmentId && !sessionShipmentId.equals(shipmentId)) ||
((sessionOrderId && !sessionOrderId.equals(orderId))) ||
"Y".equals(request.getParameter("clearAll"))) {
// Clear the map if the shipmentId or orderId are different than the current ones, or
// if the clearAll parameter is present
- itemQuantitiesToReceive.clear();
+ itemQuantitiesToReceive.clear()
}
}
-shipment = from("Shipment").where("shipmentId", shipmentId).queryOne();
-context.shipment = shipment;
+shipment = from("Shipment").where("shipmentId", shipmentId).queryOne()
+context.shipment = shipment
if (!shipment) {
- return;
+ return
}
-isPurchaseShipment = "PURCHASE_SHIPMENT".equals(shipment.shipmentTypeId);
-context.isPurchaseShipment = isPurchaseShipment;
+isPurchaseShipment = "PURCHASE_SHIPMENT".equals(shipment.shipmentTypeId)
+context.isPurchaseShipment = isPurchaseShipment
if (!isPurchaseShipment) {
- return;
+ return
}
-facility = shipment.getRelatedOne("DestinationFacility", false);
-context.facility = facility;
-context.facilityId = shipment.destinationFacilityId;
-context.now = UtilDateTime.nowTimestamp();
+facility = shipment.getRelatedOne("DestinationFacility", false)
+context.facility = facility
+context.facilityId = shipment.destinationFacilityId
+context.now = UtilDateTime.nowTimestamp()
if (!orderId) {
- orderId = shipment.primaryOrderId;
+ orderId = shipment.primaryOrderId
}
if (!shipGroupSeqId) {
- shipGroupSeqId = shipment.primaryShipGroupSeqId;
+ shipGroupSeqId = shipment.primaryShipGroupSeqId
}
-context.orderId = orderId;
+context.orderId = orderId
if (!orderId) {
- return;
+ return
}
-orderHeader = from("OrderHeader").where("orderId", orderId).queryOne();
-context.orderHeader = orderHeader;
+orderHeader = from("OrderHeader").where("orderId", orderId).queryOne()
+context.orderHeader = orderHeader
if (!orderHeader) {
- return;
+ return
}
-isPurchaseOrder = "PURCHASE_ORDER".equals(orderHeader.orderTypeId);
-context.isPurchaseOrder = isPurchaseOrder;
+isPurchaseOrder = "PURCHASE_ORDER".equals(orderHeader.orderTypeId)
+context.isPurchaseOrder = isPurchaseOrder
if (!isPurchaseOrder) {
- return;
+ return
}
// Get the base currency from the facility owner, for currency conversions
-baseCurrencyUomId = null;
+baseCurrencyUomId = null
if (facility) {
- owner = facility.getRelatedOne("OwnerParty", false);
+ owner = facility.getRelatedOne("OwnerParty", false)
if (owner) {
- result = runService('getPartyAccountingPreferences', [organizationPartyId : owner.partyId, userLogin : request.getAttribute("userLogin")]);
+ result = runService('getPartyAccountingPreferences', [organizationPartyId : owner.partyId, userLogin : request.getAttribute("userLogin")])
if (!ServiceUtil.isError(result) && result.partyAccountingPreference) {
- ownerAcctgPref = result.partyAccountingPreference;
+ ownerAcctgPref = result.partyAccountingPreference
}
}
if (ownerAcctgPref) {
- baseCurrencyUomId = ownerAcctgPref.baseCurrencyUomId;
+ baseCurrencyUomId = ownerAcctgPref.baseCurrencyUomId
}
}
-inventoryItemTypes = from("InventoryItemType").queryList();
-context.inventoryItemTypes = inventoryItemTypes;
+inventoryItemTypes = from("InventoryItemType").queryList()
+context.inventoryItemTypes = inventoryItemTypes
// Populate the tracking map with shipment and order IDs
if (!itemQuantitiesToReceive) {
- itemQuantitiesToReceive = [_shipmentId : shipmentId, _orderId : orderId];
+ itemQuantitiesToReceive = [_shipmentId : shipmentId, _orderId : orderId]
}
-oiasgaLimitMap = null;
+oiasgaLimitMap = null
if (shipGroupSeqId) {
- oiasgaLimitMap = [shipGroupSeqId : shipGroupSeqId];
+ oiasgaLimitMap = [shipGroupSeqId : shipGroupSeqId]
}
-orderItemDatas = [:] as TreeMap;
-totalAvailableToReceive = 0;
+orderItemDatas = [:] as TreeMap
+totalAvailableToReceive = 0
// Populate the order item data for the FTL
-orderItems = orderHeader.getRelated("OrderItemAndShipGroupAssoc", oiasgaLimitMap, ['shipGroupSeqId', 'orderItemSeqId'], false);
+orderItems = orderHeader.getRelated("OrderItemAndShipGroupAssoc", oiasgaLimitMap, ['shipGroupSeqId', 'orderItemSeqId'], false)
orderItems.each { orderItemAndShipGroupAssoc ->
- product = orderItemAndShipGroupAssoc.getRelatedOne("Product", false);
+ product = orderItemAndShipGroupAssoc.getRelatedOne("Product", false)
// Get the order item, since the orderItemAndShipGroupAssoc's quantity field is manipulated in some cases
- orderItem = from("OrderItem").where("orderId", orderId, "orderItemSeqId", orderItemAndShipGroupAssoc.orderItemSeqId).queryOne();
- orderItemData = [:];
+ orderItem = from("OrderItem").where("orderId", orderId, "orderItemSeqId", orderItemAndShipGroupAssoc.orderItemSeqId).queryOne()
+ orderItemData = [:]
// Get the item's ordered quantity
- totalOrdered = 0;
- ordered = orderItem.getDouble("quantity");
+ totalOrdered = 0
+ ordered = orderItem.getDouble("quantity")
if (ordered) {
- totalOrdered += ordered.doubleValue();
+ totalOrdered += ordered.doubleValue()
}
- cancelled = orderItem.getDouble("cancelQuantity");
+ cancelled = orderItem.getDouble("cancelQuantity")
if (cancelled) {
- totalOrdered -= cancelled.doubleValue();
+ totalOrdered -= cancelled.doubleValue()
}
// Get the item quantity received from all shipments via the ShipmentReceipt entity
- totalReceived = 0.0;
- receipts = from("ShipmentReceipt").where("orderId", orderId, "orderItemSeqId", orderItem.orderItemSeqId).queryList();
- fulfilledReservations = [] as ArrayList;
+ totalReceived = 0.0
+ receipts = from("ShipmentReceipt").where("orderId", orderId, "orderItemSeqId", orderItem.orderItemSeqId).queryList()
+ fulfilledReservations = [] as ArrayList
if (receipts) {
receipts.each { rec ->
- accepted = rec.getDouble("quantityAccepted");
- rejected = rec.getDouble("quantityRejected");
+ accepted = rec.getDouble("quantityAccepted")
+ rejected = rec.getDouble("quantityRejected")
if (accepted) {
- totalReceived += accepted.doubleValue();
+ totalReceived += accepted.doubleValue()
}
if (rejected) {
- totalReceived += rejected.doubleValue();
+ totalReceived += rejected.doubleValue()
}
// Get the reservations related to this receipt
- oisgirs = from("OrderItemShipGrpInvRes").where("inventoryItemId", rec.inventoryItemId).queryList();
+ oisgirs = from("OrderItemShipGrpInvRes").where("inventoryItemId", rec.inventoryItemId).queryList()
if (oisgirs) {
- fulfilledReservations.addAll(oisgirs);
+ fulfilledReservations.addAll(oisgirs)
}
}
}
- orderItemData.fulfilledReservations = fulfilledReservations;
+ orderItemData.fulfilledReservations = fulfilledReservations
// Update the unit cost with the converted value, if any
if (baseCurrencyUomId && orderHeader.currencyUom) {
if (product) {
- result = runService('convertUom', [uomId : orderHeader.currencyUom, uomIdTo : baseCurrencyUomId, originalValue : orderItem.unitPrice]);
+ result = runService('convertUom', [uomId : orderHeader.currencyUom, uomIdTo : baseCurrencyUomId, originalValue : orderItem.unitPrice])
if (!ServiceUtil.isError(result)) {
- orderItem.unitPrice = result.convertedValue;
+ orderItem.unitPrice = result.convertedValue
}
}
}
@@ -171,103 +171,103 @@ orderItems.each { orderItemAndShipGroupAssoc ->
// Retrieve the backordered quantity
// TODO: limit to a facility? The shipment destination facility is not necessarily the same facility as the inventory
conditions = [EntityCondition.makeCondition("productId", EntityOperator.EQUALS, product.productId),
- EntityCondition.makeCondition("availableToPromiseTotal", EntityOperator.LESS_THAN, BigDecimal.ZERO)];
- negativeInventoryItems = from("InventoryItem").where(conditions).queryList();
- backOrderedQuantity = 0;
+ EntityCondition.makeCondition("availableToPromiseTotal", EntityOperator.LESS_THAN, BigDecimal.ZERO)]
+ negativeInventoryItems = from("InventoryItem").where(conditions).queryList()
+ backOrderedQuantity = 0
negativeInventoryItems.each { negativeInventoryItem ->
- backOrderedQuantity += negativeInventoryItem.getDouble("availableToPromiseTotal").doubleValue();
+ backOrderedQuantity += negativeInventoryItem.getDouble("availableToPromiseTotal").doubleValue()
}
- orderItemData.backOrderedQuantity = Math.abs(backOrderedQuantity);
+ orderItemData.backOrderedQuantity = Math.abs(backOrderedQuantity)
// Calculate how many units it should be possible to recieve for this purchase order
- availableToReceive = totalOrdered - totalReceived;
- totalAvailableToReceive += availableToReceive;
- orderItemData.availableToReceive = availableToReceive;
- orderItemData.totalQuantityReceived = totalReceived;
- orderItemData.shipGroupSeqId = orderItemAndShipGroupAssoc.shipGroupSeqId;
- orderItemData.orderItem = orderItem;
- orderItemData.product = product;
- orderItemDatas.put(orderItem.orderItemSeqId, orderItemData);
+ availableToReceive = totalOrdered - totalReceived
+ totalAvailableToReceive += availableToReceive
+ orderItemData.availableToReceive = availableToReceive
+ orderItemData.totalQuantityReceived = totalReceived
+ orderItemData.shipGroupSeqId = orderItemAndShipGroupAssoc.shipGroupSeqId
+ orderItemData.orderItem = orderItem
+ orderItemData.product = product
+ orderItemDatas.put(orderItem.orderItemSeqId, orderItemData)
}
-context.orderItemDatas = orderItemDatas.values();
+context.orderItemDatas = orderItemDatas.values()
// Handle any item product quantities to receive by adding to the map in session
-productIdToReceive = request.getParameter("productId");
-productQtyToReceive = request.getParameter("quantity");
-context.newQuantity = productQtyToReceive;
+productIdToReceive = request.getParameter("productId")
+productQtyToReceive = request.getParameter("quantity")
+context.newQuantity = productQtyToReceive
if (productIdToReceive) {
- List candidateOrderItems = EntityUtil.filterByAnd(orderItems, [productId : productIdToReceive]);
+ List candidateOrderItems = EntityUtil.filterByAnd(orderItems, [productId : productIdToReceive])
// If the productId as given isn't found in the order, try any goodIdentifications and use the first match
if (!candidateOrderItems) {
- goodIdentifications = from("GoodIdentification").where("idValue", productIdToReceive).queryList();
+ goodIdentifications = from("GoodIdentification").where("idValue", productIdToReceive).queryList()
if (goodIdentifications) {
- giit = goodIdentifications.iterator();
+ giit = goodIdentifications.iterator()
while (giit.hasNext()) {
- goodIdentification = giit.next();
- candidateOrderItems = EntityUtil.filterByAnd(orderItems, [productId : goodIdentification.productId]);
+ goodIdentification = giit.next()
+ candidateOrderItems = EntityUtil.filterByAnd(orderItems, [productId : goodIdentification.productId])
if (candidateOrderItems) {
- productIdToReceive = goodIdentification.productId;
- break;
+ productIdToReceive = goodIdentification.productId
+ break
}
}
}
}
if (candidateOrderItems) {
- quantity = 0;
+ quantity = 0
if (productQtyToReceive) {
try {
- quantity = Double.parseDouble(productQtyToReceive);
+ quantity = Double.parseDouble(productQtyToReceive)
} catch (Exception e) {
// Ignore the quantity update if there's a problem parsing it
}
}
- totalQuantityUsed = 0;
- totalQuantityToReceiveBefore = 0;
- pqit = candidateOrderItems.iterator();
+ totalQuantityUsed = 0
+ totalQuantityToReceiveBefore = 0
+ pqit = candidateOrderItems.iterator()
while (pqit.hasNext() && totalQuantityUsed < quantity) {
- candidateOrderItem = pqit.next();
- orderItemSeqId = candidateOrderItem.orderItemSeqId;
- qtyBefore = itemQuantitiesToReceive.containsKey(orderItemSeqId) ? itemQuantitiesToReceive.get(orderItemSeqId) : 0;
- totalQuantityToReceiveBefore += qtyBefore;
- qtyMaxAvailable = orderItemDatas.get(orderItemSeqId).availableToReceive - qtyBefore;
+ candidateOrderItem = pqit.next()
+ orderItemSeqId = candidateOrderItem.orderItemSeqId
+ qtyBefore = itemQuantitiesToReceive.containsKey(orderItemSeqId) ? itemQuantitiesToReceive.get(orderItemSeqId) : 0
+ totalQuantityToReceiveBefore += qtyBefore
+ qtyMaxAvailable = orderItemDatas.get(orderItemSeqId).availableToReceive - qtyBefore
if (qtyMaxAvailable <= 0) {
- continue;
+ continue
}
- qtyUsedForItem = quantity - totalQuantityUsed >= qtyMaxAvailable ? qtyMaxAvailable : quantity - totalQuantityUsed;
- itemQuantitiesToReceive.put(orderItemSeqId, qtyUsedForItem + qtyBefore);
- totalQuantityUsed += qtyUsedForItem;
+ qtyUsedForItem = quantity - totalQuantityUsed >= qtyMaxAvailable ? qtyMaxAvailable : quantity - totalQuantityUsed
+ itemQuantitiesToReceive.put(orderItemSeqId, qtyUsedForItem + qtyBefore)
+ totalQuantityUsed += qtyUsedForItem
}
// If there's any quantity to receive left after using as much as possible for every relevant order item, add an error message to the context
if (quantity > totalQuantityUsed) {
- context.ProductReceiveInventoryAgainstPurchaseOrderQuantityExceedsAvailableToReceive = true;
+ context.ProductReceiveInventoryAgainstPurchaseOrderQuantityExceedsAvailableToReceive = true
}
// Notify if some or all of the quantity just entered for the product will go to a backorder
- backOrderedQuantity = orderItemDatas.get(EntityUtil.getFirst(candidateOrderItems).orderItemSeqId).backOrderedQuantity - totalQuantityToReceiveBefore;
+ backOrderedQuantity = orderItemDatas.get(EntityUtil.getFirst(candidateOrderItems).orderItemSeqId).backOrderedQuantity - totalQuantityToReceiveBefore
if (backOrderedQuantity > 0) {
- totalQtyUsedForBackorders = backOrderedQuantity >= totalQuantityUsed ? totalQuantityUsed : backOrderedQuantity;
+ totalQtyUsedForBackorders = backOrderedQuantity >= totalQuantityUsed ? totalQuantityUsed : backOrderedQuantity
if (totalQtyUsedForBackorders > 0) {
- context.quantityToReceive = totalQuantityUsed;
- context.quantityToBackOrder = totalQtyUsedForBackorders;
- context.ProductReceiveInventoryAgainstPurchaseOrderQuantityGoesToBackOrder = true;
+ context.quantityToReceive = totalQuantityUsed
+ context.quantityToBackOrder = totalQtyUsedForBackorders
+ context.ProductReceiveInventoryAgainstPurchaseOrderQuantityGoesToBackOrder = true
}
}
} else {
// Add an error message to the context if the productId doesn't exist in this purchase order
- context.ProductReceiveInventoryAgainstPurchaseOrderProductNotFound = true;
+ context.ProductReceiveInventoryAgainstPurchaseOrderProductNotFound = true
}
}
// Put the tracking map back into the session, in case it has been reconstructed
-session.setAttribute("purchaseOrderItemQuantitiesToReceive", itemQuantitiesToReceive);
-context.itemQuantitiesToReceive = itemQuantitiesToReceive;
-context.totalAvailableToReceive = totalAvailableToReceive;
+session.setAttribute("purchaseOrderItemQuantitiesToReceive", itemQuantitiesToReceive)
+context.itemQuantitiesToReceive = itemQuantitiesToReceive
+context.totalAvailableToReceive = totalAvailableToReceive
diff --git a/applications/product/groovyScripts/facility/shipment/ReviewOrdersNotPickedOrPacked.groovy b/applications/product/groovyScripts/facility/shipment/ReviewOrdersNotPickedOrPacked.groovy
index 41cbf37ef1..cecd666501 100644
--- a/applications/product/groovyScripts/facility/shipment/ReviewOrdersNotPickedOrPacked.groovy
+++ b/applications/product/groovyScripts/facility/shipment/ReviewOrdersNotPickedOrPacked.groovy
@@ -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.util.EntityUtil;
+import org.apache.ofbiz.entity.condition.EntityCondition
+import org.apache.ofbiz.entity.condition.EntityOperator
+import org.apache.ofbiz.entity.util.EntityUtil
-import java.text.SimpleDateFormat;
+import java.text.SimpleDateFormat
-condList = [];
-condList.add(EntityCondition.makeCondition("statusId", EntityOperator.EQUALS, "ORDER_APPROVED"));
-condList.add(EntityCondition.makeCondition("orderTypeId", EntityOperator.EQUALS, "SALES_ORDER"));
-condList.add(EntityCondition.makeCondition("pickSheetPrintedDate", EntityOperator.NOT_EQUAL, null));
-orderHeaders = from("OrderHeader").where(condList).queryList();
-orders = [];
-SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd'/'K:mm a");
+condList = []
+condList.add(EntityCondition.makeCondition("statusId", EntityOperator.EQUALS, "ORDER_APPROVED"))
+condList.add(EntityCondition.makeCondition("orderTypeId", EntityOperator.EQUALS, "SALES_ORDER"))
+condList.add(EntityCondition.makeCondition("pickSheetPrintedDate", EntityOperator.NOT_EQUAL, null))
+orderHeaders = from("OrderHeader").where(condList).queryList()
+orders = []
+SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd'/'K:mm a")
orderHeaders.each { orderHeader ->
- itemIssuanceList = from("ItemIssuance").where("orderId", orderHeader.orderId).queryList();
+ itemIssuanceList = from("ItemIssuance").where("orderId", orderHeader.orderId).queryList()
if (itemIssuanceList) {
- orders.add([orderId : orderHeader.orderId, pickSheetPrintedDate : dateFormat.format(orderHeader.pickSheetPrintedDate), isVerified : "Y"]);
+ orders.add([orderId : orderHeader.orderId, pickSheetPrintedDate : dateFormat.format(orderHeader.pickSheetPrintedDate), isVerified : "Y"])
} else {
- orders.add([orderId : orderHeader.orderId, pickSheetPrintedDate : dateFormat.format(orderHeader.pickSheetPrintedDate), isVerified : "N"]);
+ orders.add([orderId : orderHeader.orderId, pickSheetPrintedDate : dateFormat.format(orderHeader.pickSheetPrintedDate), isVerified : "N"])
}
}
-context.orders = orders;
+context.orders = orders
diff --git a/applications/product/groovyScripts/facility/shipment/ShipmentManifest.groovy b/applications/product/groovyScripts/facility/shipment/ShipmentManifest.groovy
index cf1daa40f2..1cef6117eb 100644
--- a/applications/product/groovyScripts/facility/shipment/ShipmentManifest.groovy
+++ b/applications/product/groovyScripts/facility/shipment/ShipmentManifest.groovy
@@ -21,44 +21,44 @@ import org.apache.ofbiz.entity.*
import org.apache.ofbiz.base.util.*
import org.apache.ofbiz.content.report.*
-shipmentId = request.getParameter("shipmentId");
-shipment = from("Shipment").where("shipmentId", shipmentId).queryOne();
+shipmentId = request.getParameter("shipmentId")
+shipment = from("Shipment").where("shipmentId", shipmentId).queryOne()
if (shipment) {
- shipmentPackageRouteSegs = shipment.getRelated("ShipmentPackageRouteSeg", null, ['shipmentRouteSegmentId', 'shipmentPackageSeqId'], false);
- shipmentPackageDatas = [] as LinkedList;
+ shipmentPackageRouteSegs = shipment.getRelated("ShipmentPackageRouteSeg", null, ['shipmentRouteSegmentId', 'shipmentPackageSeqId'], false)
+ shipmentPackageDatas = [] as LinkedList
if (shipmentPackageRouteSegs) {
shipmentPackageRouteSegs.each { shipmentPackageRouteSeg ->
- shipmentPackages = shipmentPackageRouteSeg.getRelated("ShipmentPackage", null, ['shipmentPackageSeqId'], false);
- shipmentRouteSegment = shipmentPackageRouteSeg.getRelatedOne("ShipmentRouteSegment", false);
+ shipmentPackages = shipmentPackageRouteSeg.getRelated("ShipmentPackage", null, ['shipmentPackageSeqId'], false)
+ shipmentRouteSegment = shipmentPackageRouteSeg.getRelatedOne("ShipmentRouteSegment", false)
if (shipmentPackages) {
shipmentPackages.each { shipmentPackage ->
- shipmentItemsDatas = [] as LinkedList;
- shipmentPackageContents = shipmentPackage.getRelated("ShipmentPackageContent", null, ['shipmentItemSeqId'], false);
+ shipmentItemsDatas = [] as LinkedList
+ shipmentPackageContents = shipmentPackage.getRelated("ShipmentPackageContent", null, ['shipmentItemSeqId'], false)
if (shipmentPackageContents) {
shipmentPackageContents.each { shipmentPackageContent ->
- shipmentItemsData = [:];
- packageQuantity = shipmentPackageContent.getDouble("quantity");
- shipmentItem = shipmentPackageContent.getRelatedOne("ShipmentItem", false);
+ shipmentItemsData = [:]
+ packageQuantity = shipmentPackageContent.getDouble("quantity")
+ shipmentItem = shipmentPackageContent.getRelatedOne("ShipmentItem", false)
if (shipmentItem) {
- shippedQuantity = shipmentItem.getDouble("quantity");
- shipmentItemsData.shipmentItem = shipmentItem;
- shipmentItemsData.shippedQuantity = shippedQuantity;
- shipmentItemsData.packageQuantity = packageQuantity;
- shipmentItemsDatas.add(shipmentItemsData);
+ shippedQuantity = shipmentItem.getDouble("quantity")
+ shipmentItemsData.shipmentItem = shipmentItem
+ shipmentItemsData.shippedQuantity = shippedQuantity
+ shipmentItemsData.packageQuantity = packageQuantity
+ shipmentItemsDatas.add(shipmentItemsData)
}
}
}
- shipmentPackageData = [:];
- shipmentPackageData.shipmentPackage = shipmentPackage;
- shipmentPackageData.shipmentRouteSegment = shipmentRouteSegment;
- shipmentPackageData.shipmentItemsDatas = shipmentItemsDatas;
- shipmentPackageDatas.add(shipmentPackageData);
+ shipmentPackageData = [:]
+ shipmentPackageData.shipmentPackage = shipmentPackage
+ shipmentPackageData.shipmentRouteSegment = shipmentRouteSegment
+ shipmentPackageData.shipmentItemsDatas = shipmentItemsDatas
+ shipmentPackageDatas.add(shipmentPackageData)
}
}
}
}
- context.shipmentPackageDatas = shipmentPackageDatas;
+ context.shipmentPackageDatas = shipmentPackageDatas
}
-context.shipmentId = shipmentId;
-context.shipment = shipment;
+context.shipmentId = shipmentId
+context.shipment = shipment
diff --git a/applications/product/groovyScripts/facility/shipment/VerifyPick.groovy b/applications/product/groovyScripts/facility/shipment/VerifyPick.groovy
index deadeb0e2a..b249ae6ba5 100644
--- a/applications/product/groovyScripts/facility/shipment/VerifyPick.groovy
+++ b/applications/product/groovyScripts/facility/shipment/VerifyPick.groovy
@@ -17,110 +17,110 @@
* under the License.
*/
-import org.apache.ofbiz.base.util.UtilProperties;
-import org.apache.ofbiz.entity.util.EntityUtil;
-import org.apache.ofbiz.entity.condition.EntityCondition;
-import org.apache.ofbiz.order.order.OrderReadHelper;
-import org.apache.ofbiz.shipment.verify.VerifyPickSession;
-import org.apache.ofbiz.base.util.UtilMisc;
-import org.apache.ofbiz.entity.condition.EntityOperator;
+import org.apache.ofbiz.base.util.UtilProperties
+import org.apache.ofbiz.entity.util.EntityUtil
+import org.apache.ofbiz.entity.condition.EntityCondition
+import org.apache.ofbiz.order.order.OrderReadHelper
+import org.apache.ofbiz.shipment.verify.VerifyPickSession
+import org.apache.ofbiz.base.util.UtilMisc
+import org.apache.ofbiz.entity.condition.EntityOperator
-verifyPickSession = session.getAttribute("verifyPickSession");
+verifyPickSession = session.getAttribute("verifyPickSession")
if (!verifyPickSession) {
- verifyPickSession = new VerifyPickSession(dispatcher, userLogin);
- session.setAttribute("verifyPickSession", verifyPickSession);
+ verifyPickSession = new VerifyPickSession(dispatcher, userLogin)
+ session.setAttribute("verifyPickSession", verifyPickSession)
}
-shipmentId = parameters.shipmentId;
+shipmentId = parameters.shipmentId
if (!shipmentId) {
- shipmentId = request.getAttribute("shipmentId");
+ shipmentId = request.getAttribute("shipmentId")
}
-context.shipmentId = shipmentId;
+context.shipmentId = shipmentId
if (shipmentId) {
- context.orderId = null;
- shipment = from("Shipment").where("shipmentId", shipmentId).queryOne();
+ context.orderId = null
+ shipment = from("Shipment").where("shipmentId", shipmentId).queryOne()
if (shipment) {
- shipmentItemBillingList = shipment.getRelated("ShipmentItemBilling", null, null, false);
- invoiceIds = EntityUtil.getFieldListFromEntityList(shipmentItemBillingList, "invoiceId", true);
+ shipmentItemBillingList = shipment.getRelated("ShipmentItemBilling", null, null, false)
+ invoiceIds = EntityUtil.getFieldListFromEntityList(shipmentItemBillingList, "invoiceId", true)
if (invoiceIds) {
- context.invoiceIds = invoiceIds;
- parameters.orderId = null;
+ context.invoiceIds = invoiceIds
+ parameters.orderId = null
}
}
}
-facilityId = parameters.facilityId;
+facilityId = parameters.facilityId
if (facilityId) {
- facility = from("Facility").where("facilityId", facilityId).queryOne();
- context.facility = facility;
+ facility = from("Facility").where("facilityId", facilityId).queryOne()
+ context.facility = facility
}
-verifyPickSession.setFacilityId(facilityId);
-orderId = parameters.orderId;
-shipGroupSeqId = parameters.shipGroupSeqId;
+verifyPickSession.setFacilityId(facilityId)
+orderId = parameters.orderId
+shipGroupSeqId = parameters.shipGroupSeqId
if (orderId && !shipGroupSeqId && orderId.indexOf("/") > -1) {
- idArray = orderId.split("\\/");
- orderId = idArray[0];
- shipGroupSeqId = idArray[1];
+ idArray = orderId.split("\\/")
+ orderId = idArray[0]
+ shipGroupSeqId = idArray[1]
} else if (orderId && !shipGroupSeqId) {
- shipGroupSeqId = "00001";
+ shipGroupSeqId = "00001"
}
-picklistBinId = parameters.picklistBinId;
+picklistBinId = parameters.picklistBinId
if (picklistBinId) {
- picklistBin = from("PicklistBin").where("picklistBinId", picklistBinId).queryOne();
+ picklistBin = from("PicklistBin").where("picklistBinId", picklistBinId).queryOne()
if (picklistBin) {
- orderId = picklistBin.primaryOrderId;
- shipGroupSeqId = picklistBin.primaryShipGroupSeqId;
- verifyPickSession.setPicklistBinId(picklistBinId);
+ orderId = picklistBin.primaryOrderId
+ shipGroupSeqId = picklistBin.primaryShipGroupSeqId
+ verifyPickSession.setPicklistBinId(picklistBinId)
}
}
if (orderId && !picklistBinId) {
- picklistBin = from("PicklistBin").where("primaryOrderId", orderId).queryFirst();
+ picklistBin = from("PicklistBin").where("primaryOrderId", orderId).queryFirst()
if (picklistBin) {
- picklistBinId = picklistBin.picklistBinId;
- verifyPickSession.setPicklistBinId(picklistBinId);
+ picklistBinId = picklistBin.picklistBinId
+ verifyPickSession.setPicklistBinId(picklistBinId)
}
}
-context.orderId = orderId;
-context.shipGroupSeqId = shipGroupSeqId;
-context.picklistBinId = picklistBinId;
-context.isOrderStatusApproved = false;
+context.orderId = orderId
+context.shipGroupSeqId = shipGroupSeqId
+context.picklistBinId = picklistBinId
+context.isOrderStatusApproved = false
if (orderId) {
- orderHeader = from("OrderHeader").where("orderId", orderId).queryOne();
+ orderHeader = from("OrderHeader").where("orderId", orderId).queryOne()
if (orderHeader) {
- OrderReadHelper orh = new OrderReadHelper(orderHeader);
- context.orderId = orderId;
- context.orderHeader = orderHeader;
- context.orderReadHelper = orh;
+ OrderReadHelper orh = new OrderReadHelper(orderHeader)
+ context.orderId = orderId
+ context.orderHeader = orderHeader
+ context.orderReadHelper = orh
- orderItemShipGroup = orh.getOrderItemShipGroup(shipGroupSeqId);
- context.orderItemShipGroup = orderItemShipGroup;
- List exprs = UtilMisc.toList(EntityCondition.makeCondition("statusId", EntityOperator.EQUALS, "ITEM_APPROVED"));
- orderItems = orh.getOrderItemsByCondition(exprs);
- context.orderItems = orderItems;
+ orderItemShipGroup = orh.getOrderItemShipGroup(shipGroupSeqId)
+ context.orderItemShipGroup = orderItemShipGroup
+ List exprs = UtilMisc.toList(EntityCondition.makeCondition("statusId", EntityOperator.EQUALS, "ITEM_APPROVED"))
+ orderItems = orh.getOrderItemsByCondition(exprs)
+ context.orderItems = orderItems
if ("ORDER_APPROVED".equals(orderHeader.statusId)) {
- context.isOrderStatusApproved = true;
+ context.isOrderStatusApproved = true
if (shipGroupSeqId) {
- productStoreId = orh.getProductStoreId();
- context.productStoreId = productStoreId;
- shipments = from("Shipment").where("primaryOrderId", orderId, "statusId", "SHIPMENT_PICKED").queryList();
+ productStoreId = orh.getProductStoreId()
+ context.productStoreId = productStoreId
+ shipments = from("Shipment").where("primaryOrderId", orderId, "statusId", "SHIPMENT_PICKED").queryList()
if (shipments) {
- request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage("OrderErrorUiLabels", "OrderErrorAllItemsOfOrderAreAlreadyVerified", [orderId : orderId], locale));
+ request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage("OrderErrorUiLabels", "OrderErrorAllItemsOfOrderAreAlreadyVerified", [orderId : orderId], locale))
}
} else {
- request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage("ProductErrorUiLabels", "ProductErrorNoShipGroupSequenceIdFoundCannotProcess", locale));
+ request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage("ProductErrorUiLabels", "ProductErrorNoShipGroupSequenceIdFoundCannotProcess", locale))
}
} else {
- context.isOrderStatusApproved = false;
- request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage("OrderErrorUiLabels", "OrderErrorOrderNotApprovedForPicking", [orderId : orderId], locale));
+ context.isOrderStatusApproved = false
+ request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage("OrderErrorUiLabels", "OrderErrorOrderNotApprovedForPicking", [orderId : orderId], locale))
}
} else {
- request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage("OrderErrorUiLabels", "OrderErrorOrderIdNotFound", [orderId : orderId], locale));
+ request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage("OrderErrorUiLabels", "OrderErrorOrderIdNotFound", [orderId : orderId], locale))
}
}
-context.verifyPickSession = verifyPickSession;
+context.verifyPickSession = verifyPickSession
diff --git a/applications/product/groovyScripts/facility/shipment/ViewShipment.groovy b/applications/product/groovyScripts/facility/shipment/ViewShipment.groovy
index f3bd656682..0573679a8e 100644
--- a/applications/product/groovyScripts/facility/shipment/ViewShipment.groovy
+++ b/applications/product/groovyScripts/facility/shipment/ViewShipment.groovy
@@ -19,42 +19,42 @@
import org.apache.ofbiz.entity.condition.*
-shipmentId = parameters.shipmentId;
+shipmentId = parameters.shipmentId
if (!shipmentId) {
- shipmentId = request.getAttribute("shipmentId");
+ shipmentId = request.getAttribute("shipmentId")
}
-shipment = from("Shipment").where("shipmentId", shipmentId).queryOne();
+shipment = from("Shipment").where("shipmentId", shipmentId).queryOne()
-context.shipmentId = shipmentId;
-context.shipment = shipment;
+context.shipmentId = shipmentId
+context.shipment = shipment
if (shipment) {
- context.shipmentType = shipment.getRelatedOne("ShipmentType", false);
- context.statusItem = shipment.getRelatedOne("StatusItem", false);
- context.primaryOrderHeader = shipment.getRelatedOne("PrimaryOrderHeader", false);
- context.toPerson = shipment.getRelatedOne("ToPerson", false);
- context.toPartyGroup = shipment.getRelatedOne("ToPartyGroup", false);
- context.fromPerson = shipment.getRelatedOne("FromPerson", false);
- context.fromPartyGroup = shipment.getRelatedOne("FromPartyGroup", false);
- context.originFacility = shipment.getRelatedOne("OriginFacility", false);
- context.destinationFacility = shipment.getRelatedOne("DestinationFacility", false);
- context.originPostalAddress = shipment.getRelatedOne("OriginPostalAddress", false);
- context.destinationPostalAddress = shipment.getRelatedOne("DestinationPostalAddress", false);
+ context.shipmentType = shipment.getRelatedOne("ShipmentType", false)
+ context.statusItem = shipment.getRelatedOne("StatusItem", false)
+ context.primaryOrderHeader = shipment.getRelatedOne("PrimaryOrderHeader", false)
+ context.toPerson = shipment.getRelatedOne("ToPerson", false)
+ context.toPartyGroup = shipment.getRelatedOne("ToPartyGroup", false)
+ context.fromPerson = shipment.getRelatedOne("FromPerson", false)
+ context.fromPartyGroup = shipment.getRelatedOne("FromPartyGroup", false)
+ context.originFacility = shipment.getRelatedOne("OriginFacility", false)
+ context.destinationFacility = shipment.getRelatedOne("DestinationFacility", false)
+ context.originPostalAddress = shipment.getRelatedOne("OriginPostalAddress", false)
+ context.destinationPostalAddress = shipment.getRelatedOne("DestinationPostalAddress", false)
}
// check permission
-hasPermission = false;
+hasPermission = false
if (security.hasEntityPermission("FACILITY", "_VIEW", userLogin)) {
- hasPermission = true;
+ hasPermission = true
} else {
if (shipment) {
if (shipment.primaryOrderId) {
// allow if userLogin is associated with the primaryOrderId with the SUPPLIER_AGENT roleTypeId
- orderRole = from("OrderRole").where("orderId", shipment.primaryOrderId, "partyId", userLogin.partyId, "roleTypeId", "SUPPLIER_AGENT").queryOne();
+ orderRole = from("OrderRole").where("orderId", shipment.primaryOrderId, "partyId", userLogin.partyId, "roleTypeId", "SUPPLIER_AGENT").queryOne()
if (orderRole) {
- hasPermission = true;
+ hasPermission = true
}
}
}
}
-context.hasPermission = hasPermission;
+context.hasPermission = hasPermission
diff --git a/applications/product/groovyScripts/facility/shipment/WeightPackage.groovy b/applications/product/groovyScripts/facility/shipment/WeightPackage.groovy
index 30499d7996..4623dabade 100644
--- a/applications/product/groovyScripts/facility/shipment/WeightPackage.groovy
+++ b/applications/product/groovyScripts/facility/shipment/WeightPackage.groovy
@@ -17,188 +17,188 @@
* under the License.
*/
-import org.apache.ofbiz.base.util.UtilProperties;
-import org.apache.ofbiz.entity.GenericValue;
-import org.apache.ofbiz.entity.util.EntityUtil;
-import org.apache.ofbiz.entity.condition.EntityCondition;
-import org.apache.ofbiz.entity.util.EntityUtilProperties;
-import org.apache.ofbiz.order.order.OrderReadHelper;
-import org.apache.ofbiz.shipment.weightPackage.WeightPackageSession;
+import org.apache.ofbiz.base.util.UtilProperties
+import org.apache.ofbiz.entity.GenericValue
+import org.apache.ofbiz.entity.util.EntityUtil
+import org.apache.ofbiz.entity.condition.EntityCondition
+import org.apache.ofbiz.entity.util.EntityUtilProperties
+import org.apache.ofbiz.order.order.OrderReadHelper
+import org.apache.ofbiz.shipment.weightPackage.WeightPackageSession
-weightPackageSession = session.getAttribute("weightPackageSession");
+weightPackageSession = session.getAttribute("weightPackageSession")
if (!weightPackageSession) {
- weightPackageSession = new WeightPackageSession(dispatcher, userLogin);
- session.setAttribute("weightPackageSession", weightPackageSession);
+ weightPackageSession = new WeightPackageSession(dispatcher, userLogin)
+ session.setAttribute("weightPackageSession", weightPackageSession)
}
-context.weightPackageSession = weightPackageSession;
+context.weightPackageSession = weightPackageSession
-showWarningForm = parameters.showWarningForm;
+showWarningForm = parameters.showWarningForm
if (!showWarningForm) {
- showWarningForm = request.getAttribute("showWarningForm");
+ showWarningForm = request.getAttribute("showWarningForm")
if (!showWarningForm) {
- showWarningForm = false;
+ showWarningForm = false
}
}
-context.showWarningForm = showWarningForm;
+context.showWarningForm = showWarningForm
-orderId = parameters.orderId;
-shipGroupSeqId = parameters.shipGroupSeqId;
+orderId = parameters.orderId
+shipGroupSeqId = parameters.shipGroupSeqId
-shipment = from("Shipment").where("primaryOrderId", orderId, "statusId", "SHIPMENT_PICKED").queryFirst();
-context.shipment = shipment;
+shipment = from("Shipment").where("primaryOrderId", orderId, "statusId", "SHIPMENT_PICKED").queryFirst()
+context.shipment = shipment
if (shipment) {
- invoice = from("ShipmentItemBilling").where("shipmentId", shipment.shipmentId).queryFirst();
- context.invoice = invoice;
+ invoice = from("ShipmentItemBilling").where("shipmentId", shipment.shipmentId).queryFirst()
+ context.invoice = invoice
} else {
- context.invoice = null;
+ context.invoice = null
}
-actualCost = null;
+actualCost = null
if (shipment) {
- shipmentRouteSegment = from("ShipmentRouteSegment").where("shipmentId", shipment.shipmentId).queryFirst();
- actualCost = shipmentRouteSegment.actualCost;
+ shipmentRouteSegment = from("ShipmentRouteSegment").where("shipmentId", shipment.shipmentId).queryFirst()
+ actualCost = shipmentRouteSegment.actualCost
if (actualCost) {
- context.shipmentPackages = from("ShipmentPackage").where("shipmentId", shipment.shipmentId).queryList();
+ context.shipmentPackages = from("ShipmentPackage").where("shipmentId", shipment.shipmentId).queryList()
}
}
-facilityId = parameters.facilityId;
+facilityId = parameters.facilityId
if (facilityId) {
- facility = from("Facility").where("facilityId", facilityId).queryOne();
- context.facility = facility;
+ facility = from("Facility").where("facilityId", facilityId).queryOne()
+ context.facility = facility
}
if (orderId && !shipGroupSeqId && orderId.indexOf("/") > -1) {
- idSplit = orderId.split("\\/");
- orderId = idSplit[0];
- shipGroupSeqId = idSplit[1];
+ idSplit = orderId.split("\\/")
+ orderId = idSplit[0]
+ shipGroupSeqId = idSplit[1]
} else if (orderId && !shipGroupSeqId) {
- shipGroupSeqId = "00001";
+ shipGroupSeqId = "00001"
}
-picklistBinId = parameters.picklistBinId;
+picklistBinId = parameters.picklistBinId
if (picklistBinId) {
- picklistBin = from("PicklistBin").where("picklistBinId", picklistBinId).queryOne();
+ picklistBin = from("PicklistBin").where("picklistBinId", picklistBinId).queryOne()
if (picklistBin) {
- orderId = picklistBin.primaryOrderId;
- shipGroupSeqId = picklistBin.primaryShipGroupSeqId;
+ orderId = picklistBin.primaryOrderId
+ shipGroupSeqId = picklistBin.primaryShipGroupSeqId
} else {
- picklistBinId = null;
+ picklistBinId = null
}
}
-shipmentId = parameters.shipmentId;
+shipmentId = parameters.shipmentId
if (!shipmentId) {
- shipmentId = request.getAttribute("shipmentId");
+ shipmentId = request.getAttribute("shipmentId")
}
if (!shipmentId && shipment) {
- shipmentId = shipment.shipmentId;
+ shipmentId = shipment.shipmentId
}
-context.shipmentId = shipmentId;
+context.shipmentId = shipmentId
if (shipmentId) {
// Get the primaryOrderId from the shipment
- shipment = from("Shipment").where("shipmentId", shipmentId).queryOne();
+ shipment = from("Shipment").where("shipmentId", shipmentId).queryOne()
if (shipment && shipment.primaryOrderId) {
- orderItemBillingList = from("OrderItemBilling").where("orderId", shipment.primaryOrderId).orderBy("invoiceId").queryList();
- invoiceIds = EntityUtil.getFieldListFromEntityList(orderItemBillingList, "invoiceId", true);
+ orderItemBillingList = from("OrderItemBilling").where("orderId", shipment.primaryOrderId).orderBy("invoiceId").queryList()
+ invoiceIds = EntityUtil.getFieldListFromEntityList(orderItemBillingList, "invoiceId", true)
if (invoiceIds) {
- context.invoiceIds = invoiceIds;
+ context.invoiceIds = invoiceIds
}
}
if (shipment.statusId && "SHIPMENT_PACKED" == shipment.statusId) {
- orderId = null;
+ orderId = null
}
- shipmentPackageRouteSegs = from("ShipmentPackageRouteSeg").where("shipmentId", shipmentId).queryList();
- shipmentPackageRouteSegList = [];
+ shipmentPackageRouteSegs = from("ShipmentPackageRouteSeg").where("shipmentId", shipmentId).queryList()
+ shipmentPackageRouteSegList = []
shipmentPackageRouteSegs.each { shipmentPackageRouteSeg ->
if (shipmentPackageRouteSeg.labelImage) {
- shipmentPackageRouteSegList.add(shipmentPackageRouteSeg);
+ shipmentPackageRouteSegList.add(shipmentPackageRouteSeg)
}
}
- context.shipmentPackageRouteSegList = shipmentPackageRouteSegList;
+ context.shipmentPackageRouteSegList = shipmentPackageRouteSegList
}
weightPackageSession.setShipmentId(shipmentId)
-weightPackageSession.setPrimaryShipGroupSeqId(shipGroupSeqId);
-weightPackageSession.setPrimaryOrderId(orderId);
-weightPackageSession.setPicklistBinId(picklistBinId);
-weightPackageSession.setFacilityId(facilityId);
-context.primaryOrderId = orderId;
+weightPackageSession.setPrimaryShipGroupSeqId(shipGroupSeqId)
+weightPackageSession.setPrimaryOrderId(orderId)
+weightPackageSession.setPicklistBinId(picklistBinId)
+weightPackageSession.setFacilityId(facilityId)
+context.primaryOrderId = orderId
-carrierPartyId = null;
+carrierPartyId = null
if (orderId) {
- orderHeader = from("OrderHeader").where("orderId", orderId).queryOne();
+ orderHeader = from("OrderHeader").where("orderId", orderId).queryOne()
if (orderHeader) {
- OrderReadHelper orderReadHelper = new OrderReadHelper(orderHeader);
- GenericValue orderItemShipGroup = orderReadHelper.getOrderItemShipGroup(shipGroupSeqId);
- carrierPartyId = orderItemShipGroup.carrierPartyId;
+ OrderReadHelper orderReadHelper = new OrderReadHelper(orderHeader)
+ GenericValue orderItemShipGroup = orderReadHelper.getOrderItemShipGroup(shipGroupSeqId)
+ carrierPartyId = orderItemShipGroup.carrierPartyId
if ("ORDER_APPROVED".equals(orderHeader.statusId)) {
if (shipGroupSeqId) {
if (shipment) {
- productStoreId = orderReadHelper.getProductStoreId();
- shippableItemInfo = orderReadHelper.getOrderItemAndShipGroupAssoc(shipGroupSeqId);
- shippableItems = from("OrderItemAndShipGrpInvResAndItemSum").where("orderId", orderId, "shipGroupSeqId", shipGroupSeqId).queryList();
- shippableTotal = orderReadHelper.getShippableTotal(shipGroupSeqId);
- shippableWeight = orderReadHelper.getShippableWeight(shipGroupSeqId);
- shippableQuantity = orderReadHelper.getShippableQuantity(shipGroupSeqId);
- estimatedShippingCost = weightPackageSession.getShipmentCostEstimate(orderItemShipGroup, orderId, productStoreId, shippableItemInfo, shippableTotal, shippableWeight, shippableQuantity);
+ productStoreId = orderReadHelper.getProductStoreId()
+ shippableItemInfo = orderReadHelper.getOrderItemAndShipGroupAssoc(shipGroupSeqId)
+ shippableItems = from("OrderItemAndShipGrpInvResAndItemSum").where("orderId", orderId, "shipGroupSeqId", shipGroupSeqId).queryList()
+ shippableTotal = orderReadHelper.getShippableTotal(shipGroupSeqId)
+ shippableWeight = orderReadHelper.getShippableWeight(shipGroupSeqId)
+ shippableQuantity = orderReadHelper.getShippableQuantity(shipGroupSeqId)
+ estimatedShippingCost = weightPackageSession.getShipmentCostEstimate(orderItemShipGroup, orderId, productStoreId, shippableItemInfo, shippableTotal, shippableWeight, shippableQuantity)
if (weightPackageSession.getPackedLines(orderId)) {
- shipWeight = weightPackageSession.getShippableWeight(orderId);
- newEstimatedShippingCost = weightPackageSession.getShipmentCostEstimate(orderItemShipGroup, orderId, productStoreId, shippableItemInfo, shippableTotal, shipWeight, shippableQuantity);
- context.newEstimatedShippingCost = newEstimatedShippingCost;
+ shipWeight = weightPackageSession.getShippableWeight(orderId)
+ newEstimatedShippingCost = weightPackageSession.getShipmentCostEstimate(orderItemShipGroup, orderId, productStoreId, shippableItemInfo, shippableTotal, shipWeight, shippableQuantity)
+ context.newEstimatedShippingCost = newEstimatedShippingCost
}
- context.productStoreId = productStoreId;
- context.estimatedShippingCost = estimatedShippingCost;
+ context.productStoreId = productStoreId
+ context.estimatedShippingCost = estimatedShippingCost
} else {
- request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage("OrderErrorUiLabels", "OrderErrorOrderNotVerified", ["orderId" : orderId], locale));
- orderId = null;
+ request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage("OrderErrorUiLabels", "OrderErrorOrderNotVerified", ["orderId" : orderId], locale))
+ orderId = null
}
} else {
- request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage("ProductErrorUiLabels", "ProductErrorNoShipGroupSequenceIdFoundCannotProcess", locale));
- orderId = null;
+ request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage("ProductErrorUiLabels", "ProductErrorNoShipGroupSequenceIdFoundCannotProcess", locale))
+ orderId = null
}
} else {
- request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage("OrderErrorUiLabels", "OrderErrorOrderNotApprovedForPacking", [orderId : orderId], locale));
- orderId = null;
+ request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage("OrderErrorUiLabels", "OrderErrorOrderNotApprovedForPacking", [orderId : orderId], locale))
+ orderId = null
}
} else {
- request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage("OrderErrorUiLabels", "OrderErrorOrderIdNotFound", [orderId : orderId], locale));
- orderId = null;
+ request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage("OrderErrorUiLabels", "OrderErrorOrderIdNotFound", [orderId : orderId], locale))
+ orderId = null
}
- context.orderedQuantity = weightPackageSession.getOrderedQuantity(orderId);
+ context.orderedQuantity = weightPackageSession.getOrderedQuantity(orderId)
}
-weightPackageSession.setCarrierPartyId(carrierPartyId);
-context.orderId = orderId;
-context.shipGroupSeqId = shipGroupSeqId;
-context.picklistBinId = picklistBinId;
+weightPackageSession.setCarrierPartyId(carrierPartyId)
+context.orderId = orderId
+context.shipGroupSeqId = shipGroupSeqId
+context.picklistBinId = picklistBinId
if (carrierPartyId) {
- carrierShipmentBoxTypes = from("CarrierShipmentBoxType").where("partyId", carrierPartyId).queryList();
- shipmentBoxTypes = [];
+ carrierShipmentBoxTypes = from("CarrierShipmentBoxType").where("partyId", carrierPartyId).queryList()
+ shipmentBoxTypes = []
carrierShipmentBoxTypes.each { carrierShipmentBoxType ->
- shipmentBoxTypes.add(from("ShipmentBoxType").where("shipmentBoxTypeId", carrierShipmentBoxType.shipmentBoxTypeId).queryOne());
- context.shipmentBoxTypes = shipmentBoxTypes;
+ shipmentBoxTypes.add(from("ShipmentBoxType").where("shipmentBoxTypeId", carrierShipmentBoxType.shipmentBoxTypeId).queryOne())
+ context.shipmentBoxTypes = shipmentBoxTypes
}
}
if (actualCost) {
- context.newEstimatedShippingCost = actualCost;
+ context.newEstimatedShippingCost = actualCost
}
-defaultDimensionUomId = null;
+defaultDimensionUomId = null
if (facility) {
- defaultDimensionUomId = facility.defaultDimensionUomId;
+ defaultDimensionUomId = facility.defaultDimensionUomId
}
if (!defaultDimensionUomId) {
- defaultDimensionUomId = EntityUtilProperties.getPropertyValue("shipment", "shipment.default.dimension.uom", "LEN_in", delegator);
+ defaultDimensionUomId = EntityUtilProperties.getPropertyValue("shipment", "shipment.default.dimension.uom", "LEN_in", delegator)
}
-context.defaultDimensionUomId = defaultDimensionUomId;
+context.defaultDimensionUomId = defaultDimensionUomId
-defaultWeightUomId = null;
+defaultWeightUomId = null
if (facility) {
- defaultWeightUomId = facility.defaultWeightUomId;
+ defaultWeightUomId = facility.defaultWeightUomId
}
if (!defaultWeightUomId) {
- defaultWeightUomId = EntityUtilProperties.getPropertyValue("shipment", "shipment.default.weight.uom", "WT_kg", delegator);
+ defaultWeightUomId = EntityUtilProperties.getPropertyValue("shipment", "shipment.default.weight.uom", "WT_kg", delegator)
}
-context.defaultWeightUomId = defaultWeightUomId;
+context.defaultWeightUomId = defaultWeightUomId
diff --git a/applications/workeffort/groovyScripts/ical/IsCalOwner.groovy b/applications/workeffort/groovyScripts/ical/IsCalOwner.groovy
index 68ff99beab..6407477c50 100644
--- a/applications/workeffort/groovyScripts/ical/IsCalOwner.groovy
+++ b/applications/workeffort/groovyScripts/ical/IsCalOwner.groovy
@@ -17,15 +17,15 @@
* under the License.
*/
-import java.util.*;
-import org.apache.ofbiz.entity.util.*;
+import java.util.*
+import org.apache.ofbiz.entity.util.*
-boolean isCalOwner = false;
-List partyAssignments = EntityUtil.filterByDate(delegator.findByAnd("WorkEffortPartyAssignment", ["workEffortId" : parameters.workEffortId, "partyId" : parameters.userLogin.partyId], null, false));
+boolean isCalOwner = false
+List partyAssignments = EntityUtil.filterByDate(delegator.findByAnd("WorkEffortPartyAssignment", ["workEffortId" : parameters.workEffortId, "partyId" : parameters.userLogin.partyId], null, false))
for (partyAssign in partyAssignments) {
if ("CAL_OWNER".equals(partyAssign.roleTypeId) || "CAL_DELEGATE".equals(partyAssign.roleTypeId)) {
- isCalOwner = true;
- break;
+ isCalOwner = true
+ break
}
}
-context.isCalOwner = isCalOwner;
+context.isCalOwner = isCalOwner
diff --git a/applications/workeffort/groovyScripts/workeffort/calendar/CreateUrlParam.groovy b/applications/workeffort/groovyScripts/workeffort/calendar/CreateUrlParam.groovy
index 1124500843..490cca129b 100644
--- a/applications/workeffort/groovyScripts/workeffort/calendar/CreateUrlParam.groovy
+++ b/applications/workeffort/groovyScripts/workeffort/calendar/CreateUrlParam.groovy
@@ -17,18 +17,18 @@
* under the License.
*/
-import org.apache.ofbiz.base.util.UtilMisc;
+import org.apache.ofbiz.base.util.UtilMisc
// Allow containing screens to specify URL parameters to be included in calendar navigation links
-List urlParameterNames = context.urlParameterNames;
+List urlParameterNames = context.urlParameterNames
if (urlParameterNames == null) {
- urlParameterNames = UtilMisc.toList("fixedAssetId", "partyId", "workEffortTypeId", "calendarType", "hideEvents", "portalPageId");
+ urlParameterNames = UtilMisc.toList("fixedAssetId", "partyId", "workEffortTypeId", "calendarType", "hideEvents", "portalPageId")
}
-StringBuilder sb = new StringBuilder();
+StringBuilder sb = new StringBuilder()
for (entry in parameters.entrySet()) {
if (urlParameterNames.contains(entry.getKey())) {
- sb.append("&").append(entry.getKey()).append("=").append(entry.getValue());
+ sb.append("&").append(entry.getKey()).append("=").append(entry.getValue())
}
}
-context.put("urlParam", sb.toString());
+context.put("urlParam", sb.toString())
diff --git a/applications/workeffort/groovyScripts/workeffort/calendar/Days.groovy b/applications/workeffort/groovyScripts/workeffort/calendar/Days.groovy
index c0a266320f..5642c50053 100644
--- a/applications/workeffort/groovyScripts/workeffort/calendar/Days.groovy
+++ b/applications/workeffort/groovyScripts/workeffort/calendar/Days.groovy
@@ -17,33 +17,33 @@
* under the License.
*/
-import java.sql.Timestamp;
-import org.apache.ofbiz.base.util.UtilDateTime;
-import org.apache.ofbiz.base.util.UtilMisc;
-import org.apache.ofbiz.base.util.UtilValidate;
+import java.sql.Timestamp
+import org.apache.ofbiz.base.util.UtilDateTime
+import org.apache.ofbiz.base.util.UtilMisc
+import org.apache.ofbiz.base.util.UtilValidate
-String startParam = parameters.startTime;
-Timestamp start = null;
+String startParam = parameters.startTime
+Timestamp start = null
if (UtilValidate.isNotEmpty(startParam)) {
- start = new Timestamp(Long.parseLong(startParam));
+ start = new Timestamp(Long.parseLong(startParam))
}
if (start == null) {
- start = UtilDateTime.getDayStart(nowTimestamp, timeZone, locale);
+ start = UtilDateTime.getDayStart(nowTimestamp, timeZone, locale)
} else {
- start = UtilDateTime.getDayStart(start, timeZone, locale);
+ start = UtilDateTime.getDayStart(start, timeZone, locale)
}
-Timestamp prev = UtilDateTime.getDayStart(start, -1, timeZone, locale);
-context.prevMillis = new Long(prev.getTime()).toString();
-Timestamp next = UtilDateTime.getDayStart(start, 1, timeZone, locale);
-context.nextMillis = new Long(next.getTime()).toString();
-Map serviceCtx = dispatcher.getDispatchContext().makeValidContext("getWorkEffortEventsByPeriod", "IN", parameters);
-serviceCtx.putAll(UtilMisc.toMap("userLogin", userLogin, "start", start, "numPeriods", 24, "periodType", Calendar.HOUR, "locale", locale, "timeZone", timeZone));
+Timestamp prev = UtilDateTime.getDayStart(start, -1, timeZone, locale)
+context.prevMillis = new Long(prev.getTime()).toString()
+Timestamp next = UtilDateTime.getDayStart(start, 1, timeZone, locale)
+context.nextMillis = new Long(next.getTime()).toString()
+Map serviceCtx = dispatcher.getDispatchContext().makeValidContext("getWorkEffortEventsByPeriod", "IN", parameters)
+serviceCtx.putAll(UtilMisc.toMap("userLogin", userLogin, "start", start, "numPeriods", 24, "periodType", Calendar.HOUR, "locale", locale, "timeZone", timeZone))
if (context.entityExprList) {
- serviceCtx.entityExprList = entityExprList;
+ serviceCtx.entityExprList = entityExprList
}
-Map result = runService('getWorkEffortEventsByPeriod', serviceCtx);
-context.put("periods", result.get("periods"));
-context.put("maxConcurrentEntries", result.get("maxConcurrentEntries"));
-context.put("start", start);
-context.put("prev", prev);
-context.put("next", next);
+Map result = runService('getWorkEffortEventsByPeriod', serviceCtx)
+context.put("periods", result.get("periods"))
+context.put("maxConcurrentEntries", result.get("maxConcurrentEntries"))
+context.put("start", start)
+context.put("prev", prev)
+context.put("next", next)
diff --git a/applications/workeffort/groovyScripts/workeffort/calendar/Month.groovy b/applications/workeffort/groovyScripts/workeffort/calendar/Month.groovy
index 5c3d007ec0..3b049ab6e1 100644
--- a/applications/workeffort/groovyScripts/workeffort/calendar/Month.groovy
+++ b/applications/workeffort/groovyScripts/workeffort/calendar/Month.groovy
@@ -17,56 +17,56 @@
* under the License.
*/
-import java.sql.Timestamp;
-import org.apache.ofbiz.base.util.UtilDateTime;
-import org.apache.ofbiz.base.util.UtilMisc;
-import org.apache.ofbiz.base.util.UtilValidate;
+import java.sql.Timestamp
+import org.apache.ofbiz.base.util.UtilDateTime
+import org.apache.ofbiz.base.util.UtilMisc
+import org.apache.ofbiz.base.util.UtilValidate
-String startParam = parameters.startTime;
-Timestamp start = null;
+String startParam = parameters.startTime
+Timestamp start = null
if (UtilValidate.isNotEmpty(startParam)) {
- start = new Timestamp(Long.parseLong(startParam));
+ start = new Timestamp(Long.parseLong(startParam))
}
if (start == null) {
- start = UtilDateTime.getMonthStart(nowTimestamp, timeZone, locale);
+ start = UtilDateTime.getMonthStart(nowTimestamp, timeZone, locale)
} else {
- start = UtilDateTime.getMonthStart(start, timeZone, locale);
+ start = UtilDateTime.getMonthStart(start, timeZone, locale)
}
-tempCal = UtilDateTime.toCalendar(start, timeZone, locale);
-numDays = tempCal.getActualMaximum(Calendar.DAY_OF_MONTH);
-prev = UtilDateTime.getMonthStart(start, -1, timeZone, locale);
-context.prevMillis = new Long(prev.getTime()).toString();
-next = UtilDateTime.getDayStart(start, numDays+1, timeZone, locale);
-context.nextMillis = new Long(next.getTime()).toString();
-end = UtilDateTime.getMonthEnd(start, timeZone, locale);
+tempCal = UtilDateTime.toCalendar(start, timeZone, locale)
+numDays = tempCal.getActualMaximum(Calendar.DAY_OF_MONTH)
+prev = UtilDateTime.getMonthStart(start, -1, timeZone, locale)
+context.prevMillis = new Long(prev.getTime()).toString()
+next = UtilDateTime.getDayStart(start, numDays+1, timeZone, locale)
+context.nextMillis = new Long(next.getTime()).toString()
+end = UtilDateTime.getMonthEnd(start, timeZone, locale)
//Find out what date to get from
-getFrom = null;
-prevMonthDays = tempCal.get(Calendar.DAY_OF_WEEK) - tempCal.getFirstDayOfWeek();
-if (prevMonthDays < 0) prevMonthDays += 7;
-tempCal.add(Calendar.DATE, -prevMonthDays);
-numDays += prevMonthDays;
-getFrom = new Timestamp(tempCal.getTimeInMillis());
-firstWeekNum = tempCal.get(Calendar.WEEK_OF_YEAR);
-context.put("firstWeekNum", firstWeekNum);
+getFrom = null
+prevMonthDays = tempCal.get(Calendar.DAY_OF_WEEK) - tempCal.getFirstDayOfWeek()
+if (prevMonthDays < 0) prevMonthDays += 7
+tempCal.add(Calendar.DATE, -prevMonthDays)
+numDays += prevMonthDays
+getFrom = new Timestamp(tempCal.getTimeInMillis())
+firstWeekNum = tempCal.get(Calendar.WEEK_OF_YEAR)
+context.put("firstWeekNum", firstWeekNum)
// also get days until the end of the week at the end of the month
-lastWeekCal = UtilDateTime.toCalendar(end, timeZone, locale);
-monthEndDay = lastWeekCal.get(Calendar.DAY_OF_WEEK);
-getTo = UtilDateTime.getWeekEnd(end, timeZone, locale);
-lastWeekCal = UtilDateTime.toCalendar(getTo, timeZone, locale);
-followingMonthDays = lastWeekCal.get(Calendar.DAY_OF_WEEK) - monthEndDay;
+lastWeekCal = UtilDateTime.toCalendar(end, timeZone, locale)
+monthEndDay = lastWeekCal.get(Calendar.DAY_OF_WEEK)
+getTo = UtilDateTime.getWeekEnd(end, timeZone, locale)
+lastWeekCal = UtilDateTime.toCalendar(getTo, timeZone, locale)
+followingMonthDays = lastWeekCal.get(Calendar.DAY_OF_WEEK) - monthEndDay
if (followingMonthDays < 0) {
- followingMonthDays += 7;
+ followingMonthDays += 7
}
-numDays += followingMonthDays;
-Map serviceCtx = dispatcher.getDispatchContext().makeValidContext("getWorkEffortEventsByPeriod", "IN", parameters);
-serviceCtx.putAll(UtilMisc.toMap("userLogin", userLogin, "start", getFrom, "calendarType", "VOID", "numPeriods", numDays, "periodType", Calendar.DATE, "locale", locale, "timeZone", timeZone));
+numDays += followingMonthDays
+Map serviceCtx = dispatcher.getDispatchContext().makeValidContext("getWorkEffortEventsByPeriod", "IN", parameters)
+serviceCtx.putAll(UtilMisc.toMap("userLogin", userLogin, "start", getFrom, "calendarType", "VOID", "numPeriods", numDays, "periodType", Calendar.DATE, "locale", locale, "timeZone", timeZone))
if (context.entityExprList) {
- serviceCtx.entityExprList = entityExprList;
+ serviceCtx.entityExprList = entityExprList
}
-result = runService('getWorkEffortEventsByPeriod', serviceCtx);
-context.put("periods",result.get("periods"));
-context.put("maxConcurrentEntries", result.get("maxConcurrentEntries"));
-context.put("start", start);
-context.put("end", end);
-context.put("prev", prev);
-context.put("next", next);
+result = runService('getWorkEffortEventsByPeriod', serviceCtx)
+context.put("periods",result.get("periods"))
+context.put("maxConcurrentEntries", result.get("maxConcurrentEntries"))
+context.put("start", start)
+context.put("end", end)
+context.put("prev", prev)
+context.put("next", next)
diff --git a/applications/workeffort/groovyScripts/workeffort/calendar/Upcoming.groovy b/applications/workeffort/groovyScripts/workeffort/calendar/Upcoming.groovy
index 2a4eef1a40..b9be45aae5 100644
--- a/applications/workeffort/groovyScripts/workeffort/calendar/Upcoming.groovy
+++ b/applications/workeffort/groovyScripts/workeffort/calendar/Upcoming.groovy
@@ -17,32 +17,32 @@
* under the License.
*/
-import org.apache.ofbiz.base.util.UtilMisc;
+import org.apache.ofbiz.base.util.UtilMisc
-facilityId = parameters.get("facilityId");
-fixedAssetId = parameters.get("fixedAssetId");
-partyId = parameters.get("partyId");
-workEffortTypeId = parameters.get("workEffortTypeId");
-calendarType = parameters.calendarType;
-start = nowTimestamp.clone();
-eventsParam = "";
+facilityId = parameters.get("facilityId")
+fixedAssetId = parameters.get("fixedAssetId")
+partyId = parameters.get("partyId")
+workEffortTypeId = parameters.get("workEffortTypeId")
+calendarType = parameters.calendarType
+start = nowTimestamp.clone()
+eventsParam = ""
if (facilityId != null) {
- eventsParam = "facilityId=" + facilityId;
+ eventsParam = "facilityId=" + facilityId
}
if (fixedAssetId != null) {
- eventsParam = "fixedAssetId=" + fixedAssetId;
+ eventsParam = "fixedAssetId=" + fixedAssetId
}
if (partyId != null) {
- eventsParam = "partyId=" + partyId;
+ eventsParam = "partyId=" + partyId
}
if (workEffortTypeId != null) {
- eventsParam = "workEffortTypeId=" + workEffortTypeId;
+ eventsParam = "workEffortTypeId=" + workEffortTypeId
}
-Map serviceCtx = UtilMisc.toMap("userLogin", userLogin, "start", start, "numPeriods", 7, "periodType", Calendar.DATE);
-serviceCtx.putAll(UtilMisc.toMap("partyId", partyId, "facilityId", facilityId, "fixedAssetId", fixedAssetId, "workEffortTypeId", workEffortTypeId, "calendarType", calendarType, "locale", locale, "timeZone", timeZone));
+Map serviceCtx = UtilMisc.toMap("userLogin", userLogin, "start", start, "numPeriods", 7, "periodType", Calendar.DATE)
+serviceCtx.putAll(UtilMisc.toMap("partyId", partyId, "facilityId", facilityId, "fixedAssetId", fixedAssetId, "workEffortTypeId", workEffortTypeId, "calendarType", calendarType, "locale", locale, "timeZone", timeZone))
-Map result = runService('getWorkEffortEventsByPeriod',serviceCtx);
-context.put("days", result.get("periods"));
-context.put("start", start);
-context.put("eventsParam", eventsParam);
+Map result = runService('getWorkEffortEventsByPeriod',serviceCtx)
+context.put("days", result.get("periods"))
+context.put("start", start)
+context.put("eventsParam", eventsParam)
diff --git a/applications/workeffort/groovyScripts/workeffort/calendar/Week.groovy b/applications/workeffort/groovyScripts/workeffort/calendar/Week.groovy
index 530b68df76..12338d865c 100644
--- a/applications/workeffort/groovyScripts/workeffort/calendar/Week.groovy
+++ b/applications/workeffort/groovyScripts/workeffort/calendar/Week.groovy
@@ -17,35 +17,35 @@
* under the License.
*/
-import java.sql.Timestamp;
-import org.apache.ofbiz.base.util.UtilDateTime;
-import org.apache.ofbiz.base.util.UtilMisc;
-import org.apache.ofbiz.base.util.UtilValidate;
+import java.sql.Timestamp
+import org.apache.ofbiz.base.util.UtilDateTime
+import org.apache.ofbiz.base.util.UtilMisc
+import org.apache.ofbiz.base.util.UtilValidate
-String startParam = parameters.startTime;
-Timestamp start = null;
+String startParam = parameters.startTime
+Timestamp start = null
if (UtilValidate.isNotEmpty(startParam)) {
- start = new Timestamp(Long.parseLong(startParam));
+ start = new Timestamp(Long.parseLong(startParam))
}
if (start == null) {
- start = UtilDateTime.getWeekStart(nowTimestamp, timeZone, locale);
+ start = UtilDateTime.getWeekStart(nowTimestamp, timeZone, locale)
} else {
- start = UtilDateTime.getWeekStart(start, timeZone, locale);
+ start = UtilDateTime.getWeekStart(start, timeZone, locale)
}
-Timestamp prev = UtilDateTime.getDayStart(start, -7, timeZone, locale);
-context.prevMillis = new Long(prev.getTime()).toString();
-Timestamp next = UtilDateTime.getDayStart(start, 7, timeZone, locale);
-context.nextMillis = new Long(next.getTime()).toString();
-Timestamp end = UtilDateTime.getDayStart(start, 6, timeZone, locale);
-Map serviceCtx = dispatcher.getDispatchContext().makeValidContext("getWorkEffortEventsByPeriod", "IN", parameters);
-serviceCtx.putAll(UtilMisc.toMap("userLogin", userLogin, "start", start, "numPeriods", 7, "periodType", Calendar.DATE, "locale", locale, "timeZone", timeZone));
+Timestamp prev = UtilDateTime.getDayStart(start, -7, timeZone, locale)
+context.prevMillis = new Long(prev.getTime()).toString()
+Timestamp next = UtilDateTime.getDayStart(start, 7, timeZone, locale)
+context.nextMillis = new Long(next.getTime()).toString()
+Timestamp end = UtilDateTime.getDayStart(start, 6, timeZone, locale)
+Map serviceCtx = dispatcher.getDispatchContext().makeValidContext("getWorkEffortEventsByPeriod", "IN", parameters)
+serviceCtx.putAll(UtilMisc.toMap("userLogin", userLogin, "start", start, "numPeriods", 7, "periodType", Calendar.DATE, "locale", locale, "timeZone", timeZone))
if (context.entityExprList) {
- serviceCtx.entityExprList = entityExprList;
+ serviceCtx.entityExprList = entityExprList
}
-Map result = runService('getWorkEffortEventsByPeriod',serviceCtx);
-context.put("periods",result.get("periods"));
-context.put("maxConcurrentEntries",result.get("maxConcurrentEntries"));
-context.put("start",start);
-context.put("end",end);
-context.put("prev",prev);
-context.put("next",next);
+Map result = runService('getWorkEffortEventsByPeriod',serviceCtx)
+context.put("periods",result.get("periods"))
+context.put("maxConcurrentEntries",result.get("maxConcurrentEntries"))
+context.put("start",start)
+context.put("end",end)
+context.put("prev",prev)
+context.put("next",next)
diff --git a/applications/workeffort/groovyScripts/workeffort/content/WorkEffortContentWrapper.groovy b/applications/workeffort/groovyScripts/workeffort/content/WorkEffortContentWrapper.groovy
index b204bef2d6..46c895043d 100644
--- a/applications/workeffort/groovyScripts/workeffort/content/WorkEffortContentWrapper.groovy
+++ b/applications/workeffort/groovyScripts/workeffort/content/WorkEffortContentWrapper.groovy
@@ -17,14 +17,14 @@
* under the License.
*/
- import org.apache.ofbiz.workeffort.content.WorkEffortContentWrapper;
+ import org.apache.ofbiz.workeffort.content.WorkEffortContentWrapper
- workEffort = context.get("workEffort");
+ workEffort = context.get("workEffort")
if (workEffort == null && workEffortId != null) {
- workEffort = from("WorkEffort").where("workEffortId", workEffortId).cache(true).queryOne();
+ workEffort = from("WorkEffort").where("workEffortId", workEffortId).cache(true).queryOne()
}
if (workEffort != null) {
- wrapper = WorkEffortContentWrapper.makeWorkEffortContentWrapper(workEffort, request);
- context.put("workEffortContentWrapper", wrapper);
+ wrapper = WorkEffortContentWrapper.makeWorkEffortContentWrapper(workEffort, request)
+ context.put("workEffortContentWrapper", wrapper)
}
diff --git a/applications/workeffort/groovyScripts/workeffort/find/WorkEffortSearchOptions.groovy b/applications/workeffort/groovyScripts/workeffort/find/WorkEffortSearchOptions.groovy
index 921ac4da4e..65a7bd1c30 100644
--- a/applications/workeffort/groovyScripts/workeffort/find/WorkEffortSearchOptions.groovy
+++ b/applications/workeffort/groovyScripts/workeffort/find/WorkEffortSearchOptions.groovy
@@ -17,44 +17,44 @@
* under the License.
*/
-import java.sql.Timestamp;
-import org.apache.ofbiz.workeffort.workeffort.WorkEffortSearchSession;
+import java.sql.Timestamp
+import org.apache.ofbiz.workeffort.workeffort.WorkEffortSearchSession
-searchOperator = parameters.get("SEARCH_OPERATOR");
+searchOperator = parameters.get("SEARCH_OPERATOR")
if (!"AND".equals(searchOperator) && !"OR".equals(searchOperator)) {
- searchOperator = "OR";
+ searchOperator = "OR"
}
//create the fromDate for calendar
-fromCal = Calendar.getInstance();
-fromCal.setTime(new java.util.Date());
-fromCal.set(Calendar.HOUR_OF_DAY, fromCal.getActualMinimum(Calendar.HOUR_OF_DAY));
-fromCal.set(Calendar.MINUTE, fromCal.getActualMinimum(Calendar.MINUTE));
-fromCal.set(Calendar.SECOND, fromCal.getActualMinimum(Calendar.SECOND));
-fromCal.set(Calendar.MILLISECOND, fromCal.getActualMinimum(Calendar.MILLISECOND));
-fromTs = new Timestamp(fromCal.getTimeInMillis());
-fromStr = fromTs.toString();
-fromStr = fromStr.substring(0, fromStr.indexOf('.'));
-context.put("fromDateStr", fromStr);
+fromCal = Calendar.getInstance()
+fromCal.setTime(new java.util.Date())
+fromCal.set(Calendar.HOUR_OF_DAY, fromCal.getActualMinimum(Calendar.HOUR_OF_DAY))
+fromCal.set(Calendar.MINUTE, fromCal.getActualMinimum(Calendar.MINUTE))
+fromCal.set(Calendar.SECOND, fromCal.getActualMinimum(Calendar.SECOND))
+fromCal.set(Calendar.MILLISECOND, fromCal.getActualMinimum(Calendar.MILLISECOND))
+fromTs = new Timestamp(fromCal.getTimeInMillis())
+fromStr = fromTs.toString()
+fromStr = fromStr.substring(0, fromStr.indexOf('.'))
+context.put("fromDateStr", fromStr)
// create the thruDate for calendar
-toCal = Calendar.getInstance();
-toCal.setTime(new java.util.Date());
-toCal.set(Calendar.HOUR_OF_DAY, toCal.getActualMaximum(Calendar.HOUR_OF_DAY));
-toCal.set(Calendar.MINUTE, toCal.getActualMaximum(Calendar.MINUTE));
-toCal.set(Calendar.SECOND, toCal.getActualMaximum(Calendar.SECOND));
-toCal.set(Calendar.MILLISECOND, toCal.getActualMaximum(Calendar.MILLISECOND));
-toTs = new Timestamp(toCal.getTimeInMillis());
-toStr = toTs.toString();
-context.put("thruDateStr", toStr);
+toCal = Calendar.getInstance()
+toCal.setTime(new java.util.Date())
+toCal.set(Calendar.HOUR_OF_DAY, toCal.getActualMaximum(Calendar.HOUR_OF_DAY))
+toCal.set(Calendar.MINUTE, toCal.getActualMaximum(Calendar.MINUTE))
+toCal.set(Calendar.SECOND, toCal.getActualMaximum(Calendar.SECOND))
+toCal.set(Calendar.MILLISECOND, toCal.getActualMaximum(Calendar.MILLISECOND))
+toTs = new Timestamp(toCal.getTimeInMillis())
+toStr = toTs.toString()
+context.put("thruDateStr", toStr)
-searchConstraintStrings = WorkEffortSearchSession.searchGetConstraintStrings(false, session, delegator);
-searchSortOrderString = WorkEffortSearchSession.searchGetSortOrderString(false, request);
-workEffortAssocTypes = from("WorkEffortAssocType").queryList();
-roleTypes = from("RoleType").queryList();
+searchConstraintStrings = WorkEffortSearchSession.searchGetConstraintStrings(false, session, delegator)
+searchSortOrderString = WorkEffortSearchSession.searchGetSortOrderString(false, request)
+workEffortAssocTypes = from("WorkEffortAssocType").queryList()
+roleTypes = from("RoleType").queryList()
-context.put("searchOperator", searchOperator);
-context.put("searchConstraintStrings", searchConstraintStrings);
-context.put("searchSortOrderString", searchSortOrderString);
-context.put("workEffortAssocTypes", workEffortAssocTypes);
-context.put("roleTypes", roleTypes);
+context.put("searchOperator", searchOperator)
+context.put("searchConstraintStrings", searchConstraintStrings)
+context.put("searchSortOrderString", searchSortOrderString)
+context.put("workEffortAssocTypes", workEffortAssocTypes)
+context.put("roleTypes", roleTypes)
diff --git a/applications/workeffort/groovyScripts/workeffort/find/WorkEffortSearchResults.groovy b/applications/workeffort/groovyScripts/workeffort/find/WorkEffortSearchResults.groovy
index 6571eaf9ce..826bd02d81 100644
--- a/applications/workeffort/groovyScripts/workeffort/find/WorkEffortSearchResults.groovy
+++ b/applications/workeffort/groovyScripts/workeffort/find/WorkEffortSearchResults.groovy
@@ -17,18 +17,18 @@
* under the License.
*/
-import org.apache.ofbiz.workeffort.workeffort.WorkEffortSearchEvents;
-import org.apache.ofbiz.workeffort.workeffort.WorkEffortSearchSession;
+import org.apache.ofbiz.workeffort.workeffort.WorkEffortSearchEvents
+import org.apache.ofbiz.workeffort.workeffort.WorkEffortSearchSession
// note: this can be run multiple times in the same request without causing problems, will check to see on its own if it has run again
-WorkEffortSearchSession.processSearchParameters(parameters, request);
-Map result = WorkEffortSearchEvents.getWorkEffortSearchResult(request, delegator);
+WorkEffortSearchSession.processSearchParameters(parameters, request)
+Map result = WorkEffortSearchEvents.getWorkEffortSearchResult(request, delegator)
-context.put("workEffortIds", result.get("workEffortIds"));
-context.put("viewIndex", result.get("viewIndex"));
-context.put("viewSize", result.get("viewSize"));
-context.put("listSize", result.get("listSize"));
-context.put("lowIndex", result.get("lowIndex"));
-context.put("highIndex", result.get("highIndex"));
-context.put("searchConstraintStrings", result.get("searchConstraintStrings"));
-context.put("searchSortOrderString", result.get("searchSortOrderString"));
+context.put("workEffortIds", result.get("workEffortIds"))
+context.put("viewIndex", result.get("viewIndex"))
+context.put("viewSize", result.get("viewSize"))
+context.put("listSize", result.get("listSize"))
+context.put("lowIndex", result.get("lowIndex"))
+context.put("highIndex", result.get("highIndex"))
+context.put("searchConstraintStrings", result.get("searchConstraintStrings"))
+context.put("searchSortOrderString", result.get("searchSortOrderString"))
diff --git a/applications/workeffort/groovyScripts/workeffort/request/RequestList.groovy b/applications/workeffort/groovyScripts/workeffort/request/RequestList.groovy
index 58955f850a..5b5d9286d1 100644
--- a/applications/workeffort/groovyScripts/workeffort/request/RequestList.groovy
+++ b/applications/workeffort/groovyScripts/workeffort/request/RequestList.groovy
@@ -17,6 +17,6 @@
* under the License.
*/
-Map requests = runService('getCustRequestsByRole', ["userLogin": userLogin]);
+Map requests = runService('getCustRequestsByRole', ["userLogin": userLogin])
-context.put("custRequestAndRoles", requests.get("custRequestAndRoles"));
+context.put("custRequestAndRoles", requests.get("custRequestAndRoles"))
diff --git a/framework/common/groovyScripts/CcTypes.groovy b/framework/common/groovyScripts/CcTypes.groovy
index 2054f4fa52..dde5296462 100644
--- a/framework/common/groovyScripts/CcTypes.groovy
+++ b/framework/common/groovyScripts/CcTypes.groovy
@@ -16,8 +16,8 @@
* specific language governing permissions and limitations
* 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
context.creditCardTypes = delegator.findList("Enumeration", EntityCondition.makeCondition("enumTypeId", EntityOperator.EQUALS, "CREDIT_CARD_TYPE"),
["enumId", "enumCode"] as Set, null, null, false);
\ No newline at end of file
diff --git a/framework/common/groovyScripts/CertKeystore.groovy b/framework/common/groovyScripts/CertKeystore.groovy
index b5f73aeb8b..4bbadf1abb 100644
--- a/framework/common/groovyScripts/CertKeystore.groovy
+++ b/framework/common/groovyScripts/CertKeystore.groovy
@@ -1,15 +1,15 @@
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
+import java.io.IOException
+import java.util.ArrayList
+import java.util.Collection
+import java.util.List
-import org.apache.ofbiz.base.component.ComponentConfig;
-import org.apache.ofbiz.base.component.ComponentConfig.KeystoreInfo;
-import org.apache.ofbiz.base.util.*;
-import org.apache.ofbiz.base.util.KeyStoreUtil;
+import org.apache.ofbiz.base.component.ComponentConfig
+import org.apache.ofbiz.base.component.ComponentConfig.KeystoreInfo
+import org.apache.ofbiz.base.util.*
+import org.apache.ofbiz.base.util.KeyStoreUtil
-import org.apache.ofbiz.entity.*;
-import org.apache.ofbiz.entity.util.*;
+import org.apache.ofbiz.entity.*
+import org.apache.ofbiz.entity.util.*
cert = org.apache.ofbiz.base.util.KeyStoreUtil.pemToCert(certString)
if (cert){
@@ -21,7 +21,7 @@ if (cert){
stores = []
store = []
-Collection allComponentConfigs = ComponentConfig.getAllComponents();
+Collection allComponentConfigs = ComponentConfig.getAllComponents()
for (ComponentConfig cc: allComponentConfigs) {
if (cc.getKeystoreInfos()){
componentName = cc.getComponentName()
diff --git a/framework/common/groovyScripts/FindAutocompleteOptions.groovy b/framework/common/groovyScripts/FindAutocompleteOptions.groovy
index 27354c9117..8391a28edd 100644
--- a/framework/common/groovyScripts/FindAutocompleteOptions.groovy
+++ b/framework/common/groovyScripts/FindAutocompleteOptions.groovy
@@ -17,78 +17,78 @@
* under the License.
*/
-import org.apache.ofbiz.base.util.StringUtil;
-import org.apache.ofbiz.base.util.UtilDateTime;
-import org.apache.ofbiz.base.util.Debug;
-import org.apache.ofbiz.entity.util.EntityFindOptions;
-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.EntityFieldValue;
-import org.apache.ofbiz.entity.condition.EntityFunction;
-import org.apache.ofbiz.entity.condition.EntityOperator;
-import org.apache.ofbiz.entity.util.EntityUtilProperties;
+import org.apache.ofbiz.base.util.StringUtil
+import org.apache.ofbiz.base.util.UtilDateTime
+import org.apache.ofbiz.base.util.Debug
+import org.apache.ofbiz.entity.util.EntityFindOptions
+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.EntityFieldValue
+import org.apache.ofbiz.entity.condition.EntityFunction
+import org.apache.ofbiz.entity.condition.EntityOperator
+import org.apache.ofbiz.entity.util.EntityUtilProperties
-def mainAndConds = [];
-def orExprs = [];
-def entityName = context.entityName;
-def searchFields = context.searchFields;
-def displayFields = context.displayFields ?: searchFields;
-def searchDistinct = Boolean.valueOf(context.searchDistinct ?: false);
+def mainAndConds = []
+def orExprs = []
+def entityName = context.entityName
+def searchFields = context.searchFields
+def displayFields = context.displayFields ?: searchFields
+def searchDistinct = Boolean.valueOf(context.searchDistinct ?: false)
-def searchValueFieldName = parameters.term;
-def fieldValue = null;
+def searchValueFieldName = parameters.term
+def fieldValue = null
if (searchValueFieldName) {
- fieldValue = searchValueFieldName;
+ fieldValue = searchValueFieldName
} else if (parameters.searchValueFieldName) { // This is to find the description of a lookup value on initialization.
- fieldValue = parameters.get(parameters.searchValueFieldName);
- context.description = "true";
+ fieldValue = parameters.get(parameters.searchValueFieldName)
+ context.description = "true"
}
-def searchType = context.searchType;
-def displayFieldsSet = null;
+def searchType = context.searchType
+def displayFieldsSet = null
-def conditionDates = context.conditionDates;
-def fromDateName = null;
-def thruDateName = null;
-def filterByDateValue = null;
+def conditionDates = context.conditionDates
+def fromDateName = null
+def thruDateName = null
+def filterByDateValue = null
//If conditionDates is present on context, resolve values use add condition date to the condition search
if (conditionDates) {
- filterByDateValue = conditionDates.filterByDateValue ?: UtilDateTime.nowTimestamp();
- fromDateName = conditionDates.fromDateName ?: null;
- thruDateName = conditionDates.thruDateName ?: null;
+ filterByDateValue = conditionDates.filterByDateValue ?: UtilDateTime.nowTimestamp()
+ fromDateName = conditionDates.fromDateName ?: null
+ thruDateName = conditionDates.thruDateName ?: null
//if the field filterByDate is present, init default value for fromDate and thruDate
if (!fromDateName && !thruDateName) {
- fromDateName = "fromDate";
- thruDateName = "thruDate";
+ fromDateName = "fromDate"
+ thruDateName = "thruDate"
}
}
if (searchFields && fieldValue) {
- def searchFieldsList = StringUtil.toList(searchFields);
- displayFieldsSet = StringUtil.toSet(displayFields);
+ def searchFieldsList = StringUtil.toList(searchFields)
+ displayFieldsSet = StringUtil.toSet(displayFields)
if (context.description && fieldValue instanceof java.lang.String) {
- returnField = parameters.searchValueFieldName;
+ returnField = parameters.searchValueFieldName
} else {
- returnField = searchFieldsList[0]; //default to first element of searchFields
- displayFieldsSet.add(returnField); //add it to select fields, in case it is missing
+ returnField = searchFieldsList[0] //default to first element of searchFields
+ displayFieldsSet.add(returnField) //add it to select fields, in case it is missing
}
- context.returnField = returnField;
- context.displayFieldsSet = displayFieldsSet;
+ context.returnField = returnField
+ context.displayFieldsSet = displayFieldsSet
if ("STARTS_WITH".equals(searchType)) {
- searchValue = fieldValue.toUpperCase() + "%";
+ searchValue = fieldValue.toUpperCase() + "%"
} else if ("EQUALS".equals(searchType)) {
- searchValue = fieldValue;
+ searchValue = fieldValue
} else {//default is CONTAINS
- searchValue = "%" + fieldValue.toUpperCase() + "%";
+ searchValue = "%" + fieldValue.toUpperCase() + "%"
}
searchFieldsList.each { fieldName ->
if ("EQUALS".equals(searchType)) {
- orExprs.add(EntityCondition.makeCondition(EntityFieldValue.makeFieldValue(searchFieldsList[0]), EntityOperator.EQUALS, searchValue));
- return;//in case of EQUALS, we search only a match for the returned field
+ orExprs.add(EntityCondition.makeCondition(EntityFieldValue.makeFieldValue(searchFieldsList[0]), EntityOperator.EQUALS, searchValue))
+ return //in case of EQUALS, we search only a match for the returned field
} else {
- orExprs.add(EntityCondition.makeCondition(EntityFunction.UPPER(EntityFieldValue.makeFieldValue(fieldName)), EntityOperator.LIKE, searchValue));
+ orExprs.add(EntityCondition.makeCondition(EntityFunction.UPPER(EntityFieldValue.makeFieldValue(fieldName)), EntityOperator.LIKE, searchValue))
}
}
}
@@ -97,61 +97,61 @@ if (searchFields && fieldValue) {
* but that is not supported by the Jquery Autocompleter, but this is still useful to pass parameters from the
* lookup screen definition:
*/
-def conditionFields = context.conditionFields;
+def conditionFields = context.conditionFields
if (conditionFields) {
// these fields are for additonal conditions, this is a Map of name/value pairs
for (conditionFieldEntry in conditionFields.entrySet()) {
if (conditionFieldEntry.getValue() instanceof java.util.List) {
- def orCondFields = [];
+ def orCondFields = []
for (entry in conditionFieldEntry.getValue()) {
- orCondFields.add(EntityCondition.makeCondition(EntityFieldValue.makeFieldValue(conditionFieldEntry.getKey()), EntityOperator.EQUALS, entry));
+ orCondFields.add(EntityCondition.makeCondition(EntityFieldValue.makeFieldValue(conditionFieldEntry.getKey()), EntityOperator.EQUALS, entry))
}
- mainAndConds.add(EntityCondition.makeCondition(orCondFields, EntityOperator.OR));
+ mainAndConds.add(EntityCondition.makeCondition(orCondFields, EntityOperator.OR))
} else {
- mainAndConds.add(EntityCondition.makeCondition(EntityFieldValue.makeFieldValue(conditionFieldEntry.getKey()), EntityOperator.EQUALS, conditionFieldEntry.getValue()));
+ mainAndConds.add(EntityCondition.makeCondition(EntityFieldValue.makeFieldValue(conditionFieldEntry.getKey()), EntityOperator.EQUALS, conditionFieldEntry.getValue()))
}
}
}
if (orExprs && entityName && displayFieldsSet) {
- mainAndConds.add(EntityCondition.makeCondition(orExprs, EntityOperator.OR));
+ mainAndConds.add(EntityCondition.makeCondition(orExprs, EntityOperator.OR))
//if there is an extra condition, add it to main condition list
if (context.andCondition && context.andCondition instanceof EntityCondition) {
- mainAndConds.add(context.andCondition);
+ mainAndConds.add(context.andCondition)
}
if (conditionDates) {
- def condsDateList = [];
+ def condsDateList = []
if (thruDateName) {
- def condsByThruDate = [];
- condsByThruDate.add(EntityCondition.makeCondition(EntityFieldValue.makeFieldValue(thruDateName), EntityOperator.GREATER_THAN, filterByDateValue));
- condsByThruDate.add(EntityCondition.makeCondition(EntityFieldValue.makeFieldValue(thruDateName), EntityOperator.EQUALS, null));
- condsDateList.add(EntityCondition.makeCondition(condsByThruDate, EntityOperator.OR));
+ def condsByThruDate = []
+ condsByThruDate.add(EntityCondition.makeCondition(EntityFieldValue.makeFieldValue(thruDateName), EntityOperator.GREATER_THAN, filterByDateValue))
+ condsByThruDate.add(EntityCondition.makeCondition(EntityFieldValue.makeFieldValue(thruDateName), EntityOperator.EQUALS, null))
+ condsDateList.add(EntityCondition.makeCondition(condsByThruDate, EntityOperator.OR))
}
if (fromDateName) {
- def condsByFromDate = [];
- condsByFromDate.add(EntityCondition.makeCondition(EntityFieldValue.makeFieldValue(fromDateName), EntityOperator.LESS_THAN_EQUAL_TO, filterByDateValue));
- condsByFromDate.add(EntityCondition.makeCondition(EntityFieldValue.makeFieldValue(fromDateName), EntityOperator.EQUALS, null));
- condsDateList.add(EntityCondition.makeCondition(condsByFromDate, EntityOperator.OR));
+ def condsByFromDate = []
+ condsByFromDate.add(EntityCondition.makeCondition(EntityFieldValue.makeFieldValue(fromDateName), EntityOperator.LESS_THAN_EQUAL_TO, filterByDateValue))
+ condsByFromDate.add(EntityCondition.makeCondition(EntityFieldValue.makeFieldValue(fromDateName), EntityOperator.EQUALS, null))
+ condsDateList.add(EntityCondition.makeCondition(condsByFromDate, EntityOperator.OR))
}
- mainAndConds.add(EntityCondition.makeCondition(condsDateList, EntityOperator.AND));
+ mainAndConds.add(EntityCondition.makeCondition(condsDateList, EntityOperator.AND))
}
- def entityConditionList = EntityCondition.makeCondition(mainAndConds, EntityOperator.AND);
+ def entityConditionList = EntityCondition.makeCondition(mainAndConds, EntityOperator.AND)
- String viewSizeStr = context.autocompleterViewSize;
+ String viewSizeStr = context.autocompleterViewSize
if (viewSizeStr == null) {
- viewSizeStr = EntityUtilProperties.getPropertyValue("widget", "widget.autocompleter.defaultViewSize", delegator);
+ viewSizeStr = EntityUtilProperties.getPropertyValue("widget", "widget.autocompleter.defaultViewSize", delegator)
}
- Integer autocompleterViewSize = Integer.valueOf(viewSizeStr ?: 10);
- EntityFindOptions findOptions = new EntityFindOptions();
- findOptions.setMaxRows(autocompleterViewSize);
- findOptions.setDistinct(searchDistinct);
+ Integer autocompleterViewSize = Integer.valueOf(viewSizeStr ?: 10)
+ EntityFindOptions findOptions = new EntityFindOptions()
+ findOptions.setMaxRows(autocompleterViewSize)
+ findOptions.setDistinct(searchDistinct)
- autocompleteOptions = delegator.findList(entityName, entityConditionList, displayFieldsSet, StringUtil.toList(displayFields), findOptions, false);
+ autocompleteOptions = delegator.findList(entityName, entityConditionList, displayFieldsSet, StringUtil.toList(displayFields), findOptions, false)
if (autocompleteOptions) {
- context.autocompleteOptions = autocompleteOptions;
+ context.autocompleteOptions = autocompleteOptions
}
}
diff --git a/framework/common/groovyScripts/GeoLocation.groovy b/framework/common/groovyScripts/GeoLocation.groovy
index c27982f569..1c60e93387 100644
--- a/framework/common/groovyScripts/GeoLocation.groovy
+++ b/framework/common/groovyScripts/GeoLocation.groovy
@@ -18,6 +18,6 @@
*/
if (geoPoint && geoPoint.elevationUomId) {
- elevationUom = delegator.findOne("Uom", [uomId : geoPoint.elevationUomId], false);
- context.elevationUomAbbr = elevationUom.abbreviation;
+ elevationUom = delegator.findOne("Uom", [uomId : geoPoint.elevationUomId], false)
+ context.elevationUomAbbr = elevationUom.abbreviation
}
diff --git a/framework/common/groovyScripts/GetLocaleList.groovy b/framework/common/groovyScripts/GetLocaleList.groovy
index bf8f68e4d2..20f88cd6b6 100644
--- a/framework/common/groovyScripts/GetLocaleList.groovy
+++ b/framework/common/groovyScripts/GetLocaleList.groovy
@@ -17,35 +17,35 @@
* under the License.
*/
-import java.util.List;
-import org.apache.ofbiz.base.util.*;
-import org.apache.ofbiz.base.util.string.*;
-import org.apache.ofbiz.base.util.UtilMisc;
+import java.util.List
+import org.apache.ofbiz.base.util.*
+import org.apache.ofbiz.base.util.string.*
+import org.apache.ofbiz.base.util.UtilMisc
-locales = [] as LinkedList;
+locales = [] as LinkedList
availableLocales = UtilMisc.availableLocales()
-// Debug.logInfo(parameters.localeString + "==" + parameters.localeName);
+// Debug.logInfo(parameters.localeString + "==" + parameters.localeName)
if (availableLocales) {
availableLocales.each { availableLocale ->
- locale = [:];
- locale.localeName = availableLocale.getDisplayName(availableLocale);
- locale.localeString = availableLocale.toString();
+ locale = [:]
+ locale.localeName = availableLocale.getDisplayName(availableLocale)
+ locale.localeString = availableLocale.toString()
if (UtilValidate.isNotEmpty(parameters.localeString)) {
if (locale.localeString.toUpperCase().contains(parameters.localeString.toUpperCase())) {
- locales.add(locale);
+ locales.add(locale)
}
}
if (UtilValidate.isNotEmpty(parameters.localeName)) {
if (locale.localeName.toUpperCase().contains(parameters.localeName.toUpperCase())) {
- locales.add(locale);
+ locales.add(locale)
}
}
if (UtilValidate.isEmpty(parameters.localeString) && UtilValidate.isEmpty(parameters.localeName)) {
- locales.add(locale);
+ locales.add(locale)
}
}
}
-context.locales = locales;
+context.locales = locales
diff --git a/framework/common/groovyScripts/GetParentPortalPageId.groovy b/framework/common/groovyScripts/GetParentPortalPageId.groovy
index 18536483ad..3784eeb0bf 100644
--- a/framework/common/groovyScripts/GetParentPortalPageId.groovy
+++ b/framework/common/groovyScripts/GetParentPortalPageId.groovy
@@ -17,10 +17,10 @@
* under the License.
*/
-import org.apache.ofbiz.entity.*;
-import org.apache.ofbiz.base.util.*;
-import org.apache.ofbiz.entity.condition.*;
-import org.apache.ofbiz.entity.util.EntityUtil;
+import org.apache.ofbiz.entity.*
+import org.apache.ofbiz.base.util.*
+import org.apache.ofbiz.entity.condition.*
+import org.apache.ofbiz.entity.util.EntityUtil
// executes only on startup when only the basic parameters.portalPageId (from commonscreens.xml) is available
if (userLogin && parameters.parentPortalPageId && !parameters.portalPageId) {
@@ -30,43 +30,43 @@ if (userLogin && parameters.parentPortalPageId && !parameters.portalPageId) {
EntityCondition.makeCondition("portalPageId", EntityOperator.LIKE, parameters.parentPortalPageId + "%"),
EntityCondition.makeCondition("parentPortalPageId", EntityOperator.EQUALS, null),
EntityCondition.makeCondition("userLoginId", EntityOperator.EQUALS, userLogin.userLoginId)
- ],EntityOperator.AND);
- portalMainPages = EntityUtil.filterByDate(delegator.findList("PortalPageAndUserLogin", condSec, null, null, null, false));
+ ],EntityOperator.AND)
+ portalMainPages = EntityUtil.filterByDate(delegator.findList("PortalPageAndUserLogin", condSec, null, null, null, false))
if (!portalMainPages) { // look for a null securityGroup if not found
condSec = EntityCondition.makeCondition([
EntityCondition.makeCondition("securityGroupId", EntityOperator.EQUALS, null),
EntityCondition.makeCondition("parentPortalPageId", EntityOperator.EQUALS, null),
EntityCondition.makeCondition("portalPageId", EntityOperator.LIKE, parameters.parentPortalPageId + "%")
- ],EntityOperator.AND);
- portalMainPages = delegator.findList("PortalPage", condSec, null, null, null, false);
+ ],EntityOperator.AND)
+ portalMainPages = delegator.findList("PortalPage", condSec, null, null, null, false)
}
if (portalMainPages) {
- portalPageId = portalMainPages.get(0).portalPageId;
+ portalPageId = portalMainPages.get(0).portalPageId
// check if overridden with a privat page
- privatMainPages = delegator.findByAnd("PortalPage", [originalPortalPageId : portalPageId, ownerUserLoginId : userLogin.userLoginId], null, false);
+ privatMainPages = delegator.findByAnd("PortalPage", [originalPortalPageId : portalPageId, ownerUserLoginId : userLogin.userLoginId], null, false)
if (privatMainPages) {
- context.parameters.portalPageId = privatMainPages.get(0).portalPageId;
+ context.parameters.portalPageId = privatMainPages.get(0).portalPageId
} else {
- context.parameters.portalPageId = portalPageId;
+ context.parameters.portalPageId = portalPageId
}
}
}
-// Debug.log('======portalPageId: ' + parameters.portalPageId);
+// Debug.log('======portalPageId: ' + parameters.portalPageId)
if (userLogin && parameters.portalPageId) {
- portalPage = delegator.findOne("PortalPage", [portalPageId : parameters.portalPageId], false);
+ portalPage = delegator.findOne("PortalPage", [portalPageId : parameters.portalPageId], false)
if (portalPage) {
if (portalPage.parentPortalPageId) {
- context.parameters.parentPortalPageId = portalPage.parentPortalPageId;
+ context.parameters.parentPortalPageId = portalPage.parentPortalPageId
} else {
if ("_NA_".equals(portalPage.ownerUserLoginId)) {
- context.parameters.parentPortalPageId = portalPage.portalPageId;
+ context.parameters.parentPortalPageId = portalPage.portalPageId
} else {
- context.parameters.parentPortalPageId = portalPage.originalPortalPageId;
+ context.parameters.parentPortalPageId = portalPage.originalPortalPageId
}
}
}
}
-// Debug.log('======parent portalPageId: ' + parameters.parentPortalPageId);
+// Debug.log('======parent portalPageId: ' + parameters.parentPortalPageId)
if (!context.headerItem && parameters.portalPageId) {
- context.headerItem = parameters.portalPageId; // and the menu item is highlighted
+ context.headerItem = parameters.portalPageId // and the menu item is highlighted
}
diff --git a/framework/common/groovyScripts/ListPortalPortlets.groovy b/framework/common/groovyScripts/ListPortalPortlets.groovy
index b180d0d36c..297e114427 100644
--- a/framework/common/groovyScripts/ListPortalPortlets.groovy
+++ b/framework/common/groovyScripts/ListPortalPortlets.groovy
@@ -17,33 +17,33 @@
* under the License.
*/
-import org.apache.ofbiz.entity.*;
-import org.apache.ofbiz.entity.condition.*;
+import org.apache.ofbiz.entity.*
+import org.apache.ofbiz.entity.condition.*
-ppCond = EntityCondition.makeCondition("portletCategoryId", EntityOperator.EQUALS, parameters.portletCategoryId);
-categories = delegator.findList("PortletPortletCategory", ppCond, null, null, null, false);
+ppCond = EntityCondition.makeCondition("portletCategoryId", EntityOperator.EQUALS, parameters.portletCategoryId)
+categories = delegator.findList("PortletPortletCategory", ppCond, null, null, null, false)
-portalPortlets = [];
+portalPortlets = []
categories.each { category ->
- pCond = EntityCondition.makeCondition("portalPortletId", EntityOperator.EQUALS, category.get("portalPortletId"));
- listPortalPortlets = delegator.findList("PortalPortlet", pCond, null, null, null, false);
+ pCond = EntityCondition.makeCondition("portalPortletId", EntityOperator.EQUALS, category.get("portalPortletId"))
+ listPortalPortlets = delegator.findList("PortalPortlet", pCond, null, null, null, false)
- inMap = [:];
+ inMap = [:]
listPortalPortlets.each { listPortalPortlet ->
if (listPortalPortlet.securityServiceName && listPortalPortlet.securityMainAction) {
- inMap.mainAction = listPortalPortlet.securityMainAction;
- inMap.userLogin = context.userLogin;
+ inMap.mainAction = listPortalPortlet.securityMainAction
+ inMap.userLogin = context.userLogin
result = runService(listPortalPortlet.securityServiceName, inMap)
- hasPermission = result.hasPermission;
+ hasPermission = result.hasPermission
} else {
- hasPermission = true;
+ hasPermission = true
}
if (hasPermission) {
- portalPortlets.add(listPortalPortlet);
+ portalPortlets.add(listPortalPortlet)
}
}
}
-context.portletCat = delegator.findList("PortletCategory", null, null, null, null, false);
-context.portalPortlets = portalPortlets;
\ No newline at end of file
+context.portletCat = delegator.findList("PortletCategory", null, null, null, null, false)
+context.portalPortlets = portalPortlets
\ No newline at end of file
diff --git a/framework/common/groovyScripts/PrepareDataForFlotGraph.groovy b/framework/common/groovyScripts/PrepareDataForFlotGraph.groovy
index 406bc7a609..927e070503 100644
--- a/framework/common/groovyScripts/PrepareDataForFlotGraph.groovy
+++ b/framework/common/groovyScripts/PrepareDataForFlotGraph.groovy
@@ -17,40 +17,40 @@
* under the License.
*/
-import org.apache.ofbiz.base.util.StringUtil;
-chartData = context.chartData;
-chartType = context.chartType;
-labelFieldName = context.labelFieldName;
-dataFieldName = context.dataFieldName;
+import org.apache.ofbiz.base.util.StringUtil
+chartData = context.chartData
+chartType = context.chartType
+labelFieldName = context.labelFieldName
+dataFieldName = context.dataFieldName
if("Pie" == chartType){
- iter = chartData.iterator();
- first = true;
- dataText = "";
+ iter = chartData.iterator()
+ first = true
+ dataText = ""
while(iter.hasNext()){
- entry = iter.next();
+ entry = iter.next()
if(!first){
- dataText = dataText + ",";
+ dataText = dataText + ","
}
- first = false;
- dataText = dataText + entry.get(labelFieldName) + "," + entry.get(dataFieldName);
+ first = false
+ dataText = dataText + entry.get(labelFieldName) + "," + entry.get(dataFieldName)
}
- context.dataText = dataText;
+ context.dataText = dataText
}
else if("Bars" == chartType){
- iter = chartData.iterator();
- i = 1;
- dataText = "";
- labels = "";
+ iter = chartData.iterator()
+ i = 1
+ dataText = ""
+ labels = ""
while(iter.hasNext()){
- entry = iter.next();
+ entry = iter.next()
if(i!=1){
- dataText = dataText + ",";
- labels = labels + ",";
+ dataText = dataText + ","
+ labels = labels + ","
}
- dataText = dataText + i + "," + entry.get(dataFieldName);
- labels = labels + entry.get(labelFieldName);
- i++;
+ dataText = dataText + i + "," + entry.get(dataFieldName)
+ labels = labels + entry.get(labelFieldName)
+ i++
}
- context.dataText = dataText;
- context.labelsText = labels;
+ context.dataText = dataText
+ context.labelsText = labels
}
\ No newline at end of file
diff --git a/framework/common/minilang/GroovyServiceTest.groovy b/framework/common/minilang/GroovyServiceTest.groovy
index 704a59be5e..22a9cd05b1 100644
--- a/framework/common/minilang/GroovyServiceTest.groovy
+++ b/framework/common/minilang/GroovyServiceTest.groovy
@@ -17,53 +17,53 @@
* under the License.
*/
-import org.apache.ofbiz.service.ServiceUtil;
-import org.apache.ofbiz.base.util.Debug;
+import org.apache.ofbiz.service.ServiceUtil
+import org.apache.ofbiz.base.util.Debug
-Debug.logInfo("-=-=-=- TEST GROOVY SERVICE -=-=-=-", "");
-result = ServiceUtil.returnSuccess();
+Debug.logInfo("-=-=-=- TEST GROOVY SERVICE -=-=-=-", "")
+result = ServiceUtil.returnSuccess()
if (context.message) {
- String message = context.message;
- result.successMessage = (String) "Got message [$message] and finished fine";
- result.result = message;
- Debug.logInfo("----- Message is: $message -----", "");
+ String message = context.message
+ result.successMessage = (String) "Got message [$message] and finished fine"
+ result.result = message
+ Debug.logInfo("----- Message is: $message -----", "")
} else {
- result.successMessage = (String) "Got no message but finished fine anyway";
- result.result = (String) "[no message received]";
- Debug.logInfo("----- No message received -----", "");
+ result.successMessage = (String) "Got no message but finished fine anyway"
+ result.result = (String) "[no message received]"
+ Debug.logInfo("----- No message received -----", "")
}
-return result;
+return result
// GroovyEngine will invoke the no-arg method.
public Map testMethod() {
- Debug.logInfo("----- no-arg testMethod invoked -----", "");
- result = ServiceUtil.returnSuccess();
+ Debug.logInfo("----- no-arg testMethod invoked -----", "")
+ result = ServiceUtil.returnSuccess()
if (context.message) {
- String message = context.message;
- result.successMessage = (String) "Got message [$message] and finished fine";
- result.result = message;
- Debug.logInfo("----- Message is: $message -----", "");
+ String message = context.message
+ result.successMessage = (String) "Got message [$message] and finished fine"
+ result.result = message
+ Debug.logInfo("----- Message is: $message -----", "")
} else {
- result.successMessage = (String) "Got no message but finished fine anyway";
- result.result = (String) "[no message received]";
- Debug.logInfo("----- No message received -----", "");
+ result.successMessage = (String) "Got no message but finished fine anyway"
+ result.result = (String) "[no message received]"
+ Debug.logInfo("----- No message received -----", "")
}
- return result;
+ return result
}
// ScriptEngine (JSR-223) will invoke the arg method.
public Map testMethod(Map context) {
- Debug.logInfo("----- arg testMethod invoked -----", "");
- result = ServiceUtil.returnSuccess();
+ Debug.logInfo("----- arg testMethod invoked -----", "")
+ result = ServiceUtil.returnSuccess()
if (context.message) {
- String message = context.message;
- result.successMessage = (String) "Got message [$message] and finished fine";
- result.result = message;
- Debug.logInfo("----- Message is: $message -----", "");
+ String message = context.message
+ result.successMessage = (String) "Got message [$message] and finished fine"
+ result.result = message
+ Debug.logInfo("----- Message is: $message -----", "")
} else {
- result.successMessage = (String) "Got no message but finished fine anyway";
- result.result = (String) "[no message received]";
- Debug.logInfo("----- No message received -----", "");
+ result.successMessage = (String) "Got no message but finished fine anyway"
+ result.result = (String) "[no message received]"
+ Debug.logInfo("----- No message received -----", "")
}
- return result;
+ return result
}
diff --git a/framework/service/src/main/java/org/apache/ofbiz/service/engine/GroovyBaseScript.groovy b/framework/service/src/main/java/org/apache/ofbiz/service/engine/GroovyBaseScript.groovy
index 181eee7ff0..da83a689b4 100644
--- a/framework/service/src/main/java/org/apache/ofbiz/service/engine/GroovyBaseScript.groovy
+++ b/framework/service/src/main/java/org/apache/ofbiz/service/engine/GroovyBaseScript.groovy
@@ -24,43 +24,43 @@ import org.apache.ofbiz.service.ServiceUtil
import org.apache.ofbiz.service.ExecutionServiceException
abstract class GroovyBaseScript extends Script {
- public static final String module = GroovyBaseScript.class.getName();
+ public static final String module = GroovyBaseScript.class.getName()
Map runService(String serviceName, Map inputMap) throws ExecutionServiceException {
if (!inputMap.userLogin) {
- inputMap.userLogin = this.binding.getVariable('parameters').userLogin;
+ inputMap.userLogin = this.binding.getVariable('parameters').userLogin
}
if (!inputMap.timeZone) {
- inputMap.timeZone = this.binding.getVariable('parameters').timeZone;
+ inputMap.timeZone = this.binding.getVariable('parameters').timeZone
}
if (!inputMap.locale) {
- inputMap.locale = this.binding.getVariable('parameters').locale;
+ inputMap.locale = this.binding.getVariable('parameters').locale
}
- Map result = binding.getVariable('dispatcher').runSync(serviceName, inputMap);
+ Map result = binding.getVariable('dispatcher').runSync(serviceName, inputMap)
if (ServiceUtil.isError(result)) {
throw new ExecutionServiceException(ServiceUtil.getErrorMessage(result))
}
- return result;
+ return result
}
Map run(Map args) throws ExecutionServiceException {
- return runService((String)args.get('service'), (Map)args.get('with', new HashMap()));
+ return runService((String)args.get('service'), (Map)args.get('with', new HashMap()))
}
Map makeValue(String entityName) throws ExecutionServiceException {
- return result = binding.getVariable('delegator').makeValue(entityName);
+ return result = binding.getVariable('delegator').makeValue(entityName)
}
EntityQuery from(def entity) {
- return EntityQuery.use(binding.getVariable('delegator')).from(entity);
+ return EntityQuery.use(binding.getVariable('delegator')).from(entity)
}
EntityQuery select(String... fields) {
- return EntityQuery.use(binding.getVariable('delegator')).select(fields);
+ return EntityQuery.use(binding.getVariable('delegator')).select(fields)
}
EntityQuery select(Set fields) {
- return EntityQuery.use(binding.getVariable('delegator')).select(fields);
+ return EntityQuery.use(binding.getVariable('delegator')).select(fields)
}
def success(String message) {
@@ -70,22 +70,22 @@ abstract class GroovyBaseScript extends Script {
if (message) {
this.binding.getVariable('request').setAttribute("_EVENT_MESSAGE_", message)
}
- return 'success';
+ return 'success'
} else {
// the script is invoked as a "service"
if (message) {
- return ServiceUtil.returnSuccess(message);
+ return ServiceUtil.returnSuccess(message)
} else {
- return ServiceUtil.returnSuccess();
+ return ServiceUtil.returnSuccess()
}
}
}
Map failure(String message) {
// TODO: implement some clever i18n mechanism based on the userLogin and locale in the binding
if (message) {
- return ServiceUtil.returnFailure(message);
+ return ServiceUtil.returnFailure(message)
} else {
- return ServiceUtil.returnFailure();
+ return ServiceUtil.returnFailure()
}
}
def error(String message) {
@@ -95,22 +95,22 @@ abstract class GroovyBaseScript extends Script {
if (message) {
this.binding.getVariable('request').setAttribute("_ERROR_MESSAGE_", message)
}
- return 'error';
+ return 'error'
} else {
if (message) {
- return ServiceUtil.returnError(message);
+ return ServiceUtil.returnError(message)
} else {
- return ServiceUtil.returnError();
+ return ServiceUtil.returnError()
}
}
}
def logInfo(String message) {
- Debug.logInfo(message, module);
+ Debug.logInfo(message, module)
}
def logWarning(String message) {
- Debug.logWarning(message, module);
+ Debug.logWarning(message, module)
}
def logError(String message) {
- Debug.logError(message, module);
+ Debug.logError(message, module)
}
}
diff --git a/framework/webtools/groovyScripts/artifactinfo/ArtifactInfo.groovy b/framework/webtools/groovyScripts/artifactinfo/ArtifactInfo.groovy
index a256a20251..7edebdfa78 100644
--- a/framework/webtools/groovyScripts/artifactinfo/ArtifactInfo.groovy
+++ b/framework/webtools/groovyScripts/artifactinfo/ArtifactInfo.groovy
@@ -17,50 +17,50 @@
* under the License.
*/
-import org.apache.ofbiz.entity.Delegator;
-import org.apache.ofbiz.webtools.artifactinfo.*;
-import org.apache.ofbiz.base.util.*;
+import org.apache.ofbiz.entity.Delegator
+import org.apache.ofbiz.webtools.artifactinfo.*
+import org.apache.ofbiz.base.util.*
-name = parameters.name;
-location = parameters.location;
-type = parameters.type;
-uniqueId = parameters.uniqueId;
+name = parameters.name
+location = parameters.location
+type = parameters.type
+uniqueId = parameters.uniqueId
delegatorName = delegator.getDelegatorName()
if (delegatorName.contains("default#")) {
- delegatorName = "default";
+ delegatorName = "default"
}
-aif = ArtifactInfoFactory.getArtifactInfoFactory(delegatorName);
-context.aif = aif;
-artifactInfo = null;
+aif = ArtifactInfoFactory.getArtifactInfoFactory(delegatorName)
+context.aif = aif
+artifactInfo = null
if ("search".equals(parameters.findType)) {
- artifactInfoSet = aif.getAllArtifactInfosByNamePartial(name, type);
+ artifactInfoSet = aif.getAllArtifactInfosByNamePartial(name, type)
if (artifactInfoSet.size() == 1) {
- artifactInfo = artifactInfoSet.iterator().next();
- context.artifactInfo = artifactInfo;
+ artifactInfo = artifactInfoSet.iterator().next()
+ context.artifactInfo = artifactInfo
} else {
- context.artifactInfoSet = new TreeSet(artifactInfoSet);
+ context.artifactInfoSet = new TreeSet(artifactInfoSet)
}
} else {
if (name) {
- artifactInfo = aif.getArtifactInfoByNameAndType(name, location, type);
- context.artifactInfo = artifactInfo;
+ artifactInfo = aif.getArtifactInfoByNameAndType(name, location, type)
+ context.artifactInfo = artifactInfo
} else if (uniqueId) {
- artifactInfo = aif.getArtifactInfoByUniqueIdAndType(uniqueId, type);
- context.artifactInfo = artifactInfo;
+ artifactInfo = aif.getArtifactInfoByUniqueIdAndType(uniqueId, type)
+ context.artifactInfo = artifactInfo
}
}
if (artifactInfo) {
- artifactInfoMap = [type : artifactInfo.getType(), uniqueId : artifactInfo.getUniqueId(), displayName : artifactInfo.getDisplayName()];
+ artifactInfoMap = [type : artifactInfo.getType(), uniqueId : artifactInfo.getUniqueId(), displayName : artifactInfo.getDisplayName()]
// add to the recently viewed list
- recentArtifactInfoList = session.getAttribute("recentArtifactInfoList");
+ recentArtifactInfoList = session.getAttribute("recentArtifactInfoList")
if (!recentArtifactInfoList) {
- recentArtifactInfoList = [];
- session.setAttribute("recentArtifactInfoList", recentArtifactInfoList);
+ recentArtifactInfoList = []
+ session.setAttribute("recentArtifactInfoList", recentArtifactInfoList)
}
if (recentArtifactInfoList && recentArtifactInfoList.get(0).equals(artifactInfoMap)) {
// hmmm, I guess do nothing if it's already there
} else {
- recentArtifactInfoList.add(0, artifactInfoMap);
+ recentArtifactInfoList.add(0, artifactInfoMap)
}
}
diff --git a/framework/webtools/groovyScripts/artifactinfo/ComponentList.groovy b/framework/webtools/groovyScripts/artifactinfo/ComponentList.groovy
index 874e8b8a69..06cfe18daa 100644
--- a/framework/webtools/groovyScripts/artifactinfo/ComponentList.groovy
+++ b/framework/webtools/groovyScripts/artifactinfo/ComponentList.groovy
@@ -17,59 +17,59 @@
* under the License.
*/
-import java.util.Collection;
-import java.util.List;
+import java.util.Collection
+import java.util.List
-import org.apache.ofbiz.base.component.ComponentConfig;
-import org.apache.ofbiz.base.component.ComponentConfig.WebappInfo;
+import org.apache.ofbiz.base.component.ComponentConfig
+import org.apache.ofbiz.base.component.ComponentConfig.WebappInfo
import org.apache.ofbiz.base.util.*
-Collection components = ComponentConfig.getAllComponents();
-List componentList = [];
+Collection components = ComponentConfig.getAllComponents()
+List componentList = []
components.each { component ->
- List webApps = component.getWebappInfos();
+ List webApps = component.getWebappInfos()
webApps.each { webApp ->
- componentMap = [:];
- componentMap.compName = component.getComponentName();
- componentMap.rootLocation = component.getRootLocation();
- componentMap.enabled = (component.enabled() == true? "Y" : "N");
- componentMap.webAppName = webApp.getName();
- componentMap.contextRoot = webApp.getContextRoot();
- componentMap.location = webApp.getLocation();
- componentMap.webAppName = webApp.getName();
- componentMap.contextRoot = webApp.getContextRoot();
- componentMap.location = webApp.getLocation();
- componentList.add(componentMap);
+ componentMap = [:]
+ componentMap.compName = component.getComponentName()
+ componentMap.rootLocation = component.getRootLocation()
+ componentMap.enabled = (component.enabled() == true? "Y" : "N")
+ componentMap.webAppName = webApp.getName()
+ componentMap.contextRoot = webApp.getContextRoot()
+ componentMap.location = webApp.getLocation()
+ componentMap.webAppName = webApp.getName()
+ componentMap.contextRoot = webApp.getContextRoot()
+ componentMap.location = webApp.getLocation()
+ componentList.add(componentMap)
}
if (UtilValidate.isEmpty(webApps)) {
- componentMap = [:];
- componentMap.compName = component.getComponentName();
- componentMap.rootLocation = component.getRootLocation();
- componentMap.enabled = (component.enabled() == true? "Y" : "N");
- componentList.add(componentMap);
- componentMap.webAppName = "";
- componentMap.contextRoot = "";
- componentMap.location = "";
- componentMap.webAppName = "";
- componentMap.contextRoot = "";
- componentMap.location = "";
+ componentMap = [:]
+ componentMap.compName = component.getComponentName()
+ componentMap.rootLocation = component.getRootLocation()
+ componentMap.enabled = (component.enabled() == true? "Y" : "N")
+ componentList.add(componentMap)
+ componentMap.webAppName = ""
+ componentMap.contextRoot = ""
+ componentMap.location = ""
+ componentMap.webAppName = ""
+ componentMap.contextRoot = ""
+ componentMap.location = ""
}
}
// sort the entries
-componentList = UtilMisc.sortMaps(componentList, UtilMisc.toList("+compName"));
+componentList = UtilMisc.sortMaps(componentList, UtilMisc.toList("+compName"))
// make the list more readable
-lastComp = null;
+lastComp = null
for (int entry = 0; entry < componentList.size(); entry++) {
- compSave = componentList[entry].compName;
+ compSave = componentList[entry].compName
if (lastComp != null && compSave.equals(lastComp)) {
- componentList[entry].compName = "";
- componentList[entry].rootLocation = "";
- componentList[entry].enabled = "";
+ componentList[entry].compName = ""
+ componentList[entry].rootLocation = ""
+ componentList[entry].enabled = ""
}
- lastComp = compSave;
+ lastComp = compSave
}
-context.componentList = componentList;
+context.componentList = componentList
diff --git a/framework/webtools/groovyScripts/artifactinfo/TestSuiteInfo.groovy b/framework/webtools/groovyScripts/artifactinfo/TestSuiteInfo.groovy
index 8323554420..26cafcf71b 100644
--- a/framework/webtools/groovyScripts/artifactinfo/TestSuiteInfo.groovy
+++ b/framework/webtools/groovyScripts/artifactinfo/TestSuiteInfo.groovy
@@ -17,45 +17,45 @@
* under the License.
*/
-import org.apache.ofbiz.base.component.ComponentConfig;
-import org.apache.ofbiz.base.config.GenericConfigException;
-import org.apache.ofbiz.base.config.ResourceHandler;
-import org.apache.ofbiz.base.util.Debug;
-import org.apache.ofbiz.base.util.UtilXml;
-import org.apache.ofbiz.base.util.UtilMisc;
+import org.apache.ofbiz.base.component.ComponentConfig
+import org.apache.ofbiz.base.config.GenericConfigException
+import org.apache.ofbiz.base.config.ResourceHandler
+import org.apache.ofbiz.base.util.Debug
+import org.apache.ofbiz.base.util.UtilXml
+import org.apache.ofbiz.base.util.UtilMisc
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
+import org.w3c.dom.Document
+import org.w3c.dom.Element
-List testList = [];
+List testList = []
for (ComponentConfig.TestSuiteInfo testSuiteInfo: ComponentConfig.getAllTestSuiteInfos(parameters.compName)) {
- String componentName = testSuiteInfo.componentConfig.getComponentName();
- ResourceHandler testSuiteResource = testSuiteInfo.createResourceHandler();
+ String componentName = testSuiteInfo.componentConfig.getComponentName()
+ ResourceHandler testSuiteResource = testSuiteInfo.createResourceHandler()
try {
- Document testSuiteDocument = testSuiteResource.getDocument();
- Element documentElement = testSuiteDocument.getDocumentElement();
+ Document testSuiteDocument = testSuiteResource.getDocument()
+ Element documentElement = testSuiteDocument.getDocumentElement()
suiteName = documentElement.getAttribute("suite-name")
- firstLine = true;
+ firstLine = true
for (Element testCaseElement : UtilXml.childElementList(documentElement, UtilMisc.toSet("test-case", "test-group"))) {
- testMap = [:];
- String caseName = testCaseElement.getAttribute("case-name");
+ testMap = [:]
+ String caseName = testCaseElement.getAttribute("case-name")
if (firstLine == true) {
- testMap = UtilMisc.toMap("suiteName", suiteName, "suiteNameSave", suiteName, "caseName", caseName);
- firstLine = false;
+ testMap = UtilMisc.toMap("suiteName", suiteName, "suiteNameSave", suiteName, "caseName", caseName)
+ firstLine = false
} else {
- testMap = UtilMisc.toMap("suiteNameSave", suiteName, "caseName", caseName);
+ testMap = UtilMisc.toMap("suiteNameSave", suiteName, "caseName", caseName)
}
- testList.add(testMap);
+ testList.add(testMap)
}
} catch (GenericConfigException e) {
- String errMsg = "Error reading XML document from ResourceHandler for loader [" + testSuiteResource.getLoaderName() + "] and location [" + testSuiteResource.getLocation() + "]";
- Debug.logError(e, errMsg, module);
- throw new IllegalArgumentException(errMsg);
+ String errMsg = "Error reading XML document from ResourceHandler for loader [" + testSuiteResource.getLoaderName() + "] and location [" + testSuiteResource.getLocation() + "]"
+ Debug.logError(e, errMsg, module)
+ throw new IllegalArgumentException(errMsg)
}
}
-context.suits = testList;
+context.suits = testList
diff --git a/framework/webtools/groovyScripts/cache/EditUtilCache.groovy b/framework/webtools/groovyScripts/cache/EditUtilCache.groovy
index c6b86aa279..a14e89ea3d 100644
--- a/framework/webtools/groovyScripts/cache/EditUtilCache.groovy
+++ b/framework/webtools/groovyScripts/cache/EditUtilCache.groovy
@@ -16,42 +16,42 @@
* specific language governing permissions and limitations
* under the License.
*/
-import org.apache.ofbiz.base.util.cache.UtilCache;
-import org.apache.ofbiz.base.util.cache.CacheLine;
-import org.apache.ofbiz.base.util.UtilFormatOut;
-import org.apache.ofbiz.security.Security;
+import org.apache.ofbiz.base.util.cache.UtilCache
+import org.apache.ofbiz.base.util.cache.CacheLine
+import org.apache.ofbiz.base.util.UtilFormatOut
+import org.apache.ofbiz.security.Security
-cacheName = parameters.UTIL_CACHE_NAME;
-context.cacheName = cacheName;
+cacheName = parameters.UTIL_CACHE_NAME
+context.cacheName = cacheName
if (cacheName) {
- utilCache = UtilCache.findCache(cacheName);
+ utilCache = UtilCache.findCache(cacheName)
if (utilCache) {
- cache = [:];
+ cache = [:]
- cache.cacheName = utilCache.getName();
- cache.cacheSize = UtilFormatOut.formatQuantity(utilCache.size());
- cache.hitCount = UtilFormatOut.formatQuantity(utilCache.getHitCount());
- cache.missCountTot = UtilFormatOut.formatQuantity(utilCache.getMissCountTotal());
- cache.missCountNotFound = UtilFormatOut.formatQuantity(utilCache.getMissCountNotFound());
- cache.missCountExpired = UtilFormatOut.formatQuantity(utilCache.getMissCountExpired());
- cache.missCountSoftRef = UtilFormatOut.formatQuantity(utilCache.getMissCountSoftRef());
- cache.removeHitCount = UtilFormatOut.formatQuantity(utilCache.getRemoveHitCount());
- cache.removeMissCount = UtilFormatOut.formatQuantity(utilCache.getRemoveMissCount());
- cache.maxInMemory = UtilFormatOut.formatQuantity(utilCache.getMaxInMemory());
- cache.expireTime = UtilFormatOut.formatQuantity(utilCache.getExpireTime());
- cache.useSoftReference = utilCache.getUseSoftReference().toString();
+ cache.cacheName = utilCache.getName()
+ cache.cacheSize = UtilFormatOut.formatQuantity(utilCache.size())
+ cache.hitCount = UtilFormatOut.formatQuantity(utilCache.getHitCount())
+ cache.missCountTot = UtilFormatOut.formatQuantity(utilCache.getMissCountTotal())
+ cache.missCountNotFound = UtilFormatOut.formatQuantity(utilCache.getMissCountNotFound())
+ cache.missCountExpired = UtilFormatOut.formatQuantity(utilCache.getMissCountExpired())
+ cache.missCountSoftRef = UtilFormatOut.formatQuantity(utilCache.getMissCountSoftRef())
+ cache.removeHitCount = UtilFormatOut.formatQuantity(utilCache.getRemoveHitCount())
+ cache.removeMissCount = UtilFormatOut.formatQuantity(utilCache.getRemoveMissCount())
+ cache.maxInMemory = UtilFormatOut.formatQuantity(utilCache.getMaxInMemory())
+ cache.expireTime = UtilFormatOut.formatQuantity(utilCache.getExpireTime())
+ cache.useSoftReference = utilCache.getUseSoftReference().toString()
- exp = utilCache.getExpireTime();
- hrs = Math.floor(exp / (60 * 60 * 1000));
- exp = exp % (60 * 60 * 1000);
- mins = Math.floor(exp / (60 * 1000));
- exp = exp % (60 * 1000);
- secs = exp / 1000;
- cache.hrs = hrs;
- cache.mins = mins;
- cache.secs = UtilFormatOut.formatPrice(secs);
+ exp = utilCache.getExpireTime()
+ hrs = Math.floor(exp / (60 * 60 * 1000))
+ exp = exp % (60 * 60 * 1000)
+ mins = Math.floor(exp / (60 * 1000))
+ exp = exp % (60 * 1000)
+ secs = exp / 1000
+ cache.hrs = hrs
+ cache.mins = mins
+ cache.secs = UtilFormatOut.formatPrice(secs)
- context.cache = cache;
+ context.cache = cache
}
}
diff --git a/framework/webtools/groovyScripts/cache/FindUtilCache.groovy b/framework/webtools/groovyScripts/cache/FindUtilCache.groovy
index 2c145b9c7c..59aba526cf 100644
--- a/framework/webtools/groovyScripts/cache/FindUtilCache.groovy
+++ b/framework/webtools/groovyScripts/cache/FindUtilCache.groovy
@@ -16,49 +16,49 @@
* specific language governing permissions and limitations
* under the License.
*/
-import org.apache.ofbiz.base.util.cache.UtilCache;
-import org.apache.ofbiz.base.util.UtilFormatOut;
-import org.apache.ofbiz.base.util.UtilMisc;
-import org.apache.ofbiz.security.Security;
+import org.apache.ofbiz.base.util.cache.UtilCache
+import org.apache.ofbiz.base.util.UtilFormatOut
+import org.apache.ofbiz.base.util.UtilMisc
+import org.apache.ofbiz.security.Security
-context.hasUtilCacheEdit = security.hasEntityPermission("UTIL_CACHE", "_EDIT", session);
+context.hasUtilCacheEdit = security.hasEntityPermission("UTIL_CACHE", "_EDIT", session)
-cacheList = [];
-totalCacheMemory = 0.0;
-names = new TreeSet(UtilCache.getUtilCacheTableKeySet());
+cacheList = []
+totalCacheMemory = 0.0
+names = new TreeSet(UtilCache.getUtilCacheTableKeySet())
names.each { cacheName ->
- utilCache = UtilCache.findCache(cacheName);
- cache = [:];
+ utilCache = UtilCache.findCache(cacheName)
+ cache = [:]
- cache.cacheName = utilCache.getName();
- cache.cacheSize = UtilFormatOut.formatQuantity(utilCache.size());
- cache.hitCount = UtilFormatOut.formatQuantity(utilCache.getHitCount());
- cache.missCountTot = UtilFormatOut.formatQuantity(utilCache.getMissCountTotal());
- cache.missCountNotFound = UtilFormatOut.formatQuantity(utilCache.getMissCountNotFound());
- cache.missCountExpired = UtilFormatOut.formatQuantity(utilCache.getMissCountExpired());
- cache.missCountSoftRef = UtilFormatOut.formatQuantity(utilCache.getMissCountSoftRef());
- cache.removeHitCount = UtilFormatOut.formatQuantity(utilCache.getRemoveHitCount());
- cache.removeMissCount = UtilFormatOut.formatQuantity(utilCache.getRemoveMissCount());
- cache.maxInMemory = UtilFormatOut.formatQuantity(utilCache.getMaxInMemory());
- cache.expireTime = UtilFormatOut.formatQuantity(utilCache.getExpireTime());
- cache.useSoftReference = utilCache.getUseSoftReference().toString();
- cache.cacheMemory = utilCache.getSizeInBytes();
- totalCacheMemory += cache.cacheMemory;
- cacheList.add(cache);
+ cache.cacheName = utilCache.getName()
+ cache.cacheSize = UtilFormatOut.formatQuantity(utilCache.size())
+ cache.hitCount = UtilFormatOut.formatQuantity(utilCache.getHitCount())
+ cache.missCountTot = UtilFormatOut.formatQuantity(utilCache.getMissCountTotal())
+ cache.missCountNotFound = UtilFormatOut.formatQuantity(utilCache.getMissCountNotFound())
+ cache.missCountExpired = UtilFormatOut.formatQuantity(utilCache.getMissCountExpired())
+ cache.missCountSoftRef = UtilFormatOut.formatQuantity(utilCache.getMissCountSoftRef())
+ cache.removeHitCount = UtilFormatOut.formatQuantity(utilCache.getRemoveHitCount())
+ cache.removeMissCount = UtilFormatOut.formatQuantity(utilCache.getRemoveMissCount())
+ cache.maxInMemory = UtilFormatOut.formatQuantity(utilCache.getMaxInMemory())
+ cache.expireTime = UtilFormatOut.formatQuantity(utilCache.getExpireTime())
+ cache.useSoftReference = utilCache.getUseSoftReference().toString()
+ cache.cacheMemory = utilCache.getSizeInBytes()
+ totalCacheMemory += cache.cacheMemory
+ cacheList.add(cache)
}
-sortField = parameters.sortField;
+sortField = parameters.sortField
if (sortField) {
- context.cacheList = UtilMisc.sortMaps(cacheList, UtilMisc.toList(sortField));
+ context.cacheList = UtilMisc.sortMaps(cacheList, UtilMisc.toList(sortField))
} else {
- context.cacheList = cacheList;
+ context.cacheList = cacheList
}
-context.totalCacheMemory = totalCacheMemory;
+context.totalCacheMemory = totalCacheMemory
-rt = Runtime.getRuntime();
-memoryInfo = [:];
-memoryInfo.memory = UtilFormatOut.formatQuantity(rt.totalMemory());
-memoryInfo.freeMemory = UtilFormatOut.formatQuantity(rt.freeMemory());
-memoryInfo.usedMemory = UtilFormatOut.formatQuantity((rt.totalMemory() - rt.freeMemory()));
-memoryInfo.maxMemory = UtilFormatOut.formatQuantity(rt.maxMemory());
-memoryInfo.totalCacheMemory = totalCacheMemory;
-context.memoryInfo = memoryInfo;
+rt = Runtime.getRuntime()
+memoryInfo = [:]
+memoryInfo.memory = UtilFormatOut.formatQuantity(rt.totalMemory())
+memoryInfo.freeMemory = UtilFormatOut.formatQuantity(rt.freeMemory())
+memoryInfo.usedMemory = UtilFormatOut.formatQuantity((rt.totalMemory() - rt.freeMemory()))
+memoryInfo.maxMemory = UtilFormatOut.formatQuantity(rt.maxMemory())
+memoryInfo.totalCacheMemory = totalCacheMemory
+context.memoryInfo = memoryInfo
diff --git a/framework/webtools/groovyScripts/cache/FindUtilCacheElements.groovy b/framework/webtools/groovyScripts/cache/FindUtilCacheElements.groovy
index f677efe3c4..3b0cef9648 100644
--- a/framework/webtools/groovyScripts/cache/FindUtilCacheElements.groovy
+++ b/framework/webtools/groovyScripts/cache/FindUtilCacheElements.groovy
@@ -16,38 +16,38 @@
* specific language governing permissions and limitations
* under the License.
*/
-import org.apache.ofbiz.base.util.cache.UtilCache;
-import org.apache.ofbiz.base.util.cache.CacheLine;
-import org.apache.ofbiz.base.util.UtilFormatOut;
-import org.apache.ofbiz.base.util.UtilMisc;
-import org.apache.ofbiz.security.Security;
+import org.apache.ofbiz.base.util.cache.UtilCache
+import org.apache.ofbiz.base.util.cache.CacheLine
+import org.apache.ofbiz.base.util.UtilFormatOut
+import org.apache.ofbiz.base.util.UtilMisc
+import org.apache.ofbiz.security.Security
-context.hasUtilCacheEdit = security.hasEntityPermission("UTIL_CACHE", "_EDIT", session);
+context.hasUtilCacheEdit = security.hasEntityPermission("UTIL_CACHE", "_EDIT", session)
-cacheName = parameters.UTIL_CACHE_NAME;
-context.cacheName = cacheName;
-context.now = (new Date()).toString();
+cacheName = parameters.UTIL_CACHE_NAME
+context.cacheName = cacheName
+context.now = (new Date()).toString()
-totalSize = 0;
+totalSize = 0
-cacheElementsList = [];
+cacheElementsList = []
if (cacheName) {
- utilCache = UtilCache.findCache(cacheName);
+ utilCache = UtilCache.findCache(cacheName)
if (utilCache) {
cacheElementsList = utilCache.getLineInfos()
cacheElementsList.each {
if (it.expireTimeMillis != null) {
- it.expireTimeMillis = (it.expireTimeMillis / 1000) .toString();
+ it.expireTimeMillis = (it.expireTimeMillis / 1000) .toString()
}
- totalSize += it.lineSize;
- it.lineSize = UtilFormatOut.formatQuantity(it.lineSize);
+ totalSize += it.lineSize
+ it.lineSize = UtilFormatOut.formatQuantity(it.lineSize)
}
}
}
-context.totalSize = UtilFormatOut.formatQuantity(totalSize);
-sortField = parameters.sortField;
+context.totalSize = UtilFormatOut.formatQuantity(totalSize)
+sortField = parameters.sortField
if (sortField) {
- context.cacheElementsList = UtilMisc.sortMaps(cacheElementsList, UtilMisc.toList(sortField));
+ context.cacheElementsList = UtilMisc.sortMaps(cacheElementsList, UtilMisc.toList(sortField))
} else {
- context.cacheElementsList = cacheElementsList;
+ context.cacheElementsList = cacheElementsList
}
diff --git a/framework/webtools/groovyScripts/datafile/ViewDataFile.groovy b/framework/webtools/groovyScripts/datafile/ViewDataFile.groovy
index 05f82987e9..c034da8fdd 100644
--- a/framework/webtools/groovyScripts/datafile/ViewDataFile.groovy
+++ b/framework/webtools/groovyScripts/datafile/ViewDataFile.groovy
@@ -17,87 +17,87 @@
* under the License.
*/
-import java.util.*;
-import java.net.*;
-import org.apache.ofbiz.security.*;
-import org.apache.ofbiz.base.util.*;
-import org.apache.ofbiz.datafile.*;
+import java.util.*
+import java.net.*
+import org.apache.ofbiz.security.*
+import org.apache.ofbiz.base.util.*
+import org.apache.ofbiz.datafile.*
-uiLabelMap = UtilProperties.getResourceBundleMap("WebtoolsUiLabels", locale);
-messages = [];
+uiLabelMap = UtilProperties.getResourceBundleMap("WebtoolsUiLabels", locale)
+messages = []
-dataFileSave = request.getParameter("DATAFILE_SAVE");
+dataFileSave = request.getParameter("DATAFILE_SAVE")
-entityXmlFileSave = request.getParameter("ENTITYXML_FILE_SAVE");
+entityXmlFileSave = request.getParameter("ENTITYXML_FILE_SAVE")
-dataFileLoc = request.getParameter("DATAFILE_LOCATION");
-definitionLoc = request.getParameter("DEFINITION_LOCATION");
-definitionName = request.getParameter("DEFINITION_NAME");
-dataFileIsUrl = null != request.getParameter("DATAFILE_IS_URL");
-definitionIsUrl = null != request.getParameter("DEFINITION_IS_URL");
+dataFileLoc = request.getParameter("DATAFILE_LOCATION")
+definitionLoc = request.getParameter("DEFINITION_LOCATION")
+definitionName = request.getParameter("DEFINITION_NAME")
+dataFileIsUrl = null != request.getParameter("DATAFILE_IS_URL")
+definitionIsUrl = null != request.getParameter("DEFINITION_IS_URL")
try {
- dataFileUrl = dataFileIsUrl?new URL(dataFileLoc):UtilURL.fromFilename(dataFileLoc);
+ dataFileUrl = dataFileIsUrl?new URL(dataFileLoc):UtilURL.fromFilename(dataFileLoc)
}
catch (java.net.MalformedURLException e) {
- messages.add(e.getMessage());
+ messages.add(e.getMessage())
}
try {
- definitionUrl = definitionIsUrl?new URL(definitionLoc):UtilURL.fromFilename(definitionLoc);
+ definitionUrl = definitionIsUrl?new URL(definitionLoc):UtilURL.fromFilename(definitionLoc)
}
catch (java.net.MalformedURLException e) {
- messages.add(e.getMessage());
+ messages.add(e.getMessage())
}
-definitionNames = null;
+definitionNames = null
if (definitionUrl) {
try {
- ModelDataFileReader reader = ModelDataFileReader.getModelDataFileReader(definitionUrl);
+ ModelDataFileReader reader = ModelDataFileReader.getModelDataFileReader(definitionUrl)
if (reader) {
- definitionNames = ((Collection)reader.getDataFileNames()).iterator();
- context.put("definitionNames", definitionNames);
+ definitionNames = ((Collection)reader.getDataFileNames()).iterator()
+ context.put("definitionNames", definitionNames)
}
}
catch (Exception e) {
- messages.add(e.getMessage());
+ messages.add(e.getMessage())
}
}
-dataFile = null;
+dataFile = null
if (dataFileUrl && definitionUrl && definitionNames) {
try {
- dataFile = DataFile.readFile(dataFileUrl, definitionUrl, definitionName);
- context.put("dataFile", dataFile);
+ dataFile = DataFile.readFile(dataFileUrl, definitionUrl, definitionName)
+ context.put("dataFile", dataFile)
}
catch (Exception e) {
- messages.add(e.toString()); Debug.log(e);
+ messages.add(e.toString()); Debug.log(e)
}
}
if (dataFile) {
- modelDataFile = dataFile.getModelDataFile();
- context.put("modelDataFile", modelDataFile);
+ modelDataFile = dataFile.getModelDataFile()
+ context.put("modelDataFile", modelDataFile)
}
if (dataFile && dataFileSave) {
try {
- dataFile.writeDataFile(dataFileSave);
- messages.add(uiLabelMap.get("WebtoolsDataFileSavedTo") + dataFileSave);
+ dataFile.writeDataFile(dataFileSave)
+ messages.add(uiLabelMap.get("WebtoolsDataFileSavedTo") + dataFileSave)
}
catch (Exception e) {
- messages.add(e.getMessage());
+ messages.add(e.getMessage())
}
}
if (dataFile && entityXmlFileSave) {
try {
- //dataFile.writeDataFile(entityXmlFileSave);
- DataFile2EntityXml.writeToEntityXml(entityXmlFileSave, dataFile);
- messages.add(uiLabelMap.get("WebtoolsDataEntityFileSavedTo") + entityXmlFileSave);
+ //dataFile.writeDataFile(entityXmlFileSave)
+ DataFile2EntityXml.writeToEntityXml(entityXmlFileSave, dataFile)
+ messages.add(uiLabelMap.get("WebtoolsDataEntityFileSavedTo") + entityXmlFileSave)
}
catch (Exception e) {
- messages.add(e.getMessage());
+ messages.add(e.getMessage())
}
}
-context.messages = messages;
+context.messages = messages
diff --git a/framework/webtools/groovyScripts/entity/CheckDb.groovy b/framework/webtools/groovyScripts/entity/CheckDb.groovy
index c05aed6c70..fd822de87e 100644
--- a/framework/webtools/groovyScripts/entity/CheckDb.groovy
+++ b/framework/webtools/groovyScripts/entity/CheckDb.groovy
@@ -16,105 +16,105 @@
* specific language governing permissions and limitations
* under the License.
*/
-import org.apache.ofbiz.entity.Delegator;
-import org.apache.ofbiz.security.Security;
-import org.apache.ofbiz.entity.jdbc.DatabaseUtil;
-import org.apache.ofbiz.entity.model.ModelEntity;
+import org.apache.ofbiz.entity.Delegator
+import org.apache.ofbiz.security.Security
+import org.apache.ofbiz.entity.jdbc.DatabaseUtil
+import org.apache.ofbiz.entity.model.ModelEntity
-controlPath = parameters._CONTROL_PATH_;
+controlPath = parameters._CONTROL_PATH_
if (security.hasPermission("ENTITY_MAINT", session)) {
- addMissing = "true".equals(parameters.addMissing);
- checkFkIdx = "true".equals(parameters.checkFkIdx);
- checkFks = "true".equals(parameters.checkFks);
- checkPks = "true".equals(parameters.checkPks);
- repair = "true".equals(parameters.repair);
- option = parameters.option;
- groupName = parameters.groupName;
- entityName = parameters.entityName;
+ addMissing = "true".equals(parameters.addMissing)
+ checkFkIdx = "true".equals(parameters.checkFkIdx)
+ checkFks = "true".equals(parameters.checkFks)
+ checkPks = "true".equals(parameters.checkPks)
+ repair = "true".equals(parameters.repair)
+ option = parameters.option
+ groupName = parameters.groupName
+ entityName = parameters.entityName
if (groupName) {
- helperInfo = delegator.getGroupHelperInfo(groupName);
+ helperInfo = delegator.getGroupHelperInfo(groupName)
- messages = [];
- //helper = GenericHelperFactory.getHelper(helperName);
- dbUtil = new DatabaseUtil(helperInfo);
- modelEntities = delegator.getModelEntityMapByGroup(groupName);
- modelEntityNames = new TreeSet(modelEntities.keySet());
+ messages = []
+ //helper = GenericHelperFactory.getHelper(helperName)
+ dbUtil = new DatabaseUtil(helperInfo)
+ modelEntities = delegator.getModelEntityMapByGroup(groupName)
+ modelEntityNames = new TreeSet(modelEntities.keySet())
if ("checkupdatetables".equals(option)) {
- fieldsToRepair = null;
+ fieldsToRepair = null
if (repair) {
- fieldsToRepair = [];
+ fieldsToRepair = []
}
- dbUtil.checkDb(modelEntities, fieldsToRepair, messages, checkPks, checkFks, checkFkIdx, addMissing);
+ dbUtil.checkDb(modelEntities, fieldsToRepair, messages, checkPks, checkFks, checkFkIdx, addMissing)
if (fieldsToRepair) {
- dbUtil.repairColumnSizeChanges(modelEntities, fieldsToRepair, messages);
+ dbUtil.repairColumnSizeChanges(modelEntities, fieldsToRepair, messages)
}
} else if ("removetables".equals(option)) {
modelEntityNames.each { modelEntityName ->
- modelEntity = modelEntities[modelEntityName];
- dbUtil.deleteTable(modelEntity, messages);
+ modelEntity = modelEntities[modelEntityName]
+ dbUtil.deleteTable(modelEntity, messages)
}
} else if ("removetable".equals(option)) {
- modelEntity = modelEntities[entityName];
- dbUtil.deleteTable(modelEntity, messages);
+ modelEntity = modelEntities[entityName]
+ dbUtil.deleteTable(modelEntity, messages)
} else if ("removepks".equals(option)) {
modelEntityNames.each { modelEntityName ->
- modelEntity = modelEntities[modelEntityName];
- dbUtil.deletePrimaryKey(modelEntity, messages);
+ modelEntity = modelEntities[modelEntityName]
+ dbUtil.deletePrimaryKey(modelEntity, messages)
}
} else if ("removepk".equals(option)) {
- modelEntity = modelEntities[entityName];
- dbUtil.deletePrimaryKey(modelEntity, messages);
+ modelEntity = modelEntities[entityName]
+ dbUtil.deletePrimaryKey(modelEntity, messages)
} else if ("createpks".equals(option)) {
modelEntityNames.each { modelEntityName ->
- modelEntity = modelEntities[modelEntityName];
- dbUtil.createPrimaryKey(modelEntity, messages);
+ modelEntity = modelEntities[modelEntityName]
+ dbUtil.createPrimaryKey(modelEntity, messages)
}
} else if ("createpk".equals(option)) {
- modelEntity = modelEntities[entityName];
- dbUtil.createPrimaryKey(modelEntity, messages);
+ modelEntity = modelEntities[entityName]
+ dbUtil.createPrimaryKey(modelEntity, messages)
} else if ("createfkidxs".equals(option)) {
modelEntityNames.each { modelEntityName ->
- modelEntity = modelEntities[modelEntityName];
- dbUtil.createForeignKeyIndices(modelEntity, messages);
+ modelEntity = modelEntities[modelEntityName]
+ dbUtil.createForeignKeyIndices(modelEntity, messages)
}
} else if ("removefkidxs".equals(option)) {
modelEntityNames.each { modelEntityName ->
- modelEntity = modelEntities[modelEntityName];
- dbUtil.deleteForeignKeyIndices(modelEntity, messages);
+ modelEntity = modelEntities[modelEntityName]
+ dbUtil.deleteForeignKeyIndices(modelEntity, messages)
}
} else if ("createfks".equals(option)) {
modelEntityNames.each { modelEntityName ->
- modelEntity = modelEntities[modelEntityName];
- dbUtil.createForeignKeys(modelEntity, modelEntities, messages);
+ modelEntity = modelEntities[modelEntityName]
+ dbUtil.createForeignKeys(modelEntity, modelEntities, messages)
}
} else if ("removefks".equals(option)) {
modelEntityNames.each { modelEntityName ->
- modelEntity = modelEntities[modelEntityName];
- dbUtil.deleteForeignKeys(modelEntity, modelEntities, messages);
+ modelEntity = modelEntities[modelEntityName]
+ dbUtil.deleteForeignKeys(modelEntity, modelEntities, messages)
}
} else if ("createidx".equals(option)) {
modelEntityNames.each { modelEntityName ->
- modelEntity = modelEntities[modelEntityName];
- dbUtil.createDeclaredIndices(modelEntity, messages);
+ modelEntity = modelEntities[modelEntityName]
+ dbUtil.createDeclaredIndices(modelEntity, messages)
}
} else if ("removeidx".equals(option)) {
modelEntityNames.each { modelEntityName ->
- modelEntity = modelEntities[modelEntityName];
- dbUtil.deleteDeclaredIndices(modelEntity, messages);
+ modelEntity = modelEntities[modelEntityName]
+ dbUtil.deleteDeclaredIndices(modelEntity, messages)
}
} else if ("updateCharsetCollate".equals(option)) {
modelEntityNames.each { modelEntityName ->
- modelEntity = modelEntities[modelEntityName];
- dbUtil.updateCharacterSetAndCollation(modelEntity, messages);
+ modelEntity = modelEntities[modelEntityName]
+ dbUtil.updateCharacterSetAndCollation(modelEntity, messages)
}
}
- miter = messages.iterator();
- context.miters = miter;
+ miter = messages.iterator()
+ context.miters = miter
}
- context.encodeURLCheckDb = response.encodeURL(controlPath + "/view/checkdb");
- context.groupName = groupName ?: "org.apache.ofbiz";
- context.entityName = entityName ?: "";
+ context.encodeURLCheckDb = response.encodeURL(controlPath + "/view/checkdb")
+ context.groupName = groupName ?: "org.apache.ofbiz"
+ context.entityName = entityName ?: ""
}
diff --git a/framework/webtools/groovyScripts/entity/EntityMaint.groovy b/framework/webtools/groovyScripts/entity/EntityMaint.groovy
index 19d4c62e0f..1c619e3fa6 100644
--- a/framework/webtools/groovyScripts/entity/EntityMaint.groovy
+++ b/framework/webtools/groovyScripts/entity/EntityMaint.groovy
@@ -16,85 +16,85 @@
* specific language governing permissions and limitations
* under the License.
*/
-import org.apache.ofbiz.base.util.UtilValidate;
+import org.apache.ofbiz.base.util.UtilValidate
import org.apache.ofbiz.entity.Delegator
import org.apache.ofbiz.entity.DelegatorFactory
import org.apache.ofbiz.entity.GenericValue
import org.apache.ofbiz.entity.condition.EntityComparisonOperator
-import org.apache.ofbiz.entity.condition.EntityCondition;
-import org.apache.ofbiz.entity.model.ModelGroupReader;
-import org.apache.ofbiz.entity.model.ModelReader;
-import org.apache.ofbiz.entity.model.ModelEntity;
+import org.apache.ofbiz.entity.condition.EntityCondition
+import org.apache.ofbiz.entity.model.ModelGroupReader
+import org.apache.ofbiz.entity.model.ModelReader
+import org.apache.ofbiz.entity.model.ModelEntity
import org.apache.ofbiz.entity.model.ModelViewEntity
-import org.apache.ofbiz.entity.util.EntityUtil;
-import org.apache.ofbiz.base.util.UtilProperties;
+import org.apache.ofbiz.entity.util.EntityUtil
+import org.apache.ofbiz.base.util.UtilProperties
if (delegator.getDelegatorTenantId() == null) {
- mgr = delegator.getModelGroupReader();
- entityGroups = mgr.getGroupNames(delegator.getDelegatorName()).toArray().sort();
+ mgr = delegator.getModelGroupReader()
+ entityGroups = mgr.getGroupNames(delegator.getDelegatorName()).toArray().sort()
} else {
- Delegator baseDelegator = DelegatorFactory.getDelegator(delegator.getDelegatorBaseName());
- entityGroups = EntityUtil.getFieldListFromEntityList(baseDelegator.findList("TenantDataSource", EntityCondition.makeCondition("tenantId", EntityComparisonOperator.EQUALS, delegator.getDelegatorTenantId()), ['entityGroupName'] as Set, ['entityGroupName'], null, false), 'entityGroupName', false);
+ Delegator baseDelegator = DelegatorFactory.getDelegator(delegator.getDelegatorBaseName())
+ entityGroups = EntityUtil.getFieldListFromEntityList(baseDelegator.findList("TenantDataSource", EntityCondition.makeCondition("tenantId", EntityComparisonOperator.EQUALS, delegator.getDelegatorTenantId()), ['entityGroupName'] as Set, ['entityGroupName'], null, false), 'entityGroupName', false)
}
-context.entityGroups = [];
-context.entityGroups.add(["name" : UtilProperties.getMessage("WebtoolsUiLabels", "WebtoolsAll", locale), "value" : ""]);
+context.entityGroups = []
+context.entityGroups.add(["name" : UtilProperties.getMessage("WebtoolsUiLabels", "WebtoolsAll", locale), "value" : ""])
for (String entityGroup : entityGroups) {
- context.entityGroups.add(["name" : entityGroup, "value" : entityGroup]);
+ context.entityGroups.add(["name" : entityGroup, "value" : entityGroup])
}
-filterByGroupName = parameters.filterByGroupName;
-context.filterByGroupName = filterByGroupName;
+filterByGroupName = parameters.filterByGroupName
+context.filterByGroupName = filterByGroupName
-filterByEntityName = parameters.filterByEntityName;
-context.filterByEntityName = filterByEntityName;
+filterByEntityName = parameters.filterByEntityName
+context.filterByEntityName = filterByEntityName
-reader = delegator.getModelReader();
-entities = new TreeSet(reader.getEntityNames());
+reader = delegator.getModelReader()
+entities = new TreeSet(reader.getEntityNames())
-entitiesList = [];
-firstChars = [];
-firstChar = "";
+entitiesList = []
+firstChars = []
+firstChar = ""
entities.each { entityName ->
- entity = reader.getModelEntity(entityName);
- entityGroupName = delegator.getEntityGroupName(entity.getEntityName());
+ entity = reader.getModelEntity(entityName)
+ entityGroupName = delegator.getEntityGroupName(entity.getEntityName())
if (!entityGroups.contains(entityGroupName)) {
- return;
+ return
}
if (filterByGroupName && !filterByGroupName.equals(entityGroupName)) {
- return;
+ return
}
if (filterByEntityName && !((String)entity.getEntityName()).toUpperCase().contains(filterByEntityName.toUpperCase().replace(" ", ""))) {
- return;
+ return
}
- viewEntity = "N";
+ viewEntity = "N"
if (entity instanceof ModelViewEntity) {
- viewEntity = "Y";
+ viewEntity = "Y"
}
- entityPermissionView = "N";
+ entityPermissionView = "N"
if (security.hasEntityPermission("ENTITY_DATA", "_VIEW", session) || security.hasEntityPermission(entity.getPlainTableName(), "_VIEW", session)) {
- entityPermissionView = "Y";
+ entityPermissionView = "Y"
}
- entityPermissionCreate = "N";
+ entityPermissionCreate = "N"
if (security.hasEntityPermission("ENTITY_DATA", "_CREATE", session) || security.hasEntityPermission(entity.getPlainTableName(), "_CREATE", session)) {
- entityPermissionCreate = "Y";
+ entityPermissionCreate = "Y"
}
- entityMap = [:];
- entityMap.entityName = entity.getEntityName();
- entityMap.entityPermissionView = entityPermissionView;
- entityMap.entityPermissionCreate = entityPermissionCreate;
- entityMap.viewEntity = viewEntity;
+ entityMap = [:]
+ entityMap.entityName = entity.getEntityName()
+ entityMap.entityPermissionView = entityPermissionView
+ entityMap.entityPermissionCreate = entityPermissionCreate
+ entityMap.viewEntity = viewEntity
if (firstChar != entityName.substring(0, 1)) {
- firstChar = entityName.substring(0, 1);
- firstChars.add(firstChar);
+ firstChar = entityName.substring(0, 1)
+ firstChars.add(firstChar)
}
- entitiesList.add(entityMap);
+ entitiesList.add(entityMap)
}
-context.firstChars = firstChars;
-context.entitiesList = entitiesList;
\ No newline at end of file
+context.firstChars = firstChars
+context.entitiesList = entitiesList
\ No newline at end of file
diff --git a/framework/webtools/groovyScripts/entity/EntityPerformanceTest.groovy b/framework/webtools/groovyScripts/entity/EntityPerformanceTest.groovy
index 2cc5d1c25a..e0cf35e0a3 100644
--- a/framework/webtools/groovyScripts/entity/EntityPerformanceTest.groovy
+++ b/framework/webtools/groovyScripts/entity/EntityPerformanceTest.groovy
@@ -17,233 +17,233 @@
* under the License.
*/
-import java.text.DecimalFormat;
-import java.util.*;
-import org.apache.ofbiz.base.util.cache.UtilCache;
-import org.apache.ofbiz.base.util.UtilValidate;
-import org.apache.ofbiz.security.*;
-import org.apache.ofbiz.entity.*;
-import org.apache.ofbiz.base.util.*;
+import java.text.DecimalFormat
+import java.util.*
+import org.apache.ofbiz.base.util.cache.UtilCache
+import org.apache.ofbiz.base.util.UtilValidate
+import org.apache.ofbiz.security.*
+import org.apache.ofbiz.entity.*
+import org.apache.ofbiz.base.util.*
-DecimalFormat decimalFormat = new DecimalFormat("#,##0.#######");
+DecimalFormat decimalFormat = new DecimalFormat("#,##0.#######")
if (security.hasPermission("ENTITY_MAINT", session)) {
- performanceList = [];
+ performanceList = []
- calls = 1000;
- startTime = System.currentTimeMillis();
+ calls = 1000
+ startTime = System.currentTimeMillis()
for (int i = 0; i < calls; i++) {
- dummy = delegator.findOne("JobSandbox", [jobId : "PURGE_OLD_JOBS"], false);
+ dummy = delegator.findOne("JobSandbox", [jobId : "PURGE_OLD_JOBS"], false)
}
- totalTime = System.currentTimeMillis() - startTime;
- callsPerSecond = calls / (totalTime/1000);
+ totalTime = System.currentTimeMillis() - startTime
+ callsPerSecond = calls / (totalTime/1000)
- perfRow = [:];
- perfRow.operation = "findOne(false)";
- perfRow.entity = "Large:JobSandbox";
- perfRow.calls = decimalFormat.format(calls);
- perfRow.seconds = decimalFormat.format(totalTime / 1000);
- perfRow.secsPerCall = decimalFormat.format(1 / callsPerSecond);
- perfRow.callsPerSecond = decimalFormat.format(callsPerSecond);
- performanceList.add(perfRow);
+ perfRow = [:]
+ perfRow.operation = "findOne(false)"
+ perfRow.entity = "Large:JobSandbox"
+ perfRow.calls = decimalFormat.format(calls)
+ perfRow.seconds = decimalFormat.format(totalTime / 1000)
+ perfRow.secsPerCall = decimalFormat.format(1 / callsPerSecond)
+ perfRow.callsPerSecond = decimalFormat.format(callsPerSecond)
+ performanceList.add(perfRow)
- calls = 10000;
- startTime = System.currentTimeMillis();
+ calls = 10000
+ startTime = System.currentTimeMillis()
for (int i = 0; i < calls; i++) {
- dummy = delegator.findOne("JobSandbox", [jobId : "PURGE_OLD_JOBS"], true);
+ dummy = delegator.findOne("JobSandbox", [jobId : "PURGE_OLD_JOBS"], true)
}
- totalTime = System.currentTimeMillis() - startTime;
- callsPerSecond = calls / (totalTime / 1000);
+ totalTime = System.currentTimeMillis() - startTime
+ callsPerSecond = calls / (totalTime / 1000)
- perfRow = [:];
- perfRow.operation = "findOne(true)";
- perfRow.entity = "Large:JobSandbox";
- perfRow.calls = decimalFormat.format(calls);
- perfRow.seconds = decimalFormat.format(totalTime / 1000);
- perfRow.secsPerCall = decimalFormat.format(1 / callsPerSecond);
- perfRow.callsPerSecond = decimalFormat.format(callsPerSecond);
- performanceList.add(perfRow);
+ perfRow = [:]
+ perfRow.operation = "findOne(true)"
+ perfRow.entity = "Large:JobSandbox"
+ perfRow.calls = decimalFormat.format(calls)
+ perfRow.seconds = decimalFormat.format(totalTime / 1000)
+ perfRow.secsPerCall = decimalFormat.format(1 / callsPerSecond)
+ perfRow.callsPerSecond = decimalFormat.format(callsPerSecond)
+ performanceList.add(perfRow)
- calls = 1000;
- startTime = System.currentTimeMillis();
+ calls = 1000
+ startTime = System.currentTimeMillis()
for (int i = 0; i < calls; i++) {
- dummy = delegator.findOne("DataSourceType", [dataSourceTypeId : "ADMIN_ENTRY"], false);
+ dummy = delegator.findOne("DataSourceType", [dataSourceTypeId : "ADMIN_ENTRY"], false)
}
- totalTime = System.currentTimeMillis() - startTime;
- callsPerSecond = calls / (totalTime / 1000);
+ totalTime = System.currentTimeMillis() - startTime
+ callsPerSecond = calls / (totalTime / 1000)
- perfRow = [:];
- perfRow.operation = "findOne(false)";
- perfRow.entity = "Small:DataSourceType";
- perfRow.calls = decimalFormat.format(calls);
- perfRow.seconds = decimalFormat.format(totalTime / 1000);
- perfRow.secsPerCall = decimalFormat.format(1 / callsPerSecond);
- perfRow.callsPerSecond = decimalFormat.format(callsPerSecond);
- performanceList.add(perfRow);
+ perfRow = [:]
+ perfRow.operation = "findOne(false)"
+ perfRow.entity = "Small:DataSourceType"
+ perfRow.calls = decimalFormat.format(calls)
+ perfRow.seconds = decimalFormat.format(totalTime / 1000)
+ perfRow.secsPerCall = decimalFormat.format(1 / callsPerSecond)
+ perfRow.callsPerSecond = decimalFormat.format(callsPerSecond)
+ performanceList.add(perfRow)
- calls = 10000;
- startTime = System.currentTimeMillis();
+ calls = 10000
+ startTime = System.currentTimeMillis()
for (int i=0; i < calls; i++) {
- dummy = delegator.findOne("DataSourceType", [dataSourceTypeId : "ADMIN_ENTRY"], true);
+ dummy = delegator.findOne("DataSourceType", [dataSourceTypeId : "ADMIN_ENTRY"], true)
}
- totalTime = System.currentTimeMillis() - startTime;
- callsPerSecond = calls / (totalTime / 1000);
+ totalTime = System.currentTimeMillis() - startTime
+ callsPerSecond = calls / (totalTime / 1000)
- perfRow = [:];
- perfRow.operation = "findOne(true)";
- perfRow.entity = "Small:DataSourceType";
- perfRow.calls = decimalFormat.format(calls);
- perfRow.seconds = decimalFormat.format(totalTime / 1000);
- perfRow.secsPerCall = decimalFormat.format(1 / callsPerSecond);
- perfRow.callsPerSecond = decimalFormat.format(callsPerSecond);
- performanceList.add(perfRow);
+ perfRow = [:]
+ perfRow.operation = "findOne(true)"
+ perfRow.entity = "Small:DataSourceType"
+ perfRow.calls = decimalFormat.format(calls)
+ perfRow.seconds = decimalFormat.format(totalTime / 1000)
+ perfRow.secsPerCall = decimalFormat.format(1 / callsPerSecond)
+ perfRow.callsPerSecond = decimalFormat.format(callsPerSecond)
+ performanceList.add(perfRow)
- createTestList = [];
- calls = 1000;
- startTime = System.currentTimeMillis();
+ createTestList = []
+ calls = 1000
+ startTime = System.currentTimeMillis()
for (int i = 0; i < calls; i++) {
- dummy = delegator.makeValue("JobSandbox", [poolId : "pool", jobName : "Initial Name" + i, serviceName : "foo", statusId : "SERVICE_FINISHED", jobId : "_~WRITE_TEST~_" + i]);
- createTestList.add(dummy);
- delegator.create(dummy);
+ dummy = delegator.makeValue("JobSandbox", [poolId : "pool", jobName : "Initial Name" + i, serviceName : "foo", statusId : "SERVICE_FINISHED", jobId : "_~WRITE_TEST~_" + i])
+ createTestList.add(dummy)
+ delegator.create(dummy)
}
- totalTime = System.currentTimeMillis() - startTime;
- callsPerSecond = calls / (totalTime / 1000);
+ totalTime = System.currentTimeMillis() - startTime
+ callsPerSecond = calls / (totalTime / 1000)
- perfRow = [:];
- perfRow.operation = "create";
- perfRow.entity = "Large:JobSandbox";
- perfRow.calls = decimalFormat.format(calls);
- perfRow.seconds = decimalFormat.format(totalTime / 1000);
- perfRow.secsPerCall = decimalFormat.format(1 / callsPerSecond);
- perfRow.callsPerSecond = decimalFormat.format(callsPerSecond);
- performanceList.add(perfRow);
+ perfRow = [:]
+ perfRow.operation = "create"
+ perfRow.entity = "Large:JobSandbox"
+ perfRow.calls = decimalFormat.format(calls)
+ perfRow.seconds = decimalFormat.format(totalTime / 1000)
+ perfRow.secsPerCall = decimalFormat.format(1 / callsPerSecond)
+ perfRow.callsPerSecond = decimalFormat.format(callsPerSecond)
+ performanceList.add(perfRow)
- calls = 1000;
- startTime = System.currentTimeMillis();
+ calls = 1000
+ startTime = System.currentTimeMillis()
for (int i = 0; i < calls; i++) {
- dummy = createTestList.get(i);
- dummy.jobName = "This was a test from the performance groovy script";
- dummy.store();
+ dummy = createTestList.get(i)
+ dummy.jobName = "This was a test from the performance groovy script"
+ dummy.store()
}
- totalTime = System.currentTimeMillis() - startTime;
- callsPerSecond = calls / (totalTime / 1000);
+ totalTime = System.currentTimeMillis() - startTime
+ callsPerSecond = calls / (totalTime / 1000)
- perfRow = [:];
- perfRow.operation = "update";
- perfRow.entity = "Large:JobSandbox";
- perfRow.calls = decimalFormat.format(calls);
- perfRow.seconds = decimalFormat.format(totalTime / 1000);
- perfRow.secsPerCall = decimalFormat.format(1 / callsPerSecond);
- perfRow.callsPerSecond = decimalFormat.format(callsPerSecond);
- performanceList.add(perfRow);
+ perfRow = [:]
+ perfRow.operation = "update"
+ perfRow.entity = "Large:JobSandbox"
+ perfRow.calls = decimalFormat.format(calls)
+ perfRow.seconds = decimalFormat.format(totalTime / 1000)
+ perfRow.secsPerCall = decimalFormat.format(1 / callsPerSecond)
+ perfRow.callsPerSecond = decimalFormat.format(callsPerSecond)
+ performanceList.add(perfRow)
- calls = 1000;
- startTime = System.currentTimeMillis();
+ calls = 1000
+ startTime = System.currentTimeMillis()
for (int i = 0; i < calls; i++) {
- dummy = createTestList.get(i);
- dummy.remove();
+ dummy = createTestList.get(i)
+ dummy.remove()
}
- totalTime = System.currentTimeMillis() - startTime;
- callsPerSecond = (double) calls / (totalTime / 1000);
+ totalTime = System.currentTimeMillis() - startTime
+ callsPerSecond = (double) calls / (totalTime / 1000)
- perfRow = [:];
- perfRow.operation = "remove";
- perfRow.entity = "Large:JobSandbox";
- perfRow.calls = decimalFormat.format(calls);
- perfRow.seconds = decimalFormat.format(totalTime / 1000);
- perfRow.secsPerCall = decimalFormat.format(1 / callsPerSecond);
- perfRow.callsPerSecond = decimalFormat.format(callsPerSecond);
- performanceList.add(perfRow);
+ perfRow = [:]
+ perfRow.operation = "remove"
+ perfRow.entity = "Large:JobSandbox"
+ perfRow.calls = decimalFormat.format(calls)
+ perfRow.seconds = decimalFormat.format(totalTime / 1000)
+ perfRow.secsPerCall = decimalFormat.format(1 / callsPerSecond)
+ perfRow.callsPerSecond = decimalFormat.format(callsPerSecond)
+ performanceList.add(perfRow)
- calls = 100000;
- startTime = System.currentTimeMillis();
+ calls = 100000
+ startTime = System.currentTimeMillis()
for (int i = 0; i < calls; i++) {
- ptyMap = [:];
- ptyMap.dataSourceTypeId = "ADMIN_ENTRY";
+ ptyMap = [:]
+ ptyMap.dataSourceTypeId = "ADMIN_ENTRY"
}
- totalTime = System.currentTimeMillis() - startTime;
- callsPerSecond = calls / (totalTime / 1000);
+ totalTime = System.currentTimeMillis() - startTime
+ callsPerSecond = calls / (totalTime / 1000)
- perfRow = [:];
- perfRow.operation = "new HashMap";
- perfRow.entity = "N/A";
- perfRow.calls = decimalFormat.format(calls);
- perfRow.seconds = decimalFormat.format(totalTime / 1000);
- perfRow.secsPerCall = decimalFormat.format(1 / callsPerSecond);
- perfRow.callsPerSecond = decimalFormat.format(callsPerSecond);
- performanceList.add(perfRow);
+ perfRow = [:]
+ perfRow.operation = "new HashMap"
+ perfRow.entity = "N/A"
+ perfRow.calls = decimalFormat.format(calls)
+ perfRow.seconds = decimalFormat.format(totalTime / 1000)
+ perfRow.secsPerCall = decimalFormat.format(1 / callsPerSecond)
+ perfRow.callsPerSecond = decimalFormat.format(callsPerSecond)
+ performanceList.add(perfRow)
- calls = 100000;
- startTime = System.currentTimeMillis();
+ calls = 100000
+ startTime = System.currentTimeMillis()
for (int i = 0; i < calls; i++) {
- ptyMap = UtilMisc.toMap("dataSourceTypeId", "ADMIN_ENTRY");
+ ptyMap = UtilMisc.toMap("dataSourceTypeId", "ADMIN_ENTRY")
}
- totalTime = System.currentTimeMillis() - startTime;
- callsPerSecond = calls / (totalTime / 1000);
+ totalTime = System.currentTimeMillis() - startTime
+ callsPerSecond = calls / (totalTime / 1000)
- perfRow = [:];
- perfRow.operation = "UtilMisc.toMap";
- perfRow.entity = "N/A";
- perfRow.calls = decimalFormat.format(calls);
- perfRow.seconds = decimalFormat.format(totalTime / 1000);
- perfRow.secsPerCall = decimalFormat.format(1 / callsPerSecond);
- perfRow.callsPerSecond = decimalFormat.format(callsPerSecond);
- performanceList.add(perfRow);
+ perfRow = [:]
+ perfRow.operation = "UtilMisc.toMap"
+ perfRow.entity = "N/A"
+ perfRow.calls = decimalFormat.format(calls)
+ perfRow.seconds = decimalFormat.format(totalTime / 1000)
+ perfRow.secsPerCall = decimalFormat.format(1 / callsPerSecond)
+ perfRow.callsPerSecond = decimalFormat.format(callsPerSecond)
+ performanceList.add(perfRow)
- utilCache = new UtilCache("test-cache", 0, 0, 0, false, null, "test-cache");
- utilCache.put("testName", "testValue");
- calls = 1000000;
- startTime = System.currentTimeMillis();
+ utilCache = new UtilCache("test-cache", 0, 0, 0, false, null, "test-cache")
+ utilCache.put("testName", "testValue")
+ calls = 1000000
+ startTime = System.currentTimeMillis()
for (int i = 0; i < calls; i++) {
- utilCache.get("testName");
+ utilCache.get("testName")
}
- totalTime = System.currentTimeMillis() - startTime;
- callsPerSecond = calls / (totalTime / 1000);
+ totalTime = System.currentTimeMillis() - startTime
+ callsPerSecond = calls / (totalTime / 1000)
- perfRow = [:];
- perfRow.operation = "UtilCache.get(String) - basic settings";
- perfRow.entity = "N/A";
- perfRow.calls = decimalFormat.format(calls);
- perfRow.seconds = decimalFormat.format(totalTime / 1000);
- perfRow.secsPerCall = decimalFormat.format(1 / callsPerSecond);
- perfRow.callsPerSecond = decimalFormat.format(callsPerSecond);
- performanceList.add(perfRow);
+ perfRow = [:]
+ perfRow.operation = "UtilCache.get(String) - basic settings"
+ perfRow.entity = "N/A"
+ perfRow.calls = decimalFormat.format(calls)
+ perfRow.seconds = decimalFormat.format(totalTime / 1000)
+ perfRow.secsPerCall = decimalFormat.format(1 / callsPerSecond)
+ perfRow.callsPerSecond = decimalFormat.format(callsPerSecond)
+ performanceList.add(perfRow)
- testPk = delegator.makePK("DataSourceType", [dataSourceTypeId : "ADMIN_ENTRY"]);
- utilCache.put(testPk, "testValue");
- calls = 1000000;
- startTime = System.currentTimeMillis();
+ testPk = delegator.makePK("DataSourceType", [dataSourceTypeId : "ADMIN_ENTRY"])
+ utilCache.put(testPk, "testValue")
+ calls = 1000000
+ startTime = System.currentTimeMillis()
for (int i = 0; i < calls; i++) {
- utilCache.get(testPk);
+ utilCache.get(testPk)
}
- totalTime = System.currentTimeMillis() - startTime;
- callsPerSecond = calls / (totalTime/1000);
+ totalTime = System.currentTimeMillis() - startTime
+ callsPerSecond = calls / (totalTime/1000)
- perfRow = [:];
- perfRow.operation = "UtilCache.get(GenericPK) - basic settings";
- perfRow.entity = "N/A";
- perfRow.calls = decimalFormat.format(calls);
- perfRow.seconds = decimalFormat.format(totalTime / 1000);
- perfRow.secsPerCall = decimalFormat.format(1 / callsPerSecond);
- perfRow.callsPerSecond = decimalFormat.format(callsPerSecond);
- performanceList.add(perfRow);
+ perfRow = [:]
+ perfRow.operation = "UtilCache.get(GenericPK) - basic settings"
+ perfRow.entity = "N/A"
+ perfRow.calls = decimalFormat.format(calls)
+ perfRow.seconds = decimalFormat.format(totalTime / 1000)
+ perfRow.secsPerCall = decimalFormat.format(1 / callsPerSecond)
+ perfRow.callsPerSecond = decimalFormat.format(callsPerSecond)
+ performanceList.add(perfRow)
- calls = 1000000;
- startTime = System.currentTimeMillis();
+ calls = 1000000
+ startTime = System.currentTimeMillis()
for (int i = 0; i < calls; i++) {
- utilCache.put(testPk, "testValue");
+ utilCache.put(testPk, "testValue")
}
- totalTime = System.currentTimeMillis() - startTime;
- callsPerSecond = calls / (totalTime / 1000);
+ totalTime = System.currentTimeMillis() - startTime
+ callsPerSecond = calls / (totalTime / 1000)
- perfRow = [:];
- perfRow.operation = "UtilCache.put(GenericPK) - basic settings";
- perfRow.entity = "N/A";
- perfRow.calls = decimalFormat.format(calls);
- perfRow.seconds = decimalFormat.format(totalTime / 1000);
- perfRow.secsPerCall = decimalFormat.format(1 / callsPerSecond);
- perfRow.callsPerSecond = decimalFormat.format(callsPerSecond);
- performanceList.add(perfRow);
+ perfRow = [:]
+ perfRow.operation = "UtilCache.put(GenericPK) - basic settings"
+ perfRow.entity = "N/A"
+ perfRow.calls = decimalFormat.format(calls)
+ perfRow.seconds = decimalFormat.format(totalTime / 1000)
+ perfRow.secsPerCall = decimalFormat.format(1 / callsPerSecond)
+ perfRow.callsPerSecond = decimalFormat.format(callsPerSecond)
+ performanceList.add(perfRow)
- context.performanceList = performanceList;
+ context.performanceList = performanceList
}
diff --git a/framework/webtools/groovyScripts/entity/EntityRef.groovy b/framework/webtools/groovyScripts/entity/EntityRef.groovy
index ce5f01cb3b..17933dbff7 100644
--- a/framework/webtools/groovyScripts/entity/EntityRef.groovy
+++ b/framework/webtools/groovyScripts/entity/EntityRef.groovy
@@ -16,18 +16,18 @@
* specific language governing permissions and limitations
* under the License.
*/
-controlPath = parameters._CONTROL_PATH_;
-list = "$controlPath/view/entityref_list";
-main = "$controlPath/view/entityref_main";
-search = parameters.search;
-forstatic = parameters.forstatic;
+controlPath = parameters._CONTROL_PATH_
+list = "$controlPath/view/entityref_list"
+main = "$controlPath/view/entityref_main"
+search = parameters.search
+forstatic = parameters.forstatic
if (search) {
- list = "$list?search=$search";
- main = "$main?search=$search";
+ list = "$list?search=$search"
+ main = "$main?search=$search"
} else if (forstatic) {
- list = "$list?forstatic=$forstatic";
- main = "$main?forstatic=$forstatic";
+ list = "$list?forstatic=$forstatic"
+ main = "$main?forstatic=$forstatic"
}
-context.encodeUrlList = response.encodeURL(list);
-context.encodeUrlMain = response.encodeURL(main);
+context.encodeUrlList = response.encodeURL(list)
+context.encodeUrlMain = response.encodeURL(main)
diff --git a/framework/webtools/groovyScripts/entity/EntityRefList.groovy b/framework/webtools/groovyScripts/entity/EntityRefList.groovy
index 27551f3650..461985c5ea 100644
--- a/framework/webtools/groovyScripts/entity/EntityRefList.groovy
+++ b/framework/webtools/groovyScripts/entity/EntityRefList.groovy
@@ -16,40 +16,40 @@
* specific language governing permissions and limitations
* under the License.
*/
-import org.apache.ofbiz.entity.Delegator;
-import org.apache.ofbiz.security.Security;
-import org.apache.ofbiz.entity.model.ModelReader;
-import org.apache.ofbiz.entity.model.ModelEntity;
+import org.apache.ofbiz.entity.Delegator
+import org.apache.ofbiz.security.Security
+import org.apache.ofbiz.entity.model.ModelReader
+import org.apache.ofbiz.entity.model.ModelEntity
-controlPath = parameters._CONTROL_PATH_;
-context.controlPath = controlPath;
+controlPath = parameters._CONTROL_PATH_
+context.controlPath = controlPath
if (security.hasPermission("ENTITY_MAINT", session)) {
- forstatic = "true".equals(parameters.forstatic);
- context.forstatic = forstatic;
+ forstatic = "true".equals(parameters.forstatic)
+ context.forstatic = forstatic
- reader = delegator.getModelReader();
- ec = reader.getEntityNames();
- entities = new TreeSet(ec);
- search = parameters.search;
+ reader = delegator.getModelReader()
+ ec = reader.getEntityNames()
+ entities = new TreeSet(ec)
+ search = parameters.search
- packageNames = new TreeSet();
+ packageNames = new TreeSet()
ec.each { eName ->
- ent = reader.getModelEntity(eName);
- packageNames.add(ent.getPackageName());
+ ent = reader.getModelEntity(eName)
+ packageNames.add(ent.getPackageName())
}
- context.packageNames = packageNames;
+ context.packageNames = packageNames
- entitiesList = [];
+ entitiesList = []
entities.each { entityName ->
- entityMap = [:];
+ entityMap = [:]
if (!search || entityName.toLowerCase().indexOf(search.toLowerCase()) != -1 ) {
- url = search ? "?search=$search" : "";
- entityMap.url = url;
+ url = search ? "?search=$search" : ""
+ entityMap.url = url
}
- entityMap.entityName = entityName;
+ entityMap.entityName = entityName
- entitiesList.add(entityMap);
+ entitiesList.add(entityMap)
}
- context.entitiesList = entitiesList;
+ context.entitiesList = entitiesList
}
diff --git a/framework/webtools/groovyScripts/entity/EntitySQLProcessor.groovy b/framework/webtools/groovyScripts/entity/EntitySQLProcessor.groovy
index b6cc3583ff..8d16cd3605 100644
--- a/framework/webtools/groovyScripts/entity/EntitySQLProcessor.groovy
+++ b/framework/webtools/groovyScripts/entity/EntitySQLProcessor.groovy
@@ -17,63 +17,63 @@
* under the License.
*/
-import org.apache.ofbiz.entity.jdbc.SQLProcessor;
-import java.sql.ResultSet;
-import java.sql.ResultSetMetaData;
-import java.sql.SQLException;
-import java.util.ArrayList;
-import java.util.Iterator;
-import org.apache.ofbiz.entity.*;
-import org.apache.ofbiz.entity.model.ModelGroupReader;
+import org.apache.ofbiz.entity.jdbc.SQLProcessor
+import java.sql.ResultSet
+import java.sql.ResultSetMetaData
+import java.sql.SQLException
+import java.util.ArrayList
+import java.util.Iterator
+import org.apache.ofbiz.entity.*
+import org.apache.ofbiz.entity.model.ModelGroupReader
-sqlCommand = context.request.getParameter("sqlCommand");
+sqlCommand = context.request.getParameter("sqlCommand")
-resultMessage = "";
-rs = null;
-columns = [];
-records = [];
-mgr = delegator.getModelGroupReader();
-groups = [];
-for (String group : mgr.getGroupNames(delegator.getDelegatorName())) groups.add(0,["group":group]); //use for list-option in widget drop-down
+resultMessage = ""
+rs = null
+columns = []
+records = []
+mgr = delegator.getModelGroupReader()
+groups = []
+for (String group : mgr.getGroupNames(delegator.getDelegatorName())) groups.add(0,["group":group]) //use for list-option in widget drop-down
if (sqlCommand && selGroup) {
- du = new SQLProcessor(delegator, delegator.getGroupHelperInfo(selGroup));
+ du = new SQLProcessor(delegator, delegator.getGroupHelperInfo(selGroup))
try {
if (sqlCommand.toUpperCase().startsWith("SELECT")) {
- rs = du.executeQuery(sqlCommand);
+ rs = du.executeQuery(sqlCommand)
if (rs) {
- rsmd = rs.getMetaData();
- numberOfColumns = rsmd.getColumnCount();
+ rsmd = rs.getMetaData()
+ numberOfColumns = rsmd.getColumnCount()
for (i = 1; i <= numberOfColumns; i++) {
- columns.add(rsmd.getColumnName(i));
+ columns.add(rsmd.getColumnName(i))
}
- rowLimitReached = false;
+ rowLimitReached = false
while (rs.next()) {
if (records.size() >= rowLimit) {
- resultMessage = "Returned top $rowLimit rows.";
- rowLimitReached = true;
- break;
+ resultMessage = "Returned top $rowLimit rows."
+ rowLimitReached = true
+ break
}
- record = [];
+ record = []
for (i = 1; i <= numberOfColumns; i++) {
- record.add(rs.getObject(i));
+ record.add(rs.getObject(i))
}
- records.add(record);
+ records.add(record)
}
- resultMessage = "Returned " + (rowLimitReached? "top " + rowLimit : "" + records.size()) + " rows.";
- rs.close();
+ resultMessage = "Returned " + (rowLimitReached? "top " + rowLimit : "" + records.size()) + " rows."
+ rs.close()
}
} else {
- du.prepareStatement(sqlCommand);
- numOfAffectedRows = du.executeUpdate();
- resultMessage = "Affected $numOfAffectedRows rows.";
+ du.prepareStatement(sqlCommand)
+ numOfAffectedRows = du.executeUpdate()
+ resultMessage = "Affected $numOfAffectedRows rows."
}
} catch (Exception exc) {
- resultMessage = exc.getMessage();
+ resultMessage = exc.getMessage()
}
}
-context.groups = groups;
-context.resultMessage = resultMessage;
-context.columns = columns;
-context.records = records;
-context.sqlCommand = sqlCommand; // (see OFBIZ-6567)
+context.groups = groups
+context.resultMessage = resultMessage
+context.columns = columns
+context.records = records
+context.sqlCommand = sqlCommand // (see OFBIZ-6567)
diff --git a/framework/webtools/groovyScripts/entity/FindGeneric.groovy b/framework/webtools/groovyScripts/entity/FindGeneric.groovy
index d11d2464ac..ce331f1ee8 100644
--- a/framework/webtools/groovyScripts/entity/FindGeneric.groovy
+++ b/framework/webtools/groovyScripts/entity/FindGeneric.groovy
@@ -18,239 +18,239 @@
*/
import org.apache.ofbiz.base.util.UtilMisc
-import org.apache.ofbiz.entity.Delegator;
-import org.apache.ofbiz.entity.GenericValue;
-import org.apache.ofbiz.entity.GenericEntityException;
-import org.apache.ofbiz.security.Security;
-import org.apache.ofbiz.entity.model.ModelReader;
-import org.apache.ofbiz.entity.model.ModelEntity;
-import org.apache.ofbiz.entity.model.ModelViewEntity;
-import org.apache.ofbiz.entity.model.ModelViewEntity.ModelAlias;
-import org.apache.ofbiz.entity.model.ModelField;
-import org.apache.ofbiz.entity.model.ModelFieldType;
-import org.apache.ofbiz.entity.GenericEntity;
-import org.apache.ofbiz.base.util.UtilFormatOut;
-import org.apache.ofbiz.base.util.UtilProperties;
-import org.apache.ofbiz.entity.condition.EntityExpr;
-import org.apache.ofbiz.entity.condition.EntityCondition;
-import org.apache.ofbiz.entity.condition.EntityConditionList;
-import org.apache.ofbiz.entity.condition.EntityFieldMap;
-import org.apache.ofbiz.entity.condition.EntityOperator;
-import org.apache.ofbiz.entity.transaction.TransactionUtil;
-import org.apache.ofbiz.entity.util.EntityFindOptions;
-import org.apache.ofbiz.entity.util.EntityListIterator;
-import org.apache.ofbiz.entity.util.EntityUtilProperties;
-import org.apache.ofbiz.base.util.Debug;
-import java.sql.Timestamp;
-import java.sql.Date;
-import java.sql.Time;
+import org.apache.ofbiz.entity.Delegator
+import org.apache.ofbiz.entity.GenericValue
+import org.apache.ofbiz.entity.GenericEntityException
+import org.apache.ofbiz.security.Security
+import org.apache.ofbiz.entity.model.ModelReader
+import org.apache.ofbiz.entity.model.ModelEntity
+import org.apache.ofbiz.entity.model.ModelViewEntity
+import org.apache.ofbiz.entity.model.ModelViewEntity.ModelAlias
+import org.apache.ofbiz.entity.model.ModelField
+import org.apache.ofbiz.entity.model.ModelFieldType
+import org.apache.ofbiz.entity.GenericEntity
+import org.apache.ofbiz.base.util.UtilFormatOut
+import org.apache.ofbiz.base.util.UtilProperties
+import org.apache.ofbiz.entity.condition.EntityExpr
+import org.apache.ofbiz.entity.condition.EntityCondition
+import org.apache.ofbiz.entity.condition.EntityConditionList
+import org.apache.ofbiz.entity.condition.EntityFieldMap
+import org.apache.ofbiz.entity.condition.EntityOperator
+import org.apache.ofbiz.entity.transaction.TransactionUtil
+import org.apache.ofbiz.entity.util.EntityFindOptions
+import org.apache.ofbiz.entity.util.EntityListIterator
+import org.apache.ofbiz.entity.util.EntityUtilProperties
+import org.apache.ofbiz.base.util.Debug
+import java.sql.Timestamp
+import java.sql.Date
+import java.sql.Time
-entityName = parameters.entityName;
+entityName = parameters.entityName
-ModelReader reader = delegator.getModelReader();
-ModelEntity modelEntity = reader.getModelEntity(entityName);
+ModelReader reader = delegator.getModelReader()
+ModelEntity modelEntity = reader.getModelEntity(entityName)
-groupByFields = [];
-functionFields = [];
+groupByFields = []
+functionFields = []
if (modelEntity instanceof ModelViewEntity) {
aliases = modelEntity.getAliasesCopy()
for (ModelAlias alias : aliases) {
if (alias.getGroupBy()) {
- groupByFields.add(alias.getName());
+ groupByFields.add(alias.getName())
} else if (alias.getFunction()) {
- functionFields.add(alias.getName());
+ functionFields.add(alias.getName())
}
}
}
-context.entityName = modelEntity.getEntityName();
-context.plainTableName = modelEntity.getPlainTableName();
+context.entityName = modelEntity.getEntityName()
+context.plainTableName = modelEntity.getPlainTableName()
-String hasViewPermission = (security.hasEntityPermission("ENTITY_DATA", "_VIEW", session) || security.hasEntityPermission(modelEntity.getPlainTableName(), "_VIEW", session)) == true ? "Y" : "N";
-String hasCreatePermission = (security.hasEntityPermission("ENTITY_DATA", "_CREATE", session) || security.hasEntityPermission(modelEntity.getPlainTableName(), "_CREATE", session)) == true ? "Y" : "N";
-String hasUpdatePermission = (security.hasEntityPermission("ENTITY_DATA", "_UPDATE", session) || security.hasEntityPermission(modelEntity.getPlainTableName(), "_UPDATE", session)) == true ? "Y" : "N";
-String hasDeletePermission = (security.hasEntityPermission("ENTITY_DATA", "_DELETE", session) || security.hasEntityPermission(modelEntity.getPlainTableName(), "_DELETE", session)) == true ? "Y" : "N";
+String hasViewPermission = (security.hasEntityPermission("ENTITY_DATA", "_VIEW", session) || security.hasEntityPermission(modelEntity.getPlainTableName(), "_VIEW", session)) == true ? "Y" : "N"
+String hasCreatePermission = (security.hasEntityPermission("ENTITY_DATA", "_CREATE", session) || security.hasEntityPermission(modelEntity.getPlainTableName(), "_CREATE", session)) == true ? "Y" : "N"
+String hasUpdatePermission = (security.hasEntityPermission("ENTITY_DATA", "_UPDATE", session) || security.hasEntityPermission(modelEntity.getPlainTableName(), "_UPDATE", session)) == true ? "Y" : "N"
+String hasDeletePermission = (security.hasEntityPermission("ENTITY_DATA", "_DELETE", session) || security.hasEntityPermission(modelEntity.getPlainTableName(), "_DELETE", session)) == true ? "Y" : "N"
-context.hasViewPermission = hasViewPermission;
-context.hasCreatePermission = hasCreatePermission;
-context.hasUpdatePermission = hasUpdatePermission;
-context.hasDeletePermission = hasDeletePermission;
+context.hasViewPermission = hasViewPermission
+context.hasCreatePermission = hasCreatePermission
+context.hasUpdatePermission = hasUpdatePermission
+context.hasDeletePermission = hasDeletePermission
-String find = parameters.find;
+String find = parameters.find
if (find == null) {
- find = "false";
+ find = "false"
}
-String curFindString = "entityName=" + entityName + "&find=" + find;
+String curFindString = "entityName=" + entityName + "&find=" + find
-GenericEntity findByEntity = delegator.makeValue(entityName);
-List errMsgList = [];
-Iterator fieldIterator = modelEntity.getFieldsIterator();
+GenericEntity findByEntity = delegator.makeValue(entityName)
+List errMsgList = []
+Iterator fieldIterator = modelEntity.getFieldsIterator()
while (fieldIterator.hasNext()) {
- ModelField field = fieldIterator.next();
- String fval = parameters.get(field.getName());
+ ModelField field = fieldIterator.next()
+ String fval = parameters.get(field.getName())
if (fval != null) {
if (fval.length() > 0) {
- curFindString = curFindString + "&" + field.getName() + "=" + fval;
+ curFindString = curFindString + "&" + field.getName() + "=" + fval
try {
- findByEntity.setString(field.getName(), fval);
+ findByEntity.setString(field.getName(), fval)
} catch (NumberFormatException nfe) {
- Debug.logError(nfe, "Caught an exception : " + nfe.toString(), "FindGeneric.groovy");
- errMsgList.add("Entered value is non-numeric for numeric field: " + field.getName());
+ Debug.logError(nfe, "Caught an exception : " + nfe.toString(), "FindGeneric.groovy")
+ errMsgList.add("Entered value is non-numeric for numeric field: " + field.getName())
}
}
}
}
if (errMsgList) {
- request.setAttribute("_ERROR_MESSAGE_LIST_", errMsgList);
+ request.setAttribute("_ERROR_MESSAGE_LIST_", errMsgList)
}
-curFindString = UtilFormatOut.encodeQuery(curFindString);
-context.curFindString = curFindString;
+curFindString = UtilFormatOut.encodeQuery(curFindString)
+context.curFindString = curFindString
try {
- viewIndex = Integer.valueOf((String)parameters.get("VIEW_INDEX")).intValue();
+ viewIndex = Integer.valueOf((String)parameters.get("VIEW_INDEX")).intValue()
} catch (NumberFormatException nfe) {
- viewIndex = 0;
+ viewIndex = 0
}
-context.viewIndexFirst = 0;
-context.viewIndex = viewIndex;
-context.viewIndexPrevious = viewIndex-1;
-context.viewIndexNext = viewIndex+1;
+context.viewIndexFirst = 0
+context.viewIndex = viewIndex
+context.viewIndexPrevious = viewIndex-1
+context.viewIndexNext = viewIndex+1
try {
- viewSize = Integer.valueOf((String)parameters.get("VIEW_SIZE")).intValue();
+ viewSize = Integer.valueOf((String)parameters.get("VIEW_SIZE")).intValue()
} catch (NumberFormatException nfe) {
- viewSize = (EntityUtilProperties.getPropertyAsInteger("widget", "widget.form.defaultViewSize", 0)).intValue();
+ viewSize = (EntityUtilProperties.getPropertyAsInteger("widget", "widget.form.defaultViewSize", 0)).intValue()
}
-context.viewSize = viewSize;
+context.viewSize = viewSize
-int lowIndex = viewIndex*viewSize+1;
-int highIndex = (viewIndex+1)*viewSize;
-context.lowIndex = lowIndex;
+int lowIndex = viewIndex*viewSize+1
+int highIndex = (viewIndex+1)*viewSize
+context.lowIndex = lowIndex
-int arraySize = 0;
-List resultPartialList = null;
+int arraySize = 0
+List resultPartialList = null
if ("true".equals(find)) {
- //EntityCondition condition = EntityCondition.makeCondition(findByEntity, EntityOperator.AND);
+ //EntityCondition condition = EntityCondition.makeCondition(findByEntity, EntityOperator.AND)
// small variation to support LIKE if a wildcard (%) is found in a String
- conditionList = [];
- findByKeySet = findByEntity.keySet();
- fbksIter = findByKeySet.iterator();
+ conditionList = []
+ findByKeySet = findByEntity.keySet()
+ fbksIter = findByKeySet.iterator()
while (fbksIter.hasNext()) {
- findByKey = fbksIter.next();
+ findByKey = fbksIter.next()
if (findByEntity.getString(findByKey).indexOf("%") >= 0) {
- conditionList.add(EntityCondition.makeCondition(findByKey, EntityOperator.LIKE, findByEntity.getString(findByKey)));
+ conditionList.add(EntityCondition.makeCondition(findByKey, EntityOperator.LIKE, findByEntity.getString(findByKey)))
} else {
- conditionList.add(EntityCondition.makeCondition(findByKey, EntityOperator.EQUALS, findByEntity.get(findByKey)));
+ conditionList.add(EntityCondition.makeCondition(findByKey, EntityOperator.EQUALS, findByEntity.get(findByKey)))
}
}
- condition = EntityCondition.makeCondition(conditionList, EntityOperator.AND);
+ condition = EntityCondition.makeCondition(conditionList, EntityOperator.AND)
if ((highIndex - lowIndex + 1) > 0) {
- boolean beganTransaction = false;
+ boolean beganTransaction = false
try {
- beganTransaction = TransactionUtil.begin();
+ beganTransaction = TransactionUtil.begin()
- EntityFindOptions efo = new EntityFindOptions();
- efo.setMaxRows(highIndex);
- efo.setResultSetType(EntityFindOptions.TYPE_SCROLL_INSENSITIVE);
- EntityListIterator resultEli = null;
- fieldsToSelect = null;
+ EntityFindOptions efo = new EntityFindOptions()
+ efo.setMaxRows(highIndex)
+ efo.setResultSetType(EntityFindOptions.TYPE_SCROLL_INSENSITIVE)
+ EntityListIterator resultEli = null
+ fieldsToSelect = null
if (groupByFields || functionFields) {
- fieldsToSelect = [] as Set;
+ fieldsToSelect = [] as Set
for (String groupByField : groupByFields) {
- fieldsToSelect.add(groupByField);
+ fieldsToSelect.add(groupByField)
}
for (String functionField : functionFields) {
fieldsToSelect.add(functionField)
}
}
- Collection pkNames = [];
- Iterator iter = modelEntity.getPksIterator();
+ Collection pkNames = []
+ Iterator iter = modelEntity.getPksIterator()
while (iter != null && iter.hasNext()) {
- ModelField curField = (ModelField) iter.next();
- pkNames.add(curField.getName());
+ ModelField curField = (ModelField) iter.next()
+ pkNames.add(curField.getName())
}
- resultEli = delegator.find(entityName, condition, null, fieldsToSelect, pkNames, efo);
- resultPartialList = resultEli.getPartialList(lowIndex, highIndex - lowIndex + 1);
+ resultEli = delegator.find(entityName, condition, null, fieldsToSelect, pkNames, efo)
+ resultPartialList = resultEli.getPartialList(lowIndex, highIndex - lowIndex + 1)
- arraySize = resultEli.getResultsSizeAfterPartialList();
+ arraySize = resultEli.getResultsSizeAfterPartialList()
if (arraySize < highIndex) {
- highIndex = arraySize;
+ highIndex = arraySize
}
- resultEli.close();
+ resultEli.close()
} catch (GenericEntityException e) {
- Debug.logError(e, "Failure in operation, rolling back transaction", "FindGeneric.groovy");
+ Debug.logError(e, "Failure in operation, rolling back transaction", "FindGeneric.groovy")
try {
// only rollback the transaction if we started one...
- TransactionUtil.rollback(beganTransaction, "Error looking up entity values in WebTools Entity Data Maintenance", e);
+ TransactionUtil.rollback(beganTransaction, "Error looking up entity values in WebTools Entity Data Maintenance", e)
} catch (GenericEntityException e2) {
- Debug.logError(e2, "Could not rollback transaction: " + e2.toString(), "FindGeneric.groovy");
+ Debug.logError(e2, "Could not rollback transaction: " + e2.toString(), "FindGeneric.groovy")
}
// after rolling back, rethrow the exception
- throw e;
+ throw e
} finally {
// only commit the transaction if we started one... this will throw an exception if it fails
- TransactionUtil.commit(beganTransaction);
+ TransactionUtil.commit(beganTransaction)
}
}
}
-context.highIndex = highIndex;
-context.arraySize = arraySize;
-context.resultPartialList = resultPartialList;
+context.highIndex = highIndex
+context.arraySize = arraySize
+context.resultPartialList = resultPartialList
-viewIndexLast = UtilMisc.getViewLastIndex(arraySize, viewSize);
-context.viewIndexLast = viewIndexLast;
+viewIndexLast = UtilMisc.getViewLastIndex(arraySize, viewSize)
+context.viewIndexLast = viewIndexLast
-List fieldList = [];
-fieldIterator = modelEntity.getFieldsIterator();
+List fieldList = []
+fieldIterator = modelEntity.getFieldsIterator()
while (fieldIterator.hasNext()) {
- ModelField field = fieldIterator.next();
- ModelFieldType type = delegator.getEntityFieldType(modelEntity, field.getType());
+ ModelField field = fieldIterator.next()
+ ModelFieldType type = delegator.getEntityFieldType(modelEntity, field.getType())
- Map fieldMap = [:];
- fieldMap.put("name", field.getName());
- fieldMap.put("isPk", (field.getIsPk() == true) ? "Y" : "N");
- fieldMap.put("javaType", type.getJavaType());
- fieldMap.put("sqlType", type.getSqlType());
- fieldMap.put("param", (parameters.get(field.getName()) != null ? parameters.get(field.getName()) : ""));
+ Map fieldMap = [:]
+ fieldMap.put("name", field.getName())
+ fieldMap.put("isPk", (field.getIsPk() == true) ? "Y" : "N")
+ fieldMap.put("javaType", type.getJavaType())
+ fieldMap.put("sqlType", type.getSqlType())
+ fieldMap.put("param", (parameters.get(field.getName()) != null ? parameters.get(field.getName()) : ""))
- fieldList.add(fieldMap);
+ fieldList.add(fieldMap)
}
-context.fieldList = fieldList;
-context.columnCount = fieldList.size()+2;
+context.fieldList = fieldList
+context.columnCount = fieldList.size()+2
-List records = [];
+List records = []
if (resultPartialList != null) {
- Iterator resultPartialIter = resultPartialList.iterator();
+ Iterator resultPartialIter = resultPartialList.iterator()
while (resultPartialIter.hasNext()) {
- Map record = [:];
+ Map record = [:]
- GenericValue value = (GenericValue)resultPartialIter.next();
- String findString = "entityName=" + entityName;
- Iterator pkIterator = modelEntity.getPksIterator();
+ GenericValue value = (GenericValue)resultPartialIter.next()
+ String findString = "entityName=" + entityName
+ Iterator pkIterator = modelEntity.getPksIterator()
while (pkIterator.hasNext()) {
- ModelField pkField = pkIterator.next();
- ModelFieldType type = delegator.getEntityFieldType(modelEntity, pkField.getType());
- findString += "&" + pkField.getName() + "=" + value.get(pkField.getName());
+ ModelField pkField = pkIterator.next()
+ ModelFieldType type = delegator.getEntityFieldType(modelEntity, pkField.getType())
+ findString += "&" + pkField.getName() + "=" + value.get(pkField.getName())
}
- record.put("findString", findString);
+ record.put("findString", findString)
- record.put("fields", value);
- records.add(record);
+ record.put("fields", value)
+ records.add(record)
}
}
-context.records = records;
-context.lowCount = lowIndex;
-context.highCount = lowIndex + records.size() - 1;
-context.total = arraySize;
+context.records = records
+context.lowCount = lowIndex
+context.highCount = lowIndex + records.size() - 1
+context.total = arraySize
diff --git a/framework/webtools/groovyScripts/entity/ProgramExport.groovy b/framework/webtools/groovyScripts/entity/ProgramExport.groovy
index 4459188c0a..d1e59eb9bb 100644
--- a/framework/webtools/groovyScripts/entity/ProgramExport.groovy
+++ b/framework/webtools/groovyScripts/entity/ProgramExport.groovy
@@ -16,20 +16,20 @@
* specific language governing permissions and limitations
* under the License.
*/
-import org.apache.ofbiz.entity.Delegator;
-import org.apache.ofbiz.entity.GenericValue;
-import org.apache.ofbiz.entity.model.ModelEntity;
+import org.apache.ofbiz.entity.Delegator
+import org.apache.ofbiz.entity.GenericValue
+import org.apache.ofbiz.entity.model.ModelEntity
import org.apache.ofbiz.base.util.*
-import org.w3c.dom.Document;
+import org.w3c.dom.Document
-import org.codehaus.groovy.control.customizers.ImportCustomizer;
-import org.codehaus.groovy.control.CompilerConfiguration;
-import org.codehaus.groovy.control.MultipleCompilationErrorsException;
-import org.codehaus.groovy.control.ErrorCollector;
+import org.codehaus.groovy.control.customizers.ImportCustomizer
+import org.codehaus.groovy.control.CompilerConfiguration
+import org.codehaus.groovy.control.MultipleCompilationErrorsException
+import org.codehaus.groovy.control.ErrorCollector
-String groovyProgram = null;
-recordValues = [];
-errMsgList = [];
+String groovyProgram = null
+recordValues = []
+errMsgList = []
if (UtilValidate.isEmpty(parameters.groovyProgram)) {
@@ -37,61 +37,61 @@ if (UtilValidate.isEmpty(parameters.groovyProgram)) {
// Use the List variable recordValues to fill it with GenericValue maps.
// full groovy syntaxt is available
-import org.apache.ofbiz.entity.util.EntityFindOptions;
+import org.apache.ofbiz.entity.util.EntityFindOptions
// example:
// find the first three record in the product entity (if any)
-EntityFindOptions findOptions = new EntityFindOptions();
-findOptions.setMaxRows(3);
+EntityFindOptions findOptions = new EntityFindOptions()
+findOptions.setMaxRows(3)
-List products = delegator.findList("Product", null, null, null, findOptions, false);
+List products = delegator.findList("Product", null, null, null, findOptions, false)
if (products != null) {
- recordValues.addAll(products);
+ recordValues.addAll(products)
}
'''
- parameters.groovyProgram = groovyProgram;
+ parameters.groovyProgram = groovyProgram
} else {
- groovyProgram = parameters.groovyProgram;
+ groovyProgram = parameters.groovyProgram
}
// Add imports for script.
def importCustomizer = new ImportCustomizer()
-importCustomizer.addImport("org.apache.ofbiz.entity.GenericValue");
-importCustomizer.addImport("org.apache.ofbiz.entity.model.ModelEntity");
+importCustomizer.addImport("org.apache.ofbiz.entity.GenericValue")
+importCustomizer.addImport("org.apache.ofbiz.entity.model.ModelEntity")
def configuration = new CompilerConfiguration()
configuration.addCompilationCustomizers(importCustomizer)
-Binding binding = new Binding();
-binding.setVariable("delegator", delegator);
-binding.setVariable("recordValues", recordValues);
+Binding binding = new Binding()
+binding.setVariable("delegator", delegator)
+binding.setVariable("recordValues", recordValues)
-ClassLoader loader = Thread.currentThread().getContextClassLoader();
-def shell = new GroovyShell(loader, binding, configuration);
+ClassLoader loader = Thread.currentThread().getContextClassLoader()
+def shell = new GroovyShell(loader, binding, configuration)
if (UtilValidate.isNotEmpty(groovyProgram)) {
try {
- shell.parse(groovyProgram);
+ shell.parse(groovyProgram)
shell.evaluate(groovyProgram)
- recordValues = shell.getVariable("recordValues");
- xmlDoc = GenericValue.makeXmlDocument(recordValues);
- context.put("xmlDoc", xmlDoc);
+ recordValues = shell.getVariable("recordValues")
+ xmlDoc = GenericValue.makeXmlDocument(recordValues)
+ context.put("xmlDoc", xmlDoc)
} catch(MultipleCompilationErrorsException e) {
- request.setAttribute("_ERROR_MESSAGE_", e);
- return;
+ request.setAttribute("_ERROR_MESSAGE_", e)
+ return
} catch(groovy.lang.MissingPropertyException e) {
- request.setAttribute("_ERROR_MESSAGE_", e);
- return;
+ request.setAttribute("_ERROR_MESSAGE_", e)
+ return
} catch(IllegalArgumentException e) {
- request.setAttribute("_ERROR_MESSAGE_", e);
- return;
+ request.setAttribute("_ERROR_MESSAGE_", e)
+ return
} catch(NullPointerException e) {
- request.setAttribute("_ERROR_MESSAGE_", e);
- return;
+ request.setAttribute("_ERROR_MESSAGE_", e)
+ return
} catch(Exception e) {
- request.setAttribute("_ERROR_MESSAGE_", e);
- return;
+ request.setAttribute("_ERROR_MESSAGE_", e)
+ return
}
}
diff --git a/framework/webtools/groovyScripts/entity/ViewGeneric.groovy b/framework/webtools/groovyScripts/entity/ViewGeneric.groovy
index 4eda9997e0..92d60b24c0 100644
--- a/framework/webtools/groovyScripts/entity/ViewGeneric.groovy
+++ b/framework/webtools/groovyScripts/entity/ViewGeneric.groovy
@@ -16,419 +16,419 @@
* specific language governing permissions and limitations
* under the License.
*/
-import org.apache.ofbiz.entity.Delegator;
-import org.apache.ofbiz.entity.GenericPK;
-import org.apache.ofbiz.entity.GenericValue;
-import org.apache.ofbiz.security.Security;
-import org.apache.ofbiz.entity.model.ModelReader;
-import org.apache.ofbiz.entity.model.ModelEntity;
-import org.apache.ofbiz.entity.model.ModelField;
-import org.apache.ofbiz.entity.model.ModelFieldType;
-import org.apache.ofbiz.entity.model.ModelRelation;
-import org.apache.ofbiz.entity.model.ModelKeyMap;
-import org.apache.ofbiz.base.util.UtilFormatOut;
-import org.apache.ofbiz.base.util.UtilMisc;
-import org.apache.ofbiz.base.util.UtilValidate;
-import java.sql.Timestamp;
-import java.sql.Date;
-import java.sql.Time;
+import org.apache.ofbiz.entity.Delegator
+import org.apache.ofbiz.entity.GenericPK
+import org.apache.ofbiz.entity.GenericValue
+import org.apache.ofbiz.security.Security
+import org.apache.ofbiz.entity.model.ModelReader
+import org.apache.ofbiz.entity.model.ModelEntity
+import org.apache.ofbiz.entity.model.ModelField
+import org.apache.ofbiz.entity.model.ModelFieldType
+import org.apache.ofbiz.entity.model.ModelRelation
+import org.apache.ofbiz.entity.model.ModelKeyMap
+import org.apache.ofbiz.base.util.UtilFormatOut
+import org.apache.ofbiz.base.util.UtilMisc
+import org.apache.ofbiz.base.util.UtilValidate
+import java.sql.Timestamp
+import java.sql.Date
+import java.sql.Time
-String entityName = parameters.get("entityName");
-context.put("entityName", entityName);
+String entityName = parameters.get("entityName")
+context.put("entityName", entityName)
-ModelReader reader = delegator.getModelReader();
-ModelEntity entity = reader.getModelEntity(entityName);
+ModelReader reader = delegator.getModelReader()
+ModelEntity entity = reader.getModelEntity(entityName)
-context.put("entity", entity);
-context.put("plainTableName", entity.getPlainTableName());
+context.put("entity", entity)
+context.put("plainTableName", entity.getPlainTableName())
-boolean hasAllView = security.hasEntityPermission("ENTITY_DATA", "_VIEW", session);
-boolean hasAllCreate = security.hasEntityPermission("ENTITY_DATA", "_CREATE", session);
-boolean hasAllUpdate = security.hasEntityPermission("ENTITY_DATA", "_UPDATE", session);
-boolean hasAllDelete = security.hasEntityPermission("ENTITY_DATA", "_DELETE", session);
-boolean hasViewPermission = hasAllView || security.hasEntityPermission(entity.getPlainTableName(), "_VIEW", session);
-boolean hasCreatePermission = hasAllCreate || security.hasEntityPermission(entity.getPlainTableName(), "_CREATE", session);
-boolean hasUpdatePermission = hasAllUpdate || security.hasEntityPermission(entity.getPlainTableName(), "_UPDATE", session);
-boolean hasDeletePermission = hasAllDelete || security.hasEntityPermission(entity.getPlainTableName(), "_DELETE", session);
+boolean hasAllView = security.hasEntityPermission("ENTITY_DATA", "_VIEW", session)
+boolean hasAllCreate = security.hasEntityPermission("ENTITY_DATA", "_CREATE", session)
+boolean hasAllUpdate = security.hasEntityPermission("ENTITY_DATA", "_UPDATE", session)
+boolean hasAllDelete = security.hasEntityPermission("ENTITY_DATA", "_DELETE", session)
+boolean hasViewPermission = hasAllView || security.hasEntityPermission(entity.getPlainTableName(), "_VIEW", session)
+boolean hasCreatePermission = hasAllCreate || security.hasEntityPermission(entity.getPlainTableName(), "_CREATE", session)
+boolean hasUpdatePermission = hasAllUpdate || security.hasEntityPermission(entity.getPlainTableName(), "_UPDATE", session)
+boolean hasDeletePermission = hasAllDelete || security.hasEntityPermission(entity.getPlainTableName(), "_DELETE", session)
-context.put("hasAllView", hasAllView);
-context.put("hasAllCreate", hasAllCreate);
-context.put("hasAllUpdate", hasAllUpdate);
-context.put("hasAllDelete", hasAllDelete);
-context.put("hasViewPermission", hasViewPermission);
-context.put("hasCreatePermission", hasCreatePermission);
-context.put("hasUpdatePermission", hasUpdatePermission);
-context.put("hasDeletePermission" , hasDeletePermission);
+context.put("hasAllView", hasAllView)
+context.put("hasAllCreate", hasAllCreate)
+context.put("hasAllUpdate", hasAllUpdate)
+context.put("hasAllDelete", hasAllDelete)
+context.put("hasViewPermission", hasViewPermission)
+context.put("hasCreatePermission", hasCreatePermission)
+context.put("hasUpdatePermission", hasUpdatePermission)
+context.put("hasDeletePermission" , hasDeletePermission)
-boolean useValue = true;
-String curFindString = "entityName=" + entityName;
-GenericPK findByPK = delegator.makePK(entityName);
-Iterator pkIterator = entity.getPksIterator();
+boolean useValue = true
+String curFindString = "entityName=" + entityName
+GenericPK findByPK = delegator.makePK(entityName)
+Iterator pkIterator = entity.getPksIterator()
while (pkIterator.hasNext()) {
- ModelField field = pkIterator.next();
- ModelFieldType type = delegator.getEntityFieldType(entity, field.getType());
- String fval = parameters.get(field.getName());
+ ModelField field = pkIterator.next()
+ ModelFieldType type = delegator.getEntityFieldType(entity, field.getType())
+ String fval = parameters.get(field.getName())
if (UtilValidate.isNotEmpty(fval)) {
- curFindString = curFindString + "&" + field.getName() + "=" + fval;
- findByPK.setString(field.getName(), fval);
+ curFindString = curFindString + "&" + field.getName() + "=" + fval
+ findByPK.setString(field.getName(), fval)
}
}
-context.put("findByPk", findByPK.toString());
+context.put("findByPk", findByPK.toString())
-curFindString = UtilFormatOut.encodeQuery(curFindString);
-context.put("curFindString", curFindString);
+curFindString = UtilFormatOut.encodeQuery(curFindString)
+context.put("curFindString", curFindString)
-GenericValue value = null;
+GenericValue value = null
//only try to find it if this is a valid primary key...
if (findByPK.isPrimaryKey()) {
- value = delegator.findOne(findByPK.getEntityName(), findByPK, false);
+ value = delegator.findOne(findByPK.getEntityName(), findByPK, false)
}
-context.put("value", value);
+context.put("value", value)
if (value == null) {
- useValue = false;
+ useValue = false
}
if (value != null) {
- List fieldList = [];
- Iterator fieldIterator = entity.getFieldsIterator();
+ List fieldList = []
+ Iterator fieldIterator = entity.getFieldsIterator()
while (fieldIterator.hasNext()) {
- Map mapField = [:];
+ Map mapField = [:]
- ModelField field = fieldIterator.next();
- ModelFieldType type = delegator.getEntityFieldType(entity, field.getType());
+ ModelField field = fieldIterator.next()
+ ModelFieldType type = delegator.getEntityFieldType(entity, field.getType())
- String fieldValue = "";
+ String fieldValue = ""
if (type.getJavaType().equals("Timestamp") || type.getJavaType().equals("java.sql.Timestamp")) {
- Timestamp dtVal = value.getTimestamp(field.getName());
- fieldValue = (dtVal == null) ? "" : dtVal.toString();
+ Timestamp dtVal = value.getTimestamp(field.getName())
+ fieldValue = (dtVal == null) ? "" : dtVal.toString()
} else if (type.getJavaType().equals("Date") || type.getJavaType().equals("java.sql.Date")) {
- Date dateVal = value.getDate(field.getName());
- fieldValue = (dateVal == null) ? "" : dateVal.toString();
+ Date dateVal = value.getDate(field.getName())
+ fieldValue = (dateVal == null) ? "" : dateVal.toString()
} else if (type.getJavaType().equals("Time") || type.getJavaType().equals("java.sql.Time")) {
- Time timeVal = value.getTime(field.getName());
- fieldValue = (timeVal == null) ? "" : timeVal.toString();
+ Time timeVal = value.getTime(field.getName())
+ fieldValue = (timeVal == null) ? "" : timeVal.toString()
} else if (type.getJavaType().indexOf("Integer") >= 0) {
- fieldValue = UtilFormatOut.safeToString((Integer)value.get(field.getName()));
+ fieldValue = UtilFormatOut.safeToString((Integer)value.get(field.getName()))
} else if (type.getJavaType().indexOf("Long") >= 0) {
- fieldValue = UtilFormatOut.safeToString((Long)value.get(field.getName()));
+ fieldValue = UtilFormatOut.safeToString((Long)value.get(field.getName()))
} else if (type.getJavaType().indexOf("Double") >= 0) {
- fieldValue = UtilFormatOut.safeToString((Double)value.get(field.getName()));
+ fieldValue = UtilFormatOut.safeToString((Double)value.get(field.getName()))
} else if (type.getJavaType().indexOf("Float") >= 0) {
- fieldValue = UtilFormatOut.safeToString((Float)value.get(field.getName()));
+ fieldValue = UtilFormatOut.safeToString((Float)value.get(field.getName()))
} else if (type.getJavaType().indexOf("BigDecimal") >= 0) {
- fieldValue = UtilFormatOut.safeToString((BigDecimal)value.get(field.getName()));
+ fieldValue = UtilFormatOut.safeToString((BigDecimal)value.get(field.getName()))
} else if (type.getJavaType().indexOf("String") >= 0) {
- fieldValue = UtilFormatOut.checkNull((String)value.get(field.getName()));
+ fieldValue = UtilFormatOut.checkNull((String)value.get(field.getName()))
}
- mapField.put("name", field.getName());
- mapField.put("value", fieldValue);
+ mapField.put("name", field.getName())
+ mapField.put("value", fieldValue)
- fieldList.add(mapField);
+ fieldList.add(mapField)
}
- context.put("fields", fieldList);
+ context.put("fields", fieldList)
}
-GenericValue valueSave = value;
-boolean pkNotFound = false;
+GenericValue valueSave = value
+boolean pkNotFound = false
if (value == null && (findByPK.getAllFields().size() > 0)) {
- pkNotFound = true;
+ pkNotFound = true
}
-context.put("pkNotFound", pkNotFound);
+context.put("pkNotFound", pkNotFound)
-String lastUpdateMode = parameters.get("UPDATE_MODE");
+String lastUpdateMode = parameters.get("UPDATE_MODE")
if ((session.getAttribute("_ERROR_MESSAGE_") != null || request.getAttribute("_ERROR_MESSAGE_") != null) &&
lastUpdateMode != null && !lastUpdateMode.equals("DELETE")) {
//if we are updating and there is an error, do not use the entity data for the fields, use parameters to get the old value
- useValue = false;
+ useValue = false
}
-context.put("useValue", useValue);
+context.put("useValue", useValue)
-List newFieldPkList = [];
-pkIterator = entity.getPksIterator();
+List newFieldPkList = []
+pkIterator = entity.getPksIterator()
while (pkIterator.hasNext()) {
- Map mapField = [:];
+ Map mapField = [:]
- ModelField field = pkIterator.next();
- ModelFieldType type = delegator.getEntityFieldType(entity, field.getType());
+ ModelField field = pkIterator.next()
+ ModelFieldType type = delegator.getEntityFieldType(entity, field.getType())
- String fieldValue = "";
- String fieldType = "";
- String stringLength = "";
+ String fieldValue = ""
+ String fieldType = ""
+ String stringLength = ""
if (type.getJavaType().equals("Timestamp") || type.getJavaType().equals("java.sql.Timestamp")) {
- String dateTimeString = null;
+ String dateTimeString = null
if (findByPK != null && useValue) {
- Timestamp dtVal = findByPK.getTimestamp(field.getName());
+ Timestamp dtVal = findByPK.getTimestamp(field.getName())
if (dtVal != null) {
- dateTimeString = dtVal.toString();
+ dateTimeString = dtVal.toString()
}
} else if (!useValue) {
- dateTimeString = parameters.get(field.getName());
+ dateTimeString = parameters.get(field.getName())
}
- fieldValue = UtilFormatOut.checkNull(dateTimeString);
- fieldType = "DateTime";
+ fieldValue = UtilFormatOut.checkNull(dateTimeString)
+ fieldType = "DateTime"
} else if (type.getJavaType().equals("Date") || type.getJavaType().equals("java.sql.Date")) {
- String dateString = null;
+ String dateString = null
if (findByPK != null && useValue) {
- Date dateVal = findByPK.getDate(field.getName());
- dateString = (dateVal == null) ? "" : dateVal.toString();
+ Date dateVal = findByPK.getDate(field.getName())
+ dateString = (dateVal == null) ? "" : dateVal.toString()
} else if (!useValue) {
- dateString = parameters.get(field.getName());
+ dateString = parameters.get(field.getName())
}
- fieldValue = UtilFormatOut.checkNull(dateString);
- fieldType = "Date";
+ fieldValue = UtilFormatOut.checkNull(dateString)
+ fieldType = "Date"
} else if (type.getJavaType().equals("Time") || type.getJavaType().equals("java.sql.Time")) {
- String timeString = null;
+ String timeString = null
if (findByPK != null && useValue) {
- Time timeVal = findByPK.getTime(field.getName());
- timeString = (timeVal == null) ? "" : timeVal.toString();
+ Time timeVal = findByPK.getTime(field.getName())
+ timeString = (timeVal == null) ? "" : timeVal.toString()
} else if (!useValue) {
- timeString = parameters.get(field.getName());
+ timeString = parameters.get(field.getName())
}
- fieldValue = UtilFormatOut.checkNull(timeString);
- fieldType = "Time";
+ fieldValue = UtilFormatOut.checkNull(timeString)
+ fieldType = "Time"
} else if (type.getJavaType().indexOf("Integer") >= 0) {
- fieldValue = (findByPK != null && useValue) ? UtilFormatOut.safeToString((Integer)findByPK.get(field.getName())) : (useValue ? "" : UtilFormatOut.checkNull(parameters.get(field.getName())));
- fieldType = "Integer";
+ fieldValue = (findByPK != null && useValue) ? UtilFormatOut.safeToString((Integer)findByPK.get(field.getName())) : (useValue ? "" : UtilFormatOut.checkNull(parameters.get(field.getName())))
+ fieldType = "Integer"
} else if (type.getJavaType().indexOf("Long") >= 0) {
- fieldValue = (findByPK != null && useValue) ? UtilFormatOut.safeToString((Long)findByPK.get(field.getName())) : (useValue ? "" : UtilFormatOut.checkNull(parameters.get(field.getName())));
- fieldType = "Long";
+ fieldValue = (findByPK != null && useValue) ? UtilFormatOut.safeToString((Long)findByPK.get(field.getName())) : (useValue ? "" : UtilFormatOut.checkNull(parameters.get(field.getName())))
+ fieldType = "Long"
} else if (type.getJavaType().indexOf("Double") >= 0) {
- fieldValue = (findByPK != null && useValue) ? UtilFormatOut.safeToString((Double)findByPK.get(field.getName())) : (useValue ? "" : UtilFormatOut.checkNull(parameters.get(field.getName())));
- fieldType = "Double";
+ fieldValue = (findByPK != null && useValue) ? UtilFormatOut.safeToString((Double)findByPK.get(field.getName())) : (useValue ? "" : UtilFormatOut.checkNull(parameters.get(field.getName())))
+ fieldType = "Double"
} else if (type.getJavaType().indexOf("Float") >= 0) {
- fieldValue = (findByPK != null && useValue) ? UtilFormatOut.safeToString((Float)findByPK.get(field.getName())) : (useValue ? "" : UtilFormatOut.checkNull(parameters.get(field.getName())));
- fieldType = "Float";
+ fieldValue = (findByPK != null && useValue) ? UtilFormatOut.safeToString((Float)findByPK.get(field.getName())) : (useValue ? "" : UtilFormatOut.checkNull(parameters.get(field.getName())))
+ fieldType = "Float"
} else if (type.getJavaType().indexOf("String") >= 0) {
if (type.stringLength() <= 80) {
- fieldValue = (findByPK != null && useValue) ? UtilFormatOut.checkNull((String)findByPK.get(field.getName())) : (useValue ? "" : UtilFormatOut.checkNull(parameters.get(field.getName())));
- fieldType = "StringOneRow";
+ fieldValue = (findByPK != null && useValue) ? UtilFormatOut.checkNull((String)findByPK.get(field.getName())) : (useValue ? "" : UtilFormatOut.checkNull(parameters.get(field.getName())))
+ fieldType = "StringOneRow"
} else if (type.stringLength() <= 255) {
- fieldValue = (findByPK != null && useValue) ? UtilFormatOut.checkNull((String)findByPK.get(field.getName())) : (useValue ? "" : UtilFormatOut.checkNull(parameters.get(field.getName())));
- fieldType = "String";
+ fieldValue = (findByPK != null && useValue) ? UtilFormatOut.checkNull((String)findByPK.get(field.getName())) : (useValue ? "" : UtilFormatOut.checkNull(parameters.get(field.getName())))
+ fieldType = "String"
} else {
- fieldValue = (findByPK != null && useValue) ? UtilFormatOut.checkNull((String)findByPK.get(field.getName())):(useValue?"":UtilFormatOut.checkNull(parameters.get(field.getName())));
- fieldType = "Textarea";
+ fieldValue = (findByPK != null && useValue) ? UtilFormatOut.checkNull((String)findByPK.get(field.getName())):(useValue?"":UtilFormatOut.checkNull(parameters.get(field.getName())))
+ fieldType = "Textarea"
}
- stringLength = type.stringLength().toString();
+ stringLength = type.stringLength().toString()
}
- mapField.put("name", field.getName());
- mapField.put("value", fieldValue);
- mapField.put("fieldType", fieldType);
- mapField.put("stringLength", stringLength);
+ mapField.put("name", field.getName())
+ mapField.put("value", fieldValue)
+ mapField.put("fieldType", fieldType)
+ mapField.put("stringLength", stringLength)
- newFieldPkList.add(mapField);
+ newFieldPkList.add(mapField)
}
-context.put("newFieldPkList", newFieldPkList);
+context.put("newFieldPkList", newFieldPkList)
-List newFieldNoPkList = [];
-Iterator noPkIterator = entity.getNopksIterator();
+List newFieldNoPkList = []
+Iterator noPkIterator = entity.getNopksIterator()
while (noPkIterator.hasNext()) {
- Map mapField = [:];
+ Map mapField = [:]
- ModelField field = noPkIterator.next();
- ModelFieldType type = delegator.getEntityFieldType(entity, field.getType());
+ ModelField field = noPkIterator.next()
+ ModelFieldType type = delegator.getEntityFieldType(entity, field.getType())
- String fieldValue = "";
- String fieldType = "";
- String stringLength = "";
+ String fieldValue = ""
+ String fieldType = ""
+ String stringLength = ""
if (type.getJavaType().equals("Timestamp") || type.getJavaType().equals("java.sql.Timestamp")) {
- String dateTimeString = null;
+ String dateTimeString = null
if (value != null && useValue) {
- Timestamp dtVal = value.getTimestamp(field.getName());
+ Timestamp dtVal = value.getTimestamp(field.getName())
if (dtVal != null) {
- dateTimeString = dtVal.toString();
+ dateTimeString = dtVal.toString()
}
} else if (!useValue) {
- dateTimeString = parameters.get(field.getName());
+ dateTimeString = parameters.get(field.getName())
}
- fieldValue = UtilFormatOut.checkNull(dateTimeString);
- fieldType = "DateTime";
+ fieldValue = UtilFormatOut.checkNull(dateTimeString)
+ fieldType = "DateTime"
} else if (type.getJavaType().equals("Date") || type.getJavaType().equals("java.sql.Date")) {
- String dateString = null;
+ String dateString = null
if (value != null && useValue) {
- Date dateVal = value.getDate(field.getName());
- dateString = (dateVal == null) ? "" : dateVal.toString();
+ Date dateVal = value.getDate(field.getName())
+ dateString = (dateVal == null) ? "" : dateVal.toString()
} else if (!useValue) {
- dateString = parameters.get(field.getName());
+ dateString = parameters.get(field.getName())
}
- fieldValue = UtilFormatOut.checkNull(dateString);
- fieldType = "Date";
+ fieldValue = UtilFormatOut.checkNull(dateString)
+ fieldType = "Date"
} else if (type.getJavaType().equals("Time") || type.getJavaType().equals("java.sql.Time")) {
- String timeString = null;
+ String timeString = null
if (value != null && useValue) {
- Time timeVal = value.getTime(field.getName());
- timeString = (timeVal == null) ? "" : timeVal.toString();
+ Time timeVal = value.getTime(field.getName())
+ timeString = (timeVal == null) ? "" : timeVal.toString()
} else if (!useValue) {
- timeString = parameters.get(field.getName());
+ timeString = parameters.get(field.getName())
}
- fieldValue = UtilFormatOut.checkNull(timeString);
- fieldType = "Time";
+ fieldValue = UtilFormatOut.checkNull(timeString)
+ fieldType = "Time"
} else if (type.getJavaType().indexOf("Integer") >= 0) {
- fieldValue = (value != null && useValue) ? UtilFormatOut.safeToString((Integer)value.get(field.getName())):UtilFormatOut.checkNull(parameters.get(field.getName()));
- fieldType = "Integer";
+ fieldValue = (value != null && useValue) ? UtilFormatOut.safeToString((Integer)value.get(field.getName())):UtilFormatOut.checkNull(parameters.get(field.getName()))
+ fieldType = "Integer"
} else if (type.getJavaType().indexOf("Long") >= 0) {
- fieldValue = (value != null && useValue) ? UtilFormatOut.safeToString((Long)value.get(field.getName())):UtilFormatOut.checkNull(parameters.get(field.getName()));
- fieldType = "Long";
+ fieldValue = (value != null && useValue) ? UtilFormatOut.safeToString((Long)value.get(field.getName())):UtilFormatOut.checkNull(parameters.get(field.getName()))
+ fieldType = "Long"
} else if (type.getJavaType().indexOf("Double") >= 0) {
- fieldValue = (value != null && useValue) ? UtilFormatOut.safeToString((Double)value.get(field.getName())):UtilFormatOut.checkNull(parameters.get(field.getName()));
- fieldType = "Double";
+ fieldValue = (value != null && useValue) ? UtilFormatOut.safeToString((Double)value.get(field.getName())):UtilFormatOut.checkNull(parameters.get(field.getName()))
+ fieldType = "Double"
} else if (type.getJavaType().indexOf("Float") >= 0) {
- fieldValue = (value != null && useValue) ? UtilFormatOut.safeToString((Float)value.get(field.getName())):UtilFormatOut.checkNull(parameters.get(field.getName()));
- fieldType = "Float";
+ fieldValue = (value != null && useValue) ? UtilFormatOut.safeToString((Float)value.get(field.getName())):UtilFormatOut.checkNull(parameters.get(field.getName()))
+ fieldType = "Float"
} else if (type.getJavaType().indexOf("BigDecimal") >= 0) {
- fieldValue = (value != null && useValue) ? UtilFormatOut.safeToString((BigDecimal)value.get(field.getName())):UtilFormatOut.checkNull(parameters.get(field.getName()));
- fieldType = "BigDecimal";
+ fieldValue = (value != null && useValue) ? UtilFormatOut.safeToString((BigDecimal)value.get(field.getName())):UtilFormatOut.checkNull(parameters.get(field.getName()))
+ fieldType = "BigDecimal"
} else if (type.getJavaType().indexOf("String") >= 0) {
if (type.stringLength() <= 80) {
- fieldValue = (value != null && useValue) ? UtilFormatOut.checkNull((String)value.get(field.getName())):UtilFormatOut.checkNull(parameters.get(field.getName()));
- fieldType = "StringOneRow";
+ fieldValue = (value != null && useValue) ? UtilFormatOut.checkNull((String)value.get(field.getName())):UtilFormatOut.checkNull(parameters.get(field.getName()))
+ fieldType = "StringOneRow"
} else if (type.stringLength() <= 255) {
- fieldValue = (value != null && useValue) ? UtilFormatOut.checkNull((String)value.get(field.getName())):UtilFormatOut.checkNull(parameters.get(field.getName()));
- fieldType = "String";
+ fieldValue = (value != null && useValue) ? UtilFormatOut.checkNull((String)value.get(field.getName())):UtilFormatOut.checkNull(parameters.get(field.getName()))
+ fieldType = "String"
} else {
- fieldValue = (value != null && useValue) ? UtilFormatOut.checkNull((String)value.get(field.getName())):UtilFormatOut.checkNull(parameters.get(field.getName()));
- fieldType = "Textarea";
+ fieldValue = (value != null && useValue) ? UtilFormatOut.checkNull((String)value.get(field.getName())):UtilFormatOut.checkNull(parameters.get(field.getName()))
+ fieldType = "Textarea"
}
- stringLength = type.stringLength().toString();
+ stringLength = type.stringLength().toString()
}
- mapField.put("name", field.getName());
- mapField.put("value", fieldValue);
- mapField.put("fieldType", fieldType);
- mapField.put("stringLength", stringLength);
+ mapField.put("name", field.getName())
+ mapField.put("value", fieldValue)
+ mapField.put("fieldType", fieldType)
+ mapField.put("stringLength", stringLength)
- newFieldNoPkList.add(mapField);
+ newFieldNoPkList.add(mapField)
}
-context.put("newFieldNoPkList", newFieldNoPkList);
+context.put("newFieldNoPkList", newFieldNoPkList)
-List relationFieldList = [];
+List relationFieldList = []
for (int relIndex = 0; relIndex < entity.getRelationsSize(); relIndex++) {
- Map mapRelation = [:];
+ Map mapRelation = [:]
- ModelRelation relation = entity.getRelation(relIndex);
- ModelEntity relatedEntity = reader.getModelEntity(relation.getRelEntityName());
+ ModelRelation relation = entity.getRelation(relIndex)
+ ModelEntity relatedEntity = reader.getModelEntity(relation.getRelEntityName())
- boolean relCreate = false;
+ boolean relCreate = false
if (security.hasEntityPermission(relatedEntity.getPlainTableName(), "_CREATE", session)) {
- relCreate = true;
+ relCreate = true
}
- mapRelation.put("type", relation.getType());
- mapRelation.put("title", relation.getTitle());
- mapRelation.put("relEntityName", relation.getRelEntityName());
- mapRelation.put("sortName", relation.getTitle() + relation.getRelEntityName());
- mapRelation.put("relatedTable", relatedEntity.getEntityName());
- mapRelation.put("relCreate", relCreate);
+ mapRelation.put("type", relation.getType())
+ mapRelation.put("title", relation.getTitle())
+ mapRelation.put("relEntityName", relation.getRelEntityName())
+ mapRelation.put("sortName", relation.getTitle() + relation.getRelEntityName())
+ mapRelation.put("relatedTable", relatedEntity.getEntityName())
+ mapRelation.put("relCreate", relCreate)
if ("one".equals(relation.getType()) || "one-nofk".equals(relation.getType())) {
if (value != null) {
if (hasAllView || security.hasEntityPermission(relatedEntity.getPlainTableName(), "_VIEW", session)) {
- Iterator tempIter = UtilMisc.toIterator(value.getRelated(relation.getTitle() + relatedEntity.getEntityName(), null, null, false));
- GenericValue valueRelated = null;
+ Iterator tempIter = UtilMisc.toIterator(value.getRelated(relation.getTitle() + relatedEntity.getEntityName(), null, null, false))
+ GenericValue valueRelated = null
if (tempIter != null && tempIter.hasNext()) {
- valueRelated = (GenericValue) tempIter.next();
+ valueRelated = (GenericValue) tempIter.next()
}
- List relatedFieldsList = [];
- Iterator relFieldIterator = relatedEntity.getFieldsIterator();
+ List relatedFieldsList = []
+ Iterator relFieldIterator = relatedEntity.getFieldsIterator()
while (relFieldIterator.hasNext()) {
- Map mapRelatedFields = [:];
- ModelField field = relFieldIterator.next();
- ModelFieldType type = delegator.getEntityFieldType(entity, field.getType());
+ Map mapRelatedFields = [:]
+ ModelField field = relFieldIterator.next()
+ ModelFieldType type = delegator.getEntityFieldType(entity, field.getType())
- String fieldValue = "";
- String fieldType = "";
+ String fieldValue = ""
+ String fieldType = ""
if (type.getJavaType().equals("Timestamp") || type.getJavaType().equals("java.sql.Timestamp")) {
- Timestamp dtVal = null;
+ Timestamp dtVal = null
if (valueRelated != null) {
- dtVal = valueRelated.getTimestamp(field.getName());
+ dtVal = valueRelated.getTimestamp(field.getName())
}
- fieldValue = (dtVal == null) ? "" : dtVal.toString();
- fieldType = "DateTime";
+ fieldValue = (dtVal == null) ? "" : dtVal.toString()
+ fieldType = "DateTime"
} else if (type.getJavaType().equals("Date") || type.getJavaType().equals("java.sql.Date")) {
- Date dateVal = null;
+ Date dateVal = null
if (valueRelated != null) {
- dateVal = valueRelated.getDate(field.getName());
+ dateVal = valueRelated.getDate(field.getName())
}
- fieldValue = (dateVal == null) ? "" : dateVal.toString();
- fieldType = "Date";
+ fieldValue = (dateVal == null) ? "" : dateVal.toString()
+ fieldType = "Date"
} else if (type.getJavaType().equals("Time") || type.getJavaType().equals("java.sql.Time")) {
- Time timeVal = null;
+ Time timeVal = null
if (valueRelated != null) {
- timeVal = valueRelated.getTime(field.getName());
+ timeVal = valueRelated.getTime(field.getName())
}
- fieldValue = (timeVal == null) ? "" : timeVal.toString();
- fieldType = "Time";
+ fieldValue = (timeVal == null) ? "" : timeVal.toString()
+ fieldType = "Time"
} else if (type.getJavaType().indexOf("Integer") >= 0) {
if (valueRelated != null) {
- fieldValue = UtilFormatOut.safeToString((Integer)valueRelated.get(field.getName()));
+ fieldValue = UtilFormatOut.safeToString((Integer)valueRelated.get(field.getName()))
}
- fieldType = "Integer";
+ fieldType = "Integer"
} else if (type.getJavaType().indexOf("Long") >= 0) {
if (valueRelated != null) {
- fieldValue = UtilFormatOut.safeToString((Long)valueRelated.get(field.getName()));
+ fieldValue = UtilFormatOut.safeToString((Long)valueRelated.get(field.getName()))
}
- fieldType = "Long";
+ fieldType = "Long"
} else if (type.getJavaType().indexOf("Double") >= 0) {
if (valueRelated != null) {
- fieldValue = UtilFormatOut.safeToString((Double)valueRelated.get(field.getName()));
+ fieldValue = UtilFormatOut.safeToString((Double)valueRelated.get(field.getName()))
}
- fieldType = "Double";
+ fieldType = "Double"
} else if (type.getJavaType().indexOf("Float") >= 0) {
if (valueRelated != null) {
- fieldValue = UtilFormatOut.safeToString((Float)valueRelated.get(field.getName()));
+ fieldValue = UtilFormatOut.safeToString((Float)valueRelated.get(field.getName()))
}
- fieldType = "Float";
+ fieldType = "Float"
} else if (type.getJavaType().indexOf("String") >= 0) {
if (valueRelated != null) {
- fieldValue = UtilFormatOut.checkNull((String)valueRelated.get(field.getName()));
+ fieldValue = UtilFormatOut.checkNull((String)valueRelated.get(field.getName()))
}
- fieldType = "String";
+ fieldType = "String"
}
- mapRelatedFields.put("name", field.getName());
- mapRelatedFields.put("type", fieldType);
- mapRelatedFields.put("value", fieldValue);
- relatedFieldsList.add(mapRelatedFields);
+ mapRelatedFields.put("name", field.getName())
+ mapRelatedFields.put("type", fieldType)
+ mapRelatedFields.put("value", fieldValue)
+ relatedFieldsList.add(mapRelatedFields)
}
- mapRelation.put("valueRelated", valueRelated);
+ mapRelation.put("valueRelated", valueRelated)
if (valueRelated != null) {
- mapRelation.put("valueRelatedPk", valueRelated.getPrimaryKey().toString());
+ mapRelation.put("valueRelatedPk", valueRelated.getPrimaryKey().toString())
}
- mapRelation.put("relatedFieldsList", relatedFieldsList);
- mapRelation.put("relType", "one");
+ mapRelation.put("relatedFieldsList", relatedFieldsList)
+ mapRelation.put("relType", "one")
- String findString = "entityName=" + relatedEntity.getEntityName();
+ String findString = "entityName=" + relatedEntity.getEntityName()
for (ModelKeyMap keyMap : relation.getKeyMaps()) {
if (value.get(keyMap.getFieldName()) != null) {
- findString += "&" + keyMap.getRelFieldName() + "=" + value.get(keyMap.getFieldName());
+ findString += "&" + keyMap.getRelFieldName() + "=" + value.get(keyMap.getFieldName())
}
}
- String encodeFindString = UtilFormatOut.encodeQuery(findString);
- mapRelation.put("encodeRelatedEntityFindString", encodeFindString);
+ String encodeFindString = UtilFormatOut.encodeQuery(findString)
+ mapRelation.put("encodeRelatedEntityFindString", encodeFindString)
- relationFieldList.add(mapRelation);
+ relationFieldList.add(mapRelation)
}
}
} else if (relation.getType().equalsIgnoreCase("many")) {
if (value != null) {
if (hasAllView || security.hasEntityPermission(relatedEntity.getPlainTableName(), "_VIEW", session)) {
- mapRelation.put("relType", "many");
+ mapRelation.put("relType", "many")
- String findString = "entityName=" + relatedEntity.getEntityName();
+ String findString = "entityName=" + relatedEntity.getEntityName()
for (ModelKeyMap keyMap : relation.getKeyMaps()) {
if (value.get(keyMap.getFieldName()) != null) {
- findString += "&" + keyMap.getRelFieldName() + "=" + value.get(keyMap.getFieldName());
+ findString += "&" + keyMap.getRelFieldName() + "=" + value.get(keyMap.getFieldName())
}
}
- String encodeFindString = UtilFormatOut.encodeQuery(findString);
- mapRelation.put("encodeRelatedEntityFindString", encodeFindString);
+ String encodeFindString = UtilFormatOut.encodeQuery(findString)
+ mapRelation.put("encodeRelatedEntityFindString", encodeFindString)
- relationFieldList.add(mapRelation);
+ relationFieldList.add(mapRelation)
}
}
}
}
-context.put("relationFieldList", UtilMisc.sortMaps(relationFieldList, UtilMisc.toList("sortName")));
-context.put("relSize", relationFieldList.size() + 2);
+context.put("relationFieldList", UtilMisc.sortMaps(relationFieldList, UtilMisc.toList("sortName")))
+context.put("relSize", relationFieldList.size() + 2)
diff --git a/framework/webtools/groovyScripts/entity/ViewRelations.groovy b/framework/webtools/groovyScripts/entity/ViewRelations.groovy
index 744d551358..80bf3317a8 100644
--- a/framework/webtools/groovyScripts/entity/ViewRelations.groovy
+++ b/framework/webtools/groovyScripts/entity/ViewRelations.groovy
@@ -16,44 +16,44 @@
* specific language governing permissions and limitations
* under the License.
*/
-import org.apache.ofbiz.entity.Delegator;
-import org.apache.ofbiz.security.Security;
-import org.apache.ofbiz.entity.model.ModelReader;
-import org.apache.ofbiz.entity.model.ModelEntity;
-import org.apache.ofbiz.entity.model.ModelRelation;
-import org.apache.ofbiz.entity.model.ModelKeyMap;
+import org.apache.ofbiz.entity.Delegator
+import org.apache.ofbiz.security.Security
+import org.apache.ofbiz.entity.model.ModelReader
+import org.apache.ofbiz.entity.model.ModelEntity
+import org.apache.ofbiz.entity.model.ModelRelation
+import org.apache.ofbiz.entity.model.ModelKeyMap
-entityName = parameters.entityName;
-context.entityName = entityName;
+entityName = parameters.entityName
+context.entityName = entityName
-reader = delegator.getModelReader();
-modelEntity = reader.getModelEntity(entityName);
+reader = delegator.getModelReader()
+modelEntity = reader.getModelEntity(entityName)
-context.plainTableName = modelEntity.getPlainTableName();
+context.plainTableName = modelEntity.getPlainTableName()
-hasViewPermission = security.hasEntityPermission("ENTITY_DATA", "_VIEW", session) || security.hasEntityPermission(modelEntity.getPlainTableName(), "_VIEW", session);
-context.hasViewPermission = hasViewPermission;
+hasViewPermission = security.hasEntityPermission("ENTITY_DATA", "_VIEW", session) || security.hasEntityPermission(modelEntity.getPlainTableName(), "_VIEW", session)
+context.hasViewPermission = hasViewPermission
-relations = [];
+relations = []
for (rit = modelEntity.getRelationsIterator(); rit.hasNext();) {
- mapRelation = [:];
+ mapRelation = [:]
- modelRelation = rit.next();
- relFields = [];
+ modelRelation = rit.next()
+ relFields = []
for (kit = modelRelation.getKeyMaps().iterator(); kit.hasNext();) {
- mapFields = [:];
- keyMap = kit.next();
- mapFields.fieldName = keyMap.getFieldName();
- mapFields.relFieldName = keyMap.getRelFieldName();
+ mapFields = [:]
+ keyMap = kit.next()
+ mapFields.fieldName = keyMap.getFieldName()
+ mapFields.relFieldName = keyMap.getRelFieldName()
- relFields.add(mapFields);
+ relFields.add(mapFields)
}
- mapRelation.relFields = relFields;
- mapRelation.title = modelRelation.getTitle();
- mapRelation.relEntityName = modelRelation.getRelEntityName();
- mapRelation.type = modelRelation.getType();
- mapRelation.fkName = modelRelation.getFkName();
+ mapRelation.relFields = relFields
+ mapRelation.title = modelRelation.getTitle()
+ mapRelation.relEntityName = modelRelation.getRelEntityName()
+ mapRelation.type = modelRelation.getType()
+ mapRelation.fkName = modelRelation.getFkName()
- relations.add(mapRelation);
+ relations.add(mapRelation)
}
-context.relations = relations;
+context.relations = relations
diff --git a/framework/webtools/groovyScripts/entity/XmlDsDump.groovy b/framework/webtools/groovyScripts/entity/XmlDsDump.groovy
index 55b68fe762..e3adbd8610 100644
--- a/framework/webtools/groovyScripts/entity/XmlDsDump.groovy
+++ b/framework/webtools/groovyScripts/entity/XmlDsDump.groovy
@@ -17,310 +17,310 @@
* under the License.
*/
-import java.util.*;
-import java.io.*;
-import org.apache.ofbiz.base.util.*;
-import org.apache.ofbiz.entity.model.*;
-import org.apache.ofbiz.entity.util.*;
-import org.apache.ofbiz.entity.transaction.*;
-import org.apache.ofbiz.entity.condition.*;
+import java.util.*
+import java.io.*
+import org.apache.ofbiz.base.util.*
+import org.apache.ofbiz.entity.model.*
+import org.apache.ofbiz.entity.util.*
+import org.apache.ofbiz.entity.transaction.*
+import org.apache.ofbiz.entity.condition.*
-outpath = parameters.outpath;
-filename = parameters.filename;
-maxRecStr = parameters.maxrecords;
-entitySyncId = parameters.entitySyncId;
-passedEntityNames = null;
-if (parameters.entityName) passedEntityNames = parameters.entityName instanceof Collection ? parameters.entityName as TreeSet : [parameters.entityName] as TreeSet;
+outpath = parameters.outpath
+filename = parameters.filename
+maxRecStr = parameters.maxrecords
+entitySyncId = parameters.entitySyncId
+passedEntityNames = null
+if (parameters.entityName) passedEntityNames = parameters.entityName instanceof Collection ? parameters.entityName as TreeSet : [parameters.entityName] as TreeSet
// get the max records per file setting and convert to a int
-maxRecordsPerFile = 0;
+maxRecordsPerFile = 0
if (maxRecStr) {
try {
- maxRecordsPerFile = Integer.parseInt(maxRecStr);
+ maxRecordsPerFile = Integer.parseInt(maxRecStr)
}
catch (Exception e) {
}
}
-preConfiguredSetName = parameters.preConfiguredSetName;
+preConfiguredSetName = parameters.preConfiguredSetName
if ("Product1".equals(preConfiguredSetName)) {
- passedEntityNames = new LinkedHashSet();
- passedEntityNames.add("DataResource");
- passedEntityNames.add("Facility");
- passedEntityNames.add("ProdCatalog");
- passedEntityNames.add("Product");
- passedEntityNames.add("ProductCategory");
- passedEntityNames.add("ProductFeatureCategory");
- passedEntityNames.add("ProductFeatureType");
- passedEntityNames.add("ProductPriceRule");
- passedEntityNames.add("ProductPromo");
+ passedEntityNames = new LinkedHashSet()
+ passedEntityNames.add("DataResource")
+ passedEntityNames.add("Facility")
+ passedEntityNames.add("ProdCatalog")
+ passedEntityNames.add("Product")
+ passedEntityNames.add("ProductCategory")
+ passedEntityNames.add("ProductFeatureCategory")
+ passedEntityNames.add("ProductFeatureType")
+ passedEntityNames.add("ProductPriceRule")
+ passedEntityNames.add("ProductPromo")
} else if ("Product2".equals(preConfiguredSetName)) {
- passedEntityNames = new LinkedHashSet();
- passedEntityNames.add("Content");
- passedEntityNames.add("ElectronicText");
- passedEntityNames.add("FacilityLocation");
- passedEntityNames.add("ProdCatalogCategory");
- passedEntityNames.add("ProdCatalogRole");
- passedEntityNames.add("ProductAssoc");
- passedEntityNames.add("ProductAttribute");
- passedEntityNames.add("ProductCategoryMember");
- passedEntityNames.add("ProductCategoryRollup");
- passedEntityNames.add("ProductFacility");
- passedEntityNames.add("ProductFeature");
- passedEntityNames.add("ProductFeatureCategoryAppl");
- passedEntityNames.add("ProductKeyword");
- passedEntityNames.add("ProductPrice");
- passedEntityNames.add("ProductPriceAction");
- passedEntityNames.add("ProductPriceCond");
- passedEntityNames.add("ProductPromoCode");
- passedEntityNames.add("ProductPromoCategory");
- passedEntityNames.add("ProductPromoProduct");
- passedEntityNames.add("ProductPromoRule");
+ passedEntityNames = new LinkedHashSet()
+ passedEntityNames.add("Content")
+ passedEntityNames.add("ElectronicText")
+ passedEntityNames.add("FacilityLocation")
+ passedEntityNames.add("ProdCatalogCategory")
+ passedEntityNames.add("ProdCatalogRole")
+ passedEntityNames.add("ProductAssoc")
+ passedEntityNames.add("ProductAttribute")
+ passedEntityNames.add("ProductCategoryMember")
+ passedEntityNames.add("ProductCategoryRollup")
+ passedEntityNames.add("ProductFacility")
+ passedEntityNames.add("ProductFeature")
+ passedEntityNames.add("ProductFeatureCategoryAppl")
+ passedEntityNames.add("ProductKeyword")
+ passedEntityNames.add("ProductPrice")
+ passedEntityNames.add("ProductPriceAction")
+ passedEntityNames.add("ProductPriceCond")
+ passedEntityNames.add("ProductPromoCode")
+ passedEntityNames.add("ProductPromoCategory")
+ passedEntityNames.add("ProductPromoProduct")
+ passedEntityNames.add("ProductPromoRule")
} else if ("Product3".equals(preConfiguredSetName)) {
- passedEntityNames = new LinkedHashSet();
- passedEntityNames.add("ProdCatalogInvFacility");
- passedEntityNames.add("ProductContent");
- passedEntityNames.add("ProductFacilityLocation");
- passedEntityNames.add("ProductFeatureAppl");
- passedEntityNames.add("ProductFeatureDataResource");
- passedEntityNames.add("ProductFeatureGroup");
- passedEntityNames.add("ProductPriceChange");
- passedEntityNames.add("ProductPromoAction");
- passedEntityNames.add("ProductPromoCodeEmail");
- passedEntityNames.add("ProductPromoCodeParty");
- passedEntityNames.add("ProductPromoCond");
+ passedEntityNames = new LinkedHashSet()
+ passedEntityNames.add("ProdCatalogInvFacility")
+ passedEntityNames.add("ProductContent")
+ passedEntityNames.add("ProductFacilityLocation")
+ passedEntityNames.add("ProductFeatureAppl")
+ passedEntityNames.add("ProductFeatureDataResource")
+ passedEntityNames.add("ProductFeatureGroup")
+ passedEntityNames.add("ProductPriceChange")
+ passedEntityNames.add("ProductPromoAction")
+ passedEntityNames.add("ProductPromoCodeEmail")
+ passedEntityNames.add("ProductPromoCodeParty")
+ passedEntityNames.add("ProductPromoCond")
} else if ("Product4".equals(preConfiguredSetName)) {
- passedEntityNames = new LinkedHashSet();
- passedEntityNames.add("InventoryItem");
- passedEntityNames.add("ProductFeatureCatGrpAppl");
- passedEntityNames.add("ProductFeatureGroupAppl");
+ passedEntityNames = new LinkedHashSet()
+ passedEntityNames.add("InventoryItem")
+ passedEntityNames.add("ProductFeatureCatGrpAppl")
+ passedEntityNames.add("ProductFeatureGroupAppl")
} else if ("CatalogExport".equals(preConfiguredSetName)) {
- passedEntityNames = new LinkedHashSet();
- passedEntityNames.add("ProdCatalogCategoryType");
- passedEntityNames.add("ProdCatalog");
- passedEntityNames.add("ProductCategoryType");
- passedEntityNames.add("ProductCategory");
- passedEntityNames.add("ProductCategoryRollup");
- passedEntityNames.add("ProdCatalogCategory");
- passedEntityNames.add("ProductFeatureType");
- passedEntityNames.add("ProductFeatureCategory");
+ passedEntityNames = new LinkedHashSet()
+ passedEntityNames.add("ProdCatalogCategoryType")
+ passedEntityNames.add("ProdCatalog")
+ passedEntityNames.add("ProductCategoryType")
+ passedEntityNames.add("ProductCategory")
+ passedEntityNames.add("ProductCategoryRollup")
+ passedEntityNames.add("ProdCatalogCategory")
+ passedEntityNames.add("ProductFeatureType")
+ passedEntityNames.add("ProductFeatureCategory")
- passedEntityNames.add("DataResource");
- passedEntityNames.add("Content");
- passedEntityNames.add("ElectronicText");
+ passedEntityNames.add("DataResource")
+ passedEntityNames.add("Content")
+ passedEntityNames.add("ElectronicText")
- passedEntityNames.add("ProductType");
- passedEntityNames.add("Product");
- passedEntityNames.add("ProductAttribute");
- passedEntityNames.add("GoodIdentificationType");
- passedEntityNames.add("GoodIdentification");
- passedEntityNames.add("ProductPriceType");
- passedEntityNames.add("ProductPrice");
+ passedEntityNames.add("ProductType")
+ passedEntityNames.add("Product")
+ passedEntityNames.add("ProductAttribute")
+ passedEntityNames.add("GoodIdentificationType")
+ passedEntityNames.add("GoodIdentification")
+ passedEntityNames.add("ProductPriceType")
+ passedEntityNames.add("ProductPrice")
- passedEntityNames.add("ProductPriceRule");
- passedEntityNames.add("ProductPriceCond");
- passedEntityNames.add("ProductPriceAction");
- //passedEntityNames.add("ProductPriceChange");
+ passedEntityNames.add("ProductPriceRule")
+ passedEntityNames.add("ProductPriceCond")
+ passedEntityNames.add("ProductPriceAction")
+ //passedEntityNames.add("ProductPriceChange")
- passedEntityNames.add("ProductPromo");
- passedEntityNames.add("ProductPromoCode");
- passedEntityNames.add("ProductPromoCategory");
- passedEntityNames.add("ProductPromoProduct");
- passedEntityNames.add("ProductPromoRule");
- passedEntityNames.add("ProductPromoAction");
- passedEntityNames.add("ProductPromoCodeEmail");
- passedEntityNames.add("ProductPromoCodeParty");
- passedEntityNames.add("ProductPromoCond");
+ passedEntityNames.add("ProductPromo")
+ passedEntityNames.add("ProductPromoCode")
+ passedEntityNames.add("ProductPromoCategory")
+ passedEntityNames.add("ProductPromoProduct")
+ passedEntityNames.add("ProductPromoRule")
+ passedEntityNames.add("ProductPromoAction")
+ passedEntityNames.add("ProductPromoCodeEmail")
+ passedEntityNames.add("ProductPromoCodeParty")
+ passedEntityNames.add("ProductPromoCond")
- passedEntityNames.add("ProductCategoryMember");
- passedEntityNames.add("ProductAssoc");
- passedEntityNames.add("ProductContent");
+ passedEntityNames.add("ProductCategoryMember")
+ passedEntityNames.add("ProductAssoc")
+ passedEntityNames.add("ProductContent")
- passedEntityNames.add("ProductFeature");
- passedEntityNames.add("ProductFeatureCategoryAppl");
- passedEntityNames.add("ProductFeatureAppl");
- passedEntityNames.add("ProductFeatureDataResource");
- passedEntityNames.add("ProductFeatureGroup");
- passedEntityNames.add("ProductFeatureCatGrpAppl");
- passedEntityNames.add("ProductFeatureGroupAppl");
+ passedEntityNames.add("ProductFeature")
+ passedEntityNames.add("ProductFeatureCategoryAppl")
+ passedEntityNames.add("ProductFeatureAppl")
+ passedEntityNames.add("ProductFeatureDataResource")
+ passedEntityNames.add("ProductFeatureGroup")
+ passedEntityNames.add("ProductFeatureCatGrpAppl")
+ passedEntityNames.add("ProductFeatureGroupAppl")
- //passedEntityNames.add("ProductKeyword");
+ //passedEntityNames.add("ProductKeyword")
}
if (entitySyncId) {
- passedEntityNames = org.apache.ofbiz.entityext.synchronization.EntitySyncContext.getEntitySyncModelNamesToUse(dispatcher, entitySyncId);
+ passedEntityNames = org.apache.ofbiz.entityext.synchronization.EntitySyncContext.getEntitySyncModelNamesToUse(dispatcher, entitySyncId)
}
-checkAll = "true".equals(parameters.checkAll);
-tobrowser = parameters.tobrowser != null;
-context.tobrowser = tobrowser;
+checkAll = "true".equals(parameters.checkAll)
+tobrowser = parameters.tobrowser != null
+context.tobrowser = tobrowser
-entityFromCond = null;
-entityThruCond = null;
-entityDateCond = null;
+entityFromCond = null
+entityThruCond = null
+entityDateCond = null
if (entityFrom) {
- entityFromCond = EntityCondition.makeCondition("lastUpdatedTxStamp", EntityComparisonOperator.GREATER_THAN, entityFrom);
+ entityFromCond = EntityCondition.makeCondition("lastUpdatedTxStamp", EntityComparisonOperator.GREATER_THAN, entityFrom)
}
if (entityThru) {
- entityThruCond = EntityCondition.makeCondition("lastUpdatedTxStamp", EntityComparisonOperator.LESS_THAN, entityThru);
+ entityThruCond = EntityCondition.makeCondition("lastUpdatedTxStamp", EntityComparisonOperator.LESS_THAN, entityThru)
}
if (entityFromCond && entityThruCond) {
- entityDateCond = EntityCondition.makeCondition(entityFromCond, EntityJoinOperator.AND, entityThruCond);
+ entityDateCond = EntityCondition.makeCondition(entityFromCond, EntityJoinOperator.AND, entityThruCond)
} else if (entityFromCond) {
- entityDateCond = entityFromCond;
+ entityDateCond = entityFromCond
} else if (entityThruCond) {
- entityDateCond = entityThruCond;
+ entityDateCond = entityThruCond
}
-reader = delegator.getModelReader();
-modelEntities = reader.getEntityCache().values() as TreeSet;
-context.modelEntities = modelEntities;
+reader = delegator.getModelReader()
+modelEntities = reader.getEntityCache().values() as TreeSet
+context.modelEntities = modelEntities
if (passedEntityNames) {
if (tobrowser) {
- session.setAttribute("xmlrawdump_entitylist", passedEntityNames);
- session.setAttribute("entityDateCond", entityDateCond);
+ session.setAttribute("xmlrawdump_entitylist", passedEntityNames)
+ session.setAttribute("entityDateCond", entityDateCond)
} else {
- efo = new EntityFindOptions(true, EntityFindOptions.TYPE_SCROLL_INSENSITIVE, EntityFindOptions.CONCUR_READ_ONLY, true);
- numberOfEntities = passedEntityNames?.size() ?: 0;
- context.numberOfEntities = numberOfEntities;
- numberWritten = 0;
+ efo = new EntityFindOptions(true, EntityFindOptions.TYPE_SCROLL_INSENSITIVE, EntityFindOptions.CONCUR_READ_ONLY, true)
+ numberOfEntities = passedEntityNames?.size() ?: 0
+ context.numberOfEntities = numberOfEntities
+ numberWritten = 0
// single file
if (filename && numberOfEntities) {
- writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(new FileOutputStream(filename), "UTF-8")));
- writer.println("");
- writer.println("");
+ writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(new FileOutputStream(filename), "UTF-8")))
+ writer.println("")
+ writer.println("")
passedEntityNames.each { curEntityName ->
if (entityFrom) {
- curModelEntity = reader.getModelEntity(curEntityName);
+ curModelEntity = reader.getModelEntity(curEntityName)
if (curModelEntity instanceof ModelViewEntity) {
- return;
+ return
}
}
- beganTransaction = TransactionUtil.begin(3600);
+ beganTransaction = TransactionUtil.begin(3600)
try {
- me = reader.getModelEntity(curEntityName);
+ me = reader.getModelEntity(curEntityName)
if (me.getNoAutoStamp() || me instanceof ModelViewEntity) {
- values = delegator.find(curEntityName, null, null, null, me.getPkFieldNames(), efo);
+ values = delegator.find(curEntityName, null, null, null, me.getPkFieldNames(), efo)
} else {
- values = delegator.find(curEntityName, entityDateCond, null, null, UtilMisc.toList("-createdTxStamp"), efo);
+ values = delegator.find(curEntityName, entityDateCond, null, null, UtilMisc.toList("-createdTxStamp"), efo)
}
- curNumberWritten = 0;
+ curNumberWritten = 0
while (value = values.next()) {
- value.writeXmlText(writer, "");
- numberWritten++;
- curNumberWritten++;
+ value.writeXmlText(writer, "")
+ numberWritten++
+ curNumberWritten++
if (curNumberWritten % 500 == 0 || curNumberWritten == 1) {
- Debug.log("Records written [$curEntityName]: $curNumberWritten Total: $numberWritten");
+ Debug.log("Records written [$curEntityName]: $curNumberWritten Total: $numberWritten")
}
}
- values.close();
- Debug.log("Wrote [$curNumberWritten] from entity : $curEntityName");
- TransactionUtil.commit(beganTransaction);
+ values.close()
+ Debug.log("Wrote [$curNumberWritten] from entity : $curEntityName")
+ TransactionUtil.commit(beganTransaction)
} catch (Exception e) {
- errMsg = "Error reading data for XML export:";
- Debug.logError(e, errMsg, "JSP");
- TransactionUtil.rollback(beganTransaction, errMsg, e);
+ errMsg = "Error reading data for XML export:"
+ Debug.logError(e, errMsg, "JSP")
+ TransactionUtil.rollback(beganTransaction, errMsg, e)
}
}
- writer.println("");
- writer.close();
- Debug.log("Total records written from all entities: $numberWritten");
- context.numberWritten = numberWritten;
+ writer.println("")
+ writer.close()
+ Debug.log("Total records written from all entities: $numberWritten")
+ context.numberWritten = numberWritten
}
// multiple files in a directory
- results = [];
- fileNumber = 1;
- context.results = results;
+ results = []
+ fileNumber = 1
+ context.results = results
if (outpath) {
- outdir = new File(outpath);
+ outdir = new File(outpath)
if (!outdir.exists()) {
- outdir.mkdir();
+ outdir.mkdir()
}
if (outdir.isDirectory() && outdir.canWrite()) {
passedEntityNames.each { curEntityName ->
- numberWritten = 0;
- fileName = preConfiguredSetName ? UtilFormatOut.formatPaddedNumber((long) fileNumber, 3) + "_" : "";
- fileName = fileName + curEntityName;
+ numberWritten = 0
+ fileName = preConfiguredSetName ? UtilFormatOut.formatPaddedNumber((long) fileNumber, 3) + "_" : ""
+ fileName = fileName + curEntityName
- values = null;
- beganTransaction = false;
+ values = null
+ beganTransaction = false
try {
- beganTransaction = TransactionUtil.begin(3600);
+ beganTransaction = TransactionUtil.begin(3600)
- me = delegator.getModelEntity(curEntityName);
+ me = delegator.getModelEntity(curEntityName)
if (me instanceof ModelViewEntity) {
- results.add("[$fileNumber] [vvv] $curEntityName skipping view entity");
- return;
+ results.add("[$fileNumber] [vvv] $curEntityName skipping view entity")
+ return
}
if (me.getNoAutoStamp() || me instanceof ModelViewEntity) {
- values = delegator.find(curEntityName, null, null, null, me.getPkFieldNames(), efo);
+ values = delegator.find(curEntityName, null, null, null, me.getPkFieldNames(), efo)
} else {
- values = delegator.find(curEntityName, entityDateCond, null, null, me.getPkFieldNames(), efo);
+ values = delegator.find(curEntityName, entityDateCond, null, null, me.getPkFieldNames(), efo)
}
- isFirst = true;
- writer = null;
- fileSplitNumber = 1;
+ isFirst = true
+ writer = null
+ fileSplitNumber = 1
while (value = values.next()) {
//Don't bother writing the file if there's nothing
//to put into it
if (isFirst) {
- writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(new FileOutputStream(new File(outdir, fileName +".xml")), "UTF-8")));
- writer.println("");
- writer.println("");
- isFirst = false;
+ writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(new FileOutputStream(new File(outdir, fileName +".xml")), "UTF-8")))
+ writer.println("")
+ writer.println("")
+ isFirst = false
}
- value.writeXmlText(writer, "");
- numberWritten++;
+ value.writeXmlText(writer, "")
+ numberWritten++
// split into small files
if (maxRecordsPerFile > 0 && (numberWritten % maxRecordsPerFile == 0)) {
- fileSplitNumber++;
+ fileSplitNumber++
// close the file
- writer.println("");
- writer.close();
+ writer.println("")
+ writer.close()
// create a new file
- splitNumStr = UtilFormatOut.formatPaddedNumber((long) fileSplitNumber, 3);
- writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(new FileOutputStream(new File(outdir, fileName + "_" + splitNumStr +".xml")), "UTF-8")));
- writer.println("");
- writer.println("");
+ splitNumStr = UtilFormatOut.formatPaddedNumber((long) fileSplitNumber, 3)
+ writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(new FileOutputStream(new File(outdir, fileName + "_" + splitNumStr +".xml")), "UTF-8")))
+ writer.println("")
+ writer.println("")
}
if (numberWritten % 500 == 0 || numberWritten == 1) {
- Debug.log("Records written [$curEntityName]: $numberWritten");
+ Debug.log("Records written [$curEntityName]: $numberWritten")
}
}
if (writer) {
- writer.println("");
- writer.close();
- String thisResult = "[$fileNumber] [$numberWritten] $curEntityName wrote $numberWritten records";
- Debug.log(thisResult);
- results.add(thisResult);
+ writer.println("")
+ writer.close()
+ String thisResult = "[$fileNumber] [$numberWritten] $curEntityName wrote $numberWritten records"
+ Debug.log(thisResult)
+ results.add(thisResult)
} else {
- thisResult = "[$fileNumber] [---] $curEntityName has no records, not writing file";
- Debug.log(thisResult);
- results.add(thisResult);
+ thisResult = "[$fileNumber] [---] $curEntityName has no records, not writing file"
+ Debug.log(thisResult)
+ results.add(thisResult)
}
- values.close();
+ values.close()
} catch (Exception ex) {
if (values != null) {
- values.close();
+ values.close()
}
- thisResult = "[$fileNumber] [xxx] Error when writing $curEntityName: $ex";
- Debug.log(thisResult);
- results.add(thisResult);
- TransactionUtil.rollback(beganTransaction, thisResult, ex);
+ thisResult = "[$fileNumber] [xxx] Error when writing $curEntityName: $ex"
+ Debug.log(thisResult)
+ results.add(thisResult)
+ TransactionUtil.rollback(beganTransaction, thisResult, ex)
} finally {
// only commit the transaction if we started one... this will throw an exception if it fails
- TransactionUtil.commit(beganTransaction);
+ TransactionUtil.commit(beganTransaction)
}
- fileNumber++;
+ fileNumber++
}
}
}
diff --git a/framework/webtools/groovyScripts/geo/GetGeoLocation.groovy b/framework/webtools/groovyScripts/geo/GetGeoLocation.groovy
index 2513cb359b..742fa0b10c 100644
--- a/framework/webtools/groovyScripts/geo/GetGeoLocation.groovy
+++ b/framework/webtools/groovyScripts/geo/GetGeoLocation.groovy
@@ -17,6 +17,6 @@
* under the License.
*/
-context.geoPointId = geoPoint.geoPointId;
-context.latitude = geoPoint.latitude;
-context.longitude = geoPoint.longitude;
\ No newline at end of file
+context.geoPointId = geoPoint.geoPointId
+context.latitude = geoPoint.latitude
+context.longitude = geoPoint.longitude
\ No newline at end of file
diff --git a/framework/webtools/groovyScripts/labelmanager/LabelManager.groovy b/framework/webtools/groovyScripts/labelmanager/LabelManager.groovy
index aa40ba9a7e..75e7534c92 100644
--- a/framework/webtools/groovyScripts/labelmanager/LabelManager.groovy
+++ b/framework/webtools/groovyScripts/labelmanager/LabelManager.groovy
@@ -17,23 +17,23 @@
* under the License.
*/
-import org.apache.ofbiz.entity.Delegator;
-import org.apache.ofbiz.webtools.labelmanager.*;
+import org.apache.ofbiz.entity.Delegator
+import org.apache.ofbiz.webtools.labelmanager.*
-LabelManagerFactory factory = LabelManagerFactory.getInstance();
-context.factory = factory;
+LabelManagerFactory factory = LabelManagerFactory.getInstance()
+context.factory = factory
factory.findMatchingLabels(parameters.labelComponentName, parameters.labelFileName, parameters.labelKey, parameters.labelLocaleName, "Y".equals(parameters.onlyNotUsedLabels))
-context.labels = factory.getLabels();
-context.labelsList = factory.getLabelsList();
-context.localesFound = factory.getLocalesFound();
-context.filesFound = factory.getFilesFound();
-context.componentNamesFound = factory.getComponentNamesFound();
-context.duplicatedLocalesLabels = factory.getDuplicatedLocalesLabels();
-context.duplicatedLocalesLabelsList = factory.getDuplicatedLocalesLabelsList();
-context.keySeparator = factory.keySeparator;
+context.labels = factory.getLabels()
+context.labelsList = factory.getLabelsList()
+context.localesFound = factory.getLocalesFound()
+context.filesFound = factory.getFilesFound()
+context.componentNamesFound = factory.getComponentNamesFound()
+context.duplicatedLocalesLabels = factory.getDuplicatedLocalesLabels()
+context.duplicatedLocalesLabelsList = factory.getDuplicatedLocalesLabelsList()
+context.keySeparator = factory.keySeparator
if ("Y".equals(parameters.onlyNotUsedLabels)) {
- LabelReferences refsObject = new LabelReferences(delegator, factory);
- Map references = refsObject.getLabelReferences();
- context.references = references;
- context.referencesList = references.keySet();
+ LabelReferences refsObject = new LabelReferences(delegator, factory)
+ Map references = refsObject.getLabelReferences()
+ context.references = references
+ context.referencesList = references.keySet()
}
diff --git a/framework/webtools/groovyScripts/labelmanager/UpdateManager.groovy b/framework/webtools/groovyScripts/labelmanager/UpdateManager.groovy
index 92efe07f24..334128a333 100644
--- a/framework/webtools/groovyScripts/labelmanager/UpdateManager.groovy
+++ b/framework/webtools/groovyScripts/labelmanager/UpdateManager.groovy
@@ -17,17 +17,17 @@
* under the License.
*/
-import org.apache.ofbiz.entity.Delegator;
-import org.apache.ofbiz.webtools.labelmanager.*;
+import org.apache.ofbiz.entity.Delegator
+import org.apache.ofbiz.webtools.labelmanager.*
-LabelManagerFactory factory = LabelManagerFactory.getInstance();
+LabelManagerFactory factory = LabelManagerFactory.getInstance()
factory.findMatchingLabels(null, parameters.sourceFileName, parameters.sourceKey, null, false)
-context.labels = factory.getLabels();
-context.localesFound = factory.getLocalesFound();
-context.filesFound = factory.getFilesFound();
-context.componentNamesFound = factory.getComponentNamesFound();
+context.labels = factory.getLabels()
+context.localesFound = factory.getLocalesFound()
+context.filesFound = factory.getFilesFound()
+context.componentNamesFound = factory.getComponentNamesFound()
if (parameters.sourceKey && parameters.sourceFileName) {
- context.label = context.labels.get(parameters.sourceKey + LabelManagerFactory.keySeparator + parameters.sourceFileName);
- context.titleProperty = "WebtoolsLabelManagerUpdate";
+ context.label = context.labels.get(parameters.sourceKey + LabelManagerFactory.keySeparator + parameters.sourceFileName)
+ context.titleProperty = "WebtoolsLabelManagerUpdate"
}
diff --git a/framework/webtools/groovyScripts/labelmanager/ViewFile.groovy b/framework/webtools/groovyScripts/labelmanager/ViewFile.groovy
index 121aab9613..4eb6e0c4d1 100644
--- a/framework/webtools/groovyScripts/labelmanager/ViewFile.groovy
+++ b/framework/webtools/groovyScripts/labelmanager/ViewFile.groovy
@@ -16,25 +16,25 @@
* specific language governing permissions and limitations
* under the License.
*/
-import java.net.URI;
-import org.apache.ofbiz.base.util.*;
-import org.w3c.dom.*;
-import java.io.ByteArrayOutputStream;
-import org.apache.commons.lang.StringEscapeUtils;
+import java.net.URI
+import org.apache.ofbiz.base.util.*
+import org.w3c.dom.*
+import java.io.ByteArrayOutputStream
+import org.apache.commons.lang.StringEscapeUtils
-fileString = "";
+fileString = ""
if (parameters.fileName) {
- file = new File(parameters.fileName);
+ file = new File(parameters.fileName)
if (parameters.fileName.endsWith(".xml")) {
- Document document = UtilXml.readXmlDocument(file.toURL(), false);
- ByteArrayOutputStream os = new ByteArrayOutputStream();
- UtilXml.writeXmlDocument(document, os, "UTF-8", true, true, 4);
- os.close();
- fileString = os.toString();
+ Document document = UtilXml.readXmlDocument(file.toURL(), false)
+ ByteArrayOutputStream os = new ByteArrayOutputStream()
+ UtilXml.writeXmlDocument(document, os, "UTF-8", true, true, 4)
+ os.close()
+ fileString = os.toString()
} else {
- fileString = FileUtil.readString("UTF-8", file);
+ fileString = FileUtil.readString("UTF-8", file)
}
- rows = fileString.split(System.getProperty("line.separator"));
- context.rows = rows.size();
+ rows = fileString.split(System.getProperty("line.separator"))
+ context.rows = rows.size()
}
-context.fileString = fileString;
+context.fileString = fileString
diff --git a/framework/webtools/groovyScripts/labelmanager/ViewReferences.groovy b/framework/webtools/groovyScripts/labelmanager/ViewReferences.groovy
index 606bb94def..341a417b46 100644
--- a/framework/webtools/groovyScripts/labelmanager/ViewReferences.groovy
+++ b/framework/webtools/groovyScripts/labelmanager/ViewReferences.groovy
@@ -17,21 +17,21 @@
* under the License.
*/
-import org.apache.ofbiz.entity.Delegator;
-import org.apache.ofbiz.webtools.labelmanager.*;
+import org.apache.ofbiz.entity.Delegator
+import org.apache.ofbiz.webtools.labelmanager.*
-LabelManagerFactory factory = LabelManagerFactory.getInstance();
-context.factory = factory;
+LabelManagerFactory factory = LabelManagerFactory.getInstance()
+context.factory = factory
factory.findMatchingLabels(parameters.labelComponentName, parameters.labelFileName, parameters.sourceKey, parameters.labelLocaleName, false)
-context.labels = factory.getLabels();
-context.labelsList = factory.getLabelsList();
-context.localesFound = factory.getLocalesFound();
-context.filesFound = factory.getFilesFound();
-context.componentNamesFound = factory.getComponentNamesFound();
-context.duplicatedLocalesLabels = factory.getDuplicatedLocalesLabels();
-context.duplicatedLocalesLabelsList = factory.getDuplicatedLocalesLabelsList();
-context.keySeparator = factory.keySeparator;
-LabelReferences refsObject = new LabelReferences(delegator, factory);
-Map references = refsObject.getLabelReferences();
-context.references = references;
-context.referencesList = references.keySet();
+context.labels = factory.getLabels()
+context.labelsList = factory.getLabelsList()
+context.localesFound = factory.getLocalesFound()
+context.filesFound = factory.getFilesFound()
+context.componentNamesFound = factory.getComponentNamesFound()
+context.duplicatedLocalesLabels = factory.getDuplicatedLocalesLabels()
+context.duplicatedLocalesLabelsList = factory.getDuplicatedLocalesLabelsList()
+context.keySeparator = factory.keySeparator
+LabelReferences refsObject = new LabelReferences(delegator, factory)
+Map references = refsObject.getLabelReferences()
+context.references = references
+context.referencesList = references.keySet()
diff --git a/framework/webtools/groovyScripts/log/FetchLogs.groovy b/framework/webtools/groovyScripts/log/FetchLogs.groovy
index 1e4b78a22f..ae1754b914 100644
--- a/framework/webtools/groovyScripts/log/FetchLogs.groovy
+++ b/framework/webtools/groovyScripts/log/FetchLogs.groovy
@@ -17,53 +17,53 @@
* under the License.
*/
-import org.apache.ofbiz.base.util.FileUtil;
-import org.apache.ofbiz.base.util.UtilProperties;
+import org.apache.ofbiz.base.util.FileUtil
+import org.apache.ofbiz.base.util.UtilProperties
-String ofbizLogDir = UtilProperties.getPropertyValue("debug", "log4j.appender.css.dir", "runtime/logs/");
+String ofbizLogDir = UtilProperties.getPropertyValue("debug", "log4j.appender.css.dir", "runtime/logs/")
if (!ofbizLogDir.startsWith("/")) {
- ofbizLogDir = System.getProperty("ofbiz.home") + "/" + ofbizLogDir;
+ ofbizLogDir = System.getProperty("ofbiz.home") + "/" + ofbizLogDir
}
if (!ofbizLogDir.endsWith("/")) {
- ofbizLogDir = ofbizLogDir.concat("/");
+ ofbizLogDir = ofbizLogDir.concat("/")
}
-File runTimeLogDir = FileUtil.getFile(ofbizLogDir);
-File[] listLogFiles = runTimeLogDir.listFiles();
-String ofbizLogRegExp = UtilProperties.getPropertyValue("debug", "log4j.appender.css.fileNameRegExp", "[(ofbiz)|(error)].*");
-List listLogFileNames = [];
+File runTimeLogDir = FileUtil.getFile(ofbizLogDir)
+File[] listLogFiles = runTimeLogDir.listFiles()
+String ofbizLogRegExp = UtilProperties.getPropertyValue("debug", "log4j.appender.css.fileNameRegExp", "[(ofbiz)|(error)].*")
+List listLogFileNames = []
for (int i = 0; i < listLogFiles.length; i++) {
if (listLogFiles[i].isFile()) {
- logFileName = listLogFiles[i].getName();
+ logFileName = listLogFiles[i].getName()
if (logFileName.matches(ofbizLogRegExp)) {
- listLogFileNames.add(logFileName);
+ listLogFileNames.add(logFileName)
}
}
}
-context.listLogFileNames = listLogFileNames;
+context.listLogFileNames = listLogFileNames
if (parameters.logFileName) {
- List logLines = [];
+ List logLines = []
try {
- File logFile = FileUtil.getFile(ofbizLogDir.concat(parameters.logFileName));
+ File logFile = FileUtil.getFile(ofbizLogDir.concat(parameters.logFileName))
logFile.eachLine { line ->
if (parameters.searchString) {
if (!line.contains(parameters.searchString)) {
- return;
+ return
}
}
- type = '';
+ type = ''
if (line.contains(" |I| ")) {
- type = 'INFO';
+ type = 'INFO'
} else if (line.contains(" |W| ")) {
- type = 'WARN';
+ type = 'WARN'
} else if (line.contains(" |E| ")) {
- type = 'ERROR';
+ type = 'ERROR'
} else if (line.contains(" |D| ")) {
- type = 'DEBUG';
+ type = 'DEBUG'
}
- logLines.add([type: type, line:line]);
+ logLines.add([type: type, line:line])
}
} catch (Exception exc) {}
- context.logLines = logLines;
+ context.logLines = logLines
}
diff --git a/framework/webtools/groovyScripts/log/LogConfiguration.groovy b/framework/webtools/groovyScripts/log/LogConfiguration.groovy
index 7a3d6b8d77..1b7098101c 100644
--- a/framework/webtools/groovyScripts/log/LogConfiguration.groovy
+++ b/framework/webtools/groovyScripts/log/LogConfiguration.groovy
@@ -17,7 +17,7 @@
* under the License.
*/
-import org.apache.ofbiz.base.util.Debug;
+import org.apache.ofbiz.base.util.Debug
context.activeDebugLevel = [fatal : Debug.fatalOn() ? "Y" : "N",
error : Debug.errorOn() ? "Y" : "N",
@@ -25,4 +25,4 @@ context.activeDebugLevel = [fatal : Debug.fatalOn() ? "Y" : "N",
important : Debug.importantOn() ? "Y" : "N",
info : Debug.infoOn() ? "Y" : "N",
timing : Debug.timingOn() ? "Y" : "N",
- verbose : Debug.verboseOn() ? "Y" : "N"];
+ verbose : Debug.verboseOn() ? "Y" : "N"]
diff --git a/framework/webtools/groovyScripts/service/AvailableServices.groovy b/framework/webtools/groovyScripts/service/AvailableServices.groovy
index 4b0f0c1401..69479c7cdb 100644
--- a/framework/webtools/groovyScripts/service/AvailableServices.groovy
+++ b/framework/webtools/groovyScripts/service/AvailableServices.groovy
@@ -17,559 +17,559 @@
* under the License.
*/
-import java.util.*;
-import javax.wsdl.WSDLException;
-import org.apache.ofbiz.base.util.Debug;
-import org.apache.ofbiz.base.util.UtilXml;
-import org.apache.ofbiz.base.util.UtilProperties;
-import org.apache.ofbiz.service.eca.ServiceEcaUtil;
-import org.apache.ofbiz.service.ModelPermGroup;
-import org.apache.ofbiz.service.ModelPermission;
-import org.apache.ofbiz.service.ServiceContainer;
-import org.apache.ofbiz.base.util.UtilHttp;
-import org.apache.ofbiz.base.util.UtilProperties;
-import org.apache.ofbiz.entity.util.EntityUtilProperties;
+import java.util.*
+import javax.wsdl.WSDLException
+import org.apache.ofbiz.base.util.Debug
+import org.apache.ofbiz.base.util.UtilXml
+import org.apache.ofbiz.base.util.UtilProperties
+import org.apache.ofbiz.service.eca.ServiceEcaUtil
+import org.apache.ofbiz.service.ModelPermGroup
+import org.apache.ofbiz.service.ModelPermission
+import org.apache.ofbiz.service.ServiceContainer
+import org.apache.ofbiz.base.util.UtilHttp
+import org.apache.ofbiz.base.util.UtilProperties
+import org.apache.ofbiz.entity.util.EntityUtilProperties
List getEcaListForService(String selectedService) {
- ecaMap = org.apache.ofbiz.service.eca.ServiceEcaUtil.getServiceEventMap(selectedService);
+ ecaMap = org.apache.ofbiz.service.eca.ServiceEcaUtil.getServiceEventMap(selectedService)
- if (!ecaMap) return null;
+ if (!ecaMap) return null
//ecaMap is a HashMap so get keyset & iterate
- ecaMapList = [];
+ ecaMapList = []
ecaMap.each { ecaKey, ecaValue ->
ecaValue.each { curRule ->
- curRuleMap = [:];
+ curRuleMap = [:]
- curRuleMap.ruleKey = ecaKey;
+ curRuleMap.ruleKey = ecaKey
- curRuleClass = curRule.getClass();
+ curRuleClass = curRule.getClass()
//event name for rule
- eventName = curRuleClass.getDeclaredField("eventName");
- eventName.setAccessible(true);
- eventNameVal = eventName.get(curRule);
+ eventName = curRuleClass.getDeclaredField("eventName")
+ eventName.setAccessible(true)
+ eventNameVal = eventName.get(curRule)
if (eventNameVal) {
- curRuleMap.eventName = eventNameVal as String;
+ curRuleMap.eventName = eventNameVal as String
}
- eventName.setAccessible(false);
+ eventName.setAccessible(false)
//runOnError
- runOnError = curRuleClass.getDeclaredField("runOnError");
- runOnError.setAccessible(true);
- runOnErrorVal = runOnError.get(curRule);
+ runOnError = curRuleClass.getDeclaredField("runOnError")
+ runOnError.setAccessible(true)
+ runOnErrorVal = runOnError.get(curRule)
if (runOnErrorVal) {
- curRuleMap.runOnError = runOnErrorVal as String;
+ curRuleMap.runOnError = runOnErrorVal as String
}
- runOnError.setAccessible(false);
+ runOnError.setAccessible(false)
//runOnFailure
- runOnFailure = curRuleClass.getDeclaredField("runOnFailure");
- runOnFailure.setAccessible(true);
- runOnFailureVal = runOnFailure.get(curRule);
+ runOnFailure = curRuleClass.getDeclaredField("runOnFailure")
+ runOnFailure.setAccessible(true)
+ runOnFailureVal = runOnFailure.get(curRule)
if (runOnFailureVal) {
- curRuleMap.runOnFailure = runOnFailureVal as String;
+ curRuleMap.runOnFailure = runOnFailureVal as String
}
- runOnFailure.setAccessible(false);
+ runOnFailure.setAccessible(false)
//extract actions
- actions = curRuleClass.getDeclaredField("actionsAndSets");
- actions.setAccessible(true);
- actionsVal = actions.get(curRule);
+ actions = curRuleClass.getDeclaredField("actionsAndSets")
+ actions.setAccessible(true)
+ actionsVal = actions.get(curRule)
if (actionsVal) {
- actionsList = new ArrayList();
- setsList = new ArrayList();
+ actionsList = new ArrayList()
+ setsList = new ArrayList()
actionsVal.each { curAction ->
- actionClass = curAction.getClass();
+ actionClass = curAction.getClass()
if (org.apache.ofbiz.service.eca.ServiceEcaAction.equals(actionClass)) {
- actionMap = [:];
+ actionMap = [:]
//eventName
- eventName = actionClass.getDeclaredField("eventName");
- eventName.setAccessible(true);
- eventNameVal = eventName.get(curAction);
+ eventName = actionClass.getDeclaredField("eventName")
+ eventName.setAccessible(true)
+ eventNameVal = eventName.get(curAction)
if (eventNameVal) {
- actionMap.eventName = eventNameVal as String;
+ actionMap.eventName = eventNameVal as String
}
- eventName.setAccessible(false);
+ eventName.setAccessible(false)
//ignoreError
- ignoreError = actionClass.getDeclaredField("ignoreError");
- ignoreError.setAccessible(true);
- ignoreErrorVal = ignoreError.get(curAction);
+ ignoreError = actionClass.getDeclaredField("ignoreError")
+ ignoreError.setAccessible(true)
+ ignoreErrorVal = ignoreError.get(curAction)
if (ignoreErrorVal) {
- actionMap.ignoreError = ignoreErrorVal as String;
+ actionMap.ignoreError = ignoreErrorVal as String
}
- ignoreError.setAccessible(false);
+ ignoreError.setAccessible(false)
//ignoreFailure
- ignoreFailure = actionClass.getDeclaredField("ignoreFailure");
- ignoreFailure.setAccessible(true);
- ignoreFailureVal = ignoreFailure.get(curAction);
+ ignoreFailure = actionClass.getDeclaredField("ignoreFailure")
+ ignoreFailure.setAccessible(true)
+ ignoreFailureVal = ignoreFailure.get(curAction)
if (ignoreFailureVal) {
- actionMap.ignoreFailure = ignoreFailureVal as String;
+ actionMap.ignoreFailure = ignoreFailureVal as String
}
- ignoreFailure.setAccessible(false);
+ ignoreFailure.setAccessible(false)
//persist
- persist = actionClass.getDeclaredField("persist");
- persist.setAccessible(true);
- persistVal = persist.get(curAction);
+ persist = actionClass.getDeclaredField("persist")
+ persist.setAccessible(true)
+ persistVal = persist.get(curAction)
if (persistVal) {
- actionMap.persist = persistVal as String;
+ actionMap.persist = persistVal as String
}
- persist.setAccessible(false);
+ persist.setAccessible(false)
//resultMapName
- resultMapName = actionClass.getDeclaredField("resultMapName");
- resultMapName.setAccessible(true);
- resultMapNameVal = resultMapName.get(curAction);
+ resultMapName = actionClass.getDeclaredField("resultMapName")
+ resultMapName.setAccessible(true)
+ resultMapNameVal = resultMapName.get(curAction)
if (resultMapNameVal) {
- actionMap.resultMapName = resultMapNameVal as String;
+ actionMap.resultMapName = resultMapNameVal as String
}
- resultMapName.setAccessible(false);
+ resultMapName.setAccessible(false)
//resultToContext
- resultToContext = actionClass.getDeclaredField("resultToContext");
- resultToContext.setAccessible(true);
- resultToContextVal = resultToContext.get(curAction);
+ resultToContext = actionClass.getDeclaredField("resultToContext")
+ resultToContext.setAccessible(true)
+ resultToContextVal = resultToContext.get(curAction)
if (resultToContextVal) {
- actionMap.resultToContext = resultToContextVal as String;
+ actionMap.resultToContext = resultToContextVal as String
}
- resultToContext.setAccessible(false);
+ resultToContext.setAccessible(false)
//resultToResult
- resultToResult = actionClass.getDeclaredField("resultToResult");
- resultToResult.setAccessible(true);
- resultToResultVal = resultToResult.get(curAction);
+ resultToResult = actionClass.getDeclaredField("resultToResult")
+ resultToResult.setAccessible(true)
+ resultToResultVal = resultToResult.get(curAction)
if (resultToResultVal) {
- actionMap.resultToResult = resultToResultVal as String;
+ actionMap.resultToResult = resultToResultVal as String
}
- resultToResult.setAccessible(false);
+ resultToResult.setAccessible(false)
//serviceMode
- serviceMode = actionClass.getDeclaredField("serviceMode");
- serviceMode.setAccessible(true);
- serviceModeVal = serviceMode.get(curAction);
+ serviceMode = actionClass.getDeclaredField("serviceMode")
+ serviceMode.setAccessible(true)
+ serviceModeVal = serviceMode.get(curAction)
if (serviceModeVal) {
- actionMap.serviceMode = serviceModeVal as String;
+ actionMap.serviceMode = serviceModeVal as String
}
- serviceMode.setAccessible(false);
+ serviceMode.setAccessible(false)
//serviceName
- serviceName = actionClass.getDeclaredField("serviceName");
- serviceName.setAccessible(true);
- serviceNameVal = serviceName.get(curAction);
+ serviceName = actionClass.getDeclaredField("serviceName")
+ serviceName.setAccessible(true)
+ serviceNameVal = serviceName.get(curAction)
if (serviceNameVal) {
- actionMap.serviceName = serviceNameVal as String;
+ actionMap.serviceName = serviceNameVal as String
}
- serviceName.setAccessible(false);
+ serviceName.setAccessible(false)
- actionsList.add(actionMap);
+ actionsList.add(actionMap)
} else { // FIXME : we should also show field-names and values for set operation
- setMap = [:];
+ setMap = [:]
// fieldName
- fieldName = actionClass.getDeclaredField("fieldName");
- fieldName.setAccessible(true);
- fieldNameVal = fieldName.get(curAction);
+ fieldName = actionClass.getDeclaredField("fieldName")
+ fieldName.setAccessible(true)
+ fieldNameVal = fieldName.get(curAction)
if (fieldNameVal) {
- setMap.fieldName = fieldNameVal as String;
+ setMap.fieldName = fieldNameVal as String
}
- fieldName.setAccessible(false);
+ fieldName.setAccessible(false)
// envName
- envName = actionClass.getDeclaredField("envName");
- envName.setAccessible(true);
- envNameVal = envName.get(curAction);
+ envName = actionClass.getDeclaredField("envName")
+ envName.setAccessible(true)
+ envNameVal = envName.get(curAction)
if (envNameVal) {
- setMap.envName = envNameVal as String;
+ setMap.envName = envNameVal as String
}
- envName.setAccessible(false);
+ envName.setAccessible(false)
// value
- value = actionClass.getDeclaredField("value");
- value.setAccessible(true);
- valueVal = value.get(curAction);
+ value = actionClass.getDeclaredField("value")
+ value.setAccessible(true)
+ valueVal = value.get(curAction)
if (valueVal) {
- setMap.value = valueVal as String;
+ setMap.value = valueVal as String
}
- value.setAccessible(false);
+ value.setAccessible(false)
// format
- format = actionClass.getDeclaredField("format");
- format.setAccessible(true);
- formatVal = format.get(curAction);
+ format = actionClass.getDeclaredField("format")
+ format.setAccessible(true)
+ formatVal = format.get(curAction)
if (formatVal) {
- setMap.format = formatVal as String;
+ setMap.format = formatVal as String
}
- format.setAccessible(false);
+ format.setAccessible(false)
- setsList.add(setMap);
+ setsList.add(setMap)
}
}
- curRuleMap.actions = actionsList;
- curRuleMap.sets= setsList;
+ curRuleMap.actions = actionsList
+ curRuleMap.sets= setsList
}
- actions.setAccessible(true);
+ actions.setAccessible(true)
//extract conditions
- conditions = curRuleClass.getDeclaredField("conditions");
- conditions.setAccessible(true);
- conditionsVal = conditions.get(curRule);
+ conditions = curRuleClass.getDeclaredField("conditions")
+ conditions.setAccessible(true)
+ conditionsVal = conditions.get(curRule)
if (conditionsVal) {
- curRuleMap.conditions = runOnFailureVal as String;
- condList = new ArrayList(conditionsVal.size());
+ curRuleMap.conditions = runOnFailureVal as String
+ condList = new ArrayList(conditionsVal.size())
conditionsVal.each { condVal ->
- condValClass = condVal.getClass();
- condMap = [:];
+ condValClass = condVal.getClass()
+ condMap = [:]
//compareType
- compareType = condValClass.getDeclaredField("compareType");
- compareType.setAccessible(true);
- compareTypeVal = compareType.get(condVal);
+ compareType = condValClass.getDeclaredField("compareType")
+ compareType.setAccessible(true)
+ compareTypeVal = compareType.get(condVal)
if (compareTypeVal) {
- condMap.compareType = compareTypeVal as String;
+ condMap.compareType = compareTypeVal as String
}
- compareType.setAccessible(false);
+ compareType.setAccessible(false)
//conditionService
- conditionService = condValClass.getDeclaredField("conditionService");
- conditionService.setAccessible(true);
- conditionServiceVal = conditionService.get(condVal);
+ conditionService = condValClass.getDeclaredField("conditionService")
+ conditionService.setAccessible(true)
+ conditionServiceVal = conditionService.get(condVal)
if (conditionServiceVal) {
- condMap.conditionService = conditionServiceVal as String;
+ condMap.conditionService = conditionServiceVal as String
}
- conditionService.setAccessible(false);
+ conditionService.setAccessible(false)
//format
- format = condValClass.getDeclaredField("format");
- format.setAccessible(true);
- formatVal = format.get(condVal);
+ format = condValClass.getDeclaredField("format")
+ format.setAccessible(true)
+ formatVal = format.get(condVal)
if (formatVal) {
- condMap.format = formatVal as String;
+ condMap.format = formatVal as String
}
- format.setAccessible(false);
+ format.setAccessible(false)
//isConstant
- isConstant = condValClass.getDeclaredField("isConstant");
- isConstant.setAccessible(true);
- isConstantVal = isConstant.get(condVal);
+ isConstant = condValClass.getDeclaredField("isConstant")
+ isConstant.setAccessible(true)
+ isConstantVal = isConstant.get(condVal)
if (isConstantVal) {
- condMap.isConstant = isConstantVal as String;
+ condMap.isConstant = isConstantVal as String
}
- isConstant.setAccessible(false);
+ isConstant.setAccessible(false)
//isService
- isService = condValClass.getDeclaredField("isService");
- isService.setAccessible(true);
- isServiceVal = isService.get(condVal);
+ isService = condValClass.getDeclaredField("isService")
+ isService.setAccessible(true)
+ isServiceVal = isService.get(condVal)
if (isServiceVal) {
- condMap.isService = isServiceVal as String;
+ condMap.isService = isServiceVal as String
}
- isService.setAccessible(false);
+ isService.setAccessible(false)
//lhsMapName
- lhsMapName = condValClass.getDeclaredField("lhsMapName");
- lhsMapName.setAccessible(true);
- lhsMapNameVal = lhsMapName.get(condVal);
+ lhsMapName = condValClass.getDeclaredField("lhsMapName")
+ lhsMapName.setAccessible(true)
+ lhsMapNameVal = lhsMapName.get(condVal)
if (lhsMapNameVal) {
- condMap.lhsMapName = lhsMapNameVal as String;
+ condMap.lhsMapName = lhsMapNameVal as String
}
- lhsMapName.setAccessible(false);
+ lhsMapName.setAccessible(false)
//lhsValueName
- lhsValueName = condValClass.getDeclaredField("lhsValueName");
- lhsValueName.setAccessible(true);
- lhsValueNameVal = lhsValueName.get(condVal);
+ lhsValueName = condValClass.getDeclaredField("lhsValueName")
+ lhsValueName.setAccessible(true)
+ lhsValueNameVal = lhsValueName.get(condVal)
if (lhsValueNameVal) {
- condMap.lhsValueName = lhsValueNameVal as String;
+ condMap.lhsValueName = lhsValueNameVal as String
}
- lhsValueName.setAccessible(false);
+ lhsValueName.setAccessible(false)
//operator
- operator = condValClass.getDeclaredField("operator");
- operator.setAccessible(true);
- operatorVal = operator.get(condVal);
+ operator = condValClass.getDeclaredField("operator")
+ operator.setAccessible(true)
+ operatorVal = operator.get(condVal)
if (operatorVal) {
- condMap.operator = operatorVal as String;
+ condMap.operator = operatorVal as String
}
- operator.setAccessible(false);
+ operator.setAccessible(false)
//rhsMapName
- rhsMapName = condValClass.getDeclaredField("rhsMapName");
- rhsMapName.setAccessible(true);
- rhsMapNameVal = rhsMapName.get(condVal);
+ rhsMapName = condValClass.getDeclaredField("rhsMapName")
+ rhsMapName.setAccessible(true)
+ rhsMapNameVal = rhsMapName.get(condVal)
if (rhsMapNameVal) {
- condMap.rhsMapName = rhsMapNameVal as String;
+ condMap.rhsMapName = rhsMapNameVal as String
}
- rhsMapName.setAccessible(false);
+ rhsMapName.setAccessible(false)
//rhsValueName
- rhsValueName = condValClass.getDeclaredField("rhsValueName");
- rhsValueName.setAccessible(true);
- rhsValueNameVal = rhsValueName.get(condVal);
+ rhsValueName = condValClass.getDeclaredField("rhsValueName")
+ rhsValueName.setAccessible(true)
+ rhsValueNameVal = rhsValueName.get(condVal)
if (rhsValueNameVal) {
- condMap.rhsValueName = rhsValueNameVal as String;
+ condMap.rhsValueName = rhsValueNameVal as String
}
- rhsValueName.setAccessible(false);
+ rhsValueName.setAccessible(false)
- condList.add(condMap);
+ condList.add(condMap)
}
- curRuleMap.conditions = condList;
+ curRuleMap.conditions = condList
}
- conditions.setAccessible(false);
+ conditions.setAccessible(false)
- ecaMapList.add(curRuleMap);
+ ecaMapList.add(curRuleMap)
}
}
- return ecaMapList;
+ return ecaMapList
}
//Local Dispatchers
-dispArrList = new TreeSet();
-dispArrList.addAll(ServiceContainer.getAllDispatcherNames());
-context.dispArrList = dispArrList;
+dispArrList = new TreeSet()
+dispArrList.addAll(ServiceContainer.getAllDispatcherNames())
+context.dispArrList = dispArrList
-uiLabelMap = UtilProperties.getResourceBundleMap("WebtoolsUiLabels", locale);
-uiLabelMap.addBottomResourceBundle("CommonUiLabels");
+uiLabelMap = UtilProperties.getResourceBundleMap("WebtoolsUiLabels", locale)
+uiLabelMap.addBottomResourceBundle("CommonUiLabels")
-curDispatchContext = dispatcher.getDispatchContext();
-context.dispatcherName = dispatcher.getName();
+curDispatchContext = dispatcher.getDispatchContext()
+context.dispatcherName = dispatcher.getName()
-selectedService = parameters.sel_service_name;
+selectedService = parameters.sel_service_name
if (selectedService) {
- curServiceMap = [:];
+ curServiceMap = [:]
- curServiceMap.serviceName = selectedService;
- curServiceModel = curDispatchContext.getModelService(selectedService);
+ curServiceMap.serviceName = selectedService
+ curServiceModel = curDispatchContext.getModelService(selectedService)
if (curServiceModel != null) {
- curServiceMap.description = curServiceModel.description;
- engineName = curServiceModel.engineName ?: "NA";
- defaultEntityName = curServiceModel.defaultEntityName ?: "NA";
- export = curServiceModel.export ? uiLabelMap.CommonTrue : uiLabelMap.CommonFalse;
- exportBool = curServiceModel.export ? "true" : "false";
- permissionGroups = curServiceModel.permissionGroups ?: "NA";
- implServices = curServiceModel.implServices ?: "NA";
- overrideParameters = curServiceModel.overrideParameters;
- useTrans = curServiceModel.useTransaction ? uiLabelMap.CommonTrue : uiLabelMap.CommonFalse;
- maxRetry = curServiceModel.maxRetry;
+ curServiceMap.description = curServiceModel.description
+ engineName = curServiceModel.engineName ?: "NA"
+ defaultEntityName = curServiceModel.defaultEntityName ?: "NA"
+ export = curServiceModel.export ? uiLabelMap.CommonTrue : uiLabelMap.CommonFalse
+ exportBool = curServiceModel.export ? "true" : "false"
+ permissionGroups = curServiceModel.permissionGroups ?: "NA"
+ implServices = curServiceModel.implServices ?: "NA"
+ overrideParameters = curServiceModel.overrideParameters
+ useTrans = curServiceModel.useTransaction ? uiLabelMap.CommonTrue : uiLabelMap.CommonFalse
+ maxRetry = curServiceModel.maxRetry
//Test for ECA's
- ecaMapList = getEcaListForService(selectedService);
+ ecaMapList = getEcaListForService(selectedService)
if (ecaMapList) {
- context.ecaMapList = ecaMapList;
+ context.ecaMapList = ecaMapList
}
//End Test for ECA's
- invoke = curServiceModel.invoke ?: "NA";
- location = curServiceModel.location ?: "NA";
- requireNewTransaction = curServiceModel.requireNewTransaction ? uiLabelMap.CommonTrue : uiLabelMap.CommonFalse;
+ invoke = curServiceModel.invoke ?: "NA"
+ location = curServiceModel.location ?: "NA"
+ requireNewTransaction = curServiceModel.requireNewTransaction ? uiLabelMap.CommonTrue : uiLabelMap.CommonFalse
- curServiceMap.engineName = engineName;
- curServiceMap.defaultEntityName = defaultEntityName;
- curServiceMap.invoke = invoke;
- curServiceMap.location = location;
- curServiceMap.definitionLocation = curServiceModel.definitionLocation.replaceFirst("file:/" + System.getProperty("ofbiz.home") + "/", "");
- curServiceMap.requireNewTransaction = requireNewTransaction;
- curServiceMap.export = export;
- curServiceMap.exportBool = exportBool;
+ curServiceMap.engineName = engineName
+ curServiceMap.defaultEntityName = defaultEntityName
+ curServiceMap.invoke = invoke
+ curServiceMap.location = location
+ curServiceMap.definitionLocation = curServiceModel.definitionLocation.replaceFirst("file:/" + System.getProperty("ofbiz.home") + "/", "")
+ curServiceMap.requireNewTransaction = requireNewTransaction
+ curServiceMap.export = export
+ curServiceMap.exportBool = exportBool
if (permissionGroups && !permissionGroups.equals("NA")) {
- permList = new ArrayList(permissionGroups.size());
+ permList = new ArrayList(permissionGroups.size())
permissionGroups.each { curPerm -> //This is a ModelPermGroup
curPerm.permissions.each { curPermObj ->
- permObj = [:];
- permObj.action = curPermObj.action;
- permType = curPermObj.permissionType;
+ permObj = [:]
+ permObj.action = curPermObj.action
+ permType = curPermObj.permissionType
if (permType == 1) {
- permType = "Simple Permission";
+ permType = "Simple Permission"
} else if (permType == 2) {
- permType = "Entity Permission";
+ permType = "Entity Permission"
} else if (permType == 3) {
- permType = "Role Member";
+ permType = "Role Member"
}
- permObj.permType = permType;
- permObj.nameOrRole = curPermObj.nameOrRole;
- permList.add(permObj);
+ permObj.permType = permType
+ permObj.nameOrRole = curPermObj.nameOrRole
+ permList.add(permObj)
}
}
- curServiceMap.permissionGroups = permList;
+ curServiceMap.permissionGroups = permList
} else {
- curServiceMap.permissionGroups = permissionGroups;
+ curServiceMap.permissionGroups = permissionGroups
}
- curServiceMap.implServices = implServices;
- curServiceMap.useTrans = useTrans;
- curServiceMap.maxRetry = maxRetry;
+ curServiceMap.implServices = implServices
+ curServiceMap.useTrans = useTrans
+ curServiceMap.maxRetry = maxRetry
- allParamsList = new ArrayList(3);
+ allParamsList = new ArrayList(3)
- inParams = curServiceModel.getInParamNames();
- inParamsList = new ArrayList(inParams.size());
+ inParams = curServiceModel.getInParamNames()
+ inParamsList = new ArrayList(inParams.size())
inParams.each { paramName ->
- curParam = curServiceModel.getParam(paramName);
- curInParam = [:];
- curInParam.entityName = curParam.entityName;
- curInParam.fieldName = curParam.fieldName;
- curInParam.internal = curParam.internal ? uiLabelMap.CommonTrue : uiLabelMap.CommonFalse;
- curInParam.mode = curParam.mode;
- curInParam.name = curParam.name;
- curInParam.description = curParam.description;
- curInParam.optional = curParam.optional ? uiLabelMap.CommonTrue : uiLabelMap.CommonFalse;
- curInParam.type = curParam.type;
- inParamsList.add(curInParam);
+ curParam = curServiceModel.getParam(paramName)
+ curInParam = [:]
+ curInParam.entityName = curParam.entityName
+ curInParam.fieldName = curParam.fieldName
+ curInParam.internal = curParam.internal ? uiLabelMap.CommonTrue : uiLabelMap.CommonFalse
+ curInParam.mode = curParam.mode
+ curInParam.name = curParam.name
+ curInParam.description = curParam.description
+ curInParam.optional = curParam.optional ? uiLabelMap.CommonTrue : uiLabelMap.CommonFalse
+ curInParam.type = curParam.type
+ inParamsList.add(curInParam)
}
- inParamMap = [:];
- inParamMap.title = uiLabelMap.WebtoolsInParameters;
- inParamMap.paramList = inParamsList;
- allParamsList.add(inParamMap);
+ inParamMap = [:]
+ inParamMap.title = uiLabelMap.WebtoolsInParameters
+ inParamMap.paramList = inParamsList
+ allParamsList.add(inParamMap)
- outParams = curServiceModel.getOutParamNames();
- outParamsList = new ArrayList(outParams.size());
+ outParams = curServiceModel.getOutParamNames()
+ outParamsList = new ArrayList(outParams.size())
outParams.each { paramName ->
- curParam = curServiceModel.getParam(paramName);
- curOutParam = [:];
- curOutParam.entityName = curParam.entityName;
- curOutParam.fieldName = curParam.fieldName;
- curOutParam.internal = curParam.internal ? uiLabelMap.CommonTrue : uiLabelMap.CommonFalse;
- curOutParam.mode = curParam.mode;
- curOutParam.name = curParam.name;
- curOutParam.description = curParam.description;
- curOutParam.optional = curParam.optional ? uiLabelMap.CommonTrue : uiLabelMap.CommonFalse;
- curOutParam.type = curParam.type;
- outParamsList.add(curOutParam);
+ curParam = curServiceModel.getParam(paramName)
+ curOutParam = [:]
+ curOutParam.entityName = curParam.entityName
+ curOutParam.fieldName = curParam.fieldName
+ curOutParam.internal = curParam.internal ? uiLabelMap.CommonTrue : uiLabelMap.CommonFalse
+ curOutParam.mode = curParam.mode
+ curOutParam.name = curParam.name
+ curOutParam.description = curParam.description
+ curOutParam.optional = curParam.optional ? uiLabelMap.CommonTrue : uiLabelMap.CommonFalse
+ curOutParam.type = curParam.type
+ outParamsList.add(curOutParam)
}
- outParamMap = [:];
- outParamMap.title = uiLabelMap.get("WebtoolsOutParameters");
- outParamMap.paramList = outParamsList;
- allParamsList.add(outParamMap);
+ outParamMap = [:]
+ outParamMap.title = uiLabelMap.get("WebtoolsOutParameters")
+ outParamMap.paramList = outParamsList
+ allParamsList.add(outParamMap)
if (overrideParameters) {
- ovrPrmList = new ArrayList(overrideParameters.size());
+ ovrPrmList = new ArrayList(overrideParameters.size())
overrideParameters.each { curParam ->
- curOvrPrm = [:];
- curOvrPrm.entityName = curParam.entityName;
- curOvrPrm.fieldName = curParam.fieldName;
- curOvrPrm.internal = curParam.internal ? uiLabelMap.CommonTrue : uiLabelMap.CommonFalse;
- curOvrPrm.mode = curParam.mode;
- curOvrPrm.name = curParam.name;
- curOvrPrm.description = curParam.description;
- curOvrPrm.optional = curParam.optional ? uiLabelMap.CommonTrue : uiLabelMap.CommonFalse;
- curOvrPrm.type = curParam.type;
- ovrPrmList.add(curOvrPrm);
+ curOvrPrm = [:]
+ curOvrPrm.entityName = curParam.entityName
+ curOvrPrm.fieldName = curParam.fieldName
+ curOvrPrm.internal = curParam.internal ? uiLabelMap.CommonTrue : uiLabelMap.CommonFalse
+ curOvrPrm.mode = curParam.mode
+ curOvrPrm.name = curParam.name
+ curOvrPrm.description = curParam.description
+ curOvrPrm.optional = curParam.optional ? uiLabelMap.CommonTrue : uiLabelMap.CommonFalse
+ curOvrPrm.type = curParam.type
+ ovrPrmList.add(curOvrPrm)
}
- ovrParamMap = [:];
- ovrParamMap.title = "Override parameters";
- ovrParamMap.paramList = ovrPrmList;
- allParamsList.add(ovrParamMap);
+ ovrParamMap = [:]
+ ovrParamMap.title = "Override parameters"
+ ovrParamMap.paramList = ovrPrmList
+ allParamsList.add(ovrParamMap)
}
- curServiceMap.allParamsList = allParamsList;
+ curServiceMap.allParamsList = allParamsList
}
- showWsdl = parameters.show_wsdl;
+ showWsdl = parameters.show_wsdl
if (showWsdl?.equals("true")) {
try {
- wsdl = curServiceModel.toWSDL("http://${request.getServerName()}:${EntityUtilProperties.getPropertyValue("url", "port.http", "80", delegator)}${parameters._CONTROL_PATH_}/SOAPService");
- curServiceMap.wsdl = UtilXml.writeXmlDocument(wsdl);
+ wsdl = curServiceModel.toWSDL("http://${request.getServerName()}:${EntityUtilProperties.getPropertyValue("url", "port.http", "80", delegator)}${parameters._CONTROL_PATH_}/SOAPService")
+ curServiceMap.wsdl = UtilXml.writeXmlDocument(wsdl)
} catch (WSDLException ex) {
- curServiceMap.wsdl = ex.getLocalizedMessage();
+ curServiceMap.wsdl = ex.getLocalizedMessage()
}
- context.showWsdl = true;
+ context.showWsdl = true
}
- context.selectedServiceMap = curServiceMap;
+ context.selectedServiceMap = curServiceMap
}
if (!selectedService) {
//get constraints if any
- constraint = parameters.constraint;
+ constraint = parameters.constraint
- serviceNames = curDispatchContext.getAllServiceNames();
- serviceNamesAlphaList = new ArrayList(26);
- servicesList = new ArrayList(serviceNames.size());
- servicesFoundCount = 0;
+ serviceNames = curDispatchContext.getAllServiceNames()
+ serviceNamesAlphaList = new ArrayList(26)
+ servicesList = new ArrayList(serviceNames.size())
+ servicesFoundCount = 0
serviceNames.each { serviceName ->
//add first char of service name to list
if (serviceName) {
- serviceCharAt1 = serviceName[0];
+ serviceCharAt1 = serviceName[0]
if (!serviceNamesAlphaList.contains(serviceCharAt1)) {
- serviceNamesAlphaList.add(serviceCharAt1);
+ serviceNamesAlphaList.add(serviceCharAt1)
}
}
//create basic service def
- curServiceMap = [:];
- curServiceMap.serviceName = serviceName;
- curServiceModel = curDispatchContext.getModelService(serviceName);
+ curServiceMap = [:]
+ curServiceMap.serviceName = serviceName
+ curServiceModel = curDispatchContext.getModelService(serviceName)
- canIncludeService = true;
+ canIncludeService = true
if (constraint && curServiceModel != null) {
- consArr = constraint.split("@");
- constraintName = consArr[0];
- constraintVal = consArr[1];
+ consArr = constraint.split("@")
+ constraintName = consArr[0]
+ constraintVal = consArr[1]
if (constraintName.equals("engine_name")) {
- canIncludeService = curServiceModel.engineName.equals(constraintVal);
+ canIncludeService = curServiceModel.engineName.equals(constraintVal)
if (constraintVal.equals("NA")) {
- canIncludeService = curServiceModel.engineName ? false : true;
+ canIncludeService = curServiceModel.engineName ? false : true
}
}
if (canIncludeService && constraintName.equals("default_entity_name")) {
- canIncludeService = curServiceModel.defaultEntityName.equals(constraintVal);
+ canIncludeService = curServiceModel.defaultEntityName.equals(constraintVal)
if (constraintVal.equals("NA")) {
- canIncludeService = curServiceModel.defaultEntityName ? false : true;
+ canIncludeService = curServiceModel.defaultEntityName ? false : true
}
}
if (canIncludeService && constraintName.equals("location")) {
- canIncludeService = curServiceModel.location.equals(constraintVal);
+ canIncludeService = curServiceModel.location.equals(constraintVal)
if (constraintVal.equals("NA")) {
- canIncludeService = curServiceModel.location ? false : true;
+ canIncludeService = curServiceModel.location ? false : true
}
}
if (canIncludeService && constraintName.equals("definitionLocation")) {
- canIncludeService = curServiceModel.definitionLocation.equals(constraintVal);
+ canIncludeService = curServiceModel.definitionLocation.equals(constraintVal)
}
if (canIncludeService && constraintName.equals("alpha")) {
- canIncludeService = (serviceName[0]).equals(constraintVal);
+ canIncludeService = (serviceName[0]).equals(constraintVal)
if (constraintVal.equals("NA")) {
- canIncludeService = true;
+ canIncludeService = true
}
}
}
if (curServiceModel != null && canIncludeService) {
- engineName = curServiceModel.engineName ?: "NA";
- defaultEntityName = curServiceModel.defaultEntityName ?: "NA";
- invoke = curServiceModel.invoke ?: "NA";
- location = curServiceModel.location ?: "NA";
- requireNewTransaction = curServiceModel.requireNewTransaction;
+ engineName = curServiceModel.engineName ?: "NA"
+ defaultEntityName = curServiceModel.defaultEntityName ?: "NA"
+ invoke = curServiceModel.invoke ?: "NA"
+ location = curServiceModel.location ?: "NA"
+ requireNewTransaction = curServiceModel.requireNewTransaction
- curServiceMap.engineName = engineName;
- curServiceMap.defaultEntityName = defaultEntityName;
- curServiceMap.invoke = invoke;
- curServiceMap.location = location;
- curServiceMap.definitionLocation = curServiceModel.definitionLocation.replaceFirst("file:/" + System.getProperty("ofbiz.home") + "/", "");
- curServiceMap.requireNewTransaction = requireNewTransaction;
+ curServiceMap.engineName = engineName
+ curServiceMap.defaultEntityName = defaultEntityName
+ curServiceMap.invoke = invoke
+ curServiceMap.location = location
+ curServiceMap.definitionLocation = curServiceModel.definitionLocation.replaceFirst("file:/" + System.getProperty("ofbiz.home") + "/", "")
+ curServiceMap.requireNewTransaction = requireNewTransaction
- servicesList.add(curServiceMap);
- servicesFoundCount++;
+ servicesList.add(curServiceMap)
+ servicesFoundCount++
}
}
- context.servicesList = servicesList;
- context.serviceNamesAlphaList = serviceNamesAlphaList;
- context.servicesFoundCount = servicesFoundCount;
+ context.servicesList = servicesList
+ context.serviceNamesAlphaList = serviceNamesAlphaList
+ context.servicesFoundCount = servicesFoundCount
}
diff --git a/framework/webtools/groovyScripts/service/JobDetails.groovy b/framework/webtools/groovyScripts/service/JobDetails.groovy
index f01e943202..3eb5e83529 100644
--- a/framework/webtools/groovyScripts/service/JobDetails.groovy
+++ b/framework/webtools/groovyScripts/service/JobDetails.groovy
@@ -17,10 +17,10 @@
* under the License.
*/
-import org.apache.ofbiz.entity.Delegator;
+import org.apache.ofbiz.entity.Delegator
import org.apache.ofbiz.entity.GenericValue
import org.apache.ofbiz.base.util.UtilGenerics
-import org.apache.ofbiz.entity.serialize.XmlSerializer;
+import org.apache.ofbiz.entity.serialize.XmlSerializer
GenericValue job = ((Delegator)delegator).findOne("JobSandbox", [jobId:parameters.jobId], false)
context.job = job
diff --git a/framework/webtools/groovyScripts/service/ScheduleJob.groovy b/framework/webtools/groovyScripts/service/ScheduleJob.groovy
index f3e9ddfd4c..7dad3996ee 100644
--- a/framework/webtools/groovyScripts/service/ScheduleJob.groovy
+++ b/framework/webtools/groovyScripts/service/ScheduleJob.groovy
@@ -17,64 +17,64 @@
* under the License.
*/
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.sql.Timestamp;
+import java.util.ArrayList
+import java.util.HashMap
+import java.util.Iterator
+import java.util.List
+import java.util.Map
+import java.sql.Timestamp
-import org.apache.ofbiz.base.util.Debug;
-import org.apache.ofbiz.base.util.UtilMisc;
-import org.apache.ofbiz.base.util.UtilValidate;
-import org.apache.ofbiz.service.DispatchContext;
-import org.apache.ofbiz.service.ModelService;
-import org.apache.ofbiz.service.ModelParam;
-import org.apache.ofbiz.service.RunningService;
-import org.apache.ofbiz.service.engine.GenericEngine;
-import org.apache.ofbiz.service.config.ServiceConfigUtil;
+import org.apache.ofbiz.base.util.Debug
+import org.apache.ofbiz.base.util.UtilMisc
+import org.apache.ofbiz.base.util.UtilValidate
+import org.apache.ofbiz.service.DispatchContext
+import org.apache.ofbiz.service.ModelService
+import org.apache.ofbiz.service.ModelParam
+import org.apache.ofbiz.service.RunningService
+import org.apache.ofbiz.service.engine.GenericEngine
+import org.apache.ofbiz.service.config.ServiceConfigUtil
-savedSyncResult = null;
+savedSyncResult = null
if (session.getAttribute("_SAVED_SYNC_RESULT_") != null) {
- savedSyncResult = session.getAttribute("_SAVED_SYNC_RESULT_");
+ savedSyncResult = session.getAttribute("_SAVED_SYNC_RESULT_")
}
-serviceName = parameters.SERVICE_NAME;
-context.POOL_NAME = ServiceConfigUtil.getServiceEngine().getThreadPool().getSendToPool();
+serviceName = parameters.SERVICE_NAME
+context.POOL_NAME = ServiceConfigUtil.getServiceEngine().getThreadPool().getSendToPool()
-scheduleOptions = [];
-serviceParameters = [];
-e = request.getParameterNames();
+scheduleOptions = []
+serviceParameters = []
+e = request.getParameterNames()
while (e.hasMoreElements()) {
- paramName = e.nextElement();
- paramValue = parameters[paramName];
- scheduleOptions.add([name : paramName, value : paramValue]);
+ paramName = e.nextElement()
+ paramValue = parameters[paramName]
+ scheduleOptions.add([name : paramName, value : paramValue])
}
-context.scheduleOptions = scheduleOptions;
+context.scheduleOptions = scheduleOptions
if (serviceName) {
- dctx = dispatcher.getDispatchContext();
- model = null;
+ dctx = dispatcher.getDispatchContext()
+ model = null
try {
- model = dctx.getModelService(serviceName);
+ model = dctx.getModelService(serviceName)
} catch (Exception exc) {
- context.errorMessageList = [exc.getMessage()];
+ context.errorMessageList = [exc.getMessage()]
}
if (model != null) {
model.getInParamNames().each { paramName ->
- par = model.getParam(paramName);
+ par = model.getParam(paramName)
if (par.internal) {
- return;
+ return
}
- serviceParam = null;
+ serviceParam = null
if (savedSyncResult?.get(par.name)) {
- serviceParam = [name : par.name, type : par.type, optional : par.optional ? "Y" : "N", defaultValue : par.defaultValue, value : savedSyncResult.get(par.name)];
+ serviceParam = [name : par.name, type : par.type, optional : par.optional ? "Y" : "N", defaultValue : par.defaultValue, value : savedSyncResult.get(par.name)]
} else {
- serviceParam = [name : par.name, type : par.type, optional : par.optional ? "Y" : "N", defaultValue : par.defaultValue];
+ serviceParam = [name : par.name, type : par.type, optional : par.optional ? "Y" : "N", defaultValue : par.defaultValue]
}
- serviceParameters.add(serviceParam);
+ serviceParameters.add(serviceParam)
}
}
}
-context.serviceParameters = serviceParameters;
+context.serviceParameters = serviceParameters
diff --git a/framework/webtools/groovyScripts/service/ServiceResult.groovy b/framework/webtools/groovyScripts/service/ServiceResult.groovy
index 863a1eeb39..e2dd8df947 100644
--- a/framework/webtools/groovyScripts/service/ServiceResult.groovy
+++ b/framework/webtools/groovyScripts/service/ServiceResult.groovy
@@ -17,42 +17,42 @@
* under the License.
*/
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.Map;
-import java.util.Set;
-import java.sql.Timestamp;
+import java.util.HashMap
+import java.util.Iterator
+import java.util.LinkedList
+import java.util.Map
+import java.util.Set
+import java.sql.Timestamp
-import org.apache.ofbiz.entity.GenericEntity;
-import org.apache.ofbiz.base.util.UtilMisc;
-import org.apache.ofbiz.base.util.Debug;
-import org.apache.ofbiz.webapp.event.CoreEvents;
+import org.apache.ofbiz.entity.GenericEntity
+import org.apache.ofbiz.base.util.UtilMisc
+import org.apache.ofbiz.base.util.Debug
+import org.apache.ofbiz.webapp.event.CoreEvents
if (session.getAttribute("_RUN_SYNC_RESULT_")) {
- serviceResultList = [];
- serviceResult = session.getAttribute("_RUN_SYNC_RESULT_");
+ serviceResultList = []
+ serviceResult = session.getAttribute("_RUN_SYNC_RESULT_")
if (parameters.servicePath) {
- servicePath = parameters.servicePath;
- newServiceResult = CoreEvents.getObjectFromServicePath(servicePath, serviceResult);
+ servicePath = parameters.servicePath
+ newServiceResult = CoreEvents.getObjectFromServicePath(servicePath, serviceResult)
if (newServiceResult && newServiceResult instanceof Map) {
- serviceResult = newServiceResult;
+ serviceResult = newServiceResult
}
- context.servicePath = servicePath;
+ context.servicePath = servicePath
}
serviceResult.each { key, value ->
- valueMap = [key : key, value : value.toString()];
+ valueMap = [key : key, value : value.toString()]
if (value instanceof Map || value instanceof Collection) {
- valueMap.hasChild = "Y";
+ valueMap.hasChild = "Y"
} else {
- valueMap.hasChild = "N";
+ valueMap.hasChild = "N"
}
- serviceResultList.add(valueMap);
+ serviceResultList.add(valueMap)
}
- context.serviceResultList = serviceResultList;
+ context.serviceResultList = serviceResultList
}
diff --git a/framework/webtools/groovyScripts/service/Services.groovy b/framework/webtools/groovyScripts/service/Services.groovy
index dc3bc527d5..df4084575b 100644
--- a/framework/webtools/groovyScripts/service/Services.groovy
+++ b/framework/webtools/groovyScripts/service/Services.groovy
@@ -17,37 +17,37 @@
* under the License.
*/
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-import java.sql.Timestamp;
+import java.util.ArrayList
+import java.util.HashMap
+import java.util.Iterator
+import java.util.Map
+import java.sql.Timestamp
-import org.apache.ofbiz.base.util.UtilMisc;
-import org.apache.ofbiz.service.ServiceDispatcher;
-import org.apache.ofbiz.service.RunningService;
-import org.apache.ofbiz.service.engine.GenericEngine;
-import org.apache.ofbiz.base.util.UtilHttp;
-import org.apache.ofbiz.base.util.UtilProperties;
+import org.apache.ofbiz.base.util.UtilMisc
+import org.apache.ofbiz.service.ServiceDispatcher
+import org.apache.ofbiz.service.RunningService
+import org.apache.ofbiz.service.engine.GenericEngine
+import org.apache.ofbiz.base.util.UtilHttp
+import org.apache.ofbiz.base.util.UtilProperties
-uiLabelMap = UtilProperties.getResourceBundleMap("WebtoolsUiLabels", locale);
-uiLabelMap.addBottomResourceBundle("CommonUiLabels");
+uiLabelMap = UtilProperties.getResourceBundleMap("WebtoolsUiLabels", locale)
+uiLabelMap.addBottomResourceBundle("CommonUiLabels")
-log = ServiceDispatcher.getServiceLogMap();
-serviceList = [];
+log = ServiceDispatcher.getServiceLogMap()
+serviceList = []
log.each { rs, value ->
- service = [:];
- service.serviceName = rs.getModelService().name;
- service.localName = rs.getLocalName();
- service.startTime = rs.getStartStamp();
- service.endTime = rs.getEndStamp();
- service.modeStr = rs.getMode() == GenericEngine.SYNC_MODE ? uiLabelMap.WebtoolsSync : uiLabelMap.WebtoolsAsync;
+ service = [:]
+ service.serviceName = rs.getModelService().name
+ service.localName = rs.getLocalName()
+ service.startTime = rs.getStartStamp()
+ service.endTime = rs.getEndStamp()
+ service.modeStr = rs.getMode() == GenericEngine.SYNC_MODE ? uiLabelMap.WebtoolsSync : uiLabelMap.WebtoolsAsync
- serviceList.add(service);
+ serviceList.add(service)
}
-sortField = parameters.sortField;
+sortField = parameters.sortField
if (sortField) {
- context.services = UtilMisc.sortMaps(serviceList, UtilMisc.toList(sortField));
+ context.services = UtilMisc.sortMaps(serviceList, UtilMisc.toList(sortField))
} else {
- context.services = serviceList;
+ context.services = serviceList
}
diff --git a/framework/webtools/groovyScripts/service/Threads.groovy b/framework/webtools/groovyScripts/service/Threads.groovy
index f5a53912dc..b65f40f23c 100644
--- a/framework/webtools/groovyScripts/service/Threads.groovy
+++ b/framework/webtools/groovyScripts/service/Threads.groovy
@@ -17,37 +17,37 @@
* under the License.
*/
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.sql.Timestamp;
+import java.util.ArrayList
+import java.util.HashMap
+import java.util.Iterator
+import java.util.List
+import java.util.Map
+import java.sql.Timestamp
-import org.apache.ofbiz.base.util.UtilMisc;
-import org.apache.ofbiz.service.RunningService;
-import org.apache.ofbiz.service.engine.GenericEngine;
-import org.apache.ofbiz.base.util.UtilHttp;
-import org.apache.ofbiz.base.util.UtilProperties;
+import org.apache.ofbiz.base.util.UtilMisc
+import org.apache.ofbiz.service.RunningService
+import org.apache.ofbiz.service.engine.GenericEngine
+import org.apache.ofbiz.base.util.UtilHttp
+import org.apache.ofbiz.base.util.UtilProperties
-uiLabelMap = UtilProperties.getResourceBundleMap("WebtoolsUiLabels", locale);
-uiLabelMap.addBottomResourceBundle("CommonUiLabels");
+uiLabelMap = UtilProperties.getResourceBundleMap("WebtoolsUiLabels", locale)
+uiLabelMap.addBottomResourceBundle("CommonUiLabels")
-threads = [];
-poolState = dispatcher.getJobManager().getPoolState();
-context.poolState = poolState;
-context.threads = poolState.taskList;
+threads = []
+poolState = dispatcher.getJobManager().getPoolState()
+context.poolState = poolState
+context.threads = poolState.taskList
// Some stuff for general threads on the server
-currentThread = Thread.currentThread();
-currentThreadGroup = currentThread.getThreadGroup();
-topThreadGroup = currentThreadGroup;
+currentThread = Thread.currentThread()
+currentThreadGroup = currentThread.getThreadGroup()
+topThreadGroup = currentThreadGroup
while (topThreadGroup.getParent()) {
- topThreadGroup = topThreadGroup.getParent();
+ topThreadGroup = topThreadGroup.getParent()
}
-Thread[] allThreadArray = new Thread[1000];
-topThreadGroup.enumerate(allThreadArray);
-allThreadList = Arrays.asList(allThreadArray);
+Thread[] allThreadArray = new Thread[1000]
+topThreadGroup.enumerate(allThreadArray)
+allThreadList = Arrays.asList(allThreadArray)
-context.allThreadList = allThreadList;
+context.allThreadList = allThreadList
diff --git a/framework/webtools/groovyScripts/stats/StatBinsHistory.groovy b/framework/webtools/groovyScripts/stats/StatBinsHistory.groovy
index 42fdf8d9aa..bfd60cdb11 100644
--- a/framework/webtools/groovyScripts/stats/StatBinsHistory.groovy
+++ b/framework/webtools/groovyScripts/stats/StatBinsHistory.groovy
@@ -17,43 +17,43 @@
* under the License.
*/
-import org.apache.ofbiz.base.util.*;
-import org.apache.ofbiz.security.Security;
-import org.apache.ofbiz.webapp.stats.*;
+import org.apache.ofbiz.base.util.*
+import org.apache.ofbiz.security.Security
+import org.apache.ofbiz.webapp.stats.*
-id = parameters.statsId;
-typeStr = parameters.type;
-type = -1;
+id = parameters.statsId
+typeStr = parameters.type
+type = -1
try {
- type = Integer.valueOf(typeStr);
+ type = Integer.valueOf(typeStr)
} catch (NumberFormatException e) {}
-binList = null;
+binList = null
if (type == ServerHitBin.REQUEST) {
- binList = ServerHitBin.requestHistory.get(id);
+ binList = ServerHitBin.requestHistory.get(id)
} else if (type == ServerHitBin.EVENT) {
- binList = ServerHitBin.eventHistory.get(id);
+ binList = ServerHitBin.eventHistory.get(id)
} else if (type == ServerHitBin.VIEW) {
- binList = ServerHitBin.viewHistory.get(id);
+ binList = ServerHitBin.viewHistory.get(id)
}
if (binList) {
- requestList = [];
+ requestList = []
binList.each { bin ->
- requestIdMap = [:];
+ requestIdMap = [:]
if (bin != null) {
- requestIdMap.requestId = bin.getId();
- requestIdMap.requestType = bin.getType();
- requestIdMap.startTime = bin.getStartTimeString();
- requestIdMap.endTime = bin.getEndTimeString();
- requestIdMap.lengthMins = UtilFormatOut.formatQuantity(bin.getBinLengthMinutes());
- requestIdMap.numberHits = UtilFormatOut.formatQuantity(bin.getNumberHits());
- requestIdMap.minTime = UtilFormatOut.formatQuantity(bin.getMinTimeSeconds());
- requestIdMap.avgTime = UtilFormatOut.formatQuantity(bin.getAvgTimeSeconds());
- requestIdMap.maxTime = UtilFormatOut.formatQuantity(bin.getMaxTimeSeconds());
- requestIdMap.hitsPerMin = UtilFormatOut.formatQuantity(bin.getHitsPerMinute());
- requestList.add(requestIdMap);
+ requestIdMap.requestId = bin.getId()
+ requestIdMap.requestType = bin.getType()
+ requestIdMap.startTime = bin.getStartTimeString()
+ requestIdMap.endTime = bin.getEndTimeString()
+ requestIdMap.lengthMins = UtilFormatOut.formatQuantity(bin.getBinLengthMinutes())
+ requestIdMap.numberHits = UtilFormatOut.formatQuantity(bin.getNumberHits())
+ requestIdMap.minTime = UtilFormatOut.formatQuantity(bin.getMinTimeSeconds())
+ requestIdMap.avgTime = UtilFormatOut.formatQuantity(bin.getAvgTimeSeconds())
+ requestIdMap.maxTime = UtilFormatOut.formatQuantity(bin.getMaxTimeSeconds())
+ requestIdMap.hitsPerMin = UtilFormatOut.formatQuantity(bin.getHitsPerMinute())
+ requestList.add(requestIdMap)
}
}
- context.requestList = requestList;
+ context.requestList = requestList
}
diff --git a/framework/webtools/groovyScripts/stats/StatsSinceStart.groovy b/framework/webtools/groovyScripts/stats/StatsSinceStart.groovy
index 118729540a..85e004a3b2 100644
--- a/framework/webtools/groovyScripts/stats/StatsSinceStart.groovy
+++ b/framework/webtools/groovyScripts/stats/StatsSinceStart.groovy
@@ -17,85 +17,85 @@
* under the License.
*/
-import org.apache.ofbiz.base.util.UtilFormatOut;
-import org.apache.ofbiz.base.util.UtilMisc;
-import org.apache.ofbiz.base.util.UtilValidate;
-import org.apache.ofbiz.security.Security;
-import org.apache.ofbiz.webapp.stats.*;
+import org.apache.ofbiz.base.util.UtilFormatOut
+import org.apache.ofbiz.base.util.UtilMisc
+import org.apache.ofbiz.base.util.UtilValidate
+import org.apache.ofbiz.security.Security
+import org.apache.ofbiz.webapp.stats.*
-clearBins = parameters.clear;
+clearBins = parameters.clear
if ("true".equals(clearBins)) {
- ServerHitBin.requestSinceStarted.clear();
- ServerHitBin.eventSinceStarted.clear();
- ServerHitBin.viewSinceStarted.clear();
+ ServerHitBin.requestSinceStarted.clear()
+ ServerHitBin.eventSinceStarted.clear()
+ ServerHitBin.viewSinceStarted.clear()
}
// Requests
-iterator = UtilMisc.toIterator(new TreeSet(ServerHitBin.requestSinceStarted.keySet()));
-requestList = [];
+iterator = UtilMisc.toIterator(new TreeSet(ServerHitBin.requestSinceStarted.keySet()))
+requestList = []
while (iterator.hasNext()) {
- requestIdMap = [:];
- statsId = iterator.next();
- bin = ServerHitBin.requestSinceStarted.get(statsId);
+ requestIdMap = [:]
+ statsId = iterator.next()
+ bin = ServerHitBin.requestSinceStarted.get(statsId)
if (bin) {
- requestIdMap.requestId = bin.getId();
- requestIdMap.requestType = bin.getType();
- requestIdMap.startTime = bin.getStartTimeString();
- requestIdMap.endTime = bin.getEndTimeString();
- requestIdMap.lengthMins = UtilFormatOut.formatQuantity(bin.getBinLengthMinutes());
- requestIdMap.numberHits = UtilFormatOut.formatQuantity(bin.getNumberHits());
- requestIdMap.minTime = UtilFormatOut.formatQuantity(bin.getMinTimeSeconds());
- requestIdMap.avgTime = UtilFormatOut.formatQuantity(bin.getAvgTimeSeconds());
- requestIdMap.maxTime = UtilFormatOut.formatQuantity(bin.getMaxTimeSeconds());
- requestIdMap.hitsPerMin = UtilFormatOut.formatQuantity(bin.getHitsPerMinute());
- requestList.add(requestIdMap);
+ requestIdMap.requestId = bin.getId()
+ requestIdMap.requestType = bin.getType()
+ requestIdMap.startTime = bin.getStartTimeString()
+ requestIdMap.endTime = bin.getEndTimeString()
+ requestIdMap.lengthMins = UtilFormatOut.formatQuantity(bin.getBinLengthMinutes())
+ requestIdMap.numberHits = UtilFormatOut.formatQuantity(bin.getNumberHits())
+ requestIdMap.minTime = UtilFormatOut.formatQuantity(bin.getMinTimeSeconds())
+ requestIdMap.avgTime = UtilFormatOut.formatQuantity(bin.getAvgTimeSeconds())
+ requestIdMap.maxTime = UtilFormatOut.formatQuantity(bin.getMaxTimeSeconds())
+ requestIdMap.hitsPerMin = UtilFormatOut.formatQuantity(bin.getHitsPerMinute())
+ requestList.add(requestIdMap)
}
}
-context.requestList = requestList;
+context.requestList = requestList
// Events
-iterator = UtilMisc.toIterator(new TreeSet(ServerHitBin.eventSinceStarted.keySet()));
-eventList = [];
+iterator = UtilMisc.toIterator(new TreeSet(ServerHitBin.eventSinceStarted.keySet()))
+eventList = []
while (iterator.hasNext()) {
- requestIdMap = [:];
- statsId = iterator.next();
- bin = ServerHitBin.eventSinceStarted.get(statsId);
+ requestIdMap = [:]
+ statsId = iterator.next()
+ bin = ServerHitBin.eventSinceStarted.get(statsId)
if (bin) {
- requestIdMap.requestId = bin.getId();
- requestIdMap.requestType = bin.getType();
- requestIdMap.startTime = bin.getStartTimeString();
- requestIdMap.endTime = bin.getEndTimeString();
- requestIdMap.lengthMins = UtilFormatOut.formatQuantity(bin.getBinLengthMinutes());
- requestIdMap.numberHits = UtilFormatOut.formatQuantity(bin.getNumberHits());
- requestIdMap.minTime = UtilFormatOut.formatQuantity(bin.getMinTimeSeconds());
- requestIdMap.avgTime = UtilFormatOut.formatQuantity(bin.getAvgTimeSeconds());
- requestIdMap.maxTime = UtilFormatOut.formatQuantity(bin.getMaxTimeSeconds());
- requestIdMap.hitsPerMin = UtilFormatOut.formatQuantity(bin.getHitsPerMinute());
- eventList.add(requestIdMap);
+ requestIdMap.requestId = bin.getId()
+ requestIdMap.requestType = bin.getType()
+ requestIdMap.startTime = bin.getStartTimeString()
+ requestIdMap.endTime = bin.getEndTimeString()
+ requestIdMap.lengthMins = UtilFormatOut.formatQuantity(bin.getBinLengthMinutes())
+ requestIdMap.numberHits = UtilFormatOut.formatQuantity(bin.getNumberHits())
+ requestIdMap.minTime = UtilFormatOut.formatQuantity(bin.getMinTimeSeconds())
+ requestIdMap.avgTime = UtilFormatOut.formatQuantity(bin.getAvgTimeSeconds())
+ requestIdMap.maxTime = UtilFormatOut.formatQuantity(bin.getMaxTimeSeconds())
+ requestIdMap.hitsPerMin = UtilFormatOut.formatQuantity(bin.getHitsPerMinute())
+ eventList.add(requestIdMap)
}
}
-context.eventList = eventList;
+context.eventList = eventList
// Views
-iterator = UtilMisc.toIterator(new TreeSet(ServerHitBin.viewSinceStarted.keySet()));
-viewList = [];
+iterator = UtilMisc.toIterator(new TreeSet(ServerHitBin.viewSinceStarted.keySet()))
+viewList = []
while (iterator.hasNext()) {
- requestIdMap = [:];
- statsId = iterator.next();
- bin = ServerHitBin.viewSinceStarted.get(statsId);
+ requestIdMap = [:]
+ statsId = iterator.next()
+ bin = ServerHitBin.viewSinceStarted.get(statsId)
if (bin) {
- requestIdMap.requestId = bin.getId();
- requestIdMap.requestType = bin.getType();
- requestIdMap.startTime = bin.getStartTimeString();
- requestIdMap.endTime = bin.getEndTimeString();
- requestIdMap.lengthMins = UtilFormatOut.formatQuantity(bin.getBinLengthMinutes());
- requestIdMap.numberHits = UtilFormatOut.formatQuantity(bin.getNumberHits());
- requestIdMap.minTime = UtilFormatOut.formatQuantity(bin.getMinTimeSeconds());
- requestIdMap.avgTime = UtilFormatOut.formatQuantity(bin.getAvgTimeSeconds());
- requestIdMap.maxTime = UtilFormatOut.formatQuantity(bin.getMaxTimeSeconds());
- requestIdMap.hitsPerMin = UtilFormatOut.formatQuantity(bin.getHitsPerMinute());
- viewList.add(requestIdMap);
+ requestIdMap.requestId = bin.getId()
+ requestIdMap.requestType = bin.getType()
+ requestIdMap.startTime = bin.getStartTimeString()
+ requestIdMap.endTime = bin.getEndTimeString()
+ requestIdMap.lengthMins = UtilFormatOut.formatQuantity(bin.getBinLengthMinutes())
+ requestIdMap.numberHits = UtilFormatOut.formatQuantity(bin.getNumberHits())
+ requestIdMap.minTime = UtilFormatOut.formatQuantity(bin.getMinTimeSeconds())
+ requestIdMap.avgTime = UtilFormatOut.formatQuantity(bin.getAvgTimeSeconds())
+ requestIdMap.maxTime = UtilFormatOut.formatQuantity(bin.getMaxTimeSeconds())
+ requestIdMap.hitsPerMin = UtilFormatOut.formatQuantity(bin.getHitsPerMinute())
+ viewList.add(requestIdMap)
}
}
-context.viewList = viewList;
+context.viewList = viewList
diff --git a/specialpurpose/assetmaint/groovyScripts/assetmaint/EditMaint.groovy b/specialpurpose/assetmaint/groovyScripts/assetmaint/EditMaint.groovy
index bf7dea1fd6..0357494b6a 100644
--- a/specialpurpose/assetmaint/groovyScripts/assetmaint/EditMaint.groovy
+++ b/specialpurpose/assetmaint/groovyScripts/assetmaint/EditMaint.groovy
@@ -21,13 +21,13 @@
// screen is called from one of the WorkEffort calendar screens.
// The URL coming from WorkEffort does not contain the maintHistSeqId parameter,
// so this script will look it up using the workEffortId parameter.
-maintHistSeqId = parameters.maintHistSeqId;
-workEffortId = parameters.workEffortId;
+maintHistSeqId = parameters.maintHistSeqId
+workEffortId = parameters.workEffortId
if (!maintHistSeqId && workEffortId) {
- fixedAssetMaint = from("FixedAssetMaint").where("scheduleWorkEffortId", workEffortId).queryFirst();
+ fixedAssetMaint = from("FixedAssetMaint").where("scheduleWorkEffortId", workEffortId).queryFirst()
if (fixedAssetMaint) {
- parameters.fixedAssetId = fixedAssetMaint.fixedAssetId;
- parameters.maintHistSeqId = fixedAssetMaint.maintHistSeqId;
+ parameters.fixedAssetId = fixedAssetMaint.fixedAssetId
+ parameters.maintHistSeqId = fixedAssetMaint.maintHistSeqId
}
}
diff --git a/specialpurpose/assetmaint/groovyScripts/assetmaint/PrintFixedAssetMaint.groovy b/specialpurpose/assetmaint/groovyScripts/assetmaint/PrintFixedAssetMaint.groovy
index 4904fa0ada..a637857d19 100644
--- a/specialpurpose/assetmaint/groovyScripts/assetmaint/PrintFixedAssetMaint.groovy
+++ b/specialpurpose/assetmaint/groovyScripts/assetmaint/PrintFixedAssetMaint.groovy
@@ -17,52 +17,52 @@ specific language governing permissions and limitations
under the License.
**/
-facility = fixedAsset.getRelatedOne("LocatedAtFacility", false);
-context.locatedAtFacility = facility;
+facility = fixedAsset.getRelatedOne("LocatedAtFacility", false)
+context.locatedAtFacility = facility
-fixedAssetIdents = from("FixedAssetIdent").where("fixedAssetId", fixedAssetId).queryList();
-fixedAssetIdentValue = "";
+fixedAssetIdents = from("FixedAssetIdent").where("fixedAssetId", fixedAssetId).queryList()
+fixedAssetIdentValue = ""
if (fixedAssetIdents) {
fixedAssetIdents.each { ident ->
- fixedAssetIdentValue = fixedAssetIdentValue + " " + ident.idValue;
+ fixedAssetIdentValue = fixedAssetIdentValue + " " + ident.idValue
}
}
-context.fixedAssetIdentValue = fixedAssetIdentValue;
+context.fixedAssetIdentValue = fixedAssetIdentValue
-status = fixedAssetMaint.getRelatedOne("StatusItem", false);
+status = fixedAssetMaint.getRelatedOne("StatusItem", false)
if (status) {
- context.statusItemDesc = status.description;
+ context.statusItemDesc = status.description
}
-//context.put("fixedAssetMaint",fixedAssetMaint);
+//context.put("fixedAssetMaint",fixedAssetMaint)
-intervalUom = fixedAssetMaint.getRelatedOne("IntervalUom", false);
+intervalUom = fixedAssetMaint.getRelatedOne("IntervalUom", false)
if (intervalUom) {
- context.intervalUomDesc = intervalUom.description;
+ context.intervalUomDesc = intervalUom.description
}
-instanceOfProductId = fixedAsset.instanceOfProductId;
-productMaintSeqId = fixedAssetMaint.productMaintSeqId;
+instanceOfProductId = fixedAsset.instanceOfProductId
+productMaintSeqId = fixedAssetMaint.productMaintSeqId
if (productMaintSeqId) {
- productMaint = from("ProductMaint").where("productId", instanceOfProductId, "productMaintSeqId", productMaintSeqId).queryOne();
- context.productMaintName = productMaint.maintName;
+ productMaint = from("ProductMaint").where("productId", instanceOfProductId, "productMaintSeqId", productMaintSeqId).queryOne()
+ context.productMaintName = productMaint.maintName
}
-productMaintTypeId = fixedAssetMaint.productMaintTypeId;
+productMaintTypeId = fixedAssetMaint.productMaintTypeId
if (productMaintTypeId) {
- productMaintType = from("ProductMaintType").where("productMaintTypeId", productMaintTypeId).queryOne();
+ productMaintType = from("ProductMaintType").where("productMaintTypeId", productMaintTypeId).queryOne()
if (productMaintType) {
- productMaintTypeDesc = productMaintType.description;
- context.productMaintTypeDesc = productMaintTypeDesc;
+ productMaintTypeDesc = productMaintType.description
+ context.productMaintTypeDesc = productMaintTypeDesc
}
}
-intervalMeterTypeId = fixedAssetMaint.intervalMeterTypeId;
-productMeterTypeDesc = "";
+intervalMeterTypeId = fixedAssetMaint.intervalMeterTypeId
+productMeterTypeDesc = ""
if (intervalMeterTypeId) {
- productMeterType = from("ProductMeterType").where("productMeterTypeId", intervalMeterTypeId).queryOne();
- productMeterTypeDesc = productMeterType.description;
+ productMeterType = from("ProductMeterType").where("productMeterTypeId", intervalMeterTypeId).queryOne()
+ productMeterTypeDesc = productMeterType.description
}
-context.productMeterTypeDesc = productMeterTypeDesc;
+context.productMeterTypeDesc = productMeterTypeDesc
-scheduleWorkEffort = fixedAssetMaint.getRelatedOne("ScheduleWorkEffort", false);
-context.scheduleWorkEffort = scheduleWorkEffort;
+scheduleWorkEffort = fixedAssetMaint.getRelatedOne("ScheduleWorkEffort", false)
+context.scheduleWorkEffort = scheduleWorkEffort
diff --git a/specialpurpose/assetmaint/groovyScripts/workeffort/EditWorkEfforts.groovy b/specialpurpose/assetmaint/groovyScripts/workeffort/EditWorkEfforts.groovy
index 1e987ecbf5..fa8cbfda39 100644
--- a/specialpurpose/assetmaint/groovyScripts/workeffort/EditWorkEfforts.groovy
+++ b/specialpurpose/assetmaint/groovyScripts/workeffort/EditWorkEfforts.groovy
@@ -17,61 +17,61 @@
under the License.
*/
-maintHistSeqId = context.maintHistSeqId;
-fixedAssetId = context.fixedAssetId;
-workEffortId = context.workEffortId;
+maintHistSeqId = context.maintHistSeqId
+fixedAssetId = context.fixedAssetId
+workEffortId = context.workEffortId
if (!maintHistSeqId) {
- maintHistSeqId = parameters.maintHistSeqId;
+ maintHistSeqId = parameters.maintHistSeqId
}
if (!fixedAssetId) {
- fixedAssetId = parameters.fixedAssetId;
+ fixedAssetId = parameters.fixedAssetId
}
if (!workEffortId) {
- workEffortId = parameters.workEffortId;
+ workEffortId = parameters.workEffortId
}
-fixedAssetMaint = null;
-workEffort = null;
-fixedAsset = null;
-rootWorkEffortId = null;
+fixedAssetMaint = null
+workEffort = null
+fixedAsset = null
+rootWorkEffortId = null
if (workEffortId) {
- workEffort = from("WorkEffort").where("workEffortId", workEffortId).queryOne();
+ workEffort = from("WorkEffort").where("workEffortId", workEffortId).queryOne()
if (workEffort) {
if (!fixedAssetId) {
- fixedAssetId = workEffort.fixedAssetId;
+ fixedAssetId = workEffort.fixedAssetId
}
// If this is a child workeffort, locate the "root" workeffort
- parentWorkEffort = from("WorkEffortAssoc").where("workEffortIdTo", workEffortId).queryFirst();
+ parentWorkEffort = from("WorkEffortAssoc").where("workEffortIdTo", workEffortId).queryFirst()
while (parentWorkEffort) {
- rootWorkEffortId = parentWorkEffort.workEffortIdFrom;
- parentWorkEffort = from("WorkEffortAssoc").where("workEffortIdTo", rootWorkEffortId).queryFirst();
+ rootWorkEffortId = parentWorkEffort.workEffortIdFrom
+ parentWorkEffort = from("WorkEffortAssoc").where("workEffortIdTo", rootWorkEffortId).queryFirst()
}
}
}
if (!rootWorkEffortId) {
- rootWorkEffortId = workEffortId;
+ rootWorkEffortId = workEffortId
}
if (rootWorkEffortId) {
- fixedAssetMaint = from("FixedAssetMaint").where("scheduleWorkEffortId", rootWorkEffortId).queryFirst();
+ fixedAssetMaint = from("FixedAssetMaint").where("scheduleWorkEffortId", rootWorkEffortId).queryFirst()
if (fixedAssetMaint) {
- maintHistSeqId = fixedAssetMaint.maintHistSeqId;
+ maintHistSeqId = fixedAssetMaint.maintHistSeqId
if (!fixedAssetId) {
- fixedAssetId = fixedAssetMaint.fixedAssetId;
+ fixedAssetId = fixedAssetMaint.fixedAssetId
}
}
}
if (fixedAssetId) {
- fixedAsset = from("FixedAsset").where("fixedAssetId", fixedAssetId).queryOne();
+ fixedAsset = from("FixedAsset").where("fixedAssetId", fixedAssetId).queryOne()
}
-context.fixedAssetMaint = fixedAssetMaint;
-context.workEffort = workEffort;
-context.fixedAsset = fixedAsset;
-context.maintHistSeqId = maintHistSeqId;
-context.fixedAssetId = fixedAssetId;
-context.workEffortId = workEffortId;
+context.fixedAssetMaint = fixedAssetMaint
+context.workEffort = workEffort
+context.fixedAsset = fixedAsset
+context.maintHistSeqId = maintHistSeqId
+context.fixedAssetId = fixedAssetId
+context.workEffortId = workEffortId
diff --git a/specialpurpose/bi/groovyScripts/GetStarSchemaFields.groovy b/specialpurpose/bi/groovyScripts/GetStarSchemaFields.groovy
index 75684a00cf..20bcde08b1 100644
--- a/specialpurpose/bi/groovyScripts/GetStarSchemaFields.groovy
+++ b/specialpurpose/bi/groovyScripts/GetStarSchemaFields.groovy
@@ -17,30 +17,30 @@
* under the License.
*/
-starSchemaName = parameters.starSchemaName;
+starSchemaName = parameters.starSchemaName
-starSchemaFields = [];
+starSchemaFields = []
if (starSchemaName) {
- reader = delegator.getModelReader();
- starSchema = reader.getModelEntity(starSchemaName);
+ reader = delegator.getModelReader()
+ starSchema = reader.getModelEntity(starSchemaName)
if (starSchema) {
- fieldsIt = starSchema.getAliasesIterator();
+ fieldsIt = starSchema.getAliasesIterator()
while (fieldsIt.hasNext()) {
- field = fieldsIt.next();
- fieldMap = [:];
- fieldMap.name = field.getName();
- description = field.getDescription();
+ field = fieldsIt.next()
+ fieldMap = [:]
+ fieldMap.name = field.getName()
+ description = field.getDescription()
if (!description) {
- aliasedEntity = starSchema.getAliasedEntity(field.getEntityAlias(), reader);
+ aliasedEntity = starSchema.getAliasedEntity(field.getEntityAlias(), reader)
if (aliasedEntity) {
- aliasedField = starSchema.getAliasedField(aliasedEntity, field.getField(), reader);
- description = aliasedField.getDescription();
+ aliasedField = starSchema.getAliasedField(aliasedEntity, field.getField(), reader)
+ description = aliasedField.getDescription()
}
}
- fieldMap.description = description;
- starSchemaFields.add(fieldMap);
+ fieldMap.description = description
+ starSchemaFields.add(fieldMap)
}
}
}
-context.starSchemaName = starSchemaName;
-context.starSchemaFields = starSchemaFields;
+context.starSchemaName = starSchemaName
+context.starSchemaFields = starSchemaFields
diff --git a/specialpurpose/bi/groovyScripts/GetStarSchemas.groovy b/specialpurpose/bi/groovyScripts/GetStarSchemas.groovy
index 02cb13d2e4..1de6845a68 100644
--- a/specialpurpose/bi/groovyScripts/GetStarSchemas.groovy
+++ b/specialpurpose/bi/groovyScripts/GetStarSchemas.groovy
@@ -17,24 +17,24 @@
* under the License.
*/
-reader = delegator.getModelReader();
-ec = reader.getEntityNames();
-entities = new TreeSet(ec);
-entitiesIt = entities.iterator();
+reader = delegator.getModelReader()
+ec = reader.getEntityNames()
+entities = new TreeSet(ec)
+entitiesIt = entities.iterator()
-List starSchemas = [];
+List starSchemas = []
while (entitiesIt.hasNext()) {
- entity = reader.getModelEntity(entitiesIt.next());
- packageName = entity.getPackageName();
+ entity = reader.getModelEntity(entitiesIt.next())
+ packageName = entity.getPackageName()
if (!packageName.contains("starschema")) {
- continue;
+ continue
}
- entityMap = [:];
- entityMap.name = entity.getEntityName();
- entityMap.title = entity.getTitle();
+ entityMap = [:]
+ entityMap.name = entity.getEntityName()
+ entityMap.title = entity.getTitle()
- starSchemas.add(entityMap);
+ starSchemas.add(entityMap)
}
-context.starSchemas = starSchemas;
+context.starSchemas = starSchemas
diff --git a/specialpurpose/bi/groovyScripts/RunStarSchemaQuery.groovy b/specialpurpose/bi/groovyScripts/RunStarSchemaQuery.groovy
index 5792e747a8..42b3a42b21 100644
--- a/specialpurpose/bi/groovyScripts/RunStarSchemaQuery.groovy
+++ b/specialpurpose/bi/groovyScripts/RunStarSchemaQuery.groovy
@@ -17,17 +17,17 @@
* under the License.
*/
-import org.apache.ofbiz.base.util.UtilHttp;
+import org.apache.ofbiz.base.util.UtilHttp
-starSchemaName = parameters.starSchemaName;
-selectedFieldList = UtilHttp.parseMultiFormData(parameters);
+starSchemaName = parameters.starSchemaName
+selectedFieldList = UtilHttp.parseMultiFormData(parameters)
-columnNames = [] as Set;
+columnNames = [] as Set
selectedFieldList.each { selectedField ->
- columnNames.add(selectedField.selectedFieldName);
+ columnNames.add(selectedField.selectedFieldName)
}
-context.columnNames = columnNames;
-List records = [];
-records = select(context.columnNames).from(starSchemaName).distinct(false).queryList();
+context.columnNames = columnNames
+List records = []
+records = select(context.columnNames).from(starSchemaName).distinct(false).queryList()
-context.records = records;
+context.records = records
diff --git a/specialpurpose/birt/groovyScripts/accounting/AcctgTransEntriesSearchResultsParameters.groovy b/specialpurpose/birt/groovyScripts/accounting/AcctgTransEntriesSearchResultsParameters.groovy
index cf252f9ebe..08e47a024a 100644
--- a/specialpurpose/birt/groovyScripts/accounting/AcctgTransEntriesSearchResultsParameters.groovy
+++ b/specialpurpose/birt/groovyScripts/accounting/AcctgTransEntriesSearchResultsParameters.groovy
@@ -17,32 +17,32 @@
* under the License.
*/
-def module = "AcctgTransEntriesSearchResultsParameters.groovy";
+def module = "AcctgTransEntriesSearchResultsParameters.groovy"
try {
- def birtParameters = [:];
- birtParameters.organizationPartyId = parameters.organizationPartyId;
- birtParameters.productId = parameters.productId;
- birtParameters.isPosted = parameters.isPosted;
- birtParameters.invoiceId = parameters.invoiceId;
- birtParameters.acctgTransId = parameters.acctgTransId;
- birtParameters.glFiscalTypeId = parameters.glFiscalTypeId;
- birtParameters.glAccountId = parameters.glAccountId;
- birtParameters.shipmentId = parameters.shipmentId;
- birtParameters.acctgTransTypeId = parameters.acctgTransTypeId;
- birtParameters.workEffortId = parameters.workEffortId;
- birtParameters.glJournalId = parameters.glJournalId;
- birtParameters.partyId = parameters.partyId;
- birtParameters.paymentId = parameters.paymentId;
+ def birtParameters = [:]
+ birtParameters.organizationPartyId = parameters.organizationPartyId
+ birtParameters.productId = parameters.productId
+ birtParameters.isPosted = parameters.isPosted
+ birtParameters.invoiceId = parameters.invoiceId
+ birtParameters.acctgTransId = parameters.acctgTransId
+ birtParameters.glFiscalTypeId = parameters.glFiscalTypeId
+ birtParameters.glAccountId = parameters.glAccountId
+ birtParameters.shipmentId = parameters.shipmentId
+ birtParameters.acctgTransTypeId = parameters.acctgTransTypeId
+ birtParameters.workEffortId = parameters.workEffortId
+ birtParameters.glJournalId = parameters.glJournalId
+ birtParameters.partyId = parameters.partyId
+ birtParameters.paymentId = parameters.paymentId
if (parameters.fromDate) {
- birtParameters.fromDate = Timestamp.valueOf(parameters.fromDate);
+ birtParameters.fromDate = Timestamp.valueOf(parameters.fromDate)
}
if (parameters.thruDate) {
- birtParameters.thruDate = Timestamp.valueOf(parameters.thruDate);
+ birtParameters.thruDate = Timestamp.valueOf(parameters.thruDate)
}
- birtParameters.userLoginId = userLogin.userLoginId;
- request.setAttribute("birtParameters", birtParameters);
+ birtParameters.userLoginId = userLogin.userLoginId
+ request.setAttribute("birtParameters", birtParameters)
} catch (e) {
- Debug.logError(e, module);
+ Debug.logError(e, module)
}
return "success";
\ No newline at end of file
diff --git a/specialpurpose/birt/groovyScripts/accounting/BalanceSheetParameters.groovy b/specialpurpose/birt/groovyScripts/accounting/BalanceSheetParameters.groovy
index 2498dee38b..6ff0ceb859 100644
--- a/specialpurpose/birt/groovyScripts/accounting/BalanceSheetParameters.groovy
+++ b/specialpurpose/birt/groovyScripts/accounting/BalanceSheetParameters.groovy
@@ -17,25 +17,25 @@
* under the License.
*/
-import java.sql.Timestamp;
-import org.apache.ofbiz.base.util.Debug;
+import java.sql.Timestamp
+import org.apache.ofbiz.base.util.Debug
-def module = "BalanceSheetParameters.groovy";
+def module = "BalanceSheetParameters.groovy"
try {
- def birtParameters = [:];
+ def birtParameters = [:]
if (parameters.fromDate) {
- birtParameters.fromDate = Timestamp.valueOf(parameters.fromDate);
+ birtParameters.fromDate = Timestamp.valueOf(parameters.fromDate)
}
if (parameters.thruDate) {
- birtParameters.thruDate = Timestamp.valueOf(parameters.thruDate);
+ birtParameters.thruDate = Timestamp.valueOf(parameters.thruDate)
}
- birtParameters.glFiscalTypeId = parameters.glFiscalTypeId;
- birtParameters.organizationPartyId = parameters.organizationPartyId;
- birtParameters.userLoginId = userLogin.userLoginId;
- birtParameters.locale = locale;
- request.setAttribute("birtParameters", birtParameters);
+ birtParameters.glFiscalTypeId = parameters.glFiscalTypeId
+ birtParameters.organizationPartyId = parameters.organizationPartyId
+ birtParameters.userLoginId = userLogin.userLoginId
+ birtParameters.locale = locale
+ request.setAttribute("birtParameters", birtParameters)
} catch (e) {
- Debug.logError(e, module);
+ Debug.logError(e, module)
}
return "success";
\ No newline at end of file
diff --git a/specialpurpose/birt/groovyScripts/accounting/IncomeStatementParameters.groovy b/specialpurpose/birt/groovyScripts/accounting/IncomeStatementParameters.groovy
index 0ac6bd4b42..ebf7836abb 100644
--- a/specialpurpose/birt/groovyScripts/accounting/IncomeStatementParameters.groovy
+++ b/specialpurpose/birt/groovyScripts/accounting/IncomeStatementParameters.groovy
@@ -17,24 +17,24 @@
* under the License.
*/
-import java.sql.Timestamp;
-import org.apache.ofbiz.base.util.Debug;
+import java.sql.Timestamp
+import org.apache.ofbiz.base.util.Debug
-def module = "IncomeStatementParameters.groovy";
+def module = "IncomeStatementParameters.groovy"
try {
- def birtParameters = [:];
+ def birtParameters = [:]
if (parameters.fromDate) {
- birtParameters.fromDate = Timestamp.valueOf(parameters.fromDate);
+ birtParameters.fromDate = Timestamp.valueOf(parameters.fromDate)
}
if (parameters.thruDate) {
- birtParameters.thruDate = Timestamp.valueOf(parameters.thruDate);
+ birtParameters.thruDate = Timestamp.valueOf(parameters.thruDate)
}
- birtParameters.glFiscalTypeId = parameters.glFiscalTypeId;
- birtParameters.organizationPartyId = parameters.organizationPartyId;
- birtParameters.userLoginId = userLogin.userLoginId;
- request.setAttribute("birtParameters", birtParameters);
+ birtParameters.glFiscalTypeId = parameters.glFiscalTypeId
+ birtParameters.organizationPartyId = parameters.organizationPartyId
+ birtParameters.userLoginId = userLogin.userLoginId
+ request.setAttribute("birtParameters", birtParameters)
} catch (e) {
- Debug.logError(e, module);
+ Debug.logError(e, module)
}
return "success";
\ No newline at end of file
diff --git a/specialpurpose/birt/groovyScripts/accounting/InvoiceAcctgTransEntryParameters.groovy b/specialpurpose/birt/groovyScripts/accounting/InvoiceAcctgTransEntryParameters.groovy
index f32fc6eadb..efe2074edc 100644
--- a/specialpurpose/birt/groovyScripts/accounting/InvoiceAcctgTransEntryParameters.groovy
+++ b/specialpurpose/birt/groovyScripts/accounting/InvoiceAcctgTransEntryParameters.groovy
@@ -17,14 +17,14 @@
* under the License.
*/
-def module = "InvoiceAcctgTransEntryParameters.groovy";
+def module = "InvoiceAcctgTransEntryParameters.groovy"
try {
- birtParameters = [:];
- birtParameters.invoiceId = parameters.invoiceId;
- birtParameters.userLoginId = userLogin.userLoginId;
- request.setAttribute("birtParameters", birtParameters);
+ birtParameters = [:]
+ birtParameters.invoiceId = parameters.invoiceId
+ birtParameters.userLoginId = userLogin.userLoginId
+ request.setAttribute("birtParameters", birtParameters)
} catch (e) {
- Debug.logError(e, module);
+ Debug.logError(e, module)
}
return "success";
\ No newline at end of file
diff --git a/specialpurpose/birt/groovyScripts/accounting/PaymentAcctgTransEntryParameters.groovy b/specialpurpose/birt/groovyScripts/accounting/PaymentAcctgTransEntryParameters.groovy
index 9b905d91a8..244485aa51 100644
--- a/specialpurpose/birt/groovyScripts/accounting/PaymentAcctgTransEntryParameters.groovy
+++ b/specialpurpose/birt/groovyScripts/accounting/PaymentAcctgTransEntryParameters.groovy
@@ -17,14 +17,14 @@
* under the License.
*/
-def module = "PaymentAcctgTransEntryParameters.groovy";
+def module = "PaymentAcctgTransEntryParameters.groovy"
try {
- birtParameters = [:];
- birtParameters.paymentId = parameters.paymentId;
- birtParameters.userLoginId = userLogin.userLoginId;
- request.setAttribute("birtParameters", birtParameters);
+ birtParameters = [:]
+ birtParameters.paymentId = parameters.paymentId
+ birtParameters.userLoginId = userLogin.userLoginId
+ request.setAttribute("birtParameters", birtParameters)
} catch (e) {
- Debug.logError(e, module);
+ Debug.logError(e, module)
}
return "success";
\ No newline at end of file
diff --git a/specialpurpose/birt/groovyScripts/accounting/PaymentReport.groovy b/specialpurpose/birt/groovyScripts/accounting/PaymentReport.groovy
index 955e5de915..bba5ab7b2a 100644
--- a/specialpurpose/birt/groovyScripts/accounting/PaymentReport.groovy
+++ b/specialpurpose/birt/groovyScripts/accounting/PaymentReport.groovy
@@ -17,23 +17,23 @@
* under the License.
*/
-birtParameters = [:];
-birtParameters.partyIdTo = request.getParameter("partyIdTo");
-birtParameters.paymentId = request.getParameter("paymentId");
-birtParameters.paymentTypeId = request.getParameter("paymentTypeId");
-birtParameters.paymentId_op = request.getParameter("paymentId_op");
-birtParameters.paymentRefNum_ic = request.getParameter("paymentRefNum_ic");
-birtParameters.noConditionFind = request.getParameter("noConditionFind");
-birtParameters.contentType = request.getParameter("contentType");
-birtParameters.partyIdFrom = request.getParameter("partyIdFrom");
-birtParameters.paymentRefNum_op = request.getParameter("paymentRefNum_op");
-birtParameters.amount = request.getParameter("amount");
-birtParameters.statusId = request.getParameter("statusId");
-birtParameters.paymentGatewayResponseId = request.getParameter("paymentGatewayResponseId");
-birtParameters.paymentId_ic = request.getParameter("paymentId_ic");
-birtParameters.paymentRefNum = request.getParameter("paymentRefNum");
-birtParameters.comments_ic = request.getParameter("comments_ic");
-birtParameters.comments_op = request.getParameter("comments_op");
-birtParameters.comments = request.getParameter("comments");
-request.setAttribute("birtParameters", birtParameters);
-return "success";
+birtParameters = [:]
+birtParameters.partyIdTo = request.getParameter("partyIdTo")
+birtParameters.paymentId = request.getParameter("paymentId")
+birtParameters.paymentTypeId = request.getParameter("paymentTypeId")
+birtParameters.paymentId_op = request.getParameter("paymentId_op")
+birtParameters.paymentRefNum_ic = request.getParameter("paymentRefNum_ic")
+birtParameters.noConditionFind = request.getParameter("noConditionFind")
+birtParameters.contentType = request.getParameter("contentType")
+birtParameters.partyIdFrom = request.getParameter("partyIdFrom")
+birtParameters.paymentRefNum_op = request.getParameter("paymentRefNum_op")
+birtParameters.amount = request.getParameter("amount")
+birtParameters.statusId = request.getParameter("statusId")
+birtParameters.paymentGatewayResponseId = request.getParameter("paymentGatewayResponseId")
+birtParameters.paymentId_ic = request.getParameter("paymentId_ic")
+birtParameters.paymentRefNum = request.getParameter("paymentRefNum")
+birtParameters.comments_ic = request.getParameter("comments_ic")
+birtParameters.comments_op = request.getParameter("comments_op")
+birtParameters.comments = request.getParameter("comments")
+request.setAttribute("birtParameters", birtParameters)
+return "success"
diff --git a/specialpurpose/birt/groovyScripts/accounting/TrialBalanceParameters.groovy b/specialpurpose/birt/groovyScripts/accounting/TrialBalanceParameters.groovy
index a3ce99d3a0..0ab94e72a1 100644
--- a/specialpurpose/birt/groovyScripts/accounting/TrialBalanceParameters.groovy
+++ b/specialpurpose/birt/groovyScripts/accounting/TrialBalanceParameters.groovy
@@ -17,15 +17,15 @@
* under the License.
*/
-def module = "TrialBalanceParameters.groovy";
+def module = "TrialBalanceParameters.groovy"
try {
- def birtParameters = [:];
- birtParameters.organizationPartyId = parameters.organizationPartyId;
- birtParameters.customTimePeriodId = parameters.customTimePeriodId;
- birtParameters.userLoginId = userLogin.userLoginId;
- request.setAttribute("birtParameters", birtParameters);
+ def birtParameters = [:]
+ birtParameters.organizationPartyId = parameters.organizationPartyId
+ birtParameters.customTimePeriodId = parameters.customTimePeriodId
+ birtParameters.userLoginId = userLogin.userLoginId
+ request.setAttribute("birtParameters", birtParameters)
} catch (e) {
- Debug.logError(e, module);
+ Debug.logError(e, module)
}
return "success";
\ No newline at end of file
diff --git a/specialpurpose/birt/groovyScripts/facility/InventoryItemReport.groovy b/specialpurpose/birt/groovyScripts/facility/InventoryItemReport.groovy
index 5fba0c7718..cb2152fc31 100644
--- a/specialpurpose/birt/groovyScripts/facility/InventoryItemReport.groovy
+++ b/specialpurpose/birt/groovyScripts/facility/InventoryItemReport.groovy
@@ -17,33 +17,33 @@
* under the License.
*/
- import org.apache.ofbiz.base.util.UtilDateTime;
+ import org.apache.ofbiz.base.util.UtilDateTime
- birtParameters = [:];
+ birtParameters = [:]
/*
- birtParameters.facilityId = request.getParameter("facilityId");
- birtParameters.productId = request.getParameter("productId");
- birtParameters.productTypeId = request.getParameter("productTypeId");
- birtParameters.searchInProductCategoryId = request.getParameter("searchInProductCategoryId");
- birtParameters.contentType = request.getParameter("contentType");
- birtParameters.productSupplierId = request.getParameter("productSupplierId");
- birtParameters.statusId = request.getParameter("statusId");
- birtParameters.productsSoldThruTimestamp = request.getParameter("productsSoldThruTimestamp");
- birtParameters.VIEW_SIZE = request.getParameter("VIEW_SIZE");
- birtParameters.monthsInPastLimit = request.getParameter("monthsInPastLimit");
- birtParameters.fromDateSellThrough = request.getParameter("fromDateSellThrough");
- birtParameters.thruDateSellThrough = request.getParameter("thruDateSellThrough");
+ birtParameters.facilityId = request.getParameter("facilityId")
+ birtParameters.productId = request.getParameter("productId")
+ birtParameters.productTypeId = request.getParameter("productTypeId")
+ birtParameters.searchInProductCategoryId = request.getParameter("searchInProductCategoryId")
+ birtParameters.contentType = request.getParameter("contentType")
+ birtParameters.productSupplierId = request.getParameter("productSupplierId")
+ birtParameters.statusId = request.getParameter("statusId")
+ birtParameters.productsSoldThruTimestamp = request.getParameter("productsSoldThruTimestamp")
+ birtParameters.VIEW_SIZE = request.getParameter("VIEW_SIZE")
+ birtParameters.monthsInPastLimit = request.getParameter("monthsInPastLimit")
+ birtParameters.fromDateSellThrough = request.getParameter("fromDateSellThrough")
+ birtParameters.thruDateSellThrough = request.getParameter("thruDateSellThrough")
*/
- int lastIntMonth = Integer.parseInt(request.getParameter("lastIntMonth"));
+ int lastIntMonth = Integer.parseInt(request.getParameter("lastIntMonth"))
if (lastIntMonth == 0 ){
- fromOrderDate = null;
+ fromOrderDate = null
}else{
- fromDateTime = UtilDateTime.getDayStart(UtilDateTime.toTimestamp(UtilDateTime.nowTimestamp()), (lastIntMonth*(-30)));
+ fromDateTime = UtilDateTime.getDayStart(UtilDateTime.toTimestamp(UtilDateTime.nowTimestamp()), (lastIntMonth*(-30)))
fromOrderDate = UtilDateTime.toDateString(fromDateTime,"MMMM dd, yyyy")
}
- birtParameters.facilityId = request.getParameter("facilityId");
- birtParameters.orderDateDateValue_fld0_op = fromOrderDate.toString();
- request.setAttribute("birtParameters", birtParameters);
- return "success";
+ birtParameters.facilityId = request.getParameter("facilityId")
+ birtParameters.orderDateDateValue_fld0_op = fromOrderDate.toString()
+ request.setAttribute("birtParameters", birtParameters)
+ return "success"
diff --git a/specialpurpose/birt/groovyScripts/order/CheckReportBy.groovy b/specialpurpose/birt/groovyScripts/order/CheckReportBy.groovy
index 5960f03a67..1b1a4b11b0 100644
--- a/specialpurpose/birt/groovyScripts/order/CheckReportBy.groovy
+++ b/specialpurpose/birt/groovyScripts/order/CheckReportBy.groovy
@@ -17,51 +17,51 @@
* under the License.
*/
-import org.apache.ofbiz.base.util.UtilValidate;
+import org.apache.ofbiz.base.util.UtilValidate
-reportBy = parameters.reportBy;
-exportType = parameters.exportType;
+reportBy = parameters.reportBy
+exportType = parameters.exportType
if (UtilValidate.isEmpty(parameters.fromDate)) {
- request.setAttribute("_ERROR_MESSAGE_", "Please select From Date.");
- return "error";
+ request.setAttribute("_ERROR_MESSAGE_", "Please select From Date.")
+ return "error"
}
if (exportType == "pdf") {
if (reportBy == "day") {
- return "dayPDF";
+ return "dayPDF"
} else if (reportBy == "week") {
- return "weekPDF";
+ return "weekPDF"
} else if (reportBy == "month") {
- return "monthPDF";
+ return "monthPDF"
} else {
- request.setAttribute("_ERROR_MESSAGE_", "Please select Report By.");
- return "error";
+ request.setAttribute("_ERROR_MESSAGE_", "Please select Report By.")
+ return "error"
}
}
if (exportType == "excel") {
if (reportBy == "day") {
- return "dayExcel";
+ return "dayExcel"
} else if (reportBy == "week") {
- return "weekExcel";
+ return "weekExcel"
} else if (reportBy == "month") {
- return "monthExcel";
+ return "monthExcel"
} else {
- request.setAttribute("_ERROR_MESSAGE_", "Please select Report By.");
- return "error";
+ request.setAttribute("_ERROR_MESSAGE_", "Please select Report By.")
+ return "error"
}
}
if (exportType == "html") {
if (reportBy == "day") {
- return "dayHTML";
+ return "dayHTML"
} else if (reportBy == "week") {
- return "weekHTML";
+ return "weekHTML"
} else if (reportBy == "month") {
- return "monthHTML";
+ return "monthHTML"
} else {
- request.setAttribute("_ERROR_MESSAGE_", "Please select Report By.");
- return "error";
+ request.setAttribute("_ERROR_MESSAGE_", "Please select Report By.")
+ return "error"
}
}
diff --git a/specialpurpose/birt/groovyScripts/order/NetBeforeOverheadReport.groovy b/specialpurpose/birt/groovyScripts/order/NetBeforeOverheadReport.groovy
index bba72471af..e77c4edd23 100644
--- a/specialpurpose/birt/groovyScripts/order/NetBeforeOverheadReport.groovy
+++ b/specialpurpose/birt/groovyScripts/order/NetBeforeOverheadReport.groovy
@@ -16,41 +16,41 @@
* specific language governing permissions and limitations
* under the License.
*/
-import org.apache.ofbiz.base.util.Debug;
-import org.apache.ofbiz.base.util.UtilDatetime;
-import java.sql.*;
+import org.apache.ofbiz.base.util.Debug
+import org.apache.ofbiz.base.util.UtilDatetime
+import java.sql.*
-productStoreId = parameters.productStoreId;
-DateTime = UtilDateTime.nowTimestamp();
-String DateStr = DateTime;
-DateDay = DateStr.substring(0,10);
-DateMonth = DateStr.substring(5,7);
-DateYear = DateStr.substring(0,4);
+productStoreId = parameters.productStoreId
+DateTime = UtilDateTime.nowTimestamp()
+String DateStr = DateTime
+DateDay = DateStr.substring(0,10)
+DateMonth = DateStr.substring(5,7)
+DateYear = DateStr.substring(0,4)
if (DateMonth == "01"||DateMonth == "03"||DateMonth == "05"||DateMonth == "07"||DateMonth == "08"||DateMonth == "10"||DateMonth == "12")
{
- NunberDate = 31;
+ NunberDate = 31
}
else if (DateMonth == "02")
{
- NunberDate = 29;
+ NunberDate = 29
}
else
{
- NunberDate = 30;
+ NunberDate = 30
}
-birtParameters = [:];
+birtParameters = [:]
try {
- birtParameters.productStoreId = productStoreId;
- birtParameters.DateDay = DateDay;
- birtParameters.DateMonth = DateMonth;
- birtParameters.DateYear = DateYear;
- birtParameters.NunberDate = NunberDate;
+ birtParameters.productStoreId = productStoreId
+ birtParameters.DateDay = DateDay
+ birtParameters.DateMonth = DateMonth
+ birtParameters.DateYear = DateYear
+ birtParameters.NunberDate = NunberDate
} catch (e) {
- Debug.logError(e, "");
+ Debug.logError(e, "")
}
-request.setAttribute("birtParameters", birtParameters);
+request.setAttribute("birtParameters", birtParameters)
-return "success";
+return "success"
diff --git a/specialpurpose/birt/groovyScripts/order/OrderByChannel.groovy b/specialpurpose/birt/groovyScripts/order/OrderByChannel.groovy
index af459d2668..8ab4f17295 100644
--- a/specialpurpose/birt/groovyScripts/order/OrderByChannel.groovy
+++ b/specialpurpose/birt/groovyScripts/order/OrderByChannel.groovy
@@ -17,12 +17,12 @@
* under the License.
*/
-birtParameters = [:];
+birtParameters = [:]
if(request.getParameter("SalesChannel")){
- birtParameters.saleChannel = request.getParameter("SalesChannel");
+ birtParameters.saleChannel = request.getParameter("SalesChannel")
}else{
- birtParameters.saleChannel = "null";
+ birtParameters.saleChannel = "null"
}
-request.setAttribute("birtParameters", birtParameters);
+request.setAttribute("birtParameters", birtParameters)
-return "success";
+return "success"
diff --git a/specialpurpose/birt/groovyScripts/order/ProductDemandReport.groovy b/specialpurpose/birt/groovyScripts/order/ProductDemandReport.groovy
index 7140eb1f36..aa27773328 100644
--- a/specialpurpose/birt/groovyScripts/order/ProductDemandReport.groovy
+++ b/specialpurpose/birt/groovyScripts/order/ProductDemandReport.groovy
@@ -16,26 +16,26 @@
* specific language governing permissions and limitations
* under the License.
*/
-import org.apache.ofbiz.base.util.Debug;
-import org.apache.ofbiz.base.util.UtilDateTime;
-import java.sql.*;
-import com.ibm.icu.util.Calendar;
+import org.apache.ofbiz.base.util.Debug
+import org.apache.ofbiz.base.util.UtilDateTime
+import java.sql.*
+import com.ibm.icu.util.Calendar
-productStoreId = parameters.productStoreId;
-Calendar cal = UtilDateTime.toCalendar(UtilDateTime.nowTimestamp());
-int Week = cal.get(Calendar.WEEK_OF_YEAR);
-int Year = cal.get(Calendar.YEAR);
+productStoreId = parameters.productStoreId
+Calendar cal = UtilDateTime.toCalendar(UtilDateTime.nowTimestamp())
+int Week = cal.get(Calendar.WEEK_OF_YEAR)
+int Year = cal.get(Calendar.YEAR)
-birtParameters = [:];
+birtParameters = [:]
try
{
- birtParameters.productStoreId = productStoreId;
- birtParameters.Week = Week;
- birtParameters.Year = Year;
+ birtParameters.productStoreId = productStoreId
+ birtParameters.Week = Week
+ birtParameters.Year = Year
} catch (e) {
- Debug.logError(e, "");
+ Debug.logError(e, "")
}
-request.setAttribute("birtParameters", birtParameters);
+request.setAttribute("birtParameters", birtParameters)
-return "success";
+return "success"
diff --git a/specialpurpose/birt/groovyScripts/order/SalesReport.groovy b/specialpurpose/birt/groovyScripts/order/SalesReport.groovy
index 3f1ecf3b8c..27bfe3c085 100644
--- a/specialpurpose/birt/groovyScripts/order/SalesReport.groovy
+++ b/specialpurpose/birt/groovyScripts/order/SalesReport.groovy
@@ -16,29 +16,29 @@
* specific language governing permissions and limitations
* under the License.
*/
-import org.apache.ofbiz.base.util.Debug;
-import java.sql.*;
+import org.apache.ofbiz.base.util.Debug
+import java.sql.*
-fromDateStr = parameters.fromDate;
-cal = Calendar.getInstance();
-cal.setTime(Date.valueOf(fromDateStr));
-int week = cal.get(Calendar.WEEK_OF_YEAR);
-int month = cal.get(Calendar.MONTH) + 1;
-int year = cal.get(Calendar.YEAR);
+fromDateStr = parameters.fromDate
+cal = Calendar.getInstance()
+cal.setTime(Date.valueOf(fromDateStr))
+int week = cal.get(Calendar.WEEK_OF_YEAR)
+int month = cal.get(Calendar.MONTH) + 1
+int year = cal.get(Calendar.YEAR)
-birtParameters = [:];
+birtParameters = [:]
try {
- birtParameters.reportBy = parameters.reportBy;
- birtParameters.fromDate = (Date.valueOf(fromDateStr))-2;
- birtParameters.thruDate = Date.valueOf(fromDateStr);
- birtParameters.lastDate = (Date.valueOf(fromDateStr))-7;
- birtParameters.thruWeek = week;
- birtParameters.thruMonth = month;
- birtParameters.thisYear = year;
+ birtParameters.reportBy = parameters.reportBy
+ birtParameters.fromDate = (Date.valueOf(fromDateStr))-2
+ birtParameters.thruDate = Date.valueOf(fromDateStr)
+ birtParameters.lastDate = (Date.valueOf(fromDateStr))-7
+ birtParameters.thruWeek = week
+ birtParameters.thruMonth = month
+ birtParameters.thisYear = year
} catch (e) {
- Debug.logError(e, "");
+ Debug.logError(e, "")
}
-request.setAttribute("birtParameters", birtParameters);
+request.setAttribute("birtParameters", birtParameters)
-return "success";
+return "success"
diff --git a/specialpurpose/ebay/groovyScripts/EbayAdvancedSearch.groovy b/specialpurpose/ebay/groovyScripts/EbayAdvancedSearch.groovy
index d404ed4aa1..6994acd07c 100644
--- a/specialpurpose/ebay/groovyScripts/EbayAdvancedSearch.groovy
+++ b/specialpurpose/ebay/groovyScripts/EbayAdvancedSearch.groovy
@@ -17,54 +17,54 @@
* under the License.
*/
-import org.apache.ofbiz.entity.util.EntityUtil;
-import org.apache.ofbiz.product.catalog.CatalogWorker;
-import org.apache.ofbiz.product.category.CategoryWorker;
-import org.apache.ofbiz.product.store.ProductStoreWorker;
+import org.apache.ofbiz.entity.util.EntityUtil
+import org.apache.ofbiz.product.catalog.CatalogWorker
+import org.apache.ofbiz.product.category.CategoryWorker
+import org.apache.ofbiz.product.store.ProductStoreWorker
-categoryIds = [];
-prodCatalogList = [];
-categoryList = [];
+categoryIds = []
+prodCatalogList = []
+categoryList = []
if (parameters.productStoreId) {
- productStoreId = parameters.productStoreId;
+ productStoreId = parameters.productStoreId
} else {
- productStoreId = ProductStoreWorker.getProductStoreId(request);
+ productStoreId = ProductStoreWorker.getProductStoreId(request)
}
-ebayConfigList = from("EbayConfig").queryList();
+ebayConfigList = from("EbayConfig").queryList()
if (productStoreId) {
- productStoreCatalogs = CatalogWorker.getStoreCatalogs(delegator, productStoreId);
+ productStoreCatalogs = CatalogWorker.getStoreCatalogs(delegator, productStoreId)
if (productStoreCatalogs) {
productStoreCatalogs.each { productStoreCatalog ->
- prodCatalog = from("ProdCatalog").where("prodCatalogId", productStoreCatalog.prodCatalogId).cache(true).queryOne();
- prodCatalogList.add(prodCatalog);
+ prodCatalog = from("ProdCatalog").where("prodCatalogId", productStoreCatalog.prodCatalogId).cache(true).queryOne()
+ prodCatalogList.add(prodCatalog)
}
}
}
-currentCatalogId = null;
+currentCatalogId = null
if (parameters.SEARCH_CATALOG_ID) {
- currentCatalogId = parameters.SEARCH_CATALOG_ID;
+ currentCatalogId = parameters.SEARCH_CATALOG_ID
} else if (prodCatalogList) {
- catalog = EntityUtil.getFirst(prodCatalogList);
- currentCatalogId = catalog.prodCatalogId;
+ catalog = EntityUtil.getFirst(prodCatalogList)
+ currentCatalogId = catalog.prodCatalogId
}
-topCategory = CatalogWorker.getCatalogTopEbayCategoryId(request, currentCatalogId);
+topCategory = CatalogWorker.getCatalogTopEbayCategoryId(request, currentCatalogId)
if (!topCategory) {
- topCategory = CatalogWorker.getCatalogTopCategoryId(request, currentCatalogId);
+ topCategory = CatalogWorker.getCatalogTopCategoryId(request, currentCatalogId)
}
if (topCategory) {
- CategoryWorker.getRelatedCategories(request, "topLevelList", topCategory, true);
+ CategoryWorker.getRelatedCategories(request, "topLevelList", topCategory, true)
if (request.getAttribute("topLevelList")) {
- categoryList = request.getAttribute("topLevelList");
+ categoryList = request.getAttribute("topLevelList")
} else {
- categoryIds.add(topCategory);
+ categoryIds.add(topCategory)
}
}
if (categoryList) {
- categoryIds = EntityUtil.getFieldListFromEntityList(categoryList, "productCategoryId", true);
+ categoryIds = EntityUtil.getFieldListFromEntityList(categoryList, "productCategoryId", true)
}
-context.ebayConfigList = ebayConfigList;
-context.categoryIds = categoryIds;
-context.productStoreId = productStoreId;
-context.prodCatalogList = prodCatalogList;
-context.searchCatalogId = currentCatalogId;
+context.ebayConfigList = ebayConfigList
+context.categoryIds = categoryIds
+context.productStoreId = productStoreId
+context.prodCatalogList = prodCatalogList
+context.searchCatalogId = currentCatalogId
diff --git a/specialpurpose/ebay/groovyScripts/EbayOrders.groovy b/specialpurpose/ebay/groovyScripts/EbayOrders.groovy
index 4738c09504..078635dd5e 100644
--- a/specialpurpose/ebay/groovyScripts/EbayOrders.groovy
+++ b/specialpurpose/ebay/groovyScripts/EbayOrders.groovy
@@ -18,5 +18,5 @@
*/
if (parameters.orderList) {
- session.setAttribute("orderList", parameters.orderList);
+ session.setAttribute("orderList", parameters.orderList)
}
diff --git a/specialpurpose/ebay/groovyScripts/ProductsExportToEbay.groovy b/specialpurpose/ebay/groovyScripts/ProductsExportToEbay.groovy
index 5aa8c93590..8db413ff7d 100644
--- a/specialpurpose/ebay/groovyScripts/ProductsExportToEbay.groovy
+++ b/specialpurpose/ebay/groovyScripts/ProductsExportToEbay.groovy
@@ -16,54 +16,54 @@
* specific language governing permissions and limitations
* under the License.
*/
-import org.apache.ofbiz.entity.util.EntityUtil;
+import org.apache.ofbiz.entity.util.EntityUtil
-webSiteList = [];
-webSite = null;
+webSiteList = []
+webSite = null
if (parameters.productStoreId) {
- productStoreId = parameters.productStoreId;
- webSiteList = from("WebSite").where("productStoreId", productStoreId).queryList();
+ productStoreId = parameters.productStoreId
+ webSiteList = from("WebSite").where("productStoreId", productStoreId).queryList()
if (parameters.webSiteId) {
- webSite = from("WebSite").where("webSiteId", parameters.webSiteId).cache(true).queryOne();
- context.selectedWebSiteId = parameters.webSiteId;
+ webSite = from("WebSite").where("webSiteId", parameters.webSiteId).cache(true).queryOne()
+ context.selectedWebSiteId = parameters.webSiteId
} else if (webSiteList) {
- webSite = EntityUtil.getFirst(webSiteList);
- context.selectedWebSiteId = webSite.webSiteId;
+ webSite = EntityUtil.getFirst(webSiteList)
+ context.selectedWebSiteId = webSite.webSiteId
}
- context.productStoreId = productStoreId;
- context.webSiteList = webSiteList;
- countryCode = null;
+ context.productStoreId = productStoreId
+ context.webSiteList = webSiteList
+ countryCode = null
if (parameters.country) {
- countryCode = parameters.country;
+ countryCode = parameters.country
} else {
- countryCode = "US";
+ countryCode = "US"
}
- context.countryCode = countryCode;
+ context.countryCode = countryCode
if (webSite) {
- eBayConfig = from("EbayConfig").where("productStoreId", productStoreId).queryOne();
- context.customXml = eBayConfig.customXml;
- context.webSiteUrl = webSite.getString("standardContentPrefix");
+ eBayConfig = from("EbayConfig").where("productStoreId", productStoreId).queryOne()
+ context.customXml = eBayConfig.customXml
+ context.webSiteUrl = webSite.getString("standardContentPrefix")
- categoryCode = parameters.categoryCode;
- context.categoryCode = categoryCode;
- userLogin = parameters.userLogin;
+ categoryCode = parameters.categoryCode
+ context.categoryCode = categoryCode
+ userLogin = parameters.userLogin
if (productStoreId) {
- results = runService('getEbayCategories', [categoryCode : categoryCode, userLogin : userLogin, productStoreId : productStoreId]);
+ results = runService('getEbayCategories', [categoryCode : categoryCode, userLogin : userLogin, productStoreId : productStoreId])
}
if (results.categories) {
- context.categories = results.categories;
+ context.categories = results.categories
}
if (categoryCode) {
if (!"Y".equals(categoryCode.substring(0, 1)) && !"".equals(categoryCode)) {
- context.hideExportOptions = "Y";
+ context.hideExportOptions = "Y"
} else {
- context.hideExportOptions = "N";
+ context.hideExportOptions = "N"
}
} else {
- context.hideExportOptions = "N";
+ context.hideExportOptions = "N"
}
}
}
diff --git a/specialpurpose/ebay/groovyScripts/UpdatedEbayOrders.groovy b/specialpurpose/ebay/groovyScripts/UpdatedEbayOrders.groovy
index 26cde50054..15f8138f65 100644
--- a/specialpurpose/ebay/groovyScripts/UpdatedEbayOrders.groovy
+++ b/specialpurpose/ebay/groovyScripts/UpdatedEbayOrders.groovy
@@ -18,6 +18,6 @@
*/
if (session.getAttribute("orderList")) {
- session.removeAttribute("orderList");
- return "success";
+ session.removeAttribute("orderList")
+ return "success"
}
diff --git a/specialpurpose/ebaystore/groovyScripts/automationPreferences/GetDisputeInfo.groovy b/specialpurpose/ebaystore/groovyScripts/automationPreferences/GetDisputeInfo.groovy
index 179bbadc12..a74abc574e 100644
--- a/specialpurpose/ebaystore/groovyScripts/automationPreferences/GetDisputeInfo.groovy
+++ b/specialpurpose/ebaystore/groovyScripts/automationPreferences/GetDisputeInfo.groovy
@@ -17,80 +17,80 @@
* under the License.
*/
-import com.ebay.soap.eBLBaseComponents.DisputeReasonCodeType;
-import com.ebay.soap.eBLBaseComponents.DisputeExplanationCodeType;
+import com.ebay.soap.eBLBaseComponents.DisputeReasonCodeType
+import com.ebay.soap.eBLBaseComponents.DisputeExplanationCodeType
public static String makeSpace(String text){
- String result = "";
+ String result = ""
for (int i=0; i
- contents = from("Content").where("contentId", contentRole.getString("contentId"), "ownerContentId", emailType).queryList();
+ contents = from("Content").where("contentId", contentRole.getString("contentId"), "ownerContentId", emailType).queryList()
if (contents.size() != 0) {
if (emailType.equals(contents.get(0).getString("ownerContentId"))) {
- contentId = contents.get(0).getString("contentId");
+ contentId = contents.get(0).getString("contentId")
}
}
}
}
-context.contentId = contentId;
+context.contentId = contentId
diff --git a/specialpurpose/ebaystore/groovyScripts/feedback/FeedbackList.groovy b/specialpurpose/ebaystore/groovyScripts/feedback/FeedbackList.groovy
index c72cb87262..91b46d8e53 100644
--- a/specialpurpose/ebaystore/groovyScripts/feedback/FeedbackList.groovy
+++ b/specialpurpose/ebaystore/groovyScripts/feedback/FeedbackList.groovy
@@ -17,64 +17,64 @@
* under the License.
*/
-import org.apache.ofbiz.base.util.UtilDateTime;
-import org.apache.ofbiz.entity.condition.EntityCondition;
-import org.apache.ofbiz.entity.condition.EntityOperator;
-import java.sql.Timestamp;
+import org.apache.ofbiz.base.util.UtilDateTime
+import org.apache.ofbiz.entity.condition.EntityCondition
+import org.apache.ofbiz.entity.condition.EntityOperator
+import java.sql.Timestamp
partyId = null
-resultUser = runService('getEbayStoreUser', ["productStoreId": parameters.productStoreId, "userLogin": context.get("userLogin")]);
-ownerUser = resultUser.get("userLoginId");
-userLogin = from("UserLogin").where("userLoginId", ownerUser).queryOne();
+resultUser = runService('getEbayStoreUser', ["productStoreId": parameters.productStoreId, "userLogin": context.get("userLogin")])
+ownerUser = resultUser.get("userLoginId")
+userLogin = from("UserLogin").where("userLoginId", ownerUser).queryOne()
if (userLogin) {
- partyId = userLogin.get("partyId");
+ partyId = userLogin.get("partyId")
}
-expr = [];
-cond = null;
+expr = []
+cond = null
-contentId = request.getParameter("contentId");
-fromDate = request.getParameter("fromDate");
-thruDate = request.getParameter("thruDate");
+contentId = request.getParameter("contentId")
+fromDate = request.getParameter("fromDate")
+thruDate = request.getParameter("thruDate")
if (contentId) {
- expr.add(EntityCondition.makeCondition("contentId",EntityOperator.EQUALS, contentId));
+ expr.add(EntityCondition.makeCondition("contentId",EntityOperator.EQUALS, contentId))
}
if (fromDate && thruDate) {
- exprSub = [];
- condSub = null;
- exprSub.add(EntityCondition.makeCondition("createdDate",EntityOperator.GREATER_THAN, UtilDateTime.getDayStart(Timestamp.valueOf(fromDate + " 00:00:00.000"))));
- exprSub.add(EntityCondition.makeCondition("createdDate",EntityOperator.LESS_THAN, UtilDateTime.getDayEnd(Timestamp.valueOf(thruDate + " 23:59:59.999"))));
- condSub = EntityCondition.makeCondition(exprSub, EntityOperator.AND);
- expr.add(condSub);
+ exprSub = []
+ condSub = null
+ exprSub.add(EntityCondition.makeCondition("createdDate",EntityOperator.GREATER_THAN, UtilDateTime.getDayStart(Timestamp.valueOf(fromDate + " 00:00:00.000"))))
+ exprSub.add(EntityCondition.makeCondition("createdDate",EntityOperator.LESS_THAN, UtilDateTime.getDayEnd(Timestamp.valueOf(thruDate + " 23:59:59.999"))))
+ condSub = EntityCondition.makeCondition(exprSub, EntityOperator.AND)
+ expr.add(condSub)
} else if (fromDate && !thruDate) {
- expr.add(EntityCondition.makeCondition("createdDate",EntityOperator.GREATER_THAN, UtilDateTime.getDayStart(Timestamp.valueOf(fromDate + " 00:00:00.000"))));
+ expr.add(EntityCondition.makeCondition("createdDate",EntityOperator.GREATER_THAN, UtilDateTime.getDayStart(Timestamp.valueOf(fromDate + " 00:00:00.000"))))
} else if (!fromDate && thruDate) {
- expr.add(EntityCondition.makeCondition("createdDate",EntityOperator.LESS_THAN, UtilDateTime.getDayEnd(Timestamp.valueOf(thruDate + " 23:59:59.999"))));
+ expr.add(EntityCondition.makeCondition("createdDate",EntityOperator.LESS_THAN, UtilDateTime.getDayEnd(Timestamp.valueOf(thruDate + " 23:59:59.999"))))
}
-contentRoles = from("ContentRole").where("roleTypeId","OWNER", "partyId", partyId).queryList();
-contentIds = [];
+contentRoles = from("ContentRole").where("roleTypeId","OWNER", "partyId", partyId).queryList()
+contentIds = []
contentRoles.each{ content ->
- contentIds.add(content.getString("contentId"));
+ contentIds.add(content.getString("contentId"))
}
-expr.add(EntityCondition.makeCondition("contentId", EntityOperator.IN, contentIds));
-contents = from("Content").where(expr).queryList();
+expr.add(EntityCondition.makeCondition("contentId", EntityOperator.IN, contentIds))
+contents = from("Content").where(expr).queryList()
-recentFeedbackList = [];
-ownerUser = null;
-commentator = null;
+recentFeedbackList = []
+ownerUser = null
+commentator = null
contents.each{ content ->
- commentatorContents = from("ContentRole").where("contentId",content.contentId, "roleTypeId","COMMENTATOR").queryList();
+ commentatorContents = from("ContentRole").where("contentId",content.contentId, "roleTypeId","COMMENTATOR").queryList()
if(commentatorContents){
- commentatorPartyId = commentatorContents.get(0).get("partyId");
- commentatorUsers = from("UserLogin").where("partyId", commentatorPartyId).queryList();
+ commentatorPartyId = commentatorContents.get(0).get("partyId")
+ commentatorUsers = from("UserLogin").where("partyId", commentatorPartyId).queryList()
if(commentatorUsers){
- commentator = commentatorUsers.get(0).get("userLoginId");
+ commentator = commentatorUsers.get(0).get("userLoginId")
}
}
entry = [contentId : content.contentId,
dataResourceId : content.dataResourceId,
createdDate : content.createdDate,
ownerUser : ownerUser,
- commentator : commentator];
- recentFeedbackList.add(entry);
+ commentator : commentator]
+ recentFeedbackList.add(entry)
}
-context.recentFeedbackList = recentFeedbackList;
+context.recentFeedbackList = recentFeedbackList
diff --git a/specialpurpose/ebaystore/groovyScripts/store/CheckOrderStatus.groovy b/specialpurpose/ebaystore/groovyScripts/store/CheckOrderStatus.groovy
index 619730c112..56eec04391 100644
--- a/specialpurpose/ebaystore/groovyScripts/store/CheckOrderStatus.groovy
+++ b/specialpurpose/ebaystore/groovyScripts/store/CheckOrderStatus.groovy
@@ -16,14 +16,14 @@
* specific language governing permissions and limitations
* under the License.
*/
-import org.apache.ofbiz.entity.util.EntityUtil;
+import org.apache.ofbiz.entity.util.EntityUtil
-context.importStatus = "NOT_IMPORT";
-orderHeaders = from("OrderHeader").where("externalId", externalId).queryList();
+context.importStatus = "NOT_IMPORT"
+orderHeaders = from("OrderHeader").where("externalId", externalId).queryList()
if (orderHeaders.size() > 0) {
- orderHeader = EntityUtil.getFirst(orderHeaders);
- context.orderId = orderHeader.get("orderId");
+ orderHeader = EntityUtil.getFirst(orderHeaders)
+ context.orderId = orderHeader.get("orderId")
if ("ORDER_APPROVED".equals(orderHeader.get("statusId").toString())) {
- context.importStatus = "IMPORTED";
+ context.importStatus = "IMPORTED"
}
}
diff --git a/specialpurpose/ebaystore/groovyScripts/store/OrderListParameters.groovy b/specialpurpose/ebaystore/groovyScripts/store/OrderListParameters.groovy
index c20fe47899..0b936de48d 100644
--- a/specialpurpose/ebaystore/groovyScripts/store/OrderListParameters.groovy
+++ b/specialpurpose/ebaystore/groovyScripts/store/OrderListParameters.groovy
@@ -17,9 +17,9 @@
* under the License.
*/
- session.setAttribute("shippingAddressCtx", shippingAddressCtx);
- session.setAttribute("shippingServiceSelectedCtx", shippingServiceSelectedCtx);
- session.setAttribute("shippingDetailsCtx", shippingDetailsCtx);
- session.setAttribute("checkoutStatusCtx", checkoutStatusCtx);
- session.setAttribute("externalTransactionCtx", externalTransactionCtx);
- session.setAttribute("orderItemList", orderItemList);
+ session.setAttribute("shippingAddressCtx", shippingAddressCtx)
+ session.setAttribute("shippingServiceSelectedCtx", shippingServiceSelectedCtx)
+ session.setAttribute("shippingDetailsCtx", shippingDetailsCtx)
+ session.setAttribute("checkoutStatusCtx", checkoutStatusCtx)
+ session.setAttribute("externalTransactionCtx", externalTransactionCtx)
+ session.setAttribute("orderItemList", orderItemList)
diff --git a/specialpurpose/ebaystore/groovyScripts/store/OrderListPrepare.groovy b/specialpurpose/ebaystore/groovyScripts/store/OrderListPrepare.groovy
index 6b28bbbb0f..bf2aaee026 100644
--- a/specialpurpose/ebaystore/groovyScripts/store/OrderListPrepare.groovy
+++ b/specialpurpose/ebaystore/groovyScripts/store/OrderListPrepare.groovy
@@ -17,59 +17,59 @@
* under the License.
*/
-import org.apache.ofbiz.entity.util.EntityUtil;
+import org.apache.ofbiz.entity.util.EntityUtil
-orderLists = [];
+orderLists = []
if (orderList) {
for (orderCount = 0; orderCount < orderList.size(); orderCount++) {
- orderItem = orderList[orderCount];
- orderId = null;
- orderHeaders = from("OrderHeader").where("externalId", orderItem.("externalId")).queryList();
+ orderItem = orderList[orderCount]
+ orderId = null
+ orderHeaders = from("OrderHeader").where("externalId", orderItem.("externalId")).queryList()
if (orderHeaders.size() > 0) {
- orderHeader = EntityUtil.getFirst(orderHeaders);
- orderId = orderHeader.get("orderId").toString();
+ orderHeader = EntityUtil.getFirst(orderHeaders)
+ orderId = orderHeader.get("orderId").toString()
}
- checkoutStatus = orderItem.get("checkoutStatusCtx");
- paymentMethodUsed = null;
+ checkoutStatus = orderItem.get("checkoutStatusCtx")
+ paymentMethodUsed = null
if (checkoutStatus) {
- paymentMethodUsed = checkoutStatus.get("paymentMethodUsed");
+ paymentMethodUsed = checkoutStatus.get("paymentMethodUsed")
}
- //orderLists.add(orderMap);
- items = orderItem.get("orderItemList");
+ //orderLists.add(orderMap)
+ items = orderItem.get("orderItemList")
for (itemCount = 0; itemCount < items.size(); itemCount++) {
- item = items[itemCount];
- title = null;
+ item = items[itemCount]
+ title = null
if (!(item.get("title"))) {
- product = from("Product").where("productId", item.get("productId")).cache(true).queryOne();
- title = product.get("internalName");
+ product = from("Product").where("productId", item.get("productId")).cache(true).queryOne()
+ title = product.get("internalName")
}
- orderMap = [:];
- orderMap.put("orderId", orderId);
- orderMap.put("externalId", orderItem.get("externalId"));
- orderMap.put("amountPaid", orderItem.get("amountPaid"));
- orderMap.put("createdDate", orderItem.get("createdDate"));
- orderMap.put("ebayUserIdBuyer", orderItem.get("ebayUserIdBuyer"));
- orderMap.put("paymentMethodUsed", paymentMethodUsed);
- orderMap.put("itemId", item.get("itemId"));
- orderMap.put("quantity", item.get("quantity"));
- orderMap.put("productId", item.get("productId"));
- orderMap.put("transactionPrice", item.get("transactionPrice"));
- orderMap.put("title", title);
- orderMap.put("closedDate", item.get("closedDate"));
+ orderMap = [:]
+ orderMap.put("orderId", orderId)
+ orderMap.put("externalId", orderItem.get("externalId"))
+ orderMap.put("amountPaid", orderItem.get("amountPaid"))
+ orderMap.put("createdDate", orderItem.get("createdDate"))
+ orderMap.put("ebayUserIdBuyer", orderItem.get("ebayUserIdBuyer"))
+ orderMap.put("paymentMethodUsed", paymentMethodUsed)
+ orderMap.put("itemId", item.get("itemId"))
+ orderMap.put("quantity", item.get("quantity"))
+ orderMap.put("productId", item.get("productId"))
+ orderMap.put("transactionPrice", item.get("transactionPrice"))
+ orderMap.put("title", title)
+ orderMap.put("closedDate", item.get("closedDate"))
- orderMap.put("shippingAddressCtx", orderItem.get("shippingAddressCtx"));
- orderMap.put("shippingServiceSelectedCtx", orderItem.get("shippingServiceSelectedCtx"));
- orderMap.put("shippingDetailsCtx", orderItem.get("shippingDetailsCtx"));
- orderMap.put("checkoutStatusCtx", orderItem.get("checkoutStatusCtx"));
- orderMap.put("externalTransactionCtx", orderItem.get("externalTransactionCtx"));
- orderMap.put("orderItemList", orderItem.get("orderItemList"));
- orderMap.put("paidTime", orderItem.get("paidTime"));
- orderMap.put("shippedTime", orderItem.get("shippedTime"));
- orderMap.put("paidTime", orderItem.get("paidTime"));
- orderMap.put("emailBuyer", orderItem.get("emailBuyer"));
+ orderMap.put("shippingAddressCtx", orderItem.get("shippingAddressCtx"))
+ orderMap.put("shippingServiceSelectedCtx", orderItem.get("shippingServiceSelectedCtx"))
+ orderMap.put("shippingDetailsCtx", orderItem.get("shippingDetailsCtx"))
+ orderMap.put("checkoutStatusCtx", orderItem.get("checkoutStatusCtx"))
+ orderMap.put("externalTransactionCtx", orderItem.get("externalTransactionCtx"))
+ orderMap.put("orderItemList", orderItem.get("orderItemList"))
+ orderMap.put("paidTime", orderItem.get("paidTime"))
+ orderMap.put("shippedTime", orderItem.get("shippedTime"))
+ orderMap.put("paidTime", orderItem.get("paidTime"))
+ orderMap.put("emailBuyer", orderItem.get("emailBuyer"))
- orderLists.add(orderMap);
+ orderLists.add(orderMap)
}
}
}
-context.orderLists = orderLists;
+context.orderLists = orderLists
diff --git a/specialpurpose/ebaystore/groovyScripts/store/PrepareProductListing.groovy b/specialpurpose/ebaystore/groovyScripts/store/PrepareProductListing.groovy
index 17562e11aa..c043733c68 100644
--- a/specialpurpose/ebaystore/groovyScripts/store/PrepareProductListing.groovy
+++ b/specialpurpose/ebaystore/groovyScripts/store/PrepareProductListing.groovy
@@ -17,166 +17,166 @@
* under the License.
*/
- import org.apache.ofbiz.product.product.ProductContentWrapper;
- import org.apache.ofbiz.product.catalog.CatalogWorker;
- import org.apache.ofbiz.ebaystore.EbayStoreHelper;
- import com.ebay.sdk.ApiContext;
- import com.ebay.sdk.call.AddItemCall;
- import com.ebay.soap.eBLBaseComponents.BuyerPaymentMethodCodeType;
- import com.ebay.soap.eBLBaseComponents.ItemSpecificsEnabledCodeType;
- import com.ebay.soap.eBLBaseComponents.SiteCodeType;
- import org.apache.ofbiz.ebaystore.EbayEvents;
+ import org.apache.ofbiz.product.product.ProductContentWrapper
+ import org.apache.ofbiz.product.catalog.CatalogWorker
+ import org.apache.ofbiz.ebaystore.EbayStoreHelper
+ import com.ebay.sdk.ApiContext
+ import com.ebay.sdk.call.AddItemCall
+ import com.ebay.soap.eBLBaseComponents.BuyerPaymentMethodCodeType
+ import com.ebay.soap.eBLBaseComponents.ItemSpecificsEnabledCodeType
+ import com.ebay.soap.eBLBaseComponents.SiteCodeType
+ import org.apache.ofbiz.ebaystore.EbayEvents
//set the content path prefix
- contentPathPrefix = CatalogWorker.getContentPathPrefix(request);
- productStoreId = parameters.productStoreId;
- search_CategoryId = parameters.search_CategoryId;
+ contentPathPrefix = CatalogWorker.getContentPathPrefix(request)
+ productStoreId = parameters.productStoreId
+ search_CategoryId = parameters.search_CategoryId
//Get the addItemList and Prepare details
- apiContext = EbayEvents.getApiContext(request);
- addItemObj = EbayEvents.getAddItemListingObject(request, apiContext);
- contents = [];
+ apiContext = EbayEvents.getApiContext(request)
+ addItemObj = EbayEvents.getAddItemListingObject(request, apiContext)
+ contents = []
if (addItemObj) {
- site = (SiteCodeType)apiContext.getSite();
- isExportValid = "false";
- context.site = site;
- context.siteCode = apiContext.getSite().value();
- context.siteCode_Ebay_Motors = SiteCodeType.E_BAY_MOTORS.value();
- addItems = addItemObj.itemListing;
+ site = (SiteCodeType)apiContext.getSite()
+ isExportValid = "false"
+ context.site = site
+ context.siteCode = apiContext.getSite().value()
+ context.siteCode_Ebay_Motors = SiteCodeType.E_BAY_MOTORS.value()
+ addItems = addItemObj.itemListing
addItems.each{ addItemMap ->
- addItem = addItemMap.addItemCall;
- content = [:];
- item = addItem.getItem();
- productId = item.getSKU();
- product = from("Product").where("productId", productId).cache(true).queryOne();
- contentWrapper = new ProductContentWrapper(product, request);
- content.productContentWrapper = contentWrapper;
- content.product = product;
- contents.add(content);
+ addItem = addItemMap.addItemCall
+ content = [:]
+ item = addItem.getItem()
+ productId = item.getSKU()
+ product = from("Product").where("productId", productId).cache(true).queryOne()
+ contentWrapper = new ProductContentWrapper(product, request)
+ content.productContentWrapper = contentWrapper
+ content.product = product
+ contents.add(content)
if (addItemMap.isVerify == "Y") {
- isExportValid = "true";
+ isExportValid = "true"
} else {
- isExportValid = "false";
+ isExportValid = "false"
}
}
- context.isExportValid = isExportValid;
+ context.isExportValid = isExportValid
- request.setAttribute("productStoreId", productStoreId);
- categories = EbayEvents.getChildCategories(request);
- context.categories = categories;
- storeCategories = EbayEvents.getStoreChildCategories(request);
- context.storeCategories = storeCategories;
+ request.setAttribute("productStoreId", productStoreId)
+ categories = EbayEvents.getChildCategories(request)
+ context.categories = categories
+ storeCategories = EbayEvents.getStoreChildCategories(request)
+ context.storeCategories = storeCategories
// point product tab id
- productId = null;
+ productId = null
if (request.getAttribute("isProductId") || parameters.isProductId) {
if (request.getAttribute("isProductId")) {
- productId = request.getAttribute("isProductId");
+ productId = request.getAttribute("isProductId")
} else {
- productId = parameters.isProductId;
+ productId = parameters.isProductId
}
- context.isProductId = productId;
+ context.isProductId = productId
// get product default price form product price
- productPrices = from("ProductPrice").where("productId", productId, "productPricePurposeId", "EBAY").queryList();
+ productPrices = from("ProductPrice").where("productId", productId, "productPricePurposeId", "EBAY").queryList()
if (productPrices) {
- context.productPrices = productPrices;
+ context.productPrices = productPrices
}
//Is it reserve on eBayInventory
- isReserve = EbayStoreHelper.isReserveInventory(delegator, productStoreId, productId);
- context.isReserve = isReserve;
+ isReserve = EbayStoreHelper.isReserveInventory(delegator, productStoreId, productId)
+ context.isReserve = isReserve
// get category detail
- pkCateId = null;
- stCate1ID = null;
- stCate2ID = null;
+ pkCateId = null
+ stCate1ID = null
+ stCate2ID = null
addItems.each{ addItemMap ->
- addItem = addItemMap.addItemCall;
- item = addItem.getItem();
+ addItem = addItemMap.addItemCall
+ item = addItem.getItem()
if (productId == item.getSKU()) {
- primaryCate = item.getPrimaryCategory();
- storeFront = item.getStorefront();
+ primaryCate = item.getPrimaryCategory()
+ storeFront = item.getStorefront()
if (storeFront) {
- stCate1ID = storeFront.getStoreCategoryID();
- stCate2ID = storeFront.getStoreCategory2ID();
- context.storeFront = storeFront;
+ stCate1ID = storeFront.getStoreCategoryID()
+ stCate2ID = storeFront.getStoreCategory2ID()
+ context.storeFront = storeFront
}
- if (primaryCate) pkCateId = primaryCate.getCategoryID();
+ if (primaryCate) pkCateId = primaryCate.getCategoryID()
}
}
- categorySpecificObject = EbayEvents.categorySpecifics(pkCateId, request);
+ categorySpecificObject = EbayEvents.categorySpecifics(pkCateId, request)
if(categorySpecificObject) {
- Map categorySpecificMap = categorySpecificObject.get("categorySpecifics");
- int checkNameSpecific = null;
- int checkValueSpecific = null;
- Iterator specificIterator = categorySpecificMap.keySet().iterator();
+ Map categorySpecificMap = categorySpecificObject.get("categorySpecifics")
+ int checkNameSpecific = null
+ int checkValueSpecific = null
+ Iterator specificIterator = categorySpecificMap.keySet().iterator()
while(specificIterator.hasNext()){
- String name = specificIterator.next();
- List valueList = categorySpecificMap.get(name);
- checkValueSpecific = (valueList) ? 1 : 0 ;
+ String name = specificIterator.next()
+ List valueList = categorySpecificMap.get(name)
+ checkValueSpecific = (valueList) ? 1 : 0
}
- checkNameSpecific = categorySpecificMap.size();
- String checkSpecific = ((checkNameSpecific > 0) && (checkValueSpecific == 1)) ? "true" : "false";
- context.checkSpecific = checkSpecific;
- context.categorySpecifix = categorySpecificObject;
+ checkNameSpecific = categorySpecificMap.size()
+ String checkSpecific = ((checkNameSpecific > 0) && (checkValueSpecific == 1)) ? "true" : "false"
+ context.checkSpecific = checkSpecific
+ context.categorySpecifix = categorySpecificObject
}
- context.stCate1ID = stCate1ID;
- context.stCate2ID = stCate2ID;
+ context.stCate1ID = stCate1ID
+ context.stCate2ID = stCate2ID
if (pkCateId) {
- refName = "itemCateFacade_" + pkCateId;
+ refName = "itemCateFacade_" + pkCateId
if (addItemObj.get(refName)) {
- cf = addItemObj.get(refName);
+ cf = addItemObj.get(refName)
if (cf) {
- listingTypes = [];
- listingDurationReferenceMap = cf.getListingDurationReferenceMap();
- listingDurationMap = cf.getListingDurationMap();
+ listingTypes = []
+ listingDurationReferenceMap = cf.getListingDurationReferenceMap()
+ listingDurationMap = cf.getListingDurationMap()
if (listingDurationReferenceMap && listingDurationMap) {
- Iterator keys = listingDurationReferenceMap.keySet().iterator();
+ Iterator keys = listingDurationReferenceMap.keySet().iterator()
while (keys.hasNext()) {
- listingTypeMap = [:];
- String key = keys.next();
- listingTypeMap.type = key;
- listingTypeMap.durations = listingDurationMap.get(new Integer(listingDurationReferenceMap.get(key)));
- listingTypes.add(listingTypeMap);
+ listingTypeMap = [:]
+ String key = keys.next()
+ listingTypeMap.type = key
+ listingTypeMap.durations = listingDurationMap.get(new Integer(listingDurationReferenceMap.get(key)))
+ listingTypes.add(listingTypeMap)
}
}
- context.listingTypes = listingTypes;
- buyerPaymentMethods = cf.getPaymentMethods();
+ context.listingTypes = listingTypes
+ buyerPaymentMethods = cf.getPaymentMethods()
if (buyerPaymentMethods) {
- context.paymentMethods = buyerPaymentMethods;
- context.buyerPayMethCode_PAY_PAL = BuyerPaymentMethodCodeType.PAY_PAL;
+ context.paymentMethods = buyerPaymentMethods
+ context.buyerPayMethCode_PAY_PAL = BuyerPaymentMethodCodeType.PAY_PAL
}
// load item specifices and custom if both item attributes and item specifics are supported, we only use item specifics
if (cf.getItemSpecificEnabled()) {
if (ItemSpecificsEnabledCodeType.ENABLED.equals(cf.getItemSpecificEnabled())) {
} else if (cf.AttributesEnabled()) { //show attributes input page
- String attributesHtml = attrMaster.renderHtml(cf.getJoinedAttrSets(), null);
- context.AttributesHtml = attributesHtml;
+ String attributesHtml = attrMaster.renderHtml(cf.getJoinedAttrSets(), null)
+ context.AttributesHtml = attributesHtml
} else {//show return policy input page
- sf = EbayEvents.getSiteFacade(apiContext,request);
- details = sf.getEBayDetailsMap().get(apiContext.getSite());
- returnPolicyEnabled = cf.getRetPolicyEnabled();
+ sf = EbayEvents.getSiteFacade(apiContext,request)
+ details = sf.getEBayDetailsMap().get(apiContext.getSite())
+ returnPolicyEnabled = cf.getRetPolicyEnabled()
- context.EBayDetails = details;
- context.ReturnPolicyEnabled = returnPolicyEnabled;
+ context.EBayDetails = details
+ context.ReturnPolicyEnabled = returnPolicyEnabled
}
}
// load shipping services detail
- eBayDetailsMap = sf.getEBayDetailsMap();
+ eBayDetailsMap = sf.getEBayDetailsMap()
if (eBayDetailsMap) {
- eBayDetails = eBayDetailsMap.get(site);
- shippingServiceDetails = eBayDetails.getShippingServiceDetails();
- shippingServiceDetails = EbayEvents.filterShippingService(shippingServiceDetails);
- context.shippingServiceDetails = shippingServiceDetails;
- shippingLocationDetails = eBayDetails.getShippingLocationDetails();
- context.shippingLocationDetails = shippingLocationDetails;
+ eBayDetails = eBayDetailsMap.get(site)
+ shippingServiceDetails = eBayDetails.getShippingServiceDetails()
+ shippingServiceDetails = EbayEvents.filterShippingService(shippingServiceDetails)
+ context.shippingServiceDetails = shippingServiceDetails
+ shippingLocationDetails = eBayDetails.getShippingLocationDetails()
+ context.shippingLocationDetails = shippingLocationDetails
}
// load AdItemTemplates
if (cf.getAdItemTemplates()) {
- context.adItemTemplates = cf.getAdItemTemplates();
+ context.adItemTemplates = cf.getAdItemTemplates()
}
}
}
}
}
}
- context.addItemObj = addItemObj;
- context.contentList = contents;
+ context.addItemObj = addItemObj
+ context.contentList = contents
diff --git a/specialpurpose/ebaystore/groovyScripts/store/RetrieveStoreOptions.groovy b/specialpurpose/ebaystore/groovyScripts/store/RetrieveStoreOptions.groovy
index 7de8974e2f..57d37cb7a8 100644
--- a/specialpurpose/ebaystore/groovyScripts/store/RetrieveStoreOptions.groovy
+++ b/specialpurpose/ebaystore/groovyScripts/store/RetrieveStoreOptions.groovy
@@ -17,49 +17,49 @@
* under the License.
*/
-productStoreId = parameters.productStoreId;
-storeThemeId = null;
+productStoreId = parameters.productStoreId
+storeThemeId = null
if (parameters.ebayStore) {
- ebayStore = parameters.get("ebayStore");
- storeThemeId = ebayStore.get("storeThemeId");
+ ebayStore = parameters.get("ebayStore")
+ storeThemeId = ebayStore.get("storeThemeId")
}
if (productStoreId != null) {
- flag = null;
- storeBasicThemes = null;
- resultsBasicThemes = runService('retrieveBasicThemeArray',["productStoreId":productStoreId, "userLogin": userLogin]);
+ flag = null
+ storeBasicThemes = null
+ resultsBasicThemes = runService('retrieveBasicThemeArray',["productStoreId":productStoreId, "userLogin": userLogin])
if(resultsBasicThemes){
- storeBasicThemes = resultsBasicThemes.get("storeThemeList");
+ storeBasicThemes = resultsBasicThemes.get("storeThemeList")
//check what kind of theme?
- context.put("storeThemeOptList",storeBasicThemes);
+ context.put("storeThemeOptList",storeBasicThemes)
if (storeThemeId != null && storeBasicThemes != null) {
storeBasicThemes.each { storeTheme ->
if (storeThemeId == storeTheme.storeThemeId) {
- flag = "Basic";
+ flag = "Basic"
}
}
}
}
- storeAdvanceThemes = null;
- storeAdvancedThemeColorOptList = null;
- resultsAdvanceThemes = runService('retrieveAdvancedThemeArray',["productStoreId":productStoreId, "userLogin": userLogin]);
+ storeAdvanceThemes = null
+ storeAdvancedThemeColorOptList = null
+ resultsAdvanceThemes = runService('retrieveAdvancedThemeArray',["productStoreId":productStoreId, "userLogin": userLogin])
if (resultsAdvanceThemes) {
- storeAdvanceThemes = resultsAdvanceThemes.get("storeThemeList");
- storeAdvancedThemeColorOptList = resultsAdvanceThemes.get("storeAdvancedThemeColorOptList");
- context.put("storeAdvanceThemeOptList",storeAdvanceThemes);
- context.put("storeAdvancedThemeColorOptList",storeAdvancedThemeColorOptList);
+ storeAdvanceThemes = resultsAdvanceThemes.get("storeThemeList")
+ storeAdvancedThemeColorOptList = resultsAdvanceThemes.get("storeAdvancedThemeColorOptList")
+ context.put("storeAdvanceThemeOptList",storeAdvanceThemes)
+ context.put("storeAdvancedThemeColorOptList",storeAdvancedThemeColorOptList)
if (storeThemeId != null && storeAdvanceThemes != null) {
storeAdvanceThemes.each { storeAdvanceTheme ->
if(storeThemeId == storeAdvanceTheme.storeThemeId){
- flag = "Advanced";
+ flag = "Advanced"
}
}
}
}
- resultsFontTheme = runService('retrieveStoreFontTheme',["productStoreId":productStoreId, "userLogin": userLogin]);
+ resultsFontTheme = runService('retrieveStoreFontTheme',["productStoreId":productStoreId, "userLogin": userLogin])
if (resultsFontTheme) {
- storeFontTheme = resultsFontTheme.get("advanceFontTheme");
- context.put("storeFontTheme",storeFontTheme);
+ storeFontTheme = resultsFontTheme.get("advanceFontTheme")
+ context.put("storeFontTheme",storeFontTheme)
}
- context.put("themeType",flag);
+ context.put("themeType",flag)
}
diff --git a/specialpurpose/ebaystore/groovyScripts/store/SoldAction.groovy b/specialpurpose/ebaystore/groovyScripts/store/SoldAction.groovy
index 5406482f9d..942f37672b 100644
--- a/specialpurpose/ebaystore/groovyScripts/store/SoldAction.groovy
+++ b/specialpurpose/ebaystore/groovyScripts/store/SoldAction.groovy
@@ -17,24 +17,24 @@
* under the License.
*/
-import org.apache.ofbiz.base.util.*;
+import org.apache.ofbiz.base.util.*
-actionList = [];
-hasAction = false;
+actionList = []
+hasAction = false
//Unpaid Item Dispute
if (unpaidItemStatus == null && paidTime == null && checkoutStatus != "CheckoutComplete") {
- inMap = [:];
- inMap.put("action","openUnpaid");
- inMap.put("actionName","Open Unpaid");
- actionList.add(inMap);
- hasAction = true;
+ inMap = [:]
+ inMap.put("action","openUnpaid")
+ inMap.put("actionName","Open Unpaid")
+ actionList.add(inMap)
+ hasAction = true
}
//Second Chance Offer
-inMap = [:];
-inMap.put("action","makeSecondChanceOffer");
-inMap.put("actionName","Make Second Chance Offer");
-actionList.add(inMap);
-hasAction = true;
+inMap = [:]
+inMap.put("action","makeSecondChanceOffer")
+inMap.put("actionName","Make Second Chance Offer")
+actionList.add(inMap)
+hasAction = true
-context.actionList = actionList;
-context.hasAction = hasAction;
+context.actionList = actionList
+context.hasAction = hasAction
diff --git a/specialpurpose/ebaystore/groovyScripts/store/StoreAccount.groovy b/specialpurpose/ebaystore/groovyScripts/store/StoreAccount.groovy
index 40cea56045..30bbda80f5 100644
--- a/specialpurpose/ebaystore/groovyScripts/store/StoreAccount.groovy
+++ b/specialpurpose/ebaystore/groovyScripts/store/StoreAccount.groovy
@@ -17,25 +17,25 @@
* under the License.
*/
-import org.apache.ofbiz.base.util.*;
+import org.apache.ofbiz.base.util.*
-results = [];
-ebayAccountList = from("PartyRoleAndPartyDetail").where("roleTypeId", "EBAY_ACCOUNT").queryList();
-productStoreRoles = from("ProductStoreRole").where("roleTypeId", "EBAY_ACCOUNT").queryList();
+results = []
+ebayAccountList = from("PartyRoleAndPartyDetail").where("roleTypeId", "EBAY_ACCOUNT").queryList()
+productStoreRoles = from("ProductStoreRole").where("roleTypeId", "EBAY_ACCOUNT").queryList()
if (productStoreRoles != null && ebayAccountList != null) {
ebayAccountList.each{ebayAccount->
- partyId = ebayAccount.partyId;
+ partyId = ebayAccount.partyId
productStoreRoles.each{productStoreRole ->
if(partyId.equals(productStoreRole.partyId)){
- storeMap = [:];
- storeMap.partyId = ebayAccount.partyId;
- storeMap.firstName = ebayAccount.firstName;
- storeMap.lastName = ebayAccount.lastName;
- storeMap.productStoreId = productStoreRole.productStoreId;
- results.add(storeMap);
+ storeMap = [:]
+ storeMap.partyId = ebayAccount.partyId
+ storeMap.firstName = ebayAccount.firstName
+ storeMap.lastName = ebayAccount.lastName
+ storeMap.productStoreId = productStoreRole.productStoreId
+ results.add(storeMap)
}
}
}
- context.put("stores",results);
+ context.put("stores",results)
}
diff --git a/specialpurpose/ecommerce/groovyScripts/EcommerceSetup.groovy b/specialpurpose/ecommerce/groovyScripts/EcommerceSetup.groovy
index 78a2d98efa..7878d80a48 100644
--- a/specialpurpose/ecommerce/groovyScripts/EcommerceSetup.groovy
+++ b/specialpurpose/ecommerce/groovyScripts/EcommerceSetup.groovy
@@ -17,25 +17,25 @@
* under the License.
*/
-import java.util.*;
-import org.apache.ofbiz.base.util.*;
-import org.apache.ofbiz.entity.*;
-import org.apache.ofbiz.product.catalog.CatalogWorker;
-import org.apache.ofbiz.product.store.ProductStoreWorker;
-import org.apache.ofbiz.common.CommonWorkers;
-import org.apache.ofbiz.order.shoppingcart.*;
-import org.apache.ofbiz.webapp.control.*;
+import java.util.*
+import org.apache.ofbiz.base.util.*
+import org.apache.ofbiz.entity.*
+import org.apache.ofbiz.product.catalog.CatalogWorker
+import org.apache.ofbiz.product.store.ProductStoreWorker
+import org.apache.ofbiz.common.CommonWorkers
+import org.apache.ofbiz.order.shoppingcart.*
+import org.apache.ofbiz.webapp.control.*
-productStore = ProductStoreWorker.getProductStore(request);
+productStore = ProductStoreWorker.getProductStore(request)
-prodCatalog = CatalogWorker.getProdCatalog(request);
+prodCatalog = CatalogWorker.getProdCatalog(request)
if (prodCatalog) {
- catalogStyleSheet = prodCatalog.styleSheet;
- if (catalogStyleSheet) globalContext.catalogStyleSheet = catalogStyleSheet;
- catalogHeaderLogo = prodCatalog.headerLogo;
- if (catalogHeaderLogo) globalContext.catalogHeaderLogo = catalogHeaderLogo;
+ catalogStyleSheet = prodCatalog.styleSheet
+ if (catalogStyleSheet) globalContext.catalogStyleSheet = catalogStyleSheet
+ catalogHeaderLogo = prodCatalog.headerLogo
+ if (catalogHeaderLogo) globalContext.catalogHeaderLogo = catalogHeaderLogo
}
-globalContext.productStore = productStore;
-globalContext.checkLoginUrl = LoginWorker.makeLoginUrl(request, "checkLogin");
-globalContext.catalogQuickaddUse = CatalogWorker.getCatalogQuickaddUse(request);
+globalContext.productStore = productStore
+globalContext.checkLoginUrl = LoginWorker.makeLoginUrl(request, "checkLogin")
+globalContext.catalogQuickaddUse = CatalogWorker.getCatalogQuickaddUse(request)
diff --git a/specialpurpose/ecommerce/groovyScripts/Login.groovy b/specialpurpose/ecommerce/groovyScripts/Login.groovy
index 4be040eb1f..abe1964680 100644
--- a/specialpurpose/ecommerce/groovyScripts/Login.groovy
+++ b/specialpurpose/ecommerce/groovyScripts/Login.groovy
@@ -17,18 +17,18 @@
* under the License.
*/
-import org.apache.ofbiz.base.util.*;
-import org.apache.ofbiz.common.CommonWorkers;
-import org.apache.ofbiz.webapp.control.*;
+import org.apache.ofbiz.base.util.*
+import org.apache.ofbiz.common.CommonWorkers
+import org.apache.ofbiz.webapp.control.*
-context.autoUserLogin = session.getAttribute("autoUserLogin");
-context.autoLogoutUrl = LoginWorker.makeLoginUrl(request, "autoLogout");
+context.autoUserLogin = session.getAttribute("autoUserLogin")
+context.autoLogoutUrl = LoginWorker.makeLoginUrl(request, "autoLogout")
-previousParams = session.getAttribute("_PREVIOUS_PARAMS_");
+previousParams = session.getAttribute("_PREVIOUS_PARAMS_")
if (previousParams) {
- previousParams = UtilHttp.stripNamedParamsFromQueryString(previousParams, ["USERNAME", "PASSWORD"]);
- previousParams = "?" + previousParams;
+ previousParams = UtilHttp.stripNamedParamsFromQueryString(previousParams, ["USERNAME", "PASSWORD"])
+ previousParams = "?" + previousParams
} else {
- previousParams = "";
+ previousParams = ""
}
-context.previousParams = previousParams;
+context.previousParams = previousParams
diff --git a/specialpurpose/ecommerce/groovyScripts/Main.groovy b/specialpurpose/ecommerce/groovyScripts/Main.groovy
index b234619153..5a24d2803b 100644
--- a/specialpurpose/ecommerce/groovyScripts/Main.groovy
+++ b/specialpurpose/ecommerce/groovyScripts/Main.groovy
@@ -17,13 +17,13 @@
* under the License.
*/
-import org.apache.ofbiz.product.catalog.*;
+import org.apache.ofbiz.product.catalog.*
-catalogId = CatalogWorker.getCurrentCatalogId(request);
-promoCat = CatalogWorker.getCatalogPromotionsCategoryId(request, catalogId);
-request.setAttribute("productCategoryId", promoCat);
+catalogId = CatalogWorker.getCurrentCatalogId(request)
+promoCat = CatalogWorker.getCatalogPromotionsCategoryId(request, catalogId)
+request.setAttribute("productCategoryId", promoCat)
-/* NOTE DEJ20070220 woah, this is doing weird stuff like always showing the last viewed category when going to the main page;
+/* NOTE DEJ20070220 woah, this is doing weird stuff like always showing the last viewed category when going to the main page
* It appears this was done for to make it go back to the desired category after logging in, but this is NOT the place to do that,
* and IMO this is an unacceptable side-effect.
*
@@ -33,10 +33,10 @@ request.setAttribute("productCategoryId", promoCat);
*
* NOTE JLR 20070221 this should be done using the same method than in add to cart. I will do it like that and remove all this after.
*
-productCategoryId = session.getAttribute("productCategoryId");
+productCategoryId = session.getAttribute("productCategoryId")
if (!productCategoryId) {
- request.setAttribute("productCategoryId", promoCat);
+ request.setAttribute("productCategoryId", promoCat)
} else {
- request.setAttribute("productCategoryId", productCategoryId);
+ request.setAttribute("productCategoryId", productCategoryId)
}
*/
diff --git a/specialpurpose/ecommerce/groovyScripts/ProcessPaymentSettings.groovy b/specialpurpose/ecommerce/groovyScripts/ProcessPaymentSettings.groovy
index 059c68a0c2..c0b1be3ce4 100644
--- a/specialpurpose/ecommerce/groovyScripts/ProcessPaymentSettings.groovy
+++ b/specialpurpose/ecommerce/groovyScripts/ProcessPaymentSettings.groovy
@@ -17,68 +17,68 @@
* under the License.
*/
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import java.util.ArrayList
+import java.util.HashMap
+import java.util.List
+import java.util.Map
-import org.apache.ofbiz.base.util.UtilHttp;
-import org.apache.ofbiz.base.util.UtilMisc;
-import org.apache.ofbiz.entity.Delegator;
-import org.apache.ofbiz.entity.GenericValue;
-import org.apache.ofbiz.order.shoppingcart.CheckOutHelper;
-import org.apache.ofbiz.order.shoppingcart.ShoppingCart;
-import org.apache.ofbiz.order.shoppingcart.ShoppingCartEvents;
-import org.apache.ofbiz.service.LocalDispatcher;
-import org.apache.ofbiz.service.ModelService;
-import org.apache.ofbiz.service.ServiceUtil;
+import org.apache.ofbiz.base.util.UtilHttp
+import org.apache.ofbiz.base.util.UtilMisc
+import org.apache.ofbiz.entity.Delegator
+import org.apache.ofbiz.entity.GenericValue
+import org.apache.ofbiz.order.shoppingcart.CheckOutHelper
+import org.apache.ofbiz.order.shoppingcart.ShoppingCart
+import org.apache.ofbiz.order.shoppingcart.ShoppingCartEvents
+import org.apache.ofbiz.service.LocalDispatcher
+import org.apache.ofbiz.service.ModelService
+import org.apache.ofbiz.service.ServiceUtil
-cart = ShoppingCartEvents.getCartObject(request);
-dispatcher = request.getAttribute("dispatcher");
-delegator = request.getAttribute("delegator");
-checkOutHelper = new CheckOutHelper(dispatcher, delegator, cart);
-paramMap = UtilHttp.getParameterMap(request);
+cart = ShoppingCartEvents.getCartObject(request)
+dispatcher = request.getAttribute("dispatcher")
+delegator = request.getAttribute("delegator")
+checkOutHelper = new CheckOutHelper(dispatcher, delegator, cart)
+paramMap = UtilHttp.getParameterMap(request)
-paymentMethodTypeId = paramMap.paymentMethodTypeId;
-errorMessages = [];
-errorMaps = [:];
+paymentMethodTypeId = paramMap.paymentMethodTypeId
+errorMessages = []
+errorMaps = [:]
if (paymentMethodTypeId) {
- paymentMethodId = request.getAttribute("paymentMethodId");
+ paymentMethodId = request.getAttribute("paymentMethodId")
if ("EXT_OFFLINE".equals(paymentMethodTypeId)) {
- paymentMethodId = "EXT_OFFLINE";
+ paymentMethodId = "EXT_OFFLINE"
}
- singleUsePayment = paramMap.singleUsePayment;
- appendPayment = paramMap.appendPayment;
- isSingleUsePayment = "Y".equalsIgnoreCase(singleUsePayment) ?: false;
- doAppendPayment = "Y".equalsIgnoreCase(appendPayment) ?: false;
- callResult = checkOutHelper.finalizeOrderEntryPayment(paymentMethodId, null, isSingleUsePayment, doAppendPayment);
- cpi = cart.getPaymentInfo(paymentMethodId, null, null, null, true);
- cpi.securityCode = paramMap.cardSecurityCode;
- ServiceUtil.addErrors(errorMessages, errorMaps, callResult);
+ singleUsePayment = paramMap.singleUsePayment
+ appendPayment = paramMap.appendPayment
+ isSingleUsePayment = "Y".equalsIgnoreCase(singleUsePayment) ?: false
+ doAppendPayment = "Y".equalsIgnoreCase(appendPayment) ?: false
+ callResult = checkOutHelper.finalizeOrderEntryPayment(paymentMethodId, null, isSingleUsePayment, doAppendPayment)
+ cpi = cart.getPaymentInfo(paymentMethodId, null, null, null, true)
+ cpi.securityCode = paramMap.cardSecurityCode
+ ServiceUtil.addErrors(errorMessages, errorMaps, callResult)
}
if (!errorMessages && !errorMaps) {
- selPaymentMethods = null;
- addGiftCard = paramMap.addGiftCard;
+ selPaymentMethods = null
+ addGiftCard = paramMap.addGiftCard
if ("Y".equalsIgnoreCase(addGiftCard)) {
- selPaymentMethods = [paymentMethodTypeId : null];
- callResult = checkOutHelper.checkGiftCard(paramMap, selPaymentMethods);
- ServiceUtil.addErrors(errorMessages, errorMaps, callResult);
+ selPaymentMethods = [paymentMethodTypeId : null]
+ callResult = checkOutHelper.checkGiftCard(paramMap, selPaymentMethods)
+ ServiceUtil.addErrors(errorMessages, errorMaps, callResult)
if (!errorMessages && !errorMaps) {
- gcPaymentMethodId = callResult.paymentMethodId;
- giftCardAmount = callResult.amount;
- gcCallRes = checkOutHelper.finalizeOrderEntryPayment(gcPaymentMethodId, giftCardAmount, true, true);
- ServiceUtil.addErrors(errorMessages, errorMaps, gcCallRes);
+ gcPaymentMethodId = callResult.paymentMethodId
+ giftCardAmount = callResult.amount
+ gcCallRes = checkOutHelper.finalizeOrderEntryPayment(gcPaymentMethodId, giftCardAmount, true, true)
+ ServiceUtil.addErrors(errorMessages, errorMaps, gcCallRes)
}
}
}
//See whether we need to return an error or not
-callResult = ServiceUtil.returnSuccess();
+callResult = ServiceUtil.returnSuccess()
if (errorMessages || errorMaps) {
- request.setAttribute(ModelService.ERROR_MESSAGE_LIST, errorMessages);
- request.setAttribute(ModelService.RESPONSE_MESSAGE, ModelService.RESPOND_ERROR);
- return "error";
+ request.setAttribute(ModelService.ERROR_MESSAGE_LIST, errorMessages)
+ request.setAttribute(ModelService.RESPONSE_MESSAGE, ModelService.RESPOND_ERROR)
+ return "error"
}
-return "success";
+return "success"
diff --git a/specialpurpose/ecommerce/groovyScripts/cart/ShowCart.groovy b/specialpurpose/ecommerce/groovyScripts/cart/ShowCart.groovy
index 1386af8ebf..b999215dfd 100644
--- a/specialpurpose/ecommerce/groovyScripts/cart/ShowCart.groovy
+++ b/specialpurpose/ecommerce/groovyScripts/cart/ShowCart.groovy
@@ -17,62 +17,62 @@
* under the License.
*/
-import org.apache.ofbiz.base.util.UtilMisc;
-import org.apache.ofbiz.product.catalog.CatalogWorker;
-import org.apache.ofbiz.order.shoppingcart.product.ProductDisplayWorker;
-import org.apache.ofbiz.order.shoppingcart.ShoppingCartEvents;
-import org.apache.ofbiz.product.store.ProductStoreWorker;
-import org.apache.ofbiz.entity.condition.*;
-import org.apache.ofbiz.entity.util.EntityUtil;
+import org.apache.ofbiz.base.util.UtilMisc
+import org.apache.ofbiz.product.catalog.CatalogWorker
+import org.apache.ofbiz.order.shoppingcart.product.ProductDisplayWorker
+import org.apache.ofbiz.order.shoppingcart.ShoppingCartEvents
+import org.apache.ofbiz.product.store.ProductStoreWorker
+import org.apache.ofbiz.entity.condition.*
+import org.apache.ofbiz.entity.util.EntityUtil
// Get the Cart and Prepare Size
-shoppingCart = ShoppingCartEvents.getCartObject(request);
-context.shoppingCartSize = shoppingCart?.size() ?: 0;
-context.shoppingCart = shoppingCart;
+shoppingCart = ShoppingCartEvents.getCartObject(request)
+context.shoppingCartSize = shoppingCart?.size() ?: 0
+context.shoppingCart = shoppingCart
-context.productStore = ProductStoreWorker.getProductStore(request);
+context.productStore = ProductStoreWorker.getProductStore(request)
if (parameters.add_product_id) { // check if a parameter is passed
- add_product_id = parameters.add_product_id;
- product = from("Product").where("productId", add_product_id).cache(true).queryOne();
- context.product = product;
+ add_product_id = parameters.add_product_id
+ product = from("Product").where("productId", add_product_id).cache(true).queryOne()
+ context.product = product
}
// get all the possible gift wrap options
-allgiftWraps = from("ProductFeature").where("productFeatureTypeId", "GIFT_WRAP").orderBy("defaultSequenceNum").queryList();
-context.allgiftWraps = allgiftWraps;
+allgiftWraps = from("ProductFeature").where("productFeatureTypeId", "GIFT_WRAP").orderBy("defaultSequenceNum").queryList()
+context.allgiftWraps = allgiftWraps
// get the shopping lists for the logged in user
if (userLogin) {
allShoppingLists = from("ShoppingList").where(EntityCondition.makeCondition("partyId", EntityOperator.EQUALS, userLogin.partyId),
- EntityCondition.makeCondition("listName", EntityOperator.NOT_EQUAL, "auto-save")).orderBy("listName").queryList();
- context.shoppingLists = allShoppingLists;
+ EntityCondition.makeCondition("listName", EntityOperator.NOT_EQUAL, "auto-save")).orderBy("listName").queryList()
+ context.shoppingLists = allShoppingLists
}
// Get Cart Associated Products Data
-associatedProducts = ProductDisplayWorker.getRandomCartProductAssoc(request, true);
-context.associatedProducts = associatedProducts;
+associatedProducts = ProductDisplayWorker.getRandomCartProductAssoc(request, true)
+context.associatedProducts = associatedProducts
-context.contentPathPrefix = CatalogWorker.getContentPathPrefix(request);
+context.contentPathPrefix = CatalogWorker.getContentPathPrefix(request)
//Get Cart Items
-shoppingCartItems = shoppingCart.items();
+shoppingCartItems = shoppingCart.items()
if(shoppingCartItems) {
shoppingCartItems.each { shoppingCartItem ->
if (shoppingCartItem.getProductId()) {
if (shoppingCartItem.getParentProductId()) {
- parentProductId = shoppingCartItem.getParentProductId();
+ parentProductId = shoppingCartItem.getParentProductId()
} else {
- parentProductId = shoppingCartItem.getProductId();
+ parentProductId = shoppingCartItem.getProductId()
}
- context.parentProductId = parentProductId;
+ context.parentProductId = parentProductId
}
- productCategoryMembers = from("ProductCategoryMember").where("productId", parentProductId).queryList();
+ productCategoryMembers = from("ProductCategoryMember").where("productId", parentProductId).queryList()
if (productCategoryMembers) {
- productCategoryMember = EntityUtil.getFirst(productCategoryMembers);
- productCategory = productCategoryMember.getRelatedOne("ProductCategory", false);
- context.productCategory = productCategory;
+ productCategoryMember = EntityUtil.getFirst(productCategoryMembers)
+ productCategory = productCategoryMember.getRelatedOne("ProductCategory", false)
+ context.productCategory = productCategory
}
}
}
diff --git a/specialpurpose/ecommerce/groovyScripts/cart/ShowPromoText.groovy b/specialpurpose/ecommerce/groovyScripts/cart/ShowPromoText.groovy
index 56b845b0d7..5bd32ab817 100644
--- a/specialpurpose/ecommerce/groovyScripts/cart/ShowPromoText.groovy
+++ b/specialpurpose/ecommerce/groovyScripts/cart/ShowPromoText.groovy
@@ -17,42 +17,42 @@
* under the License.
*/
-import org.apache.ofbiz.base.util.UtilMisc;
-import org.apache.ofbiz.order.shoppingcart.product.ProductPromoWorker;
+import org.apache.ofbiz.base.util.UtilMisc
+import org.apache.ofbiz.order.shoppingcart.product.ProductPromoWorker
-promoShowLimit = 3;
+promoShowLimit = 3
//Get Promo Text Data
-productPromosAll = ProductPromoWorker.getStoreProductPromos(delegator, dispatcher, request);
+productPromosAll = ProductPromoWorker.getStoreProductPromos(delegator, dispatcher, request)
//Make sure that at least one promo has non-empty promoText
-showPromoText = false;
-promoToShow = 0;
-productPromosAllShowable = new ArrayList(productPromosAll.size());
+showPromoText = false
+promoToShow = 0
+productPromosAllShowable = new ArrayList(productPromosAll.size())
productPromosAll.each { productPromo ->
- promoText = productPromo.promoText;
+ promoText = productPromo.promoText
if (promoText && !"N".equals(productPromo.showToCustomer)) {
- showPromoText = true;
- promoToShow++;
- productPromosAllShowable.add(productPromo);
+ showPromoText = true
+ promoToShow++
+ productPromosAllShowable.add(productPromo)
}
}
// now slim it down to promoShowLimit
-productPromosRandomTemp = new ArrayList(productPromosAllShowable);
-productPromos = null;
+productPromosRandomTemp = new ArrayList(productPromosAllShowable)
+productPromos = null
if (productPromosRandomTemp.size() > promoShowLimit) {
- productPromos = new ArrayList(promoShowLimit);
+ productPromos = new ArrayList(promoShowLimit)
for (i = 0; i < promoShowLimit; i++) {
- randomIndex = Math.round(java.lang.Math.random() * (productPromosRandomTemp.size() - 1)) as int;
- productPromos.add(productPromosRandomTemp.remove(randomIndex));
+ randomIndex = Math.round(java.lang.Math.random() * (productPromosRandomTemp.size() - 1)) as int
+ productPromos.add(productPromosRandomTemp.remove(randomIndex))
}
} else {
- productPromos = productPromosRandomTemp;
+ productPromos = productPromosRandomTemp
}
-context.promoShowLimit = promoShowLimit;
-context.productPromosAllShowable = productPromosAllShowable;
-context.productPromos = productPromos;
-context.showPromoText = showPromoText;
-context.promoToShow = promoToShow;
+context.promoShowLimit = promoShowLimit
+context.productPromosAllShowable = productPromosAllShowable
+context.productPromos = productPromos
+context.showPromoText = showPromoText
+context.promoToShow = promoToShow
diff --git a/specialpurpose/ecommerce/groovyScripts/catalog/AjaxBreadcrumbs.groovy b/specialpurpose/ecommerce/groovyScripts/catalog/AjaxBreadcrumbs.groovy
index d85b3e6711..a0463ec57d 100644
--- a/specialpurpose/ecommerce/groovyScripts/catalog/AjaxBreadcrumbs.groovy
+++ b/specialpurpose/ecommerce/groovyScripts/catalog/AjaxBreadcrumbs.groovy
@@ -16,34 +16,34 @@
* specific language governing permissions and limitations
* under the License.
*/
-import org.apache.ofbiz.product.product.ProductContentWrapper;
-import org.apache.ofbiz.product.category.*;
-import org.apache.ofbiz.base.util.UtilValidate;
+import org.apache.ofbiz.product.product.ProductContentWrapper
+import org.apache.ofbiz.product.category.*
+import org.apache.ofbiz.base.util.UtilValidate
-parentCategoryStr = parameters.parentCategoryStr;
+parentCategoryStr = parameters.parentCategoryStr
if(!UtilValidate.isEmpty(parentCategoryStr)) {
- pathList = parentCategoryStr.split('/');
- cateList = [];
- pathTemp = '';
+ pathList = parentCategoryStr.split('/')
+ cateList = []
+ pathTemp = ''
for(path in pathList) {
- cateMap = [:];
- category = from("ProductCategory").where("productCategoryId", path).queryOne();
- categoryContentWrapper = new CategoryContentWrapper(category, request);
+ cateMap = [:]
+ category = from("ProductCategory").where("productCategoryId", path).queryOne()
+ categoryContentWrapper = new CategoryContentWrapper(category, request)
- pathTemp = pathTemp + path;
- cateMap.title = categoryContentWrapper.get("DESCRIPTION", "html");
- cateMap.productCategoryId = category.productCategoryId;
- cateMap.parentCategory = pathTemp;
+ pathTemp = pathTemp + path
+ cateMap.title = categoryContentWrapper.get("DESCRIPTION", "html")
+ cateMap.productCategoryId = category.productCategoryId
+ cateMap.parentCategory = pathTemp
- cateList.add(cateMap);
+ cateList.add(cateMap)
- pathTemp = pathTemp + '/';
+ pathTemp = pathTemp + '/'
}
- context.productCategoryTrail = cateList;
+ context.productCategoryTrail = cateList
}
-currentCategory = from("ProductCategory").where("productCategoryId", productCategoryId).queryOne();
-currentCategoryContentWrapper = new CategoryContentWrapper(currentCategory, request);
-context.currentCategoryName = currentCategoryContentWrapper.get("CATEGORY_NAME", "html");
-context.currentCategoryDescription = currentCategoryContentWrapper.get("DESCRIPTION", "html");
-context.currentCategoryId = productCategoryId;
+currentCategory = from("ProductCategory").where("productCategoryId", productCategoryId).queryOne()
+currentCategoryContentWrapper = new CategoryContentWrapper(currentCategory, request)
+context.currentCategoryName = currentCategoryContentWrapper.get("CATEGORY_NAME", "html")
+context.currentCategoryDescription = currentCategoryContentWrapper.get("DESCRIPTION", "html")
+context.currentCategoryId = productCategoryId
diff --git a/specialpurpose/ecommerce/groovyScripts/catalog/BestSellingCategory.groovy b/specialpurpose/ecommerce/groovyScripts/catalog/BestSellingCategory.groovy
index aea5d81a96..423a7233af 100644
--- a/specialpurpose/ecommerce/groovyScripts/catalog/BestSellingCategory.groovy
+++ b/specialpurpose/ecommerce/groovyScripts/catalog/BestSellingCategory.groovy
@@ -17,26 +17,26 @@
* under the License.
*/
-import org.apache.ofbiz.base.util.UtilValidate;
-import org.apache.ofbiz.base.util.UtilMisc;
-import org.apache.ofbiz.product.catalog.*;
-import org.apache.ofbiz.product.category.*;
+import org.apache.ofbiz.base.util.UtilValidate
+import org.apache.ofbiz.base.util.UtilMisc
+import org.apache.ofbiz.product.catalog.*
+import org.apache.ofbiz.product.category.*
-catalogId = CatalogWorker.getCurrentCatalogId(request);
-bestSellerCates = [];
+catalogId = CatalogWorker.getCurrentCatalogId(request)
+bestSellerCates = []
if (UtilValidate.isNotEmpty(catalogId)) {
- prodCatalogCategoryList = CatalogWorker.getProdCatalogCategories(request, catalogId, "PCCT_BEST_SELL");
+ prodCatalogCategoryList = CatalogWorker.getProdCatalogCategories(request, catalogId, "PCCT_BEST_SELL")
if (prodCatalogCategoryList.size() > 0) {
for (int i = 0; i < prodCatalogCategoryList.size(); i++) {
- prodCatalogCategory = prodCatalogCategoryList[i];
- productCategoryId = prodCatalogCategory.getString("productCategoryId");
- childCategoryList = CategoryWorker.getRelatedCategoriesRet(request, "childCategoryList", productCategoryId, true);
+ prodCatalogCategory = prodCatalogCategoryList[i]
+ productCategoryId = prodCatalogCategory.getString("productCategoryId")
+ childCategoryList = CategoryWorker.getRelatedCategoriesRet(request, "childCategoryList", productCategoryId, true)
if (childCategoryList.size() > 0) {
- bestSellerCates.add(childCategoryList);
+ bestSellerCates.add(childCategoryList)
}
}
}
}
-context.productCategoryList = bestSellerCates;
+context.productCategoryList = bestSellerCates
diff --git a/specialpurpose/ecommerce/groovyScripts/catalog/LayeredNavigation.groovy b/specialpurpose/ecommerce/groovyScripts/catalog/LayeredNavigation.groovy
index 9bf80fc42a..d2776640a0 100644
--- a/specialpurpose/ecommerce/groovyScripts/catalog/LayeredNavigation.groovy
+++ b/specialpurpose/ecommerce/groovyScripts/catalog/LayeredNavigation.groovy
@@ -17,122 +17,122 @@
* under the License.
*/
-import org.apache.ofbiz.base.util.UtilHttp;
-import org.apache.ofbiz.entity.util.EntityUtil;
-import org.apache.ofbiz.product.catalog.CatalogWorker;
-import org.apache.ofbiz.product.category.CategoryContentWrapper;
-import org.apache.ofbiz.product.category.CategoryWorker;
-import org.apache.ofbiz.product.product.ProductSearch;
-import org.apache.ofbiz.product.product.ProductSearchSession;
+import org.apache.ofbiz.base.util.UtilHttp
+import org.apache.ofbiz.entity.util.EntityUtil
+import org.apache.ofbiz.product.catalog.CatalogWorker
+import org.apache.ofbiz.product.category.CategoryContentWrapper
+import org.apache.ofbiz.product.category.CategoryWorker
+import org.apache.ofbiz.product.product.ProductSearch
+import org.apache.ofbiz.product.product.ProductSearchSession
-searchCategoryId = parameters.searchCategoryId;
+searchCategoryId = parameters.searchCategoryId
if (!searchCategoryId) {
- searchCategoryId = context.productCategoryId;
+ searchCategoryId = context.productCategoryId
}
if (searchCategoryId) {
- currentSearchCategory = from("ProductCategory").where("productCategoryId", searchCategoryId).queryOne();
- CategoryWorker.getRelatedCategories(request, "subCategoryList", searchCategoryId, false);
- subCategoryList = request.getAttribute("subCategoryList");
- CategoryContentWrapper categoryContentWrapper = new CategoryContentWrapper(currentSearchCategory, request);
- context.currentSearchCategory = currentSearchCategory;
- context.categoryContentWrapper = categoryContentWrapper;
+ currentSearchCategory = from("ProductCategory").where("productCategoryId", searchCategoryId).queryOne()
+ CategoryWorker.getRelatedCategories(request, "subCategoryList", searchCategoryId, false)
+ subCategoryList = request.getAttribute("subCategoryList")
+ CategoryContentWrapper categoryContentWrapper = new CategoryContentWrapper(currentSearchCategory, request)
+ context.currentSearchCategory = currentSearchCategory
+ context.categoryContentWrapper = categoryContentWrapper
}
-productCategoryId = context.productCategoryId;
+productCategoryId = context.productCategoryId
if (productCategoryId) {
- context.productCategory = from("ProductCategory").where("productCategoryId", productCategoryId).queryOne();
- parameters.SEARCH_CATEGORY_ID = productCategoryId;
+ context.productCategory = from("ProductCategory").where("productCategoryId", productCategoryId).queryOne()
+ parameters.SEARCH_CATEGORY_ID = productCategoryId
}
if (!parameters.clearSearch || !"N".equals(parameters.clearSearch)) {
- ProductSearchSession.searchClear(session);
+ ProductSearchSession.searchClear(session)
}
-ProductSearchSession.processSearchParameters(parameters, request);
-prodCatalogId = CatalogWorker.getCurrentCatalogId(request);
-result = ProductSearchSession.getProductSearchResult(request, delegator, prodCatalogId);
+ProductSearchSession.processSearchParameters(parameters, request)
+prodCatalogId = CatalogWorker.getCurrentCatalogId(request)
+result = ProductSearchSession.getProductSearchResult(request, delegator, prodCatalogId)
-context.index = ProductSearchSession.getCategoryCostraintIndex(session);
+context.index = ProductSearchSession.getCategoryCostraintIndex(session)
-searchConstraintList = ProductSearchSession.getProductSearchOptions(session).getConstraintList();
+searchConstraintList = ProductSearchSession.getProductSearchOptions(session).getConstraintList()
if (searchCategoryId) {
- productCategoryRollups = from("ProductCategoryRollup").where("productCategoryId", searchCategoryId).filterByDate().queryList();
- previousCategoryId = null;
+ productCategoryRollups = from("ProductCategoryRollup").where("productCategoryId", searchCategoryId).filterByDate().queryList()
+ previousCategoryId = null
if (productCategoryRollups) {
for (categoryRollup in productCategoryRollups) {
- categoryConstraint = new ProductSearch.CategoryConstraint(categoryRollup.parentProductCategoryId, true, false);
+ categoryConstraint = new ProductSearch.CategoryConstraint(categoryRollup.parentProductCategoryId, true, false)
if (searchConstraintList.contains(categoryConstraint)) {
- previousCategoryId = categoryRollup.parentProductCategoryId;
- context.previousCategoryId = previousCategoryId;
+ previousCategoryId = categoryRollup.parentProductCategoryId
+ context.previousCategoryId = previousCategoryId
}
}
}
}
-context.showSubCats = true;
+context.showSubCats = true
if (subCategoryList) {
- thisSubCategoryList = [];
+ thisSubCategoryList = []
subCategoryList.each { subCategory ->
- categoryCount = ProductSearchSession.getCountForProductCategory(subCategory.productCategoryId, session, delegator);
+ categoryCount = ProductSearchSession.getCountForProductCategory(subCategory.productCategoryId, session, delegator)
if (categoryCount > 0) {
- subCategoryContentWrapper = new CategoryContentWrapper(subCategory, request);
- thisSubCategoryList.add([productCategoryId: subCategory.productCategoryId, categoryName: subCategory.categoryName, count: categoryCount, categoryContentWrapper: subCategoryContentWrapper]);
+ subCategoryContentWrapper = new CategoryContentWrapper(subCategory, request)
+ thisSubCategoryList.add([productCategoryId: subCategory.productCategoryId, categoryName: subCategory.categoryName, count: categoryCount, categoryContentWrapper: subCategoryContentWrapper])
}
}
if (thisSubCategoryList) {
- context.subCategoryList = thisSubCategoryList;
+ context.subCategoryList = thisSubCategoryList
} else {
- context.showSubCats = false;
+ context.showSubCats = false
}
} else {
- context.showSubCats = false;
+ context.showSubCats = false
}
-context.showColors = true;
-colors = ProductSearchSession.listCountByFeatureForType("COLOR", session, delegator);
-colorFeatureType = from("ProductFeatureType").where("productFeatureTypeId", "COLOR").queryOne();
+context.showColors = true
+colors = ProductSearchSession.listCountByFeatureForType("COLOR", session, delegator)
+colorFeatureType = from("ProductFeatureType").where("productFeatureTypeId", "COLOR").queryOne()
if (colors) {
colors.each { color ->
- featureConstraint = new ProductSearch.FeatureConstraint(color.productFeatureId, false);
+ featureConstraint = new ProductSearch.FeatureConstraint(color.productFeatureId, false)
if (searchConstraintList.contains(featureConstraint)) {
- context.showColors=false;
+ context.showColors=false
}
}
} else {
- context.showColors = false;
+ context.showColors = false
}
if (context.showColors) {
- context.colors = colors;
- context.colorFeatureType = colorFeatureType;
+ context.colors = colors
+ context.colorFeatureType = colorFeatureType
}
-availablePriceRangeList = [[low: "0", high: "10"], [low: "10", high: "20"], [low: "20", high: "30"], [low: "30", high: "40"], [low: "40", high: "50"], [low: "50", high: "60"], [low: "60", high: "70"], [low: "70", high: "80"], [low: "80", high: "90"], [low: "90", high: "100"]];
-priceRangeList = [];
-context.showPriceRange = true;
+availablePriceRangeList = [[low: "0", high: "10"], [low: "10", high: "20"], [low: "20", high: "30"], [low: "30", high: "40"], [low: "40", high: "50"], [low: "50", high: "60"], [low: "60", high: "70"], [low: "70", high: "80"], [low: "80", high: "90"], [low: "90", high: "100"]]
+priceRangeList = []
+context.showPriceRange = true
availablePriceRangeList.each { priceRange ->
- priceRangeConstraint = new ProductSearch.ListPriceRangeConstraint(new BigDecimal(priceRange.low), new BigDecimal(priceRange.high), UtilHttp.getCurrencyUom(request));
+ priceRangeConstraint = new ProductSearch.ListPriceRangeConstraint(new BigDecimal(priceRange.low), new BigDecimal(priceRange.high), UtilHttp.getCurrencyUom(request))
if (searchConstraintList.contains(priceRangeConstraint)) {
- context.showPriceRange = false;
+ context.showPriceRange = false
} else {
- priceRangeCount = ProductSearchSession.getCountForListPriceRange(new BigDecimal(priceRange.low), new BigDecimal(priceRange.high), session, delegator);
+ priceRangeCount = ProductSearchSession.getCountForListPriceRange(new BigDecimal(priceRange.low), new BigDecimal(priceRange.high), session, delegator)
if (priceRangeCount != 0) {
- priceRangeList.add([low: priceRange.low, high: priceRange.high, count: priceRangeCount]);
+ priceRangeList.add([low: priceRange.low, high: priceRange.high, count: priceRangeCount])
}
}
}
if (!priceRangeList) {
- context.showPriceRange = false;
+ context.showPriceRange = false
}
if (context.showPriceRange) {
- context.priceRangeList = priceRangeList;
+ context.priceRangeList = priceRangeList
}
-context.productIds = result.productIds;
-context.viewIndex = result.viewIndex;
-context.viewSize = result.viewSize;
-context.listSize = result.listSize;
-context.lowIndex = result.lowIndex;
-context.highIndex = result.highIndex;
-context.paging = result.paging;
-context.previousViewSize = result.previousViewSize;
-context.searchConstraintStrings = result.searchConstraintStrings;
+context.productIds = result.productIds
+context.viewIndex = result.viewIndex
+context.viewSize = result.viewSize
+context.listSize = result.listSize
+context.lowIndex = result.lowIndex
+context.highIndex = result.highIndex
+context.paging = result.paging
+context.previousViewSize = result.previousViewSize
+context.searchConstraintStrings = result.searchConstraintStrings
diff --git a/specialpurpose/ecommerce/groovyScripts/catalog/MiniProductSummary.groovy b/specialpurpose/ecommerce/groovyScripts/catalog/MiniProductSummary.groovy
index 491f348ca1..193ba2cc4d 100644
--- a/specialpurpose/ecommerce/groovyScripts/catalog/MiniProductSummary.groovy
+++ b/specialpurpose/ecommerce/groovyScripts/catalog/MiniProductSummary.groovy
@@ -17,29 +17,29 @@
* under the License.
*/
-import java.math.BigDecimal;
-import java.util.Map;
+import java.math.BigDecimal
+import java.util.Map
-import org.apache.ofbiz.base.util.*;
-import org.apache.ofbiz.entity.*;
-import org.apache.ofbiz.service.*;
-import org.apache.ofbiz.product.product.ProductContentWrapper;
-import org.apache.ofbiz.product.config.ProductConfigWorker;
-import org.apache.ofbiz.product.catalog.*;
-import org.apache.ofbiz.product.store.*;
-import org.apache.ofbiz.order.shoppingcart.*;
-import org.apache.ofbiz.webapp.website.WebSiteWorker;
+import org.apache.ofbiz.base.util.*
+import org.apache.ofbiz.entity.*
+import org.apache.ofbiz.service.*
+import org.apache.ofbiz.product.product.ProductContentWrapper
+import org.apache.ofbiz.product.config.ProductConfigWorker
+import org.apache.ofbiz.product.catalog.*
+import org.apache.ofbiz.product.store.*
+import org.apache.ofbiz.order.shoppingcart.*
+import org.apache.ofbiz.webapp.website.WebSiteWorker
-miniProduct = request.getAttribute("miniProduct");
-optProductId = request.getAttribute("optProductId");
-webSiteId = WebSiteWorker.getWebSiteId(request);
-prodCatalogId = CatalogWorker.getCurrentCatalogId(request);
-productStoreId = ProductStoreWorker.getProductStoreId(request);
-cart = ShoppingCartEvents.getCartObject(request);
-context.remove("totalPrice");
+miniProduct = request.getAttribute("miniProduct")
+optProductId = request.getAttribute("optProductId")
+webSiteId = WebSiteWorker.getWebSiteId(request)
+prodCatalogId = CatalogWorker.getCurrentCatalogId(request)
+productStoreId = ProductStoreWorker.getProductStoreId(request)
+cart = ShoppingCartEvents.getCartObject(request)
+context.remove("totalPrice")
if (optProductId) {
- miniProduct = from("Product").where("productId", optProductId).queryOne();
+ miniProduct = from("Product").where("productId", optProductId).queryOne()
}
if (miniProduct && productStoreId && prodCatalogId ) {
@@ -49,43 +49,43 @@ if (miniProduct && productStoreId && prodCatalogId ) {
webSiteId : webSiteId,
currencyUomId : cart.getCurrency(),
autoUserLogin : autoUserLogin,
- productStoreId : productStoreId];
- if (userLogin) priceParams.partyId = userLogin.partyId;
- priceResult = runService('calculateProductPrice', priceParams);
+ productStoreId : productStoreId]
+ if (userLogin) priceParams.partyId = userLogin.partyId
+ priceResult = runService('calculateProductPrice', priceParams)
// returns: isSale, price, orderItemPriceInfos
- context.priceResult = priceResult;
+ context.priceResult = priceResult
// Check if Price has to be displayed with tax
if (productStore.get("showPricesWithVatTax").equals("Y")) {
- Map priceMap = runServic('calcTaxForDisplay', ["basePrice": priceResult.get("price"), "locale": locale, "productId": optProductId, "productStoreId": productStoreId]);
- context.price = priceMap.get("priceWithTax");
+ Map priceMap = runServic('calcTaxForDisplay', ["basePrice": priceResult.get("price"), "locale": locale, "productId": optProductId, "productStoreId": productStoreId])
+ context.price = priceMap.get("priceWithTax")
} else {
- context.price = priceResult.get("price");
+ context.price = priceResult.get("price")
}
// get aggregated product totalPrice
if ("AGGREGATED".equals(miniProduct.productTypeId) || "AGGREGATED_SERVICE".equals(miniProduct.productTypeId)) {
- configWrapper = ProductConfigWorker.getProductConfigWrapper(optProductId, cart.getCurrency(), request);
+ configWrapper = ProductConfigWorker.getProductConfigWrapper(optProductId, cart.getCurrency(), request)
if (configWrapper) {
- configWrapper.setDefaultConfig();
+ configWrapper.setDefaultConfig()
// Check if Config Price has to be displayed with tax
if (productStore.get("showPricesWithVatTax").equals("Y")) {
- BigDecimal totalPriceNoTax = configWrapper.getTotalPrice();
- Map totalPriceMap = runService('calcTaxForDisplay', ["basePrice": totalPriceNoTax, "locale": locale, "productId": optProductId, "productStoreId": productStoreId]);
- context.totalPrice = totalPriceMap.get("priceWithTax");
+ BigDecimal totalPriceNoTax = configWrapper.getTotalPrice()
+ Map totalPriceMap = runService('calcTaxForDisplay', ["basePrice": totalPriceNoTax, "locale": locale, "productId": optProductId, "productStoreId": productStoreId])
+ context.totalPrice = totalPriceMap.get("priceWithTax")
} else {
- context.totalPrice = configWrapper.getTotalPrice();
+ context.totalPrice = configWrapper.getTotalPrice()
}
}
}
- context.miniProduct = miniProduct;
- context.nowTimeLong = nowTimestamp.getTime();
+ context.miniProduct = miniProduct
+ context.nowTimeLong = nowTimestamp.getTime()
- context.miniProdFormName = request.getAttribute("miniProdFormName");
- context.miniProdQuantity = request.getAttribute("miniProdQuantity");
+ context.miniProdFormName = request.getAttribute("miniProdFormName")
+ context.miniProdQuantity = request.getAttribute("miniProdQuantity")
// make the miniProductContentWrapper
- ProductContentWrapper miniProductContentWrapper = new ProductContentWrapper(miniProduct, request);
- context.miniProductContentWrapper = miniProductContentWrapper;
+ ProductContentWrapper miniProductContentWrapper = new ProductContentWrapper(miniProduct, request)
+ context.miniProductContentWrapper = miniProductContentWrapper
}
diff --git a/specialpurpose/ecommerce/groovyScripts/catalog/MiniReorderProds.groovy b/specialpurpose/ecommerce/groovyScripts/catalog/MiniReorderProds.groovy
index b00571ac3c..4049b8246c 100644
--- a/specialpurpose/ecommerce/groovyScripts/catalog/MiniReorderProds.groovy
+++ b/specialpurpose/ecommerce/groovyScripts/catalog/MiniReorderProds.groovy
@@ -17,8 +17,8 @@
* under the License.
*/
-import org.apache.ofbiz.order.shoppingcart.product.ProductDisplayWorker;
+import org.apache.ofbiz.order.shoppingcart.product.ProductDisplayWorker
-reorderProductResults = ProductDisplayWorker.getQuickReorderProducts(request);
-context.reorderProducts = reorderProductResults.products;
-context.reorderQuantities = reorderProductResults.quantities;
+reorderProductResults = ProductDisplayWorker.getQuickReorderProducts(request)
+context.reorderProducts = reorderProductResults.products
+context.reorderQuantities = reorderProductResults.quantities
diff --git a/specialpurpose/ecommerce/groovyScripts/catalog/PopularTags.groovy b/specialpurpose/ecommerce/groovyScripts/catalog/PopularTags.groovy
index 1f02b96174..046bf61831 100644
--- a/specialpurpose/ecommerce/groovyScripts/catalog/PopularTags.groovy
+++ b/specialpurpose/ecommerce/groovyScripts/catalog/PopularTags.groovy
@@ -17,66 +17,66 @@
* under the License.
*/
-import java.util.List;
-import org.apache.ofbiz.entity.*;
-import org.apache.ofbiz.entity.condition.*;
-import org.apache.ofbiz.entity.util.*;
-import org.apache.ofbiz.entity.util.EntityUtil;
+import java.util.List
+import org.apache.ofbiz.entity.*
+import org.apache.ofbiz.entity.condition.*
+import org.apache.ofbiz.entity.util.*
+import org.apache.ofbiz.entity.util.EntityUtil
import org.apache.ofbiz.entity.transaction.*
-import org.apache.ofbiz.base.util.*;
-import org.apache.ofbiz.base.util.string.*;
-import org.apache.ofbiz.content.content.*;
-import org.apache.commons.lang.StringEscapeUtils;
-import org.apache.ofbiz.entity.util.EntityUtilProperties;
+import org.apache.ofbiz.base.util.*
+import org.apache.ofbiz.base.util.string.*
+import org.apache.ofbiz.content.content.*
+import org.apache.commons.lang.StringEscapeUtils
+import org.apache.ofbiz.entity.util.EntityUtilProperties
-int minFontSize = EntityUtilProperties.getPropertyAsInteger("ecommerce", "tagcloud.min.fontsize", 0).intValue();
-int maxFontSize = EntityUtilProperties.getPropertyAsInteger("ecommerce", "tagcloud.max.fontsize", 0).intValue();
-int limitTagCloud = EntityUtilProperties.getPropertyAsInteger("ecommerce", "tagcloud.limit", 0).intValue();
+int minFontSize = EntityUtilProperties.getPropertyAsInteger("ecommerce", "tagcloud.min.fontsize", 0).intValue()
+int maxFontSize = EntityUtilProperties.getPropertyAsInteger("ecommerce", "tagcloud.max.fontsize", 0).intValue()
+int limitTagCloud = EntityUtilProperties.getPropertyAsInteger("ecommerce", "tagcloud.limit", 0).intValue()
-tagCloudList = [] as LinkedList;
-tagList = [] as LinkedList;
+tagCloudList = [] as LinkedList
+tagList = [] as LinkedList
productKeywords = select("keyword", "keywordTypeId", "statusId")
.from("ProductKeyword")
.where(keywordTypeId : "KWT_TAG", statusId : "KW_APPROVED")
.orderBy("keyword")
.distinct(true)
- .queryList();
+ .queryList()
if (UtilValidate.isNotEmpty(productKeywords)) {
productKeywords.each { productKeyword ->
- productTags = from("ProductKeyword").where("keyword", productKeyword.keyword, "keywordTypeId", "KWT_TAG", "statusId", "KW_APPROVED").queryList();
- searchResult = [:];
- searchResult.tag = productKeyword.keyword;
- searchResult.countTag = productTags.size();
- tagList.add(searchResult);
+ productTags = from("ProductKeyword").where("keyword", productKeyword.keyword, "keywordTypeId", "KWT_TAG", "statusId", "KW_APPROVED").queryList()
+ searchResult = [:]
+ searchResult.tag = productKeyword.keyword
+ searchResult.countTag = productTags.size()
+ tagList.add(searchResult)
}
}
if (tagList) {
- int tag = 0;
- tagList.sort{ a,b -> b.countTag <=> a.countTag };
+ int tag = 0
+ tagList.sort{ a,b -> b.countTag <=> a.countTag }
if (tagList.size() < limitTagCloud) {
- limitTagCloud = tagList.size();
+ limitTagCloud = tagList.size()
}
- int maxResult = tagList[0].countTag;
- int minResult = tagList[limitTagCloud - 1].countTag;
+ int maxResult = tagList[0].countTag
+ int minResult = tagList[limitTagCloud - 1].countTag
tagList.each { tagCloud ->
if (tag < limitTagCloud) {
- tagCloudOfbizInfo = [:];
- double weight = 0;
+ tagCloudOfbizInfo = [:]
+ double weight = 0
if ((maxResult - minResult) > 0) {
- weight = (tagCloud.countTag - minResult) / (maxResult - minResult);
+ weight = (tagCloud.countTag - minResult) / (maxResult - minResult)
}
- double fontSize = minFontSize + ((maxFontSize - minFontSize) * weight);
- tagCloudOfbizInfo.tag = tagCloud.tag;
- tagCloudOfbizInfo.fontSize = fontSize;
- tagCloudList.add(tagCloudOfbizInfo);
- tag++;
+ double fontSize = minFontSize + ((maxFontSize - minFontSize) * weight)
+ tagCloudOfbizInfo.tag = tagCloud.tag
+ tagCloudOfbizInfo.fontSize = fontSize
+ tagCloudList.add(tagCloudOfbizInfo)
+ tag++
}
}
}
tagCloudList = tagCloudList.sort{it.tag}
-context.tagCloudList = tagCloudList;
+context.tagCloudList = tagCloudList
diff --git a/specialpurpose/ecommerce/groovyScripts/catalog/ProductCategories.groovy b/specialpurpose/ecommerce/groovyScripts/catalog/ProductCategories.groovy
index 3dbaf3097b..e2002c83db 100644
--- a/specialpurpose/ecommerce/groovyScripts/catalog/ProductCategories.groovy
+++ b/specialpurpose/ecommerce/groovyScripts/catalog/ProductCategories.groovy
@@ -21,74 +21,74 @@
* This script is also referenced by the ecommerce's screens and
* should not contain order component's specific code.
*/
-import org.apache.ofbiz.entity.util.EntityUtil;
+import org.apache.ofbiz.entity.util.EntityUtil
-import org.apache.ofbiz.base.util.*;
-import org.apache.ofbiz.product.catalog.*;
-import org.apache.ofbiz.product.category.*;
-import org.apache.ofbiz.entity.*;
+import org.apache.ofbiz.base.util.*
+import org.apache.ofbiz.product.catalog.*
+import org.apache.ofbiz.product.category.*
+import org.apache.ofbiz.entity.*
List fillTree(rootCat ,CatLvl, parentCategoryId) {
if(rootCat) {
rootCat.sort{ it.productCategoryId }
- def listTree = [];
+ def listTree = []
for(root in rootCat) {
- preCatChilds = from("ProductCategoryRollup").where("parentProductCategoryId", root.productCategoryId).queryList();
- catChilds = EntityUtil.getRelated("CurrentProductCategory",null,preCatChilds,false);
- def childList = [];
+ preCatChilds = from("ProductCategoryRollup").where("parentProductCategoryId", root.productCategoryId).queryList()
+ catChilds = EntityUtil.getRelated("CurrentProductCategory",null,preCatChilds,false)
+ def childList = []
// CatLvl uses for identify the Category level for display different css class
if(catChilds) {
if(CatLvl==2)
- childList = fillTree(catChilds,CatLvl+1, parentCategoryId.replaceAll("/", "")+'/'+root.productCategoryId);
+ childList = fillTree(catChilds,CatLvl+1, parentCategoryId.replaceAll("/", "")+'/'+root.productCategoryId)
// replaceAll and '/' uses for fix bug in the breadcrum for href of category
else if(CatLvl==1)
- childList = fillTree(catChilds,CatLvl+1, parentCategoryId.replaceAll("/", "")+root.productCategoryId);
+ childList = fillTree(catChilds,CatLvl+1, parentCategoryId.replaceAll("/", "")+root.productCategoryId)
else
- childList = fillTree(catChilds,CatLvl+1, parentCategoryId+'/'+root.productCategoryId);
+ childList = fillTree(catChilds,CatLvl+1, parentCategoryId+'/'+root.productCategoryId)
}
- productsInCat = from("ProductCategoryAndMember").where("productCategoryId", root.productCategoryId).queryList();
+ productsInCat = from("ProductCategoryAndMember").where("productCategoryId", root.productCategoryId).queryList()
// Display the category if this category containing products or contain the category that's containing products
if(productsInCat || childList) {
- def rootMap = [:];
- category = from("ProductCategory").where("productCategoryId", root.productCategoryId).queryOne();
- categoryContentWrapper = new CategoryContentWrapper(category, request);
- context.title = categoryContentWrapper.get("CATEGORY_NAME", "html");
- categoryDescription = categoryContentWrapper.get("DESCRIPTION", "html");
+ def rootMap = [:]
+ category = from("ProductCategory").where("productCategoryId", root.productCategoryId).queryOne()
+ categoryContentWrapper = new CategoryContentWrapper(category, request)
+ context.title = categoryContentWrapper.get("CATEGORY_NAME", "html")
+ categoryDescription = categoryContentWrapper.get("DESCRIPTION", "html")
if(categoryContentWrapper.get("CATEGORY_NAME", "html").toString())
- rootMap["categoryName"] = categoryContentWrapper.get("CATEGORY_NAME", "html");
+ rootMap["categoryName"] = categoryContentWrapper.get("CATEGORY_NAME", "html")
else
- rootMap["categoryName"] = root.categoryName;
+ rootMap["categoryName"] = root.categoryName
if(categoryContentWrapper.get("DESCRIPTION", "html").toString())
- rootMap["categoryDescription"] = categoryContentWrapper.get("DESCRIPTION", "html");
+ rootMap["categoryDescription"] = categoryContentWrapper.get("DESCRIPTION", "html")
else
- rootMap["categoryDescription"] = root.description;
+ rootMap["categoryDescription"] = root.description
- rootMap["productCategoryId"] = root.productCategoryId;
- rootMap["parentCategoryId"] = parentCategoryId;
- rootMap["child"] = childList;
+ rootMap["productCategoryId"] = root.productCategoryId
+ rootMap["parentCategoryId"] = parentCategoryId
+ rootMap["child"] = childList
- listTree.add(rootMap);
+ listTree.add(rootMap)
}
}
- return listTree;
+ return listTree
}
}
-CategoryWorker.getRelatedCategories(request, "topLevelList", CatalogWorker.getCatalogTopCategoryId(request, CatalogWorker.getCurrentCatalogId(request)), true);
-curCategoryId = parameters.category_id ?: parameters.CATEGORY_ID ?: "";
-request.setAttribute("curCategoryId", curCategoryId);
-CategoryWorker.setTrail(request, curCategoryId);
+CategoryWorker.getRelatedCategories(request, "topLevelList", CatalogWorker.getCatalogTopCategoryId(request, CatalogWorker.getCurrentCatalogId(request)), true)
+curCategoryId = parameters.category_id ?: parameters.CATEGORY_ID ?: ""
+request.setAttribute("curCategoryId", curCategoryId)
+CategoryWorker.setTrail(request, curCategoryId)
-categoryList = request.getAttribute("topLevelList");
+categoryList = request.getAttribute("topLevelList")
if (categoryList) {
- catContentWrappers = [:];
- CategoryWorker.getCategoryContentWrappers(catContentWrappers, categoryList, request);
- context.catContentWrappers = catContentWrappers;
- completedTree = fillTree(categoryList, 1, "");
- context.completedTree = completedTree;
+ catContentWrappers = [:]
+ CategoryWorker.getCategoryContentWrappers(catContentWrappers, categoryList, request)
+ context.catContentWrappers = catContentWrappers
+ completedTree = fillTree(categoryList, 1, "")
+ context.completedTree = completedTree
}
diff --git a/specialpurpose/ecommerce/groovyScripts/content/AdvancedSearchPrep.groovy b/specialpurpose/ecommerce/groovyScripts/content/AdvancedSearchPrep.groovy
index 486c9c3081..dc5a815d02 100644
--- a/specialpurpose/ecommerce/groovyScripts/content/AdvancedSearchPrep.groovy
+++ b/specialpurpose/ecommerce/groovyScripts/content/AdvancedSearchPrep.groovy
@@ -17,24 +17,24 @@
* under the License.
*/
-import org.apache.ofbiz.base.util.*;
-import org.apache.ofbiz.product.catalog.*;
-import org.apache.ofbiz.product.feature.*;
-import org.apache.ofbiz.product.product.*;
+import org.apache.ofbiz.base.util.*
+import org.apache.ofbiz.product.catalog.*
+import org.apache.ofbiz.product.feature.*
+import org.apache.ofbiz.product.product.*
-productFeaturesByTypeMap = ParametricSearch.getAllFeaturesByType(delegator, 2000);
-productFeatureTypeIdsOrdered = new ArrayList(new TreeSet(productFeaturesByTypeMap.keySet()));
+productFeaturesByTypeMap = ParametricSearch.getAllFeaturesByType(delegator, 2000)
+productFeatureTypeIdsOrdered = new ArrayList(new TreeSet(productFeaturesByTypeMap.keySet()))
-searchOperator = parameters.SEARCH_OPERATOR;
+searchOperator = parameters.SEARCH_OPERATOR
if (!"AND".equals(searchOperator) && !"OR".equals(searchOperator)) {
- searchOperator = "OR";
+ searchOperator = "OR"
}
-searchConstraintStrings = ProductSearchSession.searchGetConstraintStrings(false, session, delegator);
-searchSortOrderString = ProductSearchSession.searchGetSortOrderString(false, request);
+searchConstraintStrings = ProductSearchSession.searchGetConstraintStrings(false, session, delegator)
+searchSortOrderString = ProductSearchSession.searchGetSortOrderString(false, request)
-context.productFeaturesByTypeMap = productFeaturesByTypeMap;
-context.productFeatureTypeIdsOrdered = productFeatureTypeIdsOrdered;
-context.searchOperator = searchOperator;
-context.searchConstraintStrings = searchConstraintStrings;
-context.searchSortOrderString = searchSortOrderString;
+context.productFeaturesByTypeMap = productFeaturesByTypeMap
+context.productFeatureTypeIdsOrdered = productFeatureTypeIdsOrdered
+context.searchOperator = searchOperator
+context.searchConstraintStrings = searchConstraintStrings
+context.searchSortOrderString = searchSortOrderString
diff --git a/specialpurpose/ecommerce/groovyScripts/content/ContentPrep.groovy b/specialpurpose/ecommerce/groovyScripts/content/ContentPrep.groovy
index 76d74fe84d..8db7488aeb 100644
--- a/specialpurpose/ecommerce/groovyScripts/content/ContentPrep.groovy
+++ b/specialpurpose/ecommerce/groovyScripts/content/ContentPrep.groovy
@@ -17,4 +17,4 @@
* under the License.
*/
-context.contentId = parameters.cid ?: parameters.contentId;
+context.contentId = parameters.cid ?: parameters.contentId
diff --git a/specialpurpose/ecommerce/groovyScripts/content/Mrv.groovy b/specialpurpose/ecommerce/groovyScripts/content/Mrv.groovy
index 408d4ab811..ba25fd1d6a 100644
--- a/specialpurpose/ecommerce/groovyScripts/content/Mrv.groovy
+++ b/specialpurpose/ecommerce/groovyScripts/content/Mrv.groovy
@@ -17,54 +17,54 @@
* under the License.
*/
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.TreeSet;
+import java.util.ArrayList
+import java.util.Collection
+import java.util.HashMap
+import java.util.Iterator
+import java.util.LinkedList
+import java.util.List
+import java.util.Map
+import java.util.Set
+import java.util.TreeSet
-import org.apache.ofbiz.base.util.*;
-import org.apache.ofbiz.entity.*;
-import org.apache.ofbiz.security.*;
-import org.apache.ofbiz.service.*;
-import org.apache.ofbiz.entity.model.*;
-import org.apache.ofbiz.base.util.collections.LifoSet;
+import org.apache.ofbiz.base.util.*
+import org.apache.ofbiz.entity.*
+import org.apache.ofbiz.security.*
+import org.apache.ofbiz.service.*
+import org.apache.ofbiz.entity.model.*
+import org.apache.ofbiz.base.util.collections.LifoSet
-import javax.servlet.*;
-import javax.servlet.http.*;
+import javax.servlet.*
+import javax.servlet.http.*
-entityName = "ContentDataResourceView";
-lookupCaches = session.getAttribute("lookupCaches");
+entityName = "ContentDataResourceView"
+lookupCaches = session.getAttribute("lookupCaches")
if (!lookupCaches) {
- lookupCaches = [:];
- session.setAttribute("lookupCaches", lookupCaches);
+ lookupCaches = [:]
+ session.setAttribute("lookupCaches", lookupCaches)
}
-lifoSet = lookupCaches[entityName];
+lifoSet = lookupCaches[entityName]
if (!lifoSet) {
- lifoSet = new LifoSet(10);
- lookupCaches.ContentAssocDataResourceViewFrom = lifoSet;
+ lifoSet = new LifoSet(10)
+ lookupCaches.ContentAssocDataResourceViewFrom = lifoSet
}
-sz = lifoSet.size();
-contentIdKey = null;
-mrvList = [];
+sz = lifoSet.size()
+contentIdKey = null
+mrvList = []
lifoSet.each { pk0 ->
- pk = pk0.getPrimaryKey();
- gv = from(pk.getEntityName()).where(pk).cache(true).queryOne();
+ pk = pk0.getPrimaryKey()
+ gv = from(pk.getEntityName()).where(pk).cache(true).queryOne()
if (gv) {
- arr = [gv.contentId, gv.contentName] as String[];
- mrvList.add(arr);
+ arr = [gv.contentId, gv.contentName] as String[]
+ mrvList.add(arr)
} else {
// should handle errors in some other way; this does not provide any tracing; impossible to locat
// where the error actually occurred
- //Debug.logError("findOne on " + pk + " returned null");
+ //Debug.logError("findOne on " + pk + " returned null")
}
}
-context.put("mrvList", mrvList);
+context.put("mrvList", mrvList)
diff --git a/specialpurpose/ecommerce/groovyScripts/content/Search.groovy b/specialpurpose/ecommerce/groovyScripts/content/Search.groovy
index ae351c12d8..c78c544bcc 100644
--- a/specialpurpose/ecommerce/groovyScripts/content/Search.groovy
+++ b/specialpurpose/ecommerce/groovyScripts/content/Search.groovy
@@ -31,74 +31,74 @@ import org.apache.lucene.search.*
import org.apache.lucene.index.DirectoryReader
import org.apache.lucene.store.Directory
-paramMap = UtilHttp.getParameterMap(request);
-queryLine = paramMap.queryLine.toString();
-//Debug.logInfo("in search, queryLine:" + queryLine, "");
+paramMap = UtilHttp.getParameterMap(request)
+queryLine = paramMap.queryLine.toString()
+//Debug.logInfo("in search, queryLine:" + queryLine, "")
-siteId = paramMap.siteId ?: "WebStoreCONTENT";
-//Debug.logInfo("in search, siteId:" + siteId, "");
-featureIdByType = ParametricSearch.makeFeatureIdByTypeMap(paramMap);
-//Debug.logInfo("in search, featureIdByType:" + featureIdByType, "");
+siteId = paramMap.siteId ?: "WebStoreCONTENT"
+//Debug.logInfo("in search, siteId:" + siteId, "")
+featureIdByType = ParametricSearch.makeFeatureIdByTypeMap(paramMap)
+//Debug.logInfo("in search, featureIdByType:" + featureIdByType, "")
-combQuery = new BooleanQuery();
-Directory directory = FSDirectory.open(new File(SearchWorker.getIndexPath("content")).toPath());
-DirectoryReader reader = DirectoryReader.open(directory);
-IndexSearcher searcher = null;
-Analyzer analyzer = null;
+combQuery = new BooleanQuery()
+Directory directory = FSDirectory.open(new File(SearchWorker.getIndexPath("content")).toPath())
+DirectoryReader reader = DirectoryReader.open(directory)
+IndexSearcher searcher = null
+Analyzer analyzer = null
try {
- searcher = new IndexSearcher(reader);
- analyzer = new StandardAnalyzer();
+ searcher = new IndexSearcher(reader)
+ analyzer = new StandardAnalyzer()
} catch (java.io.FileNotFoundException e) {
- Debug.logError(e, "Search.groovy");
- request.setAttribute("errorMsgReq", "No index file exists.");
+ Debug.logError(e, "Search.groovy")
+ request.setAttribute("errorMsgReq", "No index file exists.")
}
-termQuery = new TermQuery(new Term("site", siteId.toString()));
-combQuery.add(termQuery, BooleanClause.Occur.MUST);
-//Debug.logInfo("in search, termQuery:" + termQuery.toString(), "");
+termQuery = new TermQuery(new Term("site", siteId.toString()))
+combQuery.add(termQuery, BooleanClause.Occur.MUST)
+//Debug.logInfo("in search, termQuery:" + termQuery.toString(), "")
-//Debug.logInfo("in search, combQuery(1):" + combQuery, "");
+//Debug.logInfo("in search, combQuery(1):" + combQuery, "")
if (queryLine && analyzer) {
- Query query = null;
- QueryParser parser = new QueryParser("content", analyzer);
- query = parser.parse(queryLine);
- combQuery.add(query, BooleanClause.Occur.MUST);
+ Query query = null
+ QueryParser parser = new QueryParser("content", analyzer)
+ query = parser.parse(queryLine)
+ combQuery.add(query, BooleanClause.Occur.MUST)
}
if (featureIdByType) {
- featureQuery = new BooleanQuery();
- featuresRequired = BooleanClause.Occur.MUST;
+ featureQuery = new BooleanQuery()
+ featuresRequired = BooleanClause.Occur.MUST
if ("any".equals(paramMap.anyOrAll)) {
- featuresRequired = BooleanClause.Occur.SHOULD;
+ featuresRequired = BooleanClause.Occur.SHOULD
}
if (featureIdByType) {
featureIdByType.each { key, value ->
- termQuery = new TermQuery(new Term("feature", value));
- featureQuery.add(termQuery, featuresRequired);
- //Debug.logInfo("in search searchFeature3, termQuery:" + termQuery.toString(), "");
+ termQuery = new TermQuery(new Term("feature", value))
+ featureQuery.add(termQuery, featuresRequired)
+ //Debug.logInfo("in search searchFeature3, termQuery:" + termQuery.toString(), "")
}
}
- combQuery.add(featureQuery, featuresRequired);
+ combQuery.add(featureQuery, featuresRequired)
}
if (searcher) {
- Debug.logInfo("in search searchFeature3, combQuery:" + combQuery.toString(), "");
- TopScoreDocCollector collector = TopScoreDocCollector.create(100); //defaulting to 100 results
- searcher.search(combQuery, collector);
- ScoreDoc[] hits = collector.topDocs().scoreDocs;
- Debug.logInfo("in search, hits:" + collector.getTotalHits(), "");
+ Debug.logInfo("in search searchFeature3, combQuery:" + combQuery.toString(), "")
+ TopScoreDocCollector collector = TopScoreDocCollector.create(100) //defaulting to 100 results
+ searcher.search(combQuery, collector)
+ ScoreDoc[] hits = collector.topDocs().scoreDocs
+ Debug.logInfo("in search, hits:" + collector.getTotalHits(), "")
- contentList = [] as ArrayList;
- hitSet = [:] as HashSet;
+ contentList = [] as ArrayList
+ hitSet = [:] as HashSet
for (int start = 0; start < collector.getTotalHits(); start++) {
Document doc = searcher.doc(hits[start].doc)
- contentId = doc.get("contentId");
- content = from("Content").where("contentId", contentId).cache(true).queryOne();
+ contentId = doc.get("contentId")
+ content = from("Content").where("contentId", contentId).cache(true).queryOne()
if (!hitSet.contains(contentId)) {
- contentList.add(content);
- hitSet.add(contentId);
+ contentList.add(content)
+ hitSet.add(contentId)
}
}
- context.queryResults = contentList;
+ context.queryResults = contentList
}
diff --git a/specialpurpose/ecommerce/groovyScripts/customer/ChangePassword.groovy b/specialpurpose/ecommerce/groovyScripts/customer/ChangePassword.groovy
index 6785dcb1bc..2e34902316 100644
--- a/specialpurpose/ecommerce/groovyScripts/customer/ChangePassword.groovy
+++ b/specialpurpose/ecommerce/groovyScripts/customer/ChangePassword.groovy
@@ -17,21 +17,21 @@
* under the License.
*/
-import java.util.HashMap;
-import org.apache.ofbiz.base.util.UtilHttp;
+import java.util.HashMap
+import org.apache.ofbiz.base.util.UtilHttp
-tryEntity = true;
-errorMessage = parameters._ERROR_MESSAGE_;
+tryEntity = true
+errorMessage = parameters._ERROR_MESSAGE_
if (errorMessage) {
- tryEntity = false;
+ tryEntity = false
}
-donePage = parameters.DONE_PAGE ?: "viewprofile";
+donePage = parameters.DONE_PAGE ?: "viewprofile"
-userLoginData = userLogin;
-if (!tryEntity) userLoginData = UtilHttp.getParameterMap(request);
-if (!userLoginData) userLoginData = [:];
+userLoginData = userLogin
+if (!tryEntity) userLoginData = UtilHttp.getParameterMap(request)
+if (!userLoginData) userLoginData = [:]
-context.donePage = donePage;
-context.userLoginData = userLoginData;
+context.donePage = donePage
+context.userLoginData = userLoginData
diff --git a/specialpurpose/ecommerce/groovyScripts/customer/ContactList.groovy b/specialpurpose/ecommerce/groovyScripts/customer/ContactList.groovy
index 59d9f4e875..b4f36489fb 100644
--- a/specialpurpose/ecommerce/groovyScripts/customer/ContactList.groovy
+++ b/specialpurpose/ecommerce/groovyScripts/customer/ContactList.groovy
@@ -17,44 +17,44 @@
* under the License.
*/
-import java.lang.*;
-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.party.contact.ContactMechWorker;
-import org.apache.ofbiz.product.store.ProductStoreWorker;
-import org.apache.ofbiz.webapp.website.WebSiteWorker;
-import org.apache.ofbiz.accounting.payment.PaymentWorker;
+import java.lang.*
+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.party.contact.ContactMechWorker
+import org.apache.ofbiz.product.store.ProductStoreWorker
+import org.apache.ofbiz.webapp.website.WebSiteWorker
+import org.apache.ofbiz.accounting.payment.PaymentWorker
-/*publicEmailContactLists = delegator.findByAnd("ContactList", [isPublic : "Y", contactMechTypeId : "EMAIL_ADDRESS"], ["contactListName"], false);
+/*publicEmailContactLists = delegator.findByAnd("ContactList", [isPublic : "Y", contactMechTypeId : "EMAIL_ADDRESS"], ["contactListName"], false)
context.publicEmailContactLists = publicEmailContactLists;*/
-webSiteId = WebSiteWorker.getWebSiteId(request);
-exprList = [];
-exprListThruDate = [];
-exprList.add(EntityCondition.makeCondition("webSiteId", EntityOperator.EQUALS, webSiteId));
-exprListThruDate.add(EntityCondition.makeCondition("thruDate", EntityOperator.EQUALS, null));
-exprListThruDate.add(EntityCondition.makeCondition("thruDate", EntityOperator.GREATER_THAN_EQUAL_TO, UtilDateTime.nowTimestamp()));
-orCond = EntityCondition.makeCondition(exprListThruDate, EntityOperator.OR);
-exprList.add(orCond);
-webSiteContactList = from("WebSiteContactList").where(exprList).queryList();
+webSiteId = WebSiteWorker.getWebSiteId(request)
+exprList = []
+exprListThruDate = []
+exprList.add(EntityCondition.makeCondition("webSiteId", EntityOperator.EQUALS, webSiteId))
+exprListThruDate.add(EntityCondition.makeCondition("thruDate", EntityOperator.EQUALS, null))
+exprListThruDate.add(EntityCondition.makeCondition("thruDate", EntityOperator.GREATER_THAN_EQUAL_TO, UtilDateTime.nowTimestamp()))
+orCond = EntityCondition.makeCondition(exprListThruDate, EntityOperator.OR)
+exprList.add(orCond)
+webSiteContactList = from("WebSiteContactList").where(exprList).queryList()
-publicEmailContactLists = [];
+publicEmailContactLists = []
webSiteContactList.each { webSiteContactList ->
- contactList = webSiteContactList.getRelatedOne("ContactList", false);
- contactListType = contactList.getRelatedOne("ContactListType", false);
- temp = [:];
- temp.contactList = contactList;
- temp.contactListType = contactListType;
- publicEmailContactLists.add(temp);
+ contactList = webSiteContactList.getRelatedOne("ContactList", false)
+ contactListType = contactList.getRelatedOne("ContactListType", false)
+ temp = [:]
+ temp.contactList = contactList
+ temp.contactListType = contactListType
+ publicEmailContactLists.add(temp)
}
-context.publicEmailContactLists = publicEmailContactLists;
+context.publicEmailContactLists = publicEmailContactLists
if (userLogin) {
- partyAndContactMechList = from("PartyAndContactMech").where("partyId", partyId, "contactMechTypeId", "EMAIL_ADDRESS").orderBy("-fromDate").filterByDate().queryList();
- context.partyAndContactMechList = partyAndContactMechList;
+ partyAndContactMechList = from("PartyAndContactMech").where("partyId", partyId, "contactMechTypeId", "EMAIL_ADDRESS").orderBy("-fromDate").filterByDate().queryList()
+ context.partyAndContactMechList = partyAndContactMechList
}
diff --git a/specialpurpose/ecommerce/groovyScripts/customer/CustomerReviews.groovy b/specialpurpose/ecommerce/groovyScripts/customer/CustomerReviews.groovy
index 4fb8b9991e..8afe0bd033 100644
--- a/specialpurpose/ecommerce/groovyScripts/customer/CustomerReviews.groovy
+++ b/specialpurpose/ecommerce/groovyScripts/customer/CustomerReviews.groovy
@@ -22,7 +22,7 @@ import org.apache.ofbiz.entity.condition.EntityCondition
// get the product review(s) for the given user
if (userLogin) {
- reviews = from("ProductReview").where("userLoginId", userLogin.userLoginId).cache(true).queryList();
+ reviews = from("ProductReview").where("userLoginId", userLogin.userLoginId).cache(true).queryList()
- context.reviews = reviews;
+ context.reviews = reviews
}
diff --git a/specialpurpose/ecommerce/groovyScripts/customer/CustomerSurvey.groovy b/specialpurpose/ecommerce/groovyScripts/customer/CustomerSurvey.groovy
index de122630b5..ae3f56e111 100644
--- a/specialpurpose/ecommerce/groovyScripts/customer/CustomerSurvey.groovy
+++ b/specialpurpose/ecommerce/groovyScripts/customer/CustomerSurvey.groovy
@@ -17,30 +17,30 @@
* under the License.
*/
-import org.apache.ofbiz.base.util.*;
-import org.apache.ofbiz.entity.Delegator;
-import org.apache.ofbiz.entity.GenericValue;
-import org.apache.ofbiz.product.store.ProductStoreSurveyWrapper;
+import org.apache.ofbiz.base.util.*
+import org.apache.ofbiz.entity.Delegator
+import org.apache.ofbiz.entity.GenericValue
+import org.apache.ofbiz.product.store.ProductStoreSurveyWrapper
-partyId = userLogin.partyId;
-paramMap = UtilHttp.getParameterMap(request);
+partyId = userLogin.partyId
+paramMap = UtilHttp.getParameterMap(request)
-productStoreSurveyId = parameters.productStoreSurveyId;
+productStoreSurveyId = parameters.productStoreSurveyId
-surveyAppl = from("ProductStoreSurveyAppl").where("productStoreSurveyId", productStoreSurveyId).queryOne();
+surveyAppl = from("ProductStoreSurveyAppl").where("productStoreSurveyId", productStoreSurveyId).queryOne()
if (surveyAppl) {
- survey = surveyAppl.getRelatedOne("Survey", false);
- context.survey = survey;
+ survey = surveyAppl.getRelatedOne("Survey", false)
+ context.survey = survey
if (!parameters._ERROR_MESSAGE_) {
- paramMap = [productStoreSurveyId : productStoreSurveyId];
+ paramMap = [productStoreSurveyId : productStoreSurveyId]
}
- wrapper = new ProductStoreSurveyWrapper(surveyAppl, partyId, paramMap);
- context.surveyWrapper = wrapper;
+ wrapper = new ProductStoreSurveyWrapper(surveyAppl, partyId, paramMap)
+ context.surveyWrapper = wrapper
- surveyResp = parameters.surveyResponseId;
+ surveyResp = parameters.surveyResponseId
if (surveyResp) {
- wrapper.setThisResponseId(surveyResp);
- wrapper.callResult(true);
+ wrapper.setThisResponseId(surveyResp)
+ wrapper.callResult(true)
}
}
diff --git a/specialpurpose/ecommerce/groovyScripts/customer/EditBillingAddress.groovy b/specialpurpose/ecommerce/groovyScripts/customer/EditBillingAddress.groovy
index 5b24bae5f7..1c4a1a9709 100644
--- a/specialpurpose/ecommerce/groovyScripts/customer/EditBillingAddress.groovy
+++ b/specialpurpose/ecommerce/groovyScripts/customer/EditBillingAddress.groovy
@@ -17,67 +17,67 @@
* under the License.
*/
-import org.apache.ofbiz.entity.util.EntityUtil;
-import org.apache.ofbiz.party.contact.ContactHelper;
-import org.apache.ofbiz.entity.condition.EntityCondition;
+import org.apache.ofbiz.entity.util.EntityUtil
+import org.apache.ofbiz.party.contact.ContactHelper
+import org.apache.ofbiz.entity.condition.EntityCondition
if (userLogin) {
- party = userLogin.getRelatedOne("Party", false);
- contactMech = EntityUtil.getFirst(ContactHelper.getContactMech(party, "BILLING_LOCATION", "POSTAL_ADDRESS", false));
+ party = userLogin.getRelatedOne("Party", false)
+ contactMech = EntityUtil.getFirst(ContactHelper.getContactMech(party, "BILLING_LOCATION", "POSTAL_ADDRESS", false))
if (contactMech) {
- postalAddress = contactMech.getRelatedOne("PostalAddress", false);
- billToContactMechId = postalAddress.contactMechId;
- context.billToContactMechId = billToContactMechId;
- context.billToName = postalAddress.toName;
- context.billToAttnName = postalAddress.attnName;
- context.billToAddress1 = postalAddress.address1;
- context.billToAddress2 = postalAddress.address2;
- context.billToCity = postalAddress.city;
- context.billToPostalCode = postalAddress.postalCode;
- context.billToStateProvinceGeoId = postalAddress.stateProvinceGeoId;
- context.billToCountryGeoId = postalAddress.countryGeoId;
- billToStateProvinceGeo = from("Geo").where("geoId", postalAddress.stateProvinceGeoId).queryOne();
+ postalAddress = contactMech.getRelatedOne("PostalAddress", false)
+ billToContactMechId = postalAddress.contactMechId
+ context.billToContactMechId = billToContactMechId
+ context.billToName = postalAddress.toName
+ context.billToAttnName = postalAddress.attnName
+ context.billToAddress1 = postalAddress.address1
+ context.billToAddress2 = postalAddress.address2
+ context.billToCity = postalAddress.city
+ context.billToPostalCode = postalAddress.postalCode
+ context.billToStateProvinceGeoId = postalAddress.stateProvinceGeoId
+ context.billToCountryGeoId = postalAddress.countryGeoId
+ billToStateProvinceGeo = from("Geo").where("geoId", postalAddress.stateProvinceGeoId).queryOne()
if (billToStateProvinceGeo) {
- context.billToStateProvinceGeo = billToStateProvinceGeo.geoName;
+ context.billToStateProvinceGeo = billToStateProvinceGeo.geoName
}
- billToCountryProvinceGeo = from("Geo").where("geoId", postalAddress.countryGeoId).queryOne();
+ billToCountryProvinceGeo = from("Geo").where("geoId", postalAddress.countryGeoId).queryOne()
if (billToCountryProvinceGeo) {
- context.billToCountryProvinceGeo = billToCountryProvinceGeo.geoName;
+ context.billToCountryProvinceGeo = billToCountryProvinceGeo.geoName
}
- creditCards = [];
- paymentMethod = from("PaymentMethod").where("partyId", party.partyId, "paymentMethodTypeId", "CREDIT_CARD").orderBy("fromDate").filterByDate().queryFirst();
+ creditCards = []
+ paymentMethod = from("PaymentMethod").where("partyId", party.partyId, "paymentMethodTypeId", "CREDIT_CARD").orderBy("fromDate").filterByDate().queryFirst()
if (paymentMethod) {
- creditCard = paymentMethod.getRelatedOne("CreditCard", false);
- context.paymentMethodTypeId = "CREDIT_CARD";
- context.cardNumber = creditCard.cardNumber;
- context.cardType = creditCard.cardType;
- context.paymentMethodId = creditCard.paymentMethodId;
- context.firstNameOnCard = creditCard.firstNameOnCard;
- context.lastNameOnCard = creditCard.lastNameOnCard;
- context.expMonth = (creditCard.expireDate).substring(0, 2);
- context.expYear = (creditCard.expireDate).substring(3);
+ creditCard = paymentMethod.getRelatedOne("CreditCard", false)
+ context.paymentMethodTypeId = "CREDIT_CARD"
+ context.cardNumber = creditCard.cardNumber
+ context.cardType = creditCard.cardType
+ context.paymentMethodId = creditCard.paymentMethodId
+ context.firstNameOnCard = creditCard.firstNameOnCard
+ context.lastNameOnCard = creditCard.lastNameOnCard
+ context.expMonth = (creditCard.expireDate).substring(0, 2)
+ context.expYear = (creditCard.expireDate).substring(3)
}
if (shipToContactMechId) {
if (billToContactMechId && billToContactMechId.equals(shipToContactMechId)) {
- context.useShippingAddressForBilling = "Y";
+ context.useShippingAddressForBilling = "Y"
}
}
}
billToContactMechList = ContactHelper.getContactMech(party, "PHONE_BILLING", "TELECOM_NUMBER", false)
if (billToContactMechList) {
- billToTelecomNumber = (EntityUtil.getFirst(billToContactMechList)).getRelatedOne("TelecomNumber", false);
- pcm = EntityUtil.getFirst(billToTelecomNumber.getRelated("PartyContactMech", null, null, false));
- context.billToTelecomNumber = billToTelecomNumber;
- context.billToExtension = pcm.extension;
+ billToTelecomNumber = (EntityUtil.getFirst(billToContactMechList)).getRelatedOne("TelecomNumber", false)
+ pcm = EntityUtil.getFirst(billToTelecomNumber.getRelated("PartyContactMech", null, null, false))
+ context.billToTelecomNumber = billToTelecomNumber
+ context.billToExtension = pcm.extension
}
billToFaxNumberList = ContactHelper.getContactMech(party, "FAX_BILLING", "TELECOM_NUMBER", false)
if (billToFaxNumberList) {
- billToFaxNumber = (EntityUtil.getFirst(billToFaxNumberList)).getRelatedOne("TelecomNumber", false);
- faxPartyContactMech = EntityUtil.getFirst(billToFaxNumber.getRelated("PartyContactMech", null, null, false));
- context.billToFaxNumber = billToFaxNumber;
- context.billToFaxExtension = faxPartyContactMech.extension;
+ billToFaxNumber = (EntityUtil.getFirst(billToFaxNumberList)).getRelatedOne("TelecomNumber", false)
+ faxPartyContactMech = EntityUtil.getFirst(billToFaxNumber.getRelated("PartyContactMech", null, null, false))
+ context.billToFaxNumber = billToFaxNumber
+ context.billToFaxExtension = faxPartyContactMech.extension
}
}
diff --git a/specialpurpose/ecommerce/groovyScripts/customer/EditContactMech.groovy b/specialpurpose/ecommerce/groovyScripts/customer/EditContactMech.groovy
index 51c027185d..e299e47f29 100644
--- a/specialpurpose/ecommerce/groovyScripts/customer/EditContactMech.groovy
+++ b/specialpurpose/ecommerce/groovyScripts/customer/EditContactMech.groovy
@@ -17,87 +17,87 @@
* under the License.
*/
-import java.util.HashMap;
-import org.apache.ofbiz.party.contact.ContactMechWorker;
-import org.apache.ofbiz.base.util.UtilHttp;
-import org.apache.ofbiz.base.util.UtilMisc;
+import java.util.HashMap
+import org.apache.ofbiz.party.contact.ContactMechWorker
+import org.apache.ofbiz.base.util.UtilHttp
+import org.apache.ofbiz.base.util.UtilMisc
/* puts the following in the context: "contactMech", "contactMechId",
"partyContactMech", "partyContactMechPurposes", "contactMechTypeId",
"contactMechType", "purposeTypes", "postalAddress", "telecomNumber",
"requestName", "donePage", "tryEntity", "contactMechTypes"
*/
-target = [:];
-ContactMechWorker.getContactMechAndRelated(request, userLogin.partyId, target);
-context.putAll(target);
+target = [:]
+ContactMechWorker.getContactMechAndRelated(request, userLogin.partyId, target)
+context.putAll(target)
if (!security.hasEntityPermission("PARTYMGR", "_VIEW", session) && !context.partyContactMech && context.contactMech) {
- context.canNotView = true;
+ context.canNotView = true
} else {
- context.canNotView = false;
+ context.canNotView = false
}
-preContactMechTypeId = parameters.preContactMechTypeId;
-if (preContactMechTypeId) context.preContactMechTypeId = preContactMechTypeId;
+preContactMechTypeId = parameters.preContactMechTypeId
+if (preContactMechTypeId) context.preContactMechTypeId = preContactMechTypeId
-paymentMethodId = parameters.paymentMethodId;
-if (paymentMethodId) context.paymentMethodId = paymentMethodId;
+paymentMethodId = parameters.paymentMethodId
+if (paymentMethodId) context.paymentMethodId = 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
}
-tryEntity = context.tryEntity;
+tryEntity = context.tryEntity
-contactMechData = context.contactMech;
-if (!tryEntity) contactMechData = parameters;
-if (!contactMechData) contactMechData = [:];
-if (contactMechData) context.contactMechData = contactMechData;
+contactMechData = context.contactMech
+if (!tryEntity) contactMechData = parameters
+if (!contactMechData) contactMechData = [:]
+if (contactMechData) context.contactMechData = contactMechData
-partyContactMechData = context.partyContactMech;
-if (!tryEntity) partyContactMechData = parameters;
-if (!partyContactMechData) partyContactMechData = [:];
-if (partyContactMechData) context.partyContactMechData = partyContactMechData;
+partyContactMechData = context.partyContactMech
+if (!tryEntity) partyContactMechData = parameters
+if (!partyContactMechData) partyContactMechData = [:]
+if (partyContactMechData) context.partyContactMechData = partyContactMechData
-postalAddressData = context.postalAddress;
-if (!tryEntity) postalAddressData = parameters;
-if (!postalAddressData) postalAddressData = [:];
-if (postalAddressData) context.postalAddressData = postalAddressData;
+postalAddressData = context.postalAddress
+if (!tryEntity) postalAddressData = parameters
+if (!postalAddressData) postalAddressData = [:]
+if (postalAddressData) context.postalAddressData = postalAddressData
-telecomNumberData = context.telecomNumber;
-if (!tryEntity) telecomNumberData = parameters;
-if (!telecomNumberData) telecomNumberData = [:];
-if (telecomNumberData) context.telecomNumberData = telecomNumberData;
+telecomNumberData = context.telecomNumber
+if (!tryEntity) telecomNumberData = parameters
+if (!telecomNumberData) telecomNumberData = [:]
+if (telecomNumberData) context.telecomNumberData = telecomNumberData
// load the geo names for selected countries and states/regions
if (parameters.countryGeoId) {
- geoValue = from("Geo").where("geoId", parameters.countryGeoId).cache(true).queryOne();
+ geoValue = from("Geo").where("geoId", parameters.countryGeoId).cache(true).queryOne()
if (geoValue) {
- context.selectedCountryName = geoValue.geoName;
+ context.selectedCountryName = geoValue.geoName
}
} else if (postalAddressData?.countryGeoId) {
- geoValue = from("Geo").where("geoId", postalAddressData.countryGeoId).cache(true).queryOne();
+ geoValue = from("Geo").where("geoId", postalAddressData.countryGeoId).cache(true).queryOne()
if (geoValue) {
- context.selectedCountryName = geoValue.geoName;
+ context.selectedCountryName = geoValue.geoName
}
}
if (parameters.stateProvinceGeoId) {
- geoValue = from("Geo").where("geoId", parameters.stateProvinceGeoId).cache(true).queryOne();
+ geoValue = from("Geo").where("geoId", parameters.stateProvinceGeoId).cache(true).queryOne()
if (geoValue) {
- context.selectedStateName = geoValue.geoId;
+ context.selectedStateName = geoValue.geoId
}
} else if (postalAddressData?.stateProvinceGeoId) {
- geoValue = from("Geo").where("geoId", postalAddressData.stateProvinceGeoId).cache(true).queryOne();
+ geoValue = from("Geo").where("geoId", postalAddressData.stateProvinceGeoId).cache(true).queryOne()
if (geoValue) {
- context.selectedStateName = geoValue.geoId;
+ context.selectedStateName = geoValue.geoId
}
}
diff --git a/specialpurpose/ecommerce/groovyScripts/customer/EditEmailAndTelecomNumber.groovy b/specialpurpose/ecommerce/groovyScripts/customer/EditEmailAndTelecomNumber.groovy
index 1351b758ac..1382733b84 100644
--- a/specialpurpose/ecommerce/groovyScripts/customer/EditEmailAndTelecomNumber.groovy
+++ b/specialpurpose/ecommerce/groovyScripts/customer/EditEmailAndTelecomNumber.groovy
@@ -17,28 +17,28 @@
* under the License.
*/
-import org.apache.ofbiz.entity.util.EntityUtil;
-import org.apache.ofbiz.party.contact.ContactHelper;
+import org.apache.ofbiz.entity.util.EntityUtil
+import org.apache.ofbiz.party.contact.ContactHelper
if (userLogin) {
- party = userLogin.getRelatedOne("Party", false);
+ party = userLogin.getRelatedOne("Party", false)
- contactMech = EntityUtil.getFirst(ContactHelper.getContactMech(party, "PRIMARY_EMAIL", "EMAIL_ADDRESS", false));
+ contactMech = EntityUtil.getFirst(ContactHelper.getContactMech(party, "PRIMARY_EMAIL", "EMAIL_ADDRESS", false))
if (contactMech) {
- context.emailContactMechId = contactMech.contactMechId;
- context.emailAddress = contactMech.infoString;
+ context.emailContactMechId = contactMech.contactMechId
+ context.emailAddress = contactMech.infoString
}
- contactMech = EntityUtil.getFirst(ContactHelper.getContactMech(party, "PRIMARY_PHONE", "TELECOM_NUMBER", false));
+ contactMech = EntityUtil.getFirst(ContactHelper.getContactMech(party, "PRIMARY_PHONE", "TELECOM_NUMBER", false))
if (contactMech) {
- partyContactMech = from("PartyContactMech").where("partyId", party.partyId, "contactMechId", contactMech.contactMechId).filterByDate().queryFirst();
+ partyContactMech = from("PartyContactMech").where("partyId", party.partyId, "contactMechId", contactMech.contactMechId).filterByDate().queryFirst()
if (partyContactMech) {
- telecomNumber = partyContactMech.getRelatedOne("TelecomNumber", false);
- context.phoneContactMechId = telecomNumber.contactMechId;
- context.countryCode = telecomNumber.countryCode;
- context.areaCode = telecomNumber.areaCode;
- context.contactNumber = telecomNumber.contactNumber;
- context.extension = partyContactMech.extension;
+ telecomNumber = partyContactMech.getRelatedOne("TelecomNumber", false)
+ context.phoneContactMechId = telecomNumber.contactMechId
+ context.countryCode = telecomNumber.countryCode
+ context.areaCode = telecomNumber.areaCode
+ context.contactNumber = telecomNumber.contactNumber
+ context.extension = partyContactMech.extension
}
}
}
diff --git a/specialpurpose/ecommerce/groovyScripts/customer/EditPaymentMethod.groovy b/specialpurpose/ecommerce/groovyScripts/customer/EditPaymentMethod.groovy
index c3cb31339e..a00b91956c 100644
--- a/specialpurpose/ecommerce/groovyScripts/customer/EditPaymentMethod.groovy
+++ b/specialpurpose/ecommerce/groovyScripts/customer/EditPaymentMethod.groovy
@@ -17,48 +17,48 @@
* under the License.
*/
-import java.util.HashMap;
-import org.apache.ofbiz.base.util.UtilHttp;
-import org.apache.ofbiz.accounting.payment.PaymentWorker;
-import org.apache.ofbiz.party.contact.ContactMechWorker;
+import java.util.HashMap
+import org.apache.ofbiz.base.util.UtilHttp
+import org.apache.ofbiz.accounting.payment.PaymentWorker
+import org.apache.ofbiz.party.contact.ContactMechWorker
-paymentResults = PaymentWorker.getPaymentMethodAndRelated(request, userLogin.partyId);
+paymentResults = PaymentWorker.getPaymentMethodAndRelated(request, userLogin.partyId)
//returns the following: "paymentMethod", "creditCard", "giftCard", "eftAccount", "paymentMethodId", "curContactMechId", "donePage", "tryEntity"
-context.putAll(paymentResults);
+context.putAll(paymentResults)
-curPostalAddressResults = ContactMechWorker.getCurrentPostalAddress(request, userLogin.partyId, paymentResults.curContactMechId);
+curPostalAddressResults = ContactMechWorker.getCurrentPostalAddress(request, userLogin.partyId, paymentResults.curContactMechId)
//returns the following: "curPartyContactMech", "curContactMech", "curPostalAddress", "curPartyContactMechPurposes"
-context.putAll(curPostalAddressResults);
+context.putAll(curPostalAddressResults)
-postalAddressInfos = ContactMechWorker.getPartyPostalAddresses(request, userLogin.partyId, paymentResults.curContactMechId);
-context.put("postalAddressInfos", postalAddressInfos);
+postalAddressInfos = ContactMechWorker.getPartyPostalAddresses(request, userLogin.partyId, paymentResults.curContactMechId)
+context.put("postalAddressInfos", postalAddressInfos)
//prepare "Data" maps for filling form input boxes
-tryEntity = paymentResults.tryEntity;
+tryEntity = paymentResults.tryEntity
-creditCardData = paymentResults.creditCard;
-if (!tryEntity) creditCardData = parameters;
-if (!creditCardData) creditCardData = [:];
-if (creditCardData) context.creditCardData = creditCardData;
+creditCardData = paymentResults.creditCard
+if (!tryEntity) creditCardData = parameters
+if (!creditCardData) creditCardData = [:]
+if (creditCardData) context.creditCardData = creditCardData
-giftCardData = paymentResults.giftCard;
-if (!tryEntity) giftCardData = parameters;
-if (!giftCardData) giftCardData = [:];
-if (giftCardData) context.giftCardData = giftCardData;
+giftCardData = paymentResults.giftCard
+if (!tryEntity) giftCardData = parameters
+if (!giftCardData) giftCardData = [:]
+if (giftCardData) context.giftCardData = giftCardData
-eftAccountData = paymentResults.eftAccount;
-if (!tryEntity) eftAccountData = parameters;
-if (!eftAccountData) eftAccountData = [:];
-if (eftAccountData) context.eftAccountData = eftAccountData;
+eftAccountData = paymentResults.eftAccount
+if (!tryEntity) eftAccountData = parameters
+if (!eftAccountData) eftAccountData = [:]
+if (eftAccountData) context.eftAccountData = eftAccountData
-paymentMethodData = paymentResults.paymentMethod;
-if (!tryEntity) paymentMethodData = parameters;
-if (!paymentMethodData) paymentMethodData = [:];
-if (paymentMethodData) context.paymentMethodData = paymentMethodData;
+paymentMethodData = paymentResults.paymentMethod
+if (!tryEntity) paymentMethodData = parameters
+if (!paymentMethodData) paymentMethodData = [:]
+if (paymentMethodData) context.paymentMethodData = paymentMethodData
//prepare security flag
if (!security.hasEntityPermission("PARTYMGR", "_VIEW", session) && (context.creditCard || context.giftCard || context.eftAccount) && context.paymentMethod && !userLogin.partyId.equals(context.paymentMethod.partyId)) {
- context.canNotView = true;
+ context.canNotView = true
} else {
- context.canNotView = false;
+ context.canNotView = false
}
diff --git a/specialpurpose/ecommerce/groovyScripts/customer/EditPerson.groovy b/specialpurpose/ecommerce/groovyScripts/customer/EditPerson.groovy
index 023ca10b7b..7d2147d37f 100644
--- a/specialpurpose/ecommerce/groovyScripts/customer/EditPerson.groovy
+++ b/specialpurpose/ecommerce/groovyScripts/customer/EditPerson.groovy
@@ -17,16 +17,16 @@
* under the License.
*/
-import java.util.HashMap;
-import org.apache.ofbiz.base.util.UtilHttp;
+import java.util.HashMap
+import org.apache.ofbiz.base.util.UtilHttp
-tryEntity = true;
-errorMessage = parameters._ERROR_MESSAGE_;
+tryEntity = true
+errorMessage = parameters._ERROR_MESSAGE_
if (errorMessage) {
- tryEntity = false;
+ tryEntity = false
}
-personData = person;
-if (!tryEntity) personData = UtilHttp.getParameterMap(request);
-if (!personData) personData = [:];
+personData = person
+if (!tryEntity) personData = UtilHttp.getParameterMap(request)
+if (!personData) personData = [:]
-context.personData = personData;
+context.personData = personData
diff --git a/specialpurpose/ecommerce/groovyScripts/customer/EditShippingAddress.groovy b/specialpurpose/ecommerce/groovyScripts/customer/EditShippingAddress.groovy
index 62b3af93b0..55ed34fcef 100644
--- a/specialpurpose/ecommerce/groovyScripts/customer/EditShippingAddress.groovy
+++ b/specialpurpose/ecommerce/groovyScripts/customer/EditShippingAddress.groovy
@@ -17,60 +17,60 @@
* under the License.
*/
-import org.apache.ofbiz.entity.util.EntityUtil;
-import org.apache.ofbiz.party.contact.ContactHelper;
+import org.apache.ofbiz.entity.util.EntityUtil
+import org.apache.ofbiz.party.contact.ContactHelper
if (userLogin) {
- party = userLogin.getRelatedOne("Party", false);
+ party = userLogin.getRelatedOne("Party", false)
context.partyId = party.partyId
if ("PERSON".equals(party.partyTypeId)) {
- person = from("Person").where("partyId", party.partyId).queryOne();
- context.firstName = person.firstName;
- context.lastName = person.lastName;
+ person = from("Person").where("partyId", party.partyId).queryOne()
+ context.firstName = person.firstName
+ context.lastName = person.lastName
} else {
- group = from("PartyGroup").where("partyId", party.partyId).queryOne();
- context.firstName = group.groupName;
- context.lastName = "";
+ group = from("PartyGroup").where("partyId", party.partyId).queryOne()
+ context.firstName = group.groupName
+ context.lastName = ""
}
- contactMech = EntityUtil.getFirst(ContactHelper.getContactMech(party, "SHIPPING_LOCATION", "POSTAL_ADDRESS", false));
+ contactMech = EntityUtil.getFirst(ContactHelper.getContactMech(party, "SHIPPING_LOCATION", "POSTAL_ADDRESS", false))
if (contactMech) {
- postalAddress = contactMech.getRelatedOne("PostalAddress", false);
- context.shipToContactMechId = postalAddress.contactMechId;
+ postalAddress = contactMech.getRelatedOne("PostalAddress", false)
+ context.shipToContactMechId = postalAddress.contactMechId
- context.shipToName = postalAddress.toName;
- context.shipToAttnName = postalAddress.attnName;
- context.shipToAddress1 = postalAddress.address1;
- context.shipToAddress2 = postalAddress.address2;
- context.shipToCity = postalAddress.city;
- context.shipToPostalCode = postalAddress.postalCode;
- context.shipToStateProvinceGeoId = postalAddress.stateProvinceGeoId;
- context.shipToCountryGeoId = postalAddress.countryGeoId;
- shipToStateProvinceGeo = from("Geo").where("geoId", postalAddress.stateProvinceGeoId).queryOne();
+ context.shipToName = postalAddress.toName
+ context.shipToAttnName = postalAddress.attnName
+ context.shipToAddress1 = postalAddress.address1
+ context.shipToAddress2 = postalAddress.address2
+ context.shipToCity = postalAddress.city
+ context.shipToPostalCode = postalAddress.postalCode
+ context.shipToStateProvinceGeoId = postalAddress.stateProvinceGeoId
+ context.shipToCountryGeoId = postalAddress.countryGeoId
+ shipToStateProvinceGeo = from("Geo").where("geoId", postalAddress.stateProvinceGeoId).queryOne()
if (shipToStateProvinceGeo) {
- context.shipToStateProvinceGeo = shipToStateProvinceGeo.geoName;
+ context.shipToStateProvinceGeo = shipToStateProvinceGeo.geoName
}
- shipToCountryProvinceGeo = from("Geo").where("geoId", postalAddress.countryGeoId).queryOne();
+ shipToCountryProvinceGeo = from("Geo").where("geoId", postalAddress.countryGeoId).queryOne()
if (shipToCountryProvinceGeo) {
- context.shipToCountryProvinceGeo = shipToCountryProvinceGeo.geoName;
+ context.shipToCountryProvinceGeo = shipToCountryProvinceGeo.geoName
}
} else {
- context.shipToContactMechId = null;
+ context.shipToContactMechId = null
}
shipToContactMechList = ContactHelper.getContactMech(party, "PHONE_SHIPPING", "TELECOM_NUMBER", false)
if (shipToContactMechList) {
- shipToTelecomNumber = (EntityUtil.getFirst(shipToContactMechList)).getRelatedOne("TelecomNumber", false);
- pcm = EntityUtil.getFirst(shipToTelecomNumber.getRelated("PartyContactMech", null, null, false));
- context.shipToTelecomNumber = shipToTelecomNumber;
- context.shipToExtension = pcm.extension;
+ shipToTelecomNumber = (EntityUtil.getFirst(shipToContactMechList)).getRelatedOne("TelecomNumber", false)
+ pcm = EntityUtil.getFirst(shipToTelecomNumber.getRelated("PartyContactMech", null, null, false))
+ context.shipToTelecomNumber = shipToTelecomNumber
+ context.shipToExtension = pcm.extension
}
shipToFaxNumberList = ContactHelper.getContactMech(party, "FAX_SHIPPING", "TELECOM_NUMBER", false)
if (shipToFaxNumberList) {
- shipToFaxNumber = (EntityUtil.getFirst(shipToFaxNumberList)).getRelatedOne("TelecomNumber", false);
- faxPartyContactMech = EntityUtil.getFirst(shipToFaxNumber.getRelated("PartyContactMech", null, null, false));
- context.shipToFaxNumber = shipToFaxNumber;
- context.shipToFaxExtension = faxPartyContactMech.extension;
+ shipToFaxNumber = (EntityUtil.getFirst(shipToFaxNumberList)).getRelatedOne("TelecomNumber", false)
+ faxPartyContactMech = EntityUtil.getFirst(shipToFaxNumber.getRelated("PartyContactMech", null, null, false))
+ context.shipToFaxNumber = shipToFaxNumber
+ context.shipToFaxExtension = faxPartyContactMech.extension
}
}
diff --git a/specialpurpose/ecommerce/groovyScripts/customer/GiftCardBalance.groovy b/specialpurpose/ecommerce/groovyScripts/customer/GiftCardBalance.groovy
index c52b59cf7f..8051bf3aa3 100644
--- a/specialpurpose/ecommerce/groovyScripts/customer/GiftCardBalance.groovy
+++ b/specialpurpose/ecommerce/groovyScripts/customer/GiftCardBalance.groovy
@@ -17,5 +17,5 @@
* under the License.
*/
- import org.apache.ofbiz.product.store.*;
- context.paymentProperties = ProductStoreWorker.getProductStorePaymentProperties(request, "GIFT_CARD", null, true);
+ import org.apache.ofbiz.product.store.*
+ context.paymentProperties = ProductStoreWorker.getProductStorePaymentProperties(request, "GIFT_CARD", null, true)
diff --git a/specialpurpose/ecommerce/groovyScripts/customer/GiftCardLink.groovy b/specialpurpose/ecommerce/groovyScripts/customer/GiftCardLink.groovy
index d8818deb4d..3dc41143fd 100644
--- a/specialpurpose/ecommerce/groovyScripts/customer/GiftCardLink.groovy
+++ b/specialpurpose/ecommerce/groovyScripts/customer/GiftCardLink.groovy
@@ -17,17 +17,17 @@
* under the License.
*/
-import org.apache.ofbiz.product.store.*;
+import org.apache.ofbiz.product.store.*
-processResult = parameters.processResult;
+processResult = parameters.processResult
if (processResult != null) {
if (!processResult) {
- request.setAttribute("_ERROR_MESSAGE_", "There was a problem linking your cards. Please check the numbers and try again.");
- request.removeAttribute("_EVENT_MESSAGE_");
+ request.setAttribute("_ERROR_MESSAGE_", "There was a problem linking your cards. Please check the numbers and try again.")
+ request.removeAttribute("_EVENT_MESSAGE_")
} else {
- request.setAttribute("_EVENT_MESSAGE_", "Thank-you. Your gift card account is now linked.");
+ request.setAttribute("_EVENT_MESSAGE_", "Thank-you. Your gift card account is now linked.")
}
}
-context.userLogin = userLogin;
-context.paymentProperties = ProductStoreWorker.getProductStorePaymentProperties(request, "GIFT_CARD", null, true);
+context.userLogin = userLogin
+context.paymentProperties = ProductStoreWorker.getProductStorePaymentProperties(request, "GIFT_CARD", null, true)
diff --git a/specialpurpose/ecommerce/groovyScripts/customer/NewCustomer.groovy b/specialpurpose/ecommerce/groovyScripts/customer/NewCustomer.groovy
index a405b22e6e..e765a3dc12 100644
--- a/specialpurpose/ecommerce/groovyScripts/customer/NewCustomer.groovy
+++ b/specialpurpose/ecommerce/groovyScripts/customer/NewCustomer.groovy
@@ -17,42 +17,42 @@
* under the License.
*/
-import org.apache.ofbiz.base.util.UtilProperties;
-import org.apache.ofbiz.base.util.UtilMisc;
-import org.apache.ofbiz.product.store.ProductStoreWorker;
+import org.apache.ofbiz.base.util.UtilProperties
+import org.apache.ofbiz.base.util.UtilMisc
+import org.apache.ofbiz.product.store.ProductStoreWorker
-productStore = ProductStoreWorker.getProductStore(request);
-context.productStoreId = productStore.productStoreId;
-context.productStore = productStore;
+productStore = ProductStoreWorker.getProductStore(request)
+context.productStoreId = productStore.productStoreId
+context.productStore = productStore
-context.createAllowPassword = "Y".equals(productStore.allowPassword);
-context.getUsername = !"Y".equals(productStore.usePrimaryEmailUsername);
+context.createAllowPassword = "Y".equals(productStore.allowPassword)
+context.getUsername = !"Y".equals(productStore.usePrimaryEmailUsername)
-previousParams = parameters._PREVIOUS_PARAMS_;
+previousParams = parameters._PREVIOUS_PARAMS_
if (previousParams) {
- previousParams = "?" + previousParams;
+ previousParams = "?" + previousParams
} else {
- previousParams = "";
+ previousParams = ""
}
-context.previousParams = previousParams;
+context.previousParams = previousParams
//the parameters from janrain
-userInfoMap = request.getAttribute("userInfoMap");
+userInfoMap = request.getAttribute("userInfoMap")
if (!userInfoMap) {
- userInfoMap = request.getSession().getAttribute("userInfoMap");
+ userInfoMap = request.getSession().getAttribute("userInfoMap")
}
if (userInfoMap) {
if (userInfoMap.givenName && userInfoMap.familyName) {
- requestParameters.USER_FIRST_NAME = userInfoMap.givenName;
- requestParameters.USER_LAST_NAME = userInfoMap.familyName;
+ requestParameters.USER_FIRST_NAME = userInfoMap.givenName
+ requestParameters.USER_LAST_NAME = userInfoMap.familyName
} else if (userInfoMap.formatted) {
- requestParameters.USER_FIRST_NAME = userInfoMap.formatted;
+ requestParameters.USER_FIRST_NAME = userInfoMap.formatted
}
- requestParameters.CUSTOMER_EMAIL = userInfoMap.email;
- requestParameters.preferredUsername = userInfoMap.preferredUsername;
- requestParameters.USERNAME = userInfoMap.preferredUsername;
- request.getSession().setAttribute("userInfoMap", userInfoMap);
+ requestParameters.CUSTOMER_EMAIL = userInfoMap.email
+ requestParameters.preferredUsername = userInfoMap.preferredUsername
+ requestParameters.USERNAME = userInfoMap.preferredUsername
+ request.getSession().setAttribute("userInfoMap", userInfoMap)
}
donePage = "main;" + parameters.visit.sessionId
-context.donePage = donePage;
+context.donePage = donePage
diff --git a/specialpurpose/ecommerce/groovyScripts/customer/OnePageCheckoutOptions.groovy b/specialpurpose/ecommerce/groovyScripts/customer/OnePageCheckoutOptions.groovy
index bce1823e7d..ad2f2ddccd 100644
--- a/specialpurpose/ecommerce/groovyScripts/customer/OnePageCheckoutOptions.groovy
+++ b/specialpurpose/ecommerce/groovyScripts/customer/OnePageCheckoutOptions.groovy
@@ -17,11 +17,11 @@
* under the License.
*/
- import org.apache.ofbiz.order.shoppingcart.shipping.*;
+ import org.apache.ofbiz.order.shoppingcart.shipping.*
-shoppingCart = session.getAttribute("shoppingCart");
+shoppingCart = session.getAttribute("shoppingCart")
// Reassign items requiring drop-shipping to new or existing drop-ship groups
if (shoppingCart) {
- shoppingCart.createDropShipGroups(dispatcher);
+ shoppingCart.createDropShipGroups(dispatcher)
}
diff --git a/specialpurpose/ecommerce/groovyScripts/customer/ViewProfile.groovy b/specialpurpose/ecommerce/groovyScripts/customer/ViewProfile.groovy
index d15fdf6936..ee02bec21f 100644
--- a/specialpurpose/ecommerce/groovyScripts/customer/ViewProfile.groovy
+++ b/specialpurpose/ecommerce/groovyScripts/customer/ViewProfile.groovy
@@ -17,85 +17,85 @@
* under the License.
*/
-import java.lang.*;
-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.party.contact.ContactMechWorker;
-import org.apache.ofbiz.product.store.ProductStoreWorker;
-import org.apache.ofbiz.accounting.payment.PaymentWorker;
+import java.lang.*
+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.party.contact.ContactMechWorker
+import org.apache.ofbiz.product.store.ProductStoreWorker
+import org.apache.ofbiz.accounting.payment.PaymentWorker
-productStoreId = ProductStoreWorker.getProductStoreId(request);
-context.productStoreId = productStoreId;
+productStoreId = ProductStoreWorker.getProductStoreId(request)
+context.productStoreId = productStoreId
if (userLogin) {
- profiledefs = from("PartyProfileDefault").where("partyId", partyId, "productStoreId", productStoreId).queryOne();
+ profiledefs = from("PartyProfileDefault").where("partyId", partyId, "productStoreId", productStoreId).queryOne()
- showOld = "true".equals(parameters.SHOW_OLD);
+ showOld = "true".equals(parameters.SHOW_OLD)
- partyContactMechValueMaps = ContactMechWorker.getPartyContactMechValueMaps(delegator, userLogin.partyId, showOld);
- paymentMethodValueMaps = PaymentWorker.getPartyPaymentMethodValueMaps(delegator, userLogin.partyId, showOld);
+ partyContactMechValueMaps = ContactMechWorker.getPartyContactMechValueMaps(delegator, userLogin.partyId, showOld)
+ paymentMethodValueMaps = PaymentWorker.getPartyPaymentMethodValueMaps(delegator, userLogin.partyId, showOld)
- context.profiledefs = profiledefs;
- context.showOld = showOld;
- context.partyContactMechValueMaps = partyContactMechValueMaps;
- context.paymentMethodValueMaps = paymentMethodValueMaps;
+ context.profiledefs = profiledefs
+ context.showOld = showOld
+ context.partyContactMechValueMaps = partyContactMechValueMaps
+ context.paymentMethodValueMaps = paymentMethodValueMaps
// shipping methods - for default selection
if (profiledefs?.defaultShipAddr) {
- shipAddress = from("PostalAddress").where("contactMechId", profiledefs.defaultShipAddr).queryOne();
+ shipAddress = from("PostalAddress").where("contactMechId", profiledefs.defaultShipAddr).queryOne()
if (shipAddress) {
- carrierShipMeths = ProductStoreWorker.getAvailableStoreShippingMethods(delegator, productStoreId, shipAddress, [1], null, 0, 1);
- context.carrierShipMethods = carrierShipMeths;
+ carrierShipMeths = ProductStoreWorker.getAvailableStoreShippingMethods(delegator, productStoreId, shipAddress, [1], null, 0, 1)
+ context.carrierShipMethods = carrierShipMeths
}
}
- profileSurveys = ProductStoreWorker.getProductSurveys(delegator, productStoreId, null, "CUSTOMER_PROFILE");
- context.surveys = profileSurveys;
+ profileSurveys = ProductStoreWorker.getProductSurveys(delegator, productStoreId, null, "CUSTOMER_PROFILE")
+ context.surveys = profileSurveys
- exprs = [EntityCondition.makeCondition("partyId", EntityOperator.EQUALS, partyId)];
- exprs.add(EntityCondition.makeCondition("roleStatusId", EntityOperator.NOT_EQUAL, "COM_ROLE_READ"));
- messages = from("CommunicationEventAndRole").where(exprs).orderBy("-entryDate").maxRows(5).queryList();
- context.messages = messages;
- context.profileMessages = true;
+ exprs = [EntityCondition.makeCondition("partyId", EntityOperator.EQUALS, partyId)]
+ exprs.add(EntityCondition.makeCondition("roleStatusId", EntityOperator.NOT_EQUAL, "COM_ROLE_READ"))
+ messages = from("CommunicationEventAndRole").where(exprs).orderBy("-entryDate").maxRows(5).queryList()
+ context.messages = messages
+ context.profileMessages = true
- partyContent = from("ContentRole").where("partyId", partyId, "roleTypeId", "OWNER").filterByDate().queryList();
- context.partyContent = partyContent;
+ partyContent = from("ContentRole").where("partyId", partyId, "roleTypeId", "OWNER").filterByDate().queryList()
+ context.partyContent = partyContent
- mimeTypes = from("MimeType").orderBy("description", "mimeTypeId").queryList();
- context.mimeTypes = mimeTypes;
+ mimeTypes = from("MimeType").orderBy("description", "mimeTypeId").queryList()
+ context.mimeTypes = mimeTypes
- partyContentTypes = from("PartyContentType").orderBy("description").queryList();
- context.partyContentTypes = partyContentTypes;
+ partyContentTypes = from("PartyContentType").orderBy("description").queryList()
+ context.partyContentTypes = partyContentTypes
// call the getOrderedSummaryInformation service to get the sub-total of valid orders in last X months
- monthsToInclude = 12;
- result = runService('getOrderedSummaryInformation', [partyId : partyId, roleTypeId : "PLACING_CUSTOMER", orderTypeId : "SALES_ORDER", statusId : "ORDER_COMPLETED", monthsToInclude : monthsToInclude, userLogin : userLogin]);
- context.monthsToInclude = monthsToInclude;
- context.totalSubRemainingAmount = result.totalSubRemainingAmount;
- context.totalOrders = result.totalOrders;
+ monthsToInclude = 12
+ result = runService('getOrderedSummaryInformation', [partyId : partyId, roleTypeId : "PLACING_CUSTOMER", orderTypeId : "SALES_ORDER", statusId : "ORDER_COMPLETED", monthsToInclude : monthsToInclude, userLogin : userLogin])
+ context.monthsToInclude = monthsToInclude
+ context.totalSubRemainingAmount = result.totalSubRemainingAmount
+ context.totalOrders = result.totalOrders
- contactListPartyList = from("ContactListParty").where("partyId", partyId).orderBy("-fromDate").queryList();
- // show all, including history, ie don't filter: contactListPartyList = EntityUtil.filterByDate(contactListPartyList, true);
- context.contactListPartyList = contactListPartyList;
+ contactListPartyList = from("ContactListParty").where("partyId", partyId).orderBy("-fromDate").queryList()
+ // show all, including history, ie don't filter: contactListPartyList = EntityUtil.filterByDate(contactListPartyList, true)
+ context.contactListPartyList = contactListPartyList
- publicContactLists = from("ContactList").where("isPublic", "Y").orderBy("contactListName").queryList();
- context.publicContactLists = publicContactLists;
+ publicContactLists = from("ContactList").where("isPublic", "Y").orderBy("contactListName").queryList()
+ context.publicContactLists = publicContactLists
- partyAndContactMechList = from("PartyAndContactMech").where("partyId", partyId).orderBy("-fromDate").filterByDate().queryList();
- context.partyAndContactMechList = partyAndContactMechList;
+ partyAndContactMechList = from("PartyAndContactMech").where("partyId", partyId).orderBy("-fromDate").filterByDate().queryList()
+ context.partyAndContactMechList = partyAndContactMechList
// state/province & country's name
if (partyContactMechValueMaps) {
partyContactMechValueMaps.each {
if (it.postalAddress) {
- postalAddress = it.postalAddress;
- countryGeo = postalAddress.getRelatedOne("CountryGeo", false);
- if (countryGeo) it.countryGeoName = countryGeo.getString("geoName");
- stateProvinceGeo = postalAddress.getRelatedOne("StateProvinceGeo", false);
- if (stateProvinceGeo) it.stateProvinceGeoName = stateProvinceGeo.getString("geoName");
+ postalAddress = it.postalAddress
+ countryGeo = postalAddress.getRelatedOne("CountryGeo", false)
+ if (countryGeo) it.countryGeoName = countryGeo.getString("geoName")
+ stateProvinceGeo = postalAddress.getRelatedOne("StateProvinceGeo", false)
+ if (stateProvinceGeo) it.stateProvinceGeoName = stateProvinceGeo.getString("geoName")
}
}
diff --git a/specialpurpose/ecommerce/groovyScripts/forum/ContentAddPrep.groovy b/specialpurpose/ecommerce/groovyScripts/forum/ContentAddPrep.groovy
index b0f21b9d08..0930a5e218 100644
--- a/specialpurpose/ecommerce/groovyScripts/forum/ContentAddPrep.groovy
+++ b/specialpurpose/ecommerce/groovyScripts/forum/ContentAddPrep.groovy
@@ -17,77 +17,77 @@
* under the License.
*/
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.TreeSet;
-import org.apache.ofbiz.base.util.*;
-import org.apache.ofbiz.entity.*;
-import org.apache.ofbiz.security.*;
-import org.apache.ofbiz.service.*;
-import org.apache.ofbiz.entity.model.*;
-import org.apache.ofbiz.securityext.login.*;
-import org.apache.ofbiz.common.*;
-import org.apache.ofbiz.entity.model.*;
-import org.apache.ofbiz.content.ContentManagementWorker;
-import org.apache.ofbiz.content.content.ContentWorker;
+import java.util.ArrayList
+import java.util.Collection
+import java.util.HashMap
+import java.util.Iterator
+import java.util.LinkedList
+import java.util.List
+import java.util.Map
+import java.util.Set
+import java.util.TreeSet
+import org.apache.ofbiz.base.util.*
+import org.apache.ofbiz.entity.*
+import org.apache.ofbiz.security.*
+import org.apache.ofbiz.service.*
+import org.apache.ofbiz.entity.model.*
+import org.apache.ofbiz.securityext.login.*
+import org.apache.ofbiz.common.*
+import org.apache.ofbiz.entity.model.*
+import org.apache.ofbiz.content.ContentManagementWorker
+import org.apache.ofbiz.content.content.ContentWorker
-import freemarker.template.SimpleHash;
-import freemarker.template.SimpleSequence;
+import freemarker.template.SimpleHash
+import freemarker.template.SimpleSequence
-import javax.servlet.*;
-import javax.servlet.http.*;
+import javax.servlet.*
+import javax.servlet.http.*
-singleWrapper = context.singleWrapper;
-singleWrapper.putInContext("contentPurposeTypeId", page.contentPurposeTypeId);
-singleWrapper.putInContext("contentAssocTypeId", page.contentAssocTypeId);
-rootPubPt = parameters.webSiteId;
-paramMap = UtilHttp.getParameterMap(request);
-contentIdTo = ContentManagementWorker.getFromSomewhere("forumId", paramMap, request, context);
-context.contentIdTo = contentIdTo;
-//Debug.logInfo("in contentaddprep, contentIdTo:" + contentIdTo,"");
-//Debug.logInfo("in contentaddprep, paramMap:" + paramMap,"");
-attrList = from("ContentAttribute").where("contentId", contentIdTo, "attrName", "publishOperation").cache(true).queryList();
-publishOperation = null;
+singleWrapper = context.singleWrapper
+singleWrapper.putInContext("contentPurposeTypeId", page.contentPurposeTypeId)
+singleWrapper.putInContext("contentAssocTypeId", page.contentAssocTypeId)
+rootPubPt = parameters.webSiteId
+paramMap = UtilHttp.getParameterMap(request)
+contentIdTo = ContentManagementWorker.getFromSomewhere("forumId", paramMap, request, context)
+context.contentIdTo = contentIdTo
+//Debug.logInfo("in contentaddprep, contentIdTo:" + contentIdTo,"")
+//Debug.logInfo("in contentaddprep, paramMap:" + paramMap,"")
+attrList = from("ContentAttribute").where("contentId", contentIdTo, "attrName", "publishOperation").cache(true).queryList()
+publishOperation = null
if (attrList) {
- contentAttribute = attrList.get(0);
- publishOperation = contentAttribute.attrValue;
- //Debug.logInfo("in contentaddprep, publishOperation:" + publishOperation,"");
+ contentAttribute = attrList.get(0)
+ publishOperation = contentAttribute.attrValue
+ //Debug.logInfo("in contentaddprep, publishOperation:" + publishOperation,"")
}
-singleWrapper.putInContext("publishOperation", publishOperation);
-singleWrapper.putInContext("contentIdTo", contentIdTo);
-//singleWrapper.putInContext("ownerContentId", contentIdTo);
-summaryDataResourceTypeId = page.summaryDataResourceTypeId;
-singleWrapper.putInContext("summaryDataResourceTypeId", summaryDataResourceTypeId);
-targetOperation = page.targetOperation ?: "CONTENT_CREATE";
+singleWrapper.putInContext("publishOperation", publishOperation)
+singleWrapper.putInContext("contentIdTo", contentIdTo)
+//singleWrapper.putInContext("ownerContentId", contentIdTo)
+summaryDataResourceTypeId = page.summaryDataResourceTypeId
+singleWrapper.putInContext("summaryDataResourceTypeId", summaryDataResourceTypeId)
+targetOperation = page.targetOperation ?: "CONTENT_CREATE"
-singleWrapper.putInContext("targetOperation", targetOperation);
-singleWrapper.putInContext("contentTypeId", "DOCUMENT");
-contentPurpose = page.contentPurpose ?: "ARTICLE";
+singleWrapper.putInContext("targetOperation", targetOperation)
+singleWrapper.putInContext("contentTypeId", "DOCUMENT")
+contentPurpose = page.contentPurpose ?: "ARTICLE"
-singleWrapper.putInContext("contentPurpose", contentPurpose);
-singleWrapper.putInContext("forumId", contentIdTo);
+singleWrapper.putInContext("contentPurpose", contentPurpose)
+singleWrapper.putInContext("forumId", contentIdTo)
-forumContent = from("Content").where("contentId", contentIdTo).cache(true).queryOne();
-statusId = "CTNT_PUBLISHED";
+forumContent = from("Content").where("contentId", contentIdTo).cache(true).queryOne()
+statusId = "CTNT_PUBLISHED"
if (forumContent) {
- statusId = forumContent.statusId;
+ statusId = forumContent.statusId
if (!statusId) {
- statusId = page.statusId;
+ statusId = page.statusId
}
if (!statusId) {
- statusId = "CTNT_PUBLISHED";
+ statusId = "CTNT_PUBLISHED"
}
}
-singleWrapper.putInContext("statusId", statusId);
+singleWrapper.putInContext("statusId", statusId)
-siteAncestorList = [];
-siteAncestorList.add(contentIdTo);
-context.siteAncestorList = siteAncestorList;
-//Debug.logInfo("in viewprep, siteAncestorList:" + siteAncestorList,"");
+siteAncestorList = []
+siteAncestorList.add(contentIdTo)
+context.siteAncestorList = siteAncestorList
+//Debug.logInfo("in viewprep, siteAncestorList:" + siteAncestorList,"")
diff --git a/specialpurpose/ecommerce/groovyScripts/forum/ContentPrep.groovy b/specialpurpose/ecommerce/groovyScripts/forum/ContentPrep.groovy
index d021fe041a..ba3a608ed1 100644
--- a/specialpurpose/ecommerce/groovyScripts/forum/ContentPrep.groovy
+++ b/specialpurpose/ecommerce/groovyScripts/forum/ContentPrep.groovy
@@ -17,113 +17,113 @@
* under the License.
*/
-import org.apache.ofbiz.base.util.*;
-import org.apache.ofbiz.base.util.template.FreeMarkerWorker;
-import org.apache.ofbiz.entity.*;
-import org.apache.ofbiz.security.*;
-import org.apache.ofbiz.service.*;
-import org.apache.ofbiz.entity.model.*;
-import org.apache.ofbiz.webapp.ftl.FreeMarkerViewHandler;
-import org.apache.ofbiz.content.content.ContentWorker;
-import org.apache.ofbiz.content.ContentManagementWorker;
+import org.apache.ofbiz.base.util.*
+import org.apache.ofbiz.base.util.template.FreeMarkerWorker
+import org.apache.ofbiz.entity.*
+import org.apache.ofbiz.security.*
+import org.apache.ofbiz.service.*
+import org.apache.ofbiz.entity.model.*
+import org.apache.ofbiz.webapp.ftl.FreeMarkerViewHandler
+import org.apache.ofbiz.content.content.ContentWorker
+import org.apache.ofbiz.content.ContentManagementWorker
-import java.io.StringWriter;
-import freemarker.template.SimpleHash;
-import freemarker.template.WrappingTemplateModel;
+import java.io.StringWriter
+import freemarker.template.SimpleHash
+import freemarker.template.WrappingTemplateModel
-import javax.servlet.*;
-import javax.servlet.http.*;
+import javax.servlet.*
+import javax.servlet.http.*
// load edit or create Content form
-rootPubPt = parameters.webSiteId;
-//Debug.logInfo("in contentprep, security:" + security, "");
+rootPubPt = parameters.webSiteId
+//Debug.logInfo("in contentprep, security:" + security, "")
-singleWrapper = context.singleWrapper;
+singleWrapper = context.singleWrapper
-paramMap = UtilHttp.getParameterMap(request);
-contentId = "";
-contentId = ContentManagementWorker.getFromSomewhere("masterContentId", paramMap, request, context);
+paramMap = UtilHttp.getParameterMap(request)
+contentId = ""
+contentId = ContentManagementWorker.getFromSomewhere("masterContentId", paramMap, request, context)
if (!contentId)
- contentId = ContentManagementWorker.getFromSomewhere("contentIdTo", paramMap, request, context);
+ contentId = ContentManagementWorker.getFromSomewhere("contentIdTo", paramMap, request, context)
if (!contentId)
- contentId = ContentManagementWorker.getFromSomewhere("contentId", paramMap, request, context);
+ contentId = ContentManagementWorker.getFromSomewhere("contentId", paramMap, request, context)
-//Debug.logInfo("in contentprep, contentId(1):" + contentId, "");
-currentValue = parameters.currentValue;
-//Debug.logInfo("in contentprep, currentValue(0):" + currentValue, "");
+//Debug.logInfo("in contentprep, contentId(1):" + contentId, "")
+currentValue = parameters.currentValue
+//Debug.logInfo("in contentprep, currentValue(0):" + currentValue, "")
if (!contentId && currentValue) {
- contentId = currentValue.contentId;
+ contentId = currentValue.contentId
}
if (contentId && !currentValue) {
- currentValue = from("Content").where("contentId", contentId).cache(true).queryOne();
+ currentValue = from("Content").where("contentId", contentId).cache(true).queryOne()
}
-//Debug.logInfo("in contentprep, currentValue(1):" + currentValue, "");
-//Debug.logInfo("in contentprep, contentId(4):" + contentId, "");
+//Debug.logInfo("in contentprep, currentValue(1):" + currentValue, "")
+//Debug.logInfo("in contentprep, contentId(4):" + contentId, "")
if (currentValue) {
- dataResourceId = currentValue.dataResourceId;
- context.contentId = contentId;
- context.contentName = currentValue.contentName;
- context.description = currentValue.description;
- context.statusId = currentValue.statusId;
+ dataResourceId = currentValue.dataResourceId
+ context.contentId = contentId
+ context.contentName = currentValue.contentName
+ context.description = currentValue.description
+ context.statusId = currentValue.statusId
- mimeTypeId = currentValue.mimeTypeId;
- rootDir = request.getSession().getServletContext().getRealPath("/");
- wrapper = FreeMarkerWorker.getDefaultOfbizWrapper();
- WrappingTemplateModel.setDefaultObjectWrapper(wrapper);
- //templateRoot = new SimpleHash(wrapper);
- templateRoot = [:];
- FreeMarkerViewHandler.prepOfbizRoot(templateRoot, request, response);
+ mimeTypeId = currentValue.mimeTypeId
+ rootDir = request.getSession().getServletContext().getRealPath("/")
+ wrapper = FreeMarkerWorker.getDefaultOfbizWrapper()
+ WrappingTemplateModel.setDefaultObjectWrapper(wrapper)
+ //templateRoot = new SimpleHash(wrapper)
+ templateRoot = [:]
+ FreeMarkerViewHandler.prepOfbizRoot(templateRoot, request, response)
- ctx = [:];
- ctx.rootDir = rootDir;
+ ctx = [:]
+ ctx.rootDir = rootDir
// webSiteId and https need to go here, too
- templateRoot.context = ctx;
- fromDate = nowTimestamp;
- assocTypes = null;
- //assocTypes = ["SUB_CONTENT"];
- subContentDataResourceView = ContentWorker.getSubContent(delegator, contentId, "ARTICLE", null, userLogin, assocTypes, fromDate);
+ templateRoot.context = ctx
+ fromDate = nowTimestamp
+ assocTypes = null
+ //assocTypes = ["SUB_CONTENT"]
+ subContentDataResourceView = ContentWorker.getSubContent(delegator, contentId, "ARTICLE", null, userLogin, assocTypes, fromDate)
if (subContentDataResourceView) {
- out = new StringWriter();
- ContentWorker.renderContentAsText(dispatcher, delegator, null, out, templateRoot, subContentDataResourceView, locale, mimeTypeId, true);
- textData = out.toString();
- context.txtContentId = subContentDataResourceView.contentId;
- context.txtDataResourceId = subContentDataResourceView.dataResourceId;
- context.textData = textData;
- //Debug.logInfo("textId:" + txtContentId, "");
- //Debug.logInfo("textData:" + textData, "");
+ out = new StringWriter()
+ ContentWorker.renderContentAsText(dispatcher, delegator, null, out, templateRoot, subContentDataResourceView, locale, mimeTypeId, true)
+ textData = out.toString()
+ context.txtContentId = subContentDataResourceView.contentId
+ context.txtDataResourceId = subContentDataResourceView.dataResourceId
+ context.textData = textData
+ //Debug.logInfo("textId:" + txtContentId, "")
+ //Debug.logInfo("textData:" + textData, "")
if (singleWrapper) {
- //Debug.logInfo("textData:" + textData, "");
- singleWrapper.putInContext("textData", textData);
+ //Debug.logInfo("textData:" + textData, "")
+ singleWrapper.putInContext("textData", textData)
}
}
- subContentDataResourceView = ContentWorker.getSubContent(dispatcher, delegator, contentId, "SUMMARY", null, userLogin, assocTypes, fromDate, true);
+ subContentDataResourceView = ContentWorker.getSubContent(dispatcher, delegator, contentId, "SUMMARY", null, userLogin, assocTypes, fromDate, true)
if (subContentDataResourceView) {
- out = new StringWriter();
- ContentWorker.renderContentAsText(delegator, null, out, templateRoot, subContentDataResourceView, locale, mimeTypeId);
- summaryData = out.toString();
- context.sumContentId = subContentDataResourceView.contentId;
- context.sumDataResourceId = subContentDataResourceView.dataResourceId;
- context.summaryData = summaryData;
- //Debug.logInfo("sumId:" + sumContentId, "");
- //Debug.logInfo("summaryData:" + summaryData, "");
+ out = new StringWriter()
+ ContentWorker.renderContentAsText(delegator, null, out, templateRoot, subContentDataResourceView, locale, mimeTypeId)
+ summaryData = out.toString()
+ context.sumContentId = subContentDataResourceView.contentId
+ context.sumDataResourceId = subContentDataResourceView.dataResourceId
+ context.summaryData = summaryData
+ //Debug.logInfo("sumId:" + sumContentId, "")
+ //Debug.logInfo("summaryData:" + summaryData, "")
if (singleWrapper) {
- //Debug.logInfo("summaryData:" + summaryData, "");
- singleWrapper.putInContext("summaryData", summaryData);
+ //Debug.logInfo("summaryData:" + summaryData, "")
+ singleWrapper.putInContext("summaryData", summaryData)
}
}
- subContentDataResourceView = ContentWorker.getSubContent(dispatcher, delegator, contentId, "IMAGE", null, userLogin, assocTypes, fromDate, true);
+ subContentDataResourceView = ContentWorker.getSubContent(dispatcher, delegator, contentId, "IMAGE", null, userLogin, assocTypes, fromDate, true)
if (subContentDataResourceView) {
- out = new StringWriter();
- ContentWorker.renderContentAsText(delegator, null, out, templateRoot, subContentDataResourceView, locale, mimeTypeId);
- imageData = out.toString();
- context.imgContentId = subContentDataResourceView.contentId;
- context.imgDataResourceId = subContentDataResourceView.dataResourceId;
- context.imageData = imageData;
+ out = new StringWriter()
+ ContentWorker.renderContentAsText(delegator, null, out, templateRoot, subContentDataResourceView, locale, mimeTypeId)
+ imageData = out.toString()
+ context.imgContentId = subContentDataResourceView.contentId
+ context.imgDataResourceId = subContentDataResourceView.dataResourceId
+ context.imageData = imageData
}
}
diff --git a/specialpurpose/ecommerce/groovyScripts/forum/CurrentValPrep.groovy b/specialpurpose/ecommerce/groovyScripts/forum/CurrentValPrep.groovy
index 124f455789..bca27d61c1 100644
--- a/specialpurpose/ecommerce/groovyScripts/forum/CurrentValPrep.groovy
+++ b/specialpurpose/ecommerce/groovyScripts/forum/CurrentValPrep.groovy
@@ -17,131 +17,131 @@
* under the License.
*/
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.TreeSet;
-import org.apache.ofbiz.base.util.*;
-import org.apache.ofbiz.entity.*;
-import org.apache.ofbiz.security.*;
-import org.apache.ofbiz.service.*;
-import org.apache.ofbiz.entity.model.*;
-import org.apache.ofbiz.content.ContentManagementWorker;
+import java.util.ArrayList
+import java.util.Collection
+import java.util.HashMap
+import java.util.Iterator
+import java.util.LinkedList
+import java.util.List
+import java.util.Map
+import java.util.Set
+import java.util.TreeSet
+import org.apache.ofbiz.base.util.*
+import org.apache.ofbiz.entity.*
+import org.apache.ofbiz.security.*
+import org.apache.ofbiz.service.*
+import org.apache.ofbiz.entity.model.*
+import org.apache.ofbiz.content.ContentManagementWorker
-import javax.servlet.*;
-import javax.servlet.http.*;
+import javax.servlet.*
+import javax.servlet.http.*
-currentEntityMap = session.getAttribute("currentEntityMap");
+currentEntityMap = session.getAttribute("currentEntityMap")
if (!currentEntityMap) {
- currentEntityMap = [:];
- session.setAttribute("currentEntityMap", currentEntityMap);
+ currentEntityMap = [:]
+ session.setAttribute("currentEntityMap", currentEntityMap)
}
-entityName = context.entityName;
-currentEntityPropertyName = parameters.currentEntityPropertyName;
+entityName = context.entityName
+currentEntityPropertyName = parameters.currentEntityPropertyName
if (!currentEntityPropertyName) {
- currentEntityName = entityName;
+ currentEntityName = entityName
} else {
- currentEntityName = parameters[currentEntityPropertyName];
+ currentEntityName = parameters[currentEntityPropertyName]
}
-//Debug.logInfo("in currentvalprep, currentEntityName:" + currentEntityName,"");
-cachedPK = currentEntityMap[currentEntityName];
-//Debug.logInfo("in currentvalprep, cachedPK:" + cachedPK,"");
+//Debug.logInfo("in currentvalprep, currentEntityName:" + currentEntityName,"")
+cachedPK = currentEntityMap[currentEntityName]
+//Debug.logInfo("in currentvalprep, cachedPK:" + cachedPK,"")
// Build a key from param or attribute values.
-paramMap = UtilHttp.getParameterMap(request);
-//Debug.logInfo("paramMap:" + paramMap, null);
-v = delegator.makeValue(currentEntityName);
-passedPK = v.getPrimaryKey();
-keyColl = passedPK.getAllKeys();
-keyIt = keyColl.iterator();
+paramMap = UtilHttp.getParameterMap(request)
+//Debug.logInfo("paramMap:" + paramMap, null)
+v = delegator.makeValue(currentEntityName)
+passedPK = v.getPrimaryKey()
+keyColl = passedPK.getAllKeys()
+keyIt = keyColl.iterator()
while (keyIt.hasNext()) {
- attrName = keyIt.next();
- attrVal = parameters[attrName];
- //Debug.logInfo("in currentvalprep, attrName:" + attrName,"");
- //Debug.logInfo("in currentvalprep, attrVal:" + attrVal,"");
+ attrName = keyIt.next()
+ attrVal = parameters[attrName]
+ //Debug.logInfo("in currentvalprep, attrName:" + attrName,"")
+ //Debug.logInfo("in currentvalprep, attrVal:" + attrVal,"")
if (attrVal) {
- passedPK[attrName] = attrVal;
+ passedPK[attrName] = attrVal
}
}
-//Debug.logInfo("in currentvalprep, passedPK:" + passedPK,"");
+//Debug.logInfo("in currentvalprep, passedPK:" + passedPK,"")
// messed up code to determine whether or not the cached or passed keys have missing fields,
// in which case, the valid one is used to retrieve the current value
-pksEqual = true;
+pksEqual = true
if (cachedPK) {
- keyColl = cachedPK.getPrimaryKey().getAllKeys();
- keyIt = keyColl.iterator();
+ keyColl = cachedPK.getPrimaryKey().getAllKeys()
+ keyIt = keyColl.iterator()
while (keyIt.hasNext()) {
- sCached = null;
- sPassed = null;
- oCached = null;
- oCached = null;
- ky = keyIt.next();
- oPassed = passedPK[ky];
+ sCached = null
+ sPassed = null
+ oCached = null
+ oCached = null
+ ky = keyIt.next()
+ oPassed = passedPK[ky]
if (oPassed) {
- sPassed = oPassed;
+ sPassed = oPassed
if (!sPassed) {
- pksEqual = false;
+ pksEqual = false
} else {
- oCached = cachedPK[ky];
+ oCached = cachedPK[ky]
if (oCached) {
- sCached = oCached;
+ sCached = oCached
if (!sPassed) {
- pksEqual = false;
+ pksEqual = false
} else {
if (!sPassed.equals(sCached)) {
- //pksEqual = true;
+ //pksEqual = true
}
}
}
}
} else {
- pksEqual = false;
+ pksEqual = false
}
}
}
-currentPK = passedPK;
+currentPK = passedPK
if (!pksEqual) {
- currentPK = cachedPK;
+ currentPK = cachedPK
// all other condition result in currentPK = passedPK
}
-//Debug.logInfo("in currentvalprep, currentPK:" + currentPK,"");
+//Debug.logInfo("in currentvalprep, currentPK:" + currentPK,"")
-currentEntityMap[currentEntityName] = currentPK;
-request.setAttribute("currentPK", currentPK);
-context.currentPK = currentPK;
-currentValue = from(currentPK.getPrimaryKey().getEntityName()).where(currentPK.getPrimaryKey()).queryOne();
-context.currentValue = currentValue;
-request.setAttribute("currentValue", currentValue);
+currentEntityMap[currentEntityName] = currentPK
+request.setAttribute("currentPK", currentPK)
+context.currentPK = currentPK
+currentValue = from(currentPK.getPrimaryKey().getEntityName()).where(currentPK.getPrimaryKey()).queryOne()
+context.currentValue = currentValue
+request.setAttribute("currentValue", currentValue)
-// Debug.logInfo("===========in currentvalprep, currentValue:" + request.getAttribute("currentValue"),"");
+// Debug.logInfo("===========in currentvalprep, currentValue:" + request.getAttribute("currentValue"),"")
if (currentValue) {
if (currentEntityName.indexOf("DataResource") >= 0) {
- suffix = "";
- s = currentValue.dataResourceTypeId ?: currentValue.drDataResourceTypeId;
- if (s) suffix = "_" + s;
+ suffix = ""
+ s = currentValue.dataResourceTypeId ?: currentValue.drDataResourceTypeId
+ if (s) suffix = "_" + s
if ("_ELECTRONIC_TEXT".equals(suffix)) {
- s = currentValue.mimeTypeId ?: currentValue.drMimeTypeId;
- if (s) suffix += "_" + s;
+ s = currentValue.mimeTypeId ?: currentValue.drMimeTypeId
+ if (s) suffix += "_" + s
}
- //Debug.logInfo("in currentvalprep, suffix:" + suffix,"");
+ //Debug.logInfo("in currentvalprep, suffix:" + suffix,"")
// if (suffix) {
-// ContentManagementWorker.mruAdd(session, currentPK, suffix);
+// ContentManagementWorker.mruAdd(session, currentPK, suffix)
// } else {
- ContentManagementWorker.mruAdd(session, currentPK);
+ ContentManagementWorker.mruAdd(session, currentPK)
// }
} else {
- ContentManagementWorker.mruAdd(session, currentPK);
+ ContentManagementWorker.mruAdd(session, currentPK)
}
}
-//Debug.logInfo("in currentvalprep, contentId:" + request.getAttribute("contentId"),"");
+//Debug.logInfo("in currentvalprep, contentId:" + request.getAttribute("contentId"),"")
diff --git a/specialpurpose/ecommerce/groovyScripts/forum/EditAddPrep.groovy b/specialpurpose/ecommerce/groovyScripts/forum/EditAddPrep.groovy
index 9bf279443d..6797d9b215 100644
--- a/specialpurpose/ecommerce/groovyScripts/forum/EditAddPrep.groovy
+++ b/specialpurpose/ecommerce/groovyScripts/forum/EditAddPrep.groovy
@@ -17,72 +17,72 @@
* under the License.
*/
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.TreeSet;
-import org.apache.ofbiz.base.util.*;
-import org.apache.ofbiz.entity.*;
-import org.apache.ofbiz.security.*;
-import org.apache.ofbiz.service.*;
-import org.apache.ofbiz.entity.model.*;
-import org.apache.ofbiz.securityext.login.*;
-import org.apache.ofbiz.common.*;
-import org.apache.ofbiz.entity.model.*;
-import org.apache.ofbiz.content.ContentManagementWorker;
-import org.apache.ofbiz.content.content.ContentWorker;
+import java.util.ArrayList
+import java.util.Collection
+import java.util.HashMap
+import java.util.Iterator
+import java.util.LinkedList
+import java.util.List
+import java.util.Map
+import java.util.Set
+import java.util.TreeSet
+import org.apache.ofbiz.base.util.*
+import org.apache.ofbiz.entity.*
+import org.apache.ofbiz.security.*
+import org.apache.ofbiz.service.*
+import org.apache.ofbiz.entity.model.*
+import org.apache.ofbiz.securityext.login.*
+import org.apache.ofbiz.common.*
+import org.apache.ofbiz.entity.model.*
+import org.apache.ofbiz.content.ContentManagementWorker
+import org.apache.ofbiz.content.content.ContentWorker
-import freemarker.template.SimpleHash;
-import freemarker.template.SimpleSequence;
+import freemarker.template.SimpleHash
+import freemarker.template.SimpleSequence
-import javax.servlet.*;
-import javax.servlet.http.*;
+import javax.servlet.*
+import javax.servlet.http.*
-singleWrapper = context.singleWrapper;
-contentIdTo = parameters.contentIdTo;
-singleWrapper.putInContext("contentIdTo", contentIdTo);
-mapKey = parameters.mapKey;
-singleWrapper.putInContext("mapKey", mapKey);
+singleWrapper = context.singleWrapper
+contentIdTo = parameters.contentIdTo
+singleWrapper.putInContext("contentIdTo", contentIdTo)
+mapKey = parameters.mapKey
+singleWrapper.putInContext("mapKey", mapKey)
if ("SUMMARY".equals(mapKey)) {
- singleWrapper.putInContext("textSource", "summaryData");
+ singleWrapper.putInContext("textSource", "summaryData")
} else {
- singleWrapper.putInContext("textSource", "textData");
+ singleWrapper.putInContext("textSource", "textData")
}
-singleWrapper.putInContext("dataResourceTypeId", "ELECTRONIC_TEXT");
-singleWrapper.putInContext("contentAssocTypeId", "SUB_CONTENT");
-//Debug.logInfo("in editaddprep, contentIdTo:" + contentIdTo,"");
-//Debug.logInfo("in editaddprep, mapKey:" + mapKey,"");
-//currentValue = request.getAttribute("currentValue");
-//currentValue = request.getAttribute("currentValue");
+singleWrapper.putInContext("dataResourceTypeId", "ELECTRONIC_TEXT")
+singleWrapper.putInContext("contentAssocTypeId", "SUB_CONTENT")
+//Debug.logInfo("in editaddprep, contentIdTo:" + contentIdTo,"")
+//Debug.logInfo("in editaddprep, mapKey:" + mapKey,"")
+//currentValue = request.getAttribute("currentValue")
+//currentValue = request.getAttribute("currentValue")
-currentValue = ContentWorker.getSubContentCache(delegator, contentIdTo, mapKey, null, userLogin, null, null, false, null);
-//Debug.logInfo("in editaddprep, currentValue:" + currentValue,"");
+currentValue = ContentWorker.getSubContentCache(delegator, contentIdTo, mapKey, null, userLogin, null, null, false, null)
+//Debug.logInfo("in editaddprep, currentValue:" + currentValue,"")
if (!currentValue) {
- parentValue = from("Content").where("contentId", contentIdTo).cache(true).queryOne();
- currentValue = delegator.makeValue("Content");
- subject = parentValue.contentName;
+ parentValue = from("Content").where("contentId", contentIdTo).cache(true).queryOne()
+ currentValue = delegator.makeValue("Content")
+ subject = parentValue.contentName
if ("SUMMARY".equals(mapKey)) {
- subject = "Short " + subject;
+ subject = "Short " + subject
}
- currentValue.contentName = subject;
- currentValue.description = subject;
- singleWrapper.putInContext("contentTypeId", "DOCUMENT");
+ currentValue.contentName = subject
+ currentValue.description = subject
+ singleWrapper.putInContext("contentTypeId", "DOCUMENT")
} else {
- singleWrapper.putInContext("contentTypeId", null);
- //Debug.logInfo("in editaddprep, currentValue:" + currentValue,"");
+ singleWrapper.putInContext("contentTypeId", null)
+ //Debug.logInfo("in editaddprep, currentValue:" + currentValue,"")
}
-singleWrapper.putInContext("currentValue", currentValue);
-context.currentValue = currentValue;
-request.setAttribute("currentValue", currentValue);
-persistAction = parameters.persistAction ?: "persistContent";
+singleWrapper.putInContext("currentValue", currentValue)
+context.currentValue = currentValue
+request.setAttribute("currentValue", currentValue)
+persistAction = parameters.persistAction ?: "persistContent"
-singleWrapper.putInContext("persistAction", persistAction);
-//Debug.logInfo("in editaddprep, currentValue:" + currentValue,"");
+singleWrapper.putInContext("persistAction", persistAction)
+//Debug.logInfo("in editaddprep, currentValue:" + currentValue,"")
diff --git a/specialpurpose/ecommerce/groovyScripts/forum/HtmlAreaPrep.groovy b/specialpurpose/ecommerce/groovyScripts/forum/HtmlAreaPrep.groovy
index 6e37285890..4be9ac6d2c 100644
--- a/specialpurpose/ecommerce/groovyScripts/forum/HtmlAreaPrep.groovy
+++ b/specialpurpose/ecommerce/groovyScripts/forum/HtmlAreaPrep.groovy
@@ -17,25 +17,25 @@
* under the License.
*/
-import org.apache.ofbiz.base.util.*;
-import org.apache.ofbiz.entity.*;
-import org.apache.ofbiz.security.*;
-import org.apache.ofbiz.service.*;
-import org.apache.ofbiz.entity.model.*;
-import org.apache.ofbiz.content.data.DataResourceWorker;
-import org.apache.ofbiz.webapp.ftl.FreeMarkerViewHandler;
+import org.apache.ofbiz.base.util.*
+import org.apache.ofbiz.entity.*
+import org.apache.ofbiz.security.*
+import org.apache.ofbiz.service.*
+import org.apache.ofbiz.entity.model.*
+import org.apache.ofbiz.content.data.DataResourceWorker
+import org.apache.ofbiz.webapp.ftl.FreeMarkerViewHandler
-import java.io.StringWriter;
-import freemarker.ext.beans.BeansWrapper;
-import freemarker.template.SimpleHash;
-import freemarker.template.WrappingTemplateModel;
+import java.io.StringWriter
+import freemarker.ext.beans.BeansWrapper
+import freemarker.template.SimpleHash
+import freemarker.template.WrappingTemplateModel
-import javax.servlet.*;
-import javax.servlet.http.*;
+import javax.servlet.*
+import javax.servlet.http.*
-contentIdTo = parameters.contentIdTo;
+contentIdTo = parameters.contentIdTo
if (!contentIdTo || !contentIdTo.equals("TEMPLATE_MASTER")) {
- context.dynamicPrimaryHTMLField = "textData";
+ context.dynamicPrimaryHTMLField = "textData"
}
diff --git a/specialpurpose/ecommerce/groovyScripts/forum/NodeTrailPrep.groovy b/specialpurpose/ecommerce/groovyScripts/forum/NodeTrailPrep.groovy
index becd74f396..389cb49761 100644
--- a/specialpurpose/ecommerce/groovyScripts/forum/NodeTrailPrep.groovy
+++ b/specialpurpose/ecommerce/groovyScripts/forum/NodeTrailPrep.groovy
@@ -17,64 +17,64 @@
* under the License.
*/
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.TreeSet;
+import java.util.ArrayList
+import java.util.Collection
+import java.util.HashMap
+import java.util.Iterator
+import java.util.LinkedList
+import java.util.List
+import java.util.Map
+import java.util.Set
+import java.util.TreeSet
-import org.apache.ofbiz.base.util.*;
-import org.apache.ofbiz.entity.*;
-import org.apache.ofbiz.security.*;
-import org.apache.ofbiz.service.*;
-import org.apache.ofbiz.entity.model.*;
-import org.apache.ofbiz.securityext.login.*;
-import org.apache.ofbiz.common.*;
-import org.apache.ofbiz.entity.model.*;
-import org.apache.ofbiz.content.content.ContentWorker;
-import org.apache.ofbiz.content.ContentManagementWorker;
+import org.apache.ofbiz.base.util.*
+import org.apache.ofbiz.entity.*
+import org.apache.ofbiz.security.*
+import org.apache.ofbiz.service.*
+import org.apache.ofbiz.entity.model.*
+import org.apache.ofbiz.securityext.login.*
+import org.apache.ofbiz.common.*
+import org.apache.ofbiz.entity.model.*
+import org.apache.ofbiz.content.content.ContentWorker
+import org.apache.ofbiz.content.ContentManagementWorker
-import javax.servlet.*;
-import javax.servlet.http.*;
+import javax.servlet.*
+import javax.servlet.http.*
-nodeTrailCsv = ContentManagementWorker.getFromSomewhere("nodeTrailCsv", parameters, request, context);
-passedParams = null;
+nodeTrailCsv = ContentManagementWorker.getFromSomewhere("nodeTrailCsv", parameters, request, context)
+passedParams = null
if (!nodeTrailCsv) {
// this only happens in UploadContentAndImage
- passedParams = request.getAttribute("passedParams");
+ passedParams = request.getAttribute("passedParams")
if (passedParams) {
- nodeTrailCsv = passedParams.nodeTrailCsv;
+ nodeTrailCsv = passedParams.nodeTrailCsv
}
}
if (nodeTrailCsv) {
- nodeTrail = ContentWorker.csvToTrail(nodeTrailCsv, delegator);
- context.globalNodeTrail = nodeTrail;
- singleWrapper = context.singleWrapper;
+ nodeTrail = ContentWorker.csvToTrail(nodeTrailCsv, delegator)
+ context.globalNodeTrail = nodeTrail
+ singleWrapper = context.singleWrapper
if (singleWrapper) {
- singleWrapper.putInContext("nodeTrailCsv",nodeTrailCsv);
+ singleWrapper.putInContext("nodeTrailCsv",nodeTrailCsv)
// there might be another way to do this, but if the widget form def already has a default-map
// (such as "currentValue"), then I don't know how to reference another map (defined in the
// field def via "map-name", except to do this.
// What I want to do is specify 'map-name=""' and have it use the context main
- Map dummy = singleWrapper.getFromContext("dummy");
+ Map dummy = singleWrapper.getFromContext("dummy")
if (!dummy) {
- dummy = [:];
+ dummy = [:]
}
- dummy.nodeTrailCsv = nodeTrailCsv;
- //Debug.logInfo("in nodetrailprep, dummy:" + dummy,"");
- singleWrapper.putInContext("dummy",dummy);
+ dummy.nodeTrailCsv = nodeTrailCsv
+ //Debug.logInfo("in nodetrailprep, dummy:" + dummy,"")
+ singleWrapper.putInContext("dummy",dummy)
}
- context.nodeTrailCsv = nodeTrailCsv;
+ context.nodeTrailCsv = nodeTrailCsv
- //Debug.logInfo("in nodetrailprep, nodeTrailCsv:" + nodeTrailCsv,"");
- trailContentList = ContentWorker.csvToContentList(nodeTrailCsv, delegator);
- //Debug.logInfo("in nodetrailprep, trailContentList:" + trailContentList,"");
- context.ancestorList = trailContentList;
- //Debug.logInfo("in vewprep, siteAncestorList:" + siteAncestorList,"");
+ //Debug.logInfo("in nodetrailprep, nodeTrailCsv:" + nodeTrailCsv,"")
+ trailContentList = ContentWorker.csvToContentList(nodeTrailCsv, delegator)
+ //Debug.logInfo("in nodetrailprep, trailContentList:" + trailContentList,"")
+ context.ancestorList = trailContentList
+ //Debug.logInfo("in vewprep, siteAncestorList:" + siteAncestorList,"")
}
diff --git a/specialpurpose/ecommerce/groovyScripts/forum/OwnerContentPrep.groovy b/specialpurpose/ecommerce/groovyScripts/forum/OwnerContentPrep.groovy
index d9b4916044..81e2b4cd18 100644
--- a/specialpurpose/ecommerce/groovyScripts/forum/OwnerContentPrep.groovy
+++ b/specialpurpose/ecommerce/groovyScripts/forum/OwnerContentPrep.groovy
@@ -17,62 +17,62 @@
* under the License.
*/
-import org.apache.ofbiz.base.util.*;
-import org.apache.ofbiz.entity.*;
-import org.apache.ofbiz.security.*;
-import org.apache.ofbiz.service.*;
-import org.apache.ofbiz.entity.model.*;
-import org.apache.ofbiz.content.data.DataResourceWorker;
-import org.apache.ofbiz.webapp.ftl.FreeMarkerViewHandler;
-import org.apache.ofbiz.content.content.ContentWorker;
-import org.apache.ofbiz.content.ContentManagementWorker;
+import org.apache.ofbiz.base.util.*
+import org.apache.ofbiz.entity.*
+import org.apache.ofbiz.security.*
+import org.apache.ofbiz.service.*
+import org.apache.ofbiz.entity.model.*
+import org.apache.ofbiz.content.data.DataResourceWorker
+import org.apache.ofbiz.webapp.ftl.FreeMarkerViewHandler
+import org.apache.ofbiz.content.content.ContentWorker
+import org.apache.ofbiz.content.ContentManagementWorker
-import java.io.StringWriter;
-import freemarker.ext.beans.BeansWrapper;
-import freemarker.template.SimpleHash;
-import freemarker.template.WrappingTemplateModel;
+import java.io.StringWriter
+import freemarker.ext.beans.BeansWrapper
+import freemarker.template.SimpleHash
+import freemarker.template.WrappingTemplateModel
-import javax.servlet.*;
-import javax.servlet.http.*;
+import javax.servlet.*
+import javax.servlet.http.*
// load edit or create Content form
-//Debug.logInfo("in ownerprep, security:" + security, "");
+//Debug.logInfo("in ownerprep, security:" + security, "")
-rootPubPt = parameters.webSiteId;
-//Debug.logInfo("in ownerprep, rootPubPt:" + rootPubPt, "");
-entityAction = page.entityOperation;
-permittedOperations = page.permittedOperations;
+rootPubPt = parameters.webSiteId
+//Debug.logInfo("in ownerprep, rootPubPt:" + rootPubPt, "")
+entityAction = page.entityOperation
+permittedOperations = page.permittedOperations
-allDepartmentContentList = ContentManagementWorker.getAllDepartmentContent(delegator, rootPubPt);
-//Debug.logInfo("in ownercontentprep, allDepartmentContentList:" + allDepartmentContentList, "");
-departmentPointList = ContentManagementWorker.getPermittedDepartmentPoints( delegator, allDepartmentContentList, userLogin, security, entityAction, "CONTENT_CREATE", null );
-//Debug.logInfo("in ownercontentprep, departmentPointList:" + departmentPointList, "");
-departmentPointMap = [:];
-departmentPointMapAll = [:];
-ownerContentList = [];
+allDepartmentContentList = ContentManagementWorker.getAllDepartmentContent(delegator, rootPubPt)
+//Debug.logInfo("in ownercontentprep, allDepartmentContentList:" + allDepartmentContentList, "")
+departmentPointList = ContentManagementWorker.getPermittedDepartmentPoints( delegator, allDepartmentContentList, userLogin, security, entityAction, "CONTENT_CREATE", null )
+//Debug.logInfo("in ownercontentprep, departmentPointList:" + departmentPointList, "")
+departmentPointMap = [:]
+departmentPointMapAll = [:]
+ownerContentList = []
departmentPointList.each { arr ->
- contentId = arr[0];
- description = arr[1];
- subPointList = [];
- lineMap = [:];
- lineMap.contentId = contentId;
- lineMap.description = description.toUpperCase();
- ownerContentList.add(lineMap);
- subDepartmentContentList = ContentManagementWorker.getAllDepartmentContent(delegator, contentId);
+ contentId = arr[0]
+ description = arr[1]
+ subPointList = []
+ lineMap = [:]
+ lineMap.contentId = contentId
+ lineMap.description = description.toUpperCase()
+ ownerContentList.add(lineMap)
+ subDepartmentContentList = ContentManagementWorker.getAllDepartmentContent(delegator, contentId)
subDepartmentContentList.each { departmentPoint2 ->
- contentId2 = departmentPoint2.contentId;
- description2 = departmentPoint2.templateTitle;
- lineMap2 = [:];
- lineMap2.contentId = contentId2;
- lineMap2.description = " -" + description2;
- ownerContentList.add(lineMap2);
+ contentId2 = departmentPoint2.contentId
+ description2 = departmentPoint2.templateTitle
+ lineMap2 = [:]
+ lineMap2.contentId = contentId2
+ lineMap2.description = " -" + description2
+ ownerContentList.add(lineMap2)
}
}
-//Debug.logInfo("in ownercontentprep, ownerContentList:" + ownerContentList, "");
+//Debug.logInfo("in ownercontentprep, ownerContentList:" + ownerContentList, "")
-pubPt = context.pubPt;
-//Debug.logInfo("in ownercontentprep, pubPt:" + pubPt, "");
-singleWrapper = context.singleWrapper;
-singleWrapper.putInContext("ownerContentList", ownerContentList);
-singleWrapper.putInContext("pubPt", pubPt);
+pubPt = context.pubPt
+//Debug.logInfo("in ownercontentprep, pubPt:" + pubPt, "")
+singleWrapper = context.singleWrapper
+singleWrapper.putInContext("ownerContentList", ownerContentList)
+singleWrapper.putInContext("pubPt", pubPt)
diff --git a/specialpurpose/ecommerce/groovyScripts/forum/PermPrep.groovy b/specialpurpose/ecommerce/groovyScripts/forum/PermPrep.groovy
index 9f6013cccf..3b2cf42078 100644
--- a/specialpurpose/ecommerce/groovyScripts/forum/PermPrep.groovy
+++ b/specialpurpose/ecommerce/groovyScripts/forum/PermPrep.groovy
@@ -17,149 +17,149 @@
* under the License.
*/
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.TreeSet;
+import java.util.ArrayList
+import java.util.Collection
+import java.util.HashMap
+import java.util.Iterator
+import java.util.LinkedList
+import java.util.List
+import java.util.Map
+import java.util.Set
+import java.util.TreeSet
-import org.apache.ofbiz.base.util.*;
-import org.apache.ofbiz.entity.*;
-import org.apache.ofbiz.security.*;
-import org.apache.ofbiz.service.*;
-import org.apache.ofbiz.entity.model.*;
-import org.apache.ofbiz.content.content.PermissionRecorder;
-import org.apache.ofbiz.content.ContentManagementWorker;
+import org.apache.ofbiz.base.util.*
+import org.apache.ofbiz.entity.*
+import org.apache.ofbiz.security.*
+import org.apache.ofbiz.service.*
+import org.apache.ofbiz.entity.model.*
+import org.apache.ofbiz.content.content.PermissionRecorder
+import org.apache.ofbiz.content.ContentManagementWorker
-import javax.servlet.*;
-import javax.servlet.http.*;
+import javax.servlet.*
+import javax.servlet.http.*
-paramMap = UtilHttp.getParameterMap(request);
-//Debug.logInfo("in permprep, userLogin(0):" + userLogin, null);
+paramMap = UtilHttp.getParameterMap(request)
+//Debug.logInfo("in permprep, userLogin(0):" + userLogin, null)
// Get permission from pagedef config file
-permission = context.permission;
-permissionType = context.permissionType ?: "simple";
+permission = context.permission
+permissionType = context.permissionType ?: "simple"
-entityName = context.entityName;
-entityOperation = context.entityOperation;
-targetOperation = context.targetOperation;
-//Debug.logInfo("in permprep, targetOperation(0):" + targetOperation, null);
+entityName = context.entityName
+entityOperation = context.entityOperation
+targetOperation = context.targetOperation
+//Debug.logInfo("in permprep, targetOperation(0):" + targetOperation, null)
-mode = paramMap.mode;
-//Debug.logInfo("in permprep, contentId(0):" + request.getAttribute("contentId"),"");
-currentValue = request.getAttribute("currentValue");
-//Debug.logInfo("in permprep, paramMap(1):" + paramMap, null);
-//Debug.logInfo("in permprep, currentValue(1):" + currentValue, null);
+mode = paramMap.mode
+//Debug.logInfo("in permprep, contentId(0):" + request.getAttribute("contentId"),"")
+currentValue = request.getAttribute("currentValue")
+//Debug.logInfo("in permprep, paramMap(1):" + paramMap, null)
+//Debug.logInfo("in permprep, currentValue(1):" + currentValue, null)
if ("add".equals(mode)) {
- entityOperation = context.addEntityOperation ?: context.entityOperation ?: "_CREATE";
- targetOperation = context.addTargetOperation ?: context.get("targetOperation") ?: "CONTENT_CREATE";
- //org.apache.ofbiz.base.util.Debug.logInfo("in permprep, targetOperation:" + targetOperation, null);
+ entityOperation = context.addEntityOperation ?: context.entityOperation ?: "_CREATE"
+ targetOperation = context.addTargetOperation ?: context.get("targetOperation") ?: "CONTENT_CREATE"
+ //org.apache.ofbiz.base.util.Debug.logInfo("in permprep, targetOperation:" + targetOperation, null)
} else {
if (!entityOperation) {
- entityOperation = "_UPDATE";
+ entityOperation = "_UPDATE"
}
if (!targetOperation) {
- targetOperation = "CONTENT_UPDATE";
+ targetOperation = "CONTENT_UPDATE"
}
}
if (permissionType.equals("complex")) {
- mapIn = [:];
- mapIn.userLogin = userLogin;
- targetOperationList = StringUtil.split(targetOperation, "|");
- mapIn.targetOperationList = targetOperationList;
- thisContentId = null;
+ mapIn = [:]
+ mapIn.userLogin = userLogin
+ targetOperationList = StringUtil.split(targetOperation, "|")
+ mapIn.targetOperationList = targetOperationList
+ thisContentId = null
- //Debug.logInfo("in permprep, userLogin(1):" + userLogin, null);
+ //Debug.logInfo("in permprep, userLogin(1):" + userLogin, null)
//if (userLogin != null) {
- //Debug.logInfo("in permprep, userLoginId(1):" + userLogin.get("userLoginId"), null);
+ //Debug.logInfo("in permprep, userLoginId(1):" + userLogin.get("userLoginId"), null)
//}
if (!currentValue || !"Content".equals(entityName)) {
- permissionIdName = context.permissionIdName;
- //org.apache.ofbiz.base.util.Debug.logInfo("in permprep, permissionIdName(1):" + permissionIdName, null);
+ permissionIdName = context.permissionIdName
+ //org.apache.ofbiz.base.util.Debug.logInfo("in permprep, permissionIdName(1):" + permissionIdName, null)
if (!permissionIdName) {
- thisContentId = ContentManagementWorker.getFromSomewhere(permissionIdName, paramMap, request, context);
+ thisContentId = ContentManagementWorker.getFromSomewhere(permissionIdName, paramMap, request, context)
} else if (!thisContentId) {
- thisContentId = ContentManagementWorker.getFromSomewhere("subContentId", paramMap, request, context);
+ thisContentId = ContentManagementWorker.getFromSomewhere("subContentId", paramMap, request, context)
} else if (!thisContentId) {
- thisContentId = ContentManagementWorker.getFromSomewhere("contentIdTo", paramMap, request, context);
+ thisContentId = ContentManagementWorker.getFromSomewhere("contentIdTo", paramMap, request, context)
} else if (!thisContentId) {
- thisContentId = ContentManagementWorker.getFromSomewhere("contentId", paramMap, request, context);
+ thisContentId = ContentManagementWorker.getFromSomewhere("contentId", paramMap, request, context)
}
- //org.apache.ofbiz.base.util.Debug.logInfo("in permprep, thisContentId(2):" + thisContentId, null);
+ //org.apache.ofbiz.base.util.Debug.logInfo("in permprep, thisContentId(2):" + thisContentId, null)
} else {
- thisContentId = currentValue.contentId;
+ thisContentId = currentValue.contentId
}
- //org.apache.ofbiz.base.util.Debug.logInfo("in permprep, thisContentId(3):" + thisContentId, null);
+ //org.apache.ofbiz.base.util.Debug.logInfo("in permprep, thisContentId(3):" + thisContentId, null)
if (!currentValue || !"Content".equals(entityName)) {
if (thisContentId) {
- currentValue = from("Content").where("contentId", thisContentId).queryOne();
+ currentValue = from("Content").where("contentId", thisContentId).queryOne()
}
}
if ("add".equals(mode)) {
- addEntityOperation = context.addEntityOperation;
+ addEntityOperation = context.addEntityOperation
if (addEntityOperation) {
- entityOperation = addEntityOperation;
+ entityOperation = addEntityOperation
}
} else {
- editEntityOperation = context.editEntityOperation;
+ editEntityOperation = context.editEntityOperation
if (editEntityOperation) {
- entityOperation = editEntityOperation;
+ entityOperation = editEntityOperation
}
}
- //org.apache.ofbiz.base.util.Debug.logInfo("in permprep, currentValue(2):" + currentValue, null);
+ //org.apache.ofbiz.base.util.Debug.logInfo("in permprep, currentValue(2):" + currentValue, null)
if ("Content".equals(currentValue?.getEntityName())) {
- mapIn.currentContent = currentValue;
+ mapIn.currentContent = currentValue
}
- mapIn.entityOperation = entityOperation;
+ mapIn.entityOperation = entityOperation
- contentPurposeTypeId = context.contentPurposeTypeId;
+ contentPurposeTypeId = context.contentPurposeTypeId
if (contentPurposeTypeId) {
- mapIncontentPurposeList = StringUtil.split(contentPurposeTypeId, "|");
+ mapIncontentPurposeList = StringUtil.split(contentPurposeTypeId, "|")
}
- //org.apache.ofbiz.base.util.Debug.logInfo("in permprep, mapIn:" + mapIn, null);
- result = runService('checkContentPermission', mapIn);
- permissionStatus = result.permissionStatus;
- //org.apache.ofbiz.base.util.Debug.logInfo("in permprep, permissionStatus:" + permissionStatus, null);
+ //org.apache.ofbiz.base.util.Debug.logInfo("in permprep, mapIn:" + mapIn, null)
+ result = runService('checkContentPermission', mapIn)
+ permissionStatus = result.permissionStatus
+ //org.apache.ofbiz.base.util.Debug.logInfo("in permprep, permissionStatus:" + permissionStatus, null)
if ("granted".equals(permissionStatus)) {
- context.hasPermission = true;
- request.setAttribute("hasPermission", true);
- request.setAttribute("permissionStatus", "granted");
+ context.hasPermission = true
+ request.setAttribute("hasPermission", true)
+ request.setAttribute("permissionStatus", "granted")
} else {
- context.hasPermission = false;
- request.setAttribute("hasPermission", false);
- request.setAttribute("permissionStatus", "");
- errorMessage = "Permission to display:" + page.getPageName() + " is denied.";
- recorder = result.permissionRecorder;
- //Debug.logInfo("recorder(0):" + recorder, "");
+ context.hasPermission = false
+ request.setAttribute("hasPermission", false)
+ request.setAttribute("permissionStatus", "")
+ errorMessage = "Permission to display:" + page.getPageName() + " is denied."
+ recorder = result.permissionRecorder
+ //Debug.logInfo("recorder(0):" + recorder, "")
if (recorder) {
- permissionMessage = recorder.toHtml();
- //Debug.logInfo("permissionMessage(0):" + permissionMessage, "");
- errorMessage += " \n " + permissionMessage;
+ permissionMessage = recorder.toHtml()
+ //Debug.logInfo("permissionMessage(0):" + permissionMessage, "")
+ errorMessage += " \n " + permissionMessage
}
- request.setAttribute("errorMsgReq", errorMessage);
+ request.setAttribute("errorMsgReq", errorMessage)
}
- //Debug.logInfo("in permprep, contentId(1):" + request.getAttribute("contentId"),"");
+ //Debug.logInfo("in permprep, contentId(1):" + request.getAttribute("contentId"),"")
} else {
- //org.apache.ofbiz.base.util.Debug.logInfo("permission:" + permission , null);
- //org.apache.ofbiz.base.util.Debug.logInfo("entityOperation:" + entityOperation , null);
+ //org.apache.ofbiz.base.util.Debug.logInfo("permission:" + permission , null)
+ //org.apache.ofbiz.base.util.Debug.logInfo("entityOperation:" + entityOperation , null)
if (security.hasEntityPermission(permission, entityOperation, session)) {
- //org.apache.ofbiz.base.util.Debug.logInfo("hasEntityPermission is true:" , null);
- context.hasPermission = true;
- request.setAttribute("hasPermission", true);
- request.setAttribute("permissionStatus", "granted");
+ //org.apache.ofbiz.base.util.Debug.logInfo("hasEntityPermission is true:" , null)
+ context.hasPermission = true
+ request.setAttribute("hasPermission", true)
+ request.setAttribute("permissionStatus", "granted")
} else {
- //org.apache.ofbiz.base.util.Debug.logInfo("hasEntityPermission is false:" , null);
- context.hasPermission = false;
- request.setAttribute("hasPermission", false);
- request.setAttribute("permissionStatus", "");
+ //org.apache.ofbiz.base.util.Debug.logInfo("hasEntityPermission is false:" , null)
+ context.hasPermission = false
+ request.setAttribute("hasPermission", false)
+ request.setAttribute("permissionStatus", "")
}
}
diff --git a/specialpurpose/ecommerce/groovyScripts/forum/PubInit.groovy b/specialpurpose/ecommerce/groovyScripts/forum/PubInit.groovy
index 0a2ebf1323..001eded075 100644
--- a/specialpurpose/ecommerce/groovyScripts/forum/PubInit.groovy
+++ b/specialpurpose/ecommerce/groovyScripts/forum/PubInit.groovy
@@ -17,40 +17,40 @@
* under the License.
*/
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.TreeSet;
-import org.apache.ofbiz.base.util.*;
-import org.apache.ofbiz.entity.*;
-import org.apache.ofbiz.security.*;
-import org.apache.ofbiz.service.*;
-import org.apache.ofbiz.entity.model.*;
-import org.apache.ofbiz.webapp.website.WebSiteWorker;
-import org.apache.ofbiz.securityext.login.*;
-import org.apache.ofbiz.common.*;
-import org.apache.ofbiz.entity.model.*;
-import org.apache.ofbiz.content.ContentManagementWorker;
+import java.util.ArrayList
+import java.util.Collection
+import java.util.HashMap
+import java.util.Iterator
+import java.util.LinkedList
+import java.util.List
+import java.util.Map
+import java.util.Set
+import java.util.TreeSet
+import org.apache.ofbiz.base.util.*
+import org.apache.ofbiz.entity.*
+import org.apache.ofbiz.security.*
+import org.apache.ofbiz.service.*
+import org.apache.ofbiz.entity.model.*
+import org.apache.ofbiz.webapp.website.WebSiteWorker
+import org.apache.ofbiz.securityext.login.*
+import org.apache.ofbiz.common.*
+import org.apache.ofbiz.entity.model.*
+import org.apache.ofbiz.content.ContentManagementWorker
-import javax.servlet.*;
-import javax.servlet.http.*;
+import javax.servlet.*
+import javax.servlet.http.*
-paramMap = UtilHttp.getParameterMap(request);
-forumId = null;
-servletContext = session.getServletContext();
-rootForumId = WebSiteWorker.getWebSiteId(request);
-context.rootPubId = rootForumId;
-session.setAttribute("rootPubId", rootForumId);
-request.setAttribute("rootPubId", rootForumId);
-forumId = ContentManagementWorker.getFromSomewhere("forumId", paramMap, request, context);
+paramMap = UtilHttp.getParameterMap(request)
+forumId = null
+servletContext = session.getServletContext()
+rootForumId = WebSiteWorker.getWebSiteId(request)
+context.rootPubId = rootForumId
+session.setAttribute("rootPubId", rootForumId)
+request.setAttribute("rootPubId", rootForumId)
+forumId = ContentManagementWorker.getFromSomewhere("forumId", paramMap, request, context)
if (forumId) {
- forumId = rootForumId;
+ forumId = rootForumId
}
-context.forumId = forumId;
-session.setAttribute("forumId", forumId);
-request.setAttribute("forumId", forumId);
+context.forumId = forumId
+session.setAttribute("forumId", forumId)
+request.setAttribute("forumId", forumId)
diff --git a/specialpurpose/ecommerce/groovyScripts/forum/RespondPermAndPrep.groovy b/specialpurpose/ecommerce/groovyScripts/forum/RespondPermAndPrep.groovy
index 1906be3c85..ad58bc40c6 100644
--- a/specialpurpose/ecommerce/groovyScripts/forum/RespondPermAndPrep.groovy
+++ b/specialpurpose/ecommerce/groovyScripts/forum/RespondPermAndPrep.groovy
@@ -17,139 +17,139 @@
* under the License.
*/
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.TreeSet;
+import java.util.ArrayList
+import java.util.Collection
+import java.util.HashMap
+import java.util.Iterator
+import java.util.LinkedList
+import java.util.List
+import java.util.Map
+import java.util.Set
+import java.util.TreeSet
-import org.apache.ofbiz.base.util.*;
-import org.apache.ofbiz.entity.*;
-import org.apache.ofbiz.security.*;
-import org.apache.ofbiz.service.*;
-import org.apache.ofbiz.entity.model.*;
-import org.apache.ofbiz.content.content.PermissionRecorder;
+import org.apache.ofbiz.base.util.*
+import org.apache.ofbiz.entity.*
+import org.apache.ofbiz.security.*
+import org.apache.ofbiz.service.*
+import org.apache.ofbiz.entity.model.*
+import org.apache.ofbiz.content.content.PermissionRecorder
-import javax.servlet.*;
-import javax.servlet.http.*;
+import javax.servlet.*
+import javax.servlet.http.*
-paramMap = UtilHttp.getParameterMap(request);
+paramMap = UtilHttp.getParameterMap(request)
-contentIdTo = paramMap.contentIdTo;
+contentIdTo = paramMap.contentIdTo
if (!contentIdTo) {
- request.setAttribute("errorMsgReq", "contentIdTo is empty");
- return;
+ request.setAttribute("errorMsgReq", "contentIdTo is empty")
+ return
}
/*
-pubPt = paramMap.pubPt ?: context.pubPt;
+pubPt = paramMap.pubPt ?: context.pubPt
if (!pubPt) {
- request.setAttribute("errorMsgReq", "pubPt is empty");
- return;
+ request.setAttribute("errorMsgReq", "pubPt is empty")
+ return
}
*/
-contentToValue = from("Content").where("contentId", contentIdTo).queryOne();
-contentToPurposeList = contentToValue.getRelated("ContentPurpose", null, null, true);
-currentValue = delegator.makeValue("Content", [contentTypeId : "DOCUMENT", statusId : "CTNT_PUBLISHED", privilegeEnumId : "_00_"]);
+contentToValue = from("Content").where("contentId", contentIdTo).queryOne()
+contentToPurposeList = contentToValue.getRelated("ContentPurpose", null, null, true)
+currentValue = delegator.makeValue("Content", [contentTypeId : "DOCUMENT", statusId : "CTNT_PUBLISHED", privilegeEnumId : "_00_"])
if (contentToPurposeList.contains("RESPONSE")) {
- ownerContentId = contentToValue.ownerContentId;
- currentValue.ownerContentId = ownerContentId;
+ ownerContentId = contentToValue.ownerContentId
+ currentValue.ownerContentId = ownerContentId
} else {
- contentId = contentToValue.contentId;
- currentValueownerContentId = contentId;
+ contentId = contentToValue.contentId
+ currentValueownerContentId = contentId
}
-mapIn = [:];
-mapIn.userLogin = userLogin;
-targetOperationList = StringUtil.split(context.targetOperation, "|");
-mapIn.targetOperationList = targetOperationList;
+mapIn = [:]
+mapIn.userLogin = userLogin
+targetOperationList = StringUtil.split(context.targetOperation, "|")
+mapIn.targetOperationList = targetOperationList
if (currentValue) {
- mapIn.currentContent = currentValue;
+ mapIn.currentContent = currentValue
}
-mapIn.entityOperation = "_CREATE";
-mapIn.contentPurposeList = ["RESPONSE"];
+mapIn.entityOperation = "_CREATE"
+mapIn.contentPurposeList = ["RESPONSE"]
-//org.apache.ofbiz.base.util.Debug.logInfo("in permprep, mapIn:" + mapIn, null);
-result = runService('checkContentPermission', mapIn);
-permissionStatus = result.permissionStatus;
-//org.apache.ofbiz.base.util.Debug.logInfo("permissionStatus:" + permissionStatus, null);
+//org.apache.ofbiz.base.util.Debug.logInfo("in permprep, mapIn:" + mapIn, null)
+result = runService('checkContentPermission', mapIn)
+permissionStatus = result.permissionStatus
+//org.apache.ofbiz.base.util.Debug.logInfo("permissionStatus:" + permissionStatus, null)
if (!"granted".equals(permissionStatus)) {
- request.setAttribute("errorMsgReq", "Permission to add response is denied (1)");
- errorMessage = "Permission to add response is denied (2)";
- recorder = result.permissionRecorder;
- //Debug.logInfo("recorder(0):" + recorder, "");
+ request.setAttribute("errorMsgReq", "Permission to add response is denied (1)")
+ errorMessage = "Permission to add response is denied (2)"
+ recorder = result.permissionRecorder
+ //Debug.logInfo("recorder(0):" + recorder, "")
if (recorder) {
- permissionMessage = recorder.toHtml();
- //Debug.logInfo("permissionMessage(0):" + permissionMessage, "");
- errorMessage += " \n " + permissionMessage;
+ permissionMessage = recorder.toHtml()
+ //Debug.logInfo("permissionMessage(0):" + permissionMessage, "")
+ errorMessage += " \n " + permissionMessage
}
- request.setAttribute("permissionErrorMsg", errorMessage);
- context.permissionErrorMsg = errorMessage;
- context.hasPermission = false;
- request.setAttribute("hasPermission", false);
- request.setAttribute("permissionStatus", "");
- return;
+ request.setAttribute("permissionErrorMsg", errorMessage)
+ context.permissionErrorMsg = errorMessage
+ context.hasPermission = false
+ request.setAttribute("hasPermission", false)
+ request.setAttribute("permissionStatus", "")
+ return
} else {
- context.hasPermission = true;
- request.setAttribute("hasPermission", true);
- request.setAttribute("permissionStatus", "granted");
+ context.hasPermission = true
+ request.setAttribute("hasPermission", true)
+ request.setAttribute("permissionStatus", "granted")
}
/*
-pubContentValue = delegator.findOne("Content", [contentId : pubPt], false);
+pubContentValue = delegator.findOne("Content", [contentId : pubPt], false)
if (pubContentValue) {
- mapIn.currentContent = pubContentValue;
- mapIn.statusId = "CTNT_PUBLISHED";
+ mapIn.currentContent = pubContentValue
+ mapIn.statusId = "CTNT_PUBLISHED"
}
-//org.apache.ofbiz.base.util.Debug.logInfo("in permprep(2), mapIn:" + mapIn, null);
-result = dispatcher.runSync("checkContentPermission", mapIn);
-permissionStatus = result.permissionStatus;
-//org.apache.ofbiz.base.util.Debug.logInfo("permissionStatus(2):" + permissionStatus, null);
+//org.apache.ofbiz.base.util.Debug.logInfo("in permprep(2), mapIn:" + mapIn, null)
+result = dispatcher.runSync("checkContentPermission", mapIn)
+permissionStatus = result.permissionStatus
+//org.apache.ofbiz.base.util.Debug.logInfo("permissionStatus(2):" + permissionStatus, null)
if (!"granted".equals(permissionStatus)) {
- request.setAttribute("errorMsgReq", "Permission to add response is denied (2)");
- errorMessage = "Permission to add response is denied (2)";
- recorder = result.permissionRecorder;
- //Debug.logInfo("recorder(0):" + recorder, "");
+ request.setAttribute("errorMsgReq", "Permission to add response is denied (2)")
+ errorMessage = "Permission to add response is denied (2)"
+ recorder = result.permissionRecorder
+ //Debug.logInfo("recorder(0):" + recorder, "")
if (recorder) {
- permissionMessage = recorder.toHtml();
- //Debug.logInfo("permissionMessage(0):" + permissionMessage, "");
- errorMessage += " \n " + permissionMessage;
+ permissionMessage = recorder.toHtml()
+ //Debug.logInfo("permissionMessage(0):" + permissionMessage, "")
+ errorMessage += " \n " + permissionMessage
}
- request.setAttribute("permissionErrorMsg", errorMessage);
- context.permissionErrorMsg = errorMessage;
- context.hasPermission = false;
- request.setAttribute("hasPermission", false);
- request.setAttribute("permissionStatus", "");
- return;
+ request.setAttribute("permissionErrorMsg", errorMessage)
+ context.permissionErrorMsg = errorMessage
+ context.hasPermission = false
+ request.setAttribute("hasPermission", false)
+ request.setAttribute("permissionStatus", "")
+ return
} else {
- context.hasPermission = true;
- request.setAttribute("hasPermission", true);
- request.setAttribute("permissionStatus", "granted");
+ context.hasPermission = true
+ request.setAttribute("hasPermission", true)
+ request.setAttribute("permissionStatus", "granted")
}
*/
-request.setAttribute("currentValue", currentValue);
-singleWrapper = context.singleWrapper;
-singleWrapper.putInContext("contentPurposeTypeId", context.contentPurposeTypeId);
-singleWrapper.putInContext("targetOperation", context.targetOperation);
-singleWrapper.putInContext("targetOperationString", context.targetOperation);
-singleWrapper.putInContext("currentValue", currentValue);
+request.setAttribute("currentValue", currentValue)
+singleWrapper = context.singleWrapper
+singleWrapper.putInContext("contentPurposeTypeId", context.contentPurposeTypeId)
+singleWrapper.putInContext("targetOperation", context.targetOperation)
+singleWrapper.putInContext("targetOperationString", context.targetOperation)
+singleWrapper.putInContext("currentValue", currentValue)
-trailList = context.trailList;
-replyName = null;
+trailList = context.trailList
+replyName = null
if (trailList) {
- idNamePair = trailList[trailList.size() -1];
- replyName = idNamePair[1];
+ idNamePair = trailList[trailList.size() -1]
+ replyName = idNamePair[1]
if (!replyName.contains("RE:")) {
- replyName = "RE:" + replyName;
+ replyName = "RE:" + replyName
}
}
-singleWrapper.putInContext("replyName", [contentName : replyName, description : replyName]);
+singleWrapper.putInContext("replyName", [contentName : replyName, description : replyName])
diff --git a/specialpurpose/ecommerce/groovyScripts/forum/ResponsePrep.groovy b/specialpurpose/ecommerce/groovyScripts/forum/ResponsePrep.groovy
index 8935247d82..945dee3488 100644
--- a/specialpurpose/ecommerce/groovyScripts/forum/ResponsePrep.groovy
+++ b/specialpurpose/ecommerce/groovyScripts/forum/ResponsePrep.groovy
@@ -17,59 +17,59 @@
* under the License.
*/
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.TreeSet;
+import java.util.ArrayList
+import java.util.Collection
+import java.util.HashMap
+import java.util.Iterator
+import java.util.LinkedList
+import java.util.List
+import java.util.Map
+import java.util.Set
+import java.util.TreeSet
-import org.apache.ofbiz.base.util.*;
-import org.apache.ofbiz.entity.*;
-import org.apache.ofbiz.security.*;
-import org.apache.ofbiz.service.*;
-import org.apache.ofbiz.entity.model.*;
-import org.apache.ofbiz.securityext.login.*;
-import org.apache.ofbiz.common.*;
-import org.apache.ofbiz.content.content.ContentWorker;
+import org.apache.ofbiz.base.util.*
+import org.apache.ofbiz.entity.*
+import org.apache.ofbiz.security.*
+import org.apache.ofbiz.service.*
+import org.apache.ofbiz.entity.model.*
+import org.apache.ofbiz.securityext.login.*
+import org.apache.ofbiz.common.*
+import org.apache.ofbiz.content.content.ContentWorker
-import javax.servlet.*;
-import javax.servlet.http.*;
+import javax.servlet.*
+import javax.servlet.http.*
-paramMap = UtilHttp.getParameterMap(request);
+paramMap = UtilHttp.getParameterMap(request)
-contentIdTo = paramMap.contentIdTo;
-nodeTrailCsv = paramMap.nodeTrailCsv;
-//Debug.logInfo("in viewprep, nodeTrailCsv:" + nodeTrailCsv,"");
-context.nodeTrailCsv = nodeTrailCsv;
-contentId = paramMap.contentIdTo;
-context.subContentId = contentId;
-context.contentIdTo = contentId;
+contentIdTo = paramMap.contentIdTo
+nodeTrailCsv = paramMap.nodeTrailCsv
+//Debug.logInfo("in viewprep, nodeTrailCsv:" + nodeTrailCsv,"")
+context.nodeTrailCsv = nodeTrailCsv
+contentId = paramMap.contentIdTo
+context.subContentId = contentId
+context.contentIdTo = contentId
-trail = StringUtil.split(nodeTrailCsv, ",");
-siteAncestorList = [];
-idList = [];
+trail = StringUtil.split(nodeTrailCsv, ",")
+siteAncestorList = []
+idList = []
if (trail) {
- pubPt = trail[0];
- ContentWorker.getContentAncestry(delegator, pubPt, "SUBSITE", "To", idList);
- idList.add(pubPt);
+ pubPt = trail[0]
+ ContentWorker.getContentAncestry(delegator, pubPt, "SUBSITE", "To", idList)
+ idList.add(pubPt)
}
// start at 1 to skip webSiteId
idList.each { id ->
- webSitePublishPoint = from("WebSitePublishPoint").where("contentId", id).cache(true).queryOne();
- siteAncestorList.add(webSitePublishPoint);
+ webSitePublishPoint = from("WebSitePublishPoint").where("contentId", id).cache(true).queryOne()
+ siteAncestorList.add(webSitePublishPoint)
}
-context.siteAncestorList = siteAncestorList;
-//Debug.logInfo("in viewprep, siteAncestorList:" + siteAncestorList,"");
+context.siteAncestorList = siteAncestorList
+//Debug.logInfo("in viewprep, siteAncestorList:" + siteAncestorList,"")
-singleWrapper = context.singleWrapper;
-// singleWrapper.putInContext("pageName", page.getPageName());
-singleWrapper.putInContext("contentIdTo", contentIdTo);
-singleWrapper.putInContext("summaryDataResourceTypeId", null);
-singleWrapper.putInContext("mapKey", null);
-singleWrapper.putInContext("nodeTrailCsv", nodeTrailCsv);
+singleWrapper = context.singleWrapper
+// singleWrapper.putInContext("pageName", page.getPageName())
+singleWrapper.putInContext("contentIdTo", contentIdTo)
+singleWrapper.putInContext("summaryDataResourceTypeId", null)
+singleWrapper.putInContext("mapKey", null)
+singleWrapper.putInContext("nodeTrailCsv", nodeTrailCsv)
diff --git a/specialpurpose/ecommerce/groovyScripts/forum/ViewPrep.groovy b/specialpurpose/ecommerce/groovyScripts/forum/ViewPrep.groovy
index 453098e071..e5ee12f225 100644
--- a/specialpurpose/ecommerce/groovyScripts/forum/ViewPrep.groovy
+++ b/specialpurpose/ecommerce/groovyScripts/forum/ViewPrep.groovy
@@ -17,55 +17,55 @@
* under the License.
*/
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.TreeSet;
+import java.util.ArrayList
+import java.util.Collection
+import java.util.HashMap
+import java.util.Iterator
+import java.util.LinkedList
+import java.util.List
+import java.util.Map
+import java.util.Set
+import java.util.TreeSet
-import org.apache.ofbiz.base.util.*;
-import org.apache.ofbiz.entity.*;
-import org.apache.ofbiz.security.*;
-import org.apache.ofbiz.service.*;
-import org.apache.ofbiz.entity.model.*;
-import org.apache.ofbiz.securityext.login.*;
-import org.apache.ofbiz.common.*;
-import org.apache.ofbiz.content.content.ContentWorker;
-import org.apache.ofbiz.content.ContentManagementWorker;
+import org.apache.ofbiz.base.util.*
+import org.apache.ofbiz.entity.*
+import org.apache.ofbiz.security.*
+import org.apache.ofbiz.service.*
+import org.apache.ofbiz.entity.model.*
+import org.apache.ofbiz.securityext.login.*
+import org.apache.ofbiz.common.*
+import org.apache.ofbiz.content.content.ContentWorker
+import org.apache.ofbiz.content.ContentManagementWorker
-import javax.servlet.*;
-import javax.servlet.http.*;
+import javax.servlet.*
+import javax.servlet.http.*
-paramMap = UtilHttp.getParameterMap(request);
+paramMap = UtilHttp.getParameterMap(request)
// Strip old VIEW_INDEX from query string if present
//since we are adding them again.
-temp = request.getQueryString();
-queryString = UtilHttp.stripViewParamsFromQueryString(temp);
-//Debug.logInfo("in viewprep, queryString(1):" + queryString,"");
-context.queryString = queryString;
-//Debug.logInfo("in viewprep, queryString(2):" + queryString,"");
+temp = request.getQueryString()
+queryString = UtilHttp.stripViewParamsFromQueryString(temp)
+//Debug.logInfo("in viewprep, queryString(1):" + queryString,"")
+context.queryString = queryString
+//Debug.logInfo("in viewprep, queryString(2):" + queryString,"")
-requestURL = request.getRequestURL();
-//Debug.logInfo("in viewprep, requestURL(3):" + requestURL,"");
-context.requestURL = requestURL;
-viewSize = paramMap.VIEW_SIZE;
-context.viewSize = viewSize;
-//Debug.logInfo("in viewprep, viewSize(3):" + viewSize,"");
-viewIndex = paramMap.VIEW_INDEX;
-context.viewIndex = viewIndex;
-//Debug.logInfo("in viewprep, viewIndex(3):" + viewIndex,"");
+requestURL = request.getRequestURL()
+//Debug.logInfo("in viewprep, requestURL(3):" + requestURL,"")
+context.requestURL = requestURL
+viewSize = paramMap.VIEW_SIZE
+context.viewSize = viewSize
+//Debug.logInfo("in viewprep, viewSize(3):" + viewSize,"")
+viewIndex = paramMap.VIEW_INDEX
+context.viewIndex = viewIndex
+//Debug.logInfo("in viewprep, viewIndex(3):" + viewIndex,"")
-nodeTrailCsv = ContentManagementWorker.getFromSomewhere("nodeTrailCsv", paramMap, request, context);
-context.nodeTrailCsv = nodeTrailCsv;
-contentId = ContentManagementWorker.getFromSomewhere("contentId", paramMap, request, context);
-//Debug.logInfo("in viewprep, contentId(3):" + contentId,"");
-context.subContentId = contentId;
-context.contentIdTo = contentId;
-forumId = ContentManagementWorker.getFromSomewhere("forumId", paramMap, request, context);
-//forumContent = delegator.findOne("Content", [contentId : forumId], true);
-//context.forumContent = forumContent;
+nodeTrailCsv = ContentManagementWorker.getFromSomewhere("nodeTrailCsv", paramMap, request, context)
+context.nodeTrailCsv = nodeTrailCsv
+contentId = ContentManagementWorker.getFromSomewhere("contentId", paramMap, request, context)
+//Debug.logInfo("in viewprep, contentId(3):" + contentId,"")
+context.subContentId = contentId
+context.contentIdTo = contentId
+forumId = ContentManagementWorker.getFromSomewhere("forumId", paramMap, request, context)
+//forumContent = delegator.findOne("Content", [contentId : forumId], true)
+//context.forumContent = forumContent
diff --git a/specialpurpose/ecommerce/groovyScripts/includes/MruAdd.groovy b/specialpurpose/ecommerce/groovyScripts/includes/MruAdd.groovy
index 0b2966d9fa..e887ac001f 100644
--- a/specialpurpose/ecommerce/groovyScripts/includes/MruAdd.groovy
+++ b/specialpurpose/ecommerce/groovyScripts/includes/MruAdd.groovy
@@ -17,55 +17,55 @@
* under the License.
*/
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.TreeSet;
+import java.util.ArrayList
+import java.util.Collection
+import java.util.HashMap
+import java.util.Iterator
+import java.util.LinkedList
+import java.util.List
+import java.util.Map
+import java.util.Set
+import java.util.TreeSet
-import org.apache.ofbiz.base.util.*;
-import org.apache.ofbiz.entity.*;
-import org.apache.ofbiz.security.*;
-import org.apache.ofbiz.service.*;
-import org.apache.ofbiz.entity.model.*;
-import org.apache.ofbiz.content.ContentManagementWorker;
-import org.apache.ofbiz.content.content.ContentWorker;
-import org.apache.ofbiz.base.util.collections.LifoSet;
+import org.apache.ofbiz.base.util.*
+import org.apache.ofbiz.entity.*
+import org.apache.ofbiz.security.*
+import org.apache.ofbiz.service.*
+import org.apache.ofbiz.entity.model.*
+import org.apache.ofbiz.content.ContentManagementWorker
+import org.apache.ofbiz.content.content.ContentWorker
+import org.apache.ofbiz.base.util.collections.LifoSet
-import javax.servlet.*;
-import javax.servlet.http.*;
+import javax.servlet.*
+import javax.servlet.http.*
-lookupCaches = session.getAttribute("lookupCaches");
-//org.apache.ofbiz.base.util.Debug.logInfo("entityName:" + entityName, "");
-//org.apache.ofbiz.base.util.Debug.logInfo("in MruAdd.groovy, lookupCaches:" + lookupCaches, "");
+lookupCaches = session.getAttribute("lookupCaches")
+//org.apache.ofbiz.base.util.Debug.logInfo("entityName:" + entityName, "")
+//org.apache.ofbiz.base.util.Debug.logInfo("in MruAdd.groovy, lookupCaches:" + lookupCaches, "")
if (!lookupCaches) {
- lookupCaches = [:];
- session.setAttribute("lookupCaches", lookupCaches);
+ lookupCaches = [:]
+ session.setAttribute("lookupCaches", lookupCaches)
}
-cacheEntityName = entityName;
-//Debug.logInfo("cacheEntityName:" + cacheEntityName, "");
-lifoSet = lookupCaches[cacheEntityName];
-//org.apache.ofbiz.base.util.Debug.logInfo("lifoSet:" + lifoSet, "");
+cacheEntityName = entityName
+//Debug.logInfo("cacheEntityName:" + cacheEntityName, "")
+lifoSet = lookupCaches[cacheEntityName]
+//org.apache.ofbiz.base.util.Debug.logInfo("lifoSet:" + lifoSet, "")
if (!lifoSet) {
- lifoSet = new LifoSet(10);
- lookupCaches[cacheEntityName] = lifoSet;
+ lifoSet = new LifoSet(10)
+ lookupCaches[cacheEntityName] = lifoSet
}
-paramMap = UtilHttp.getParameterMap(request);
-contentId = paramMap.contentId;
-contentAssocDataResourceViewFrom = ContentWorker.getSubContentCache(delegator, null, null, contentId, null, null, null, null, null);
-//Debug.logInfo("in mruadd, contentAssocDataResourceViewFrom :" + contentAssocDataResourceViewFrom , "");
+paramMap = UtilHttp.getParameterMap(request)
+contentId = paramMap.contentId
+contentAssocDataResourceViewFrom = ContentWorker.getSubContentCache(delegator, null, null, contentId, null, null, null, null, null)
+//Debug.logInfo("in mruadd, contentAssocDataResourceViewFrom :" + contentAssocDataResourceViewFrom , "")
if (contentAssocDataResourceViewFrom) {
- lookupCaches = session.getAttribute("lookupCaches");
- viewPK = contentAssocDataResourceViewFrom.getPrimaryKey();
- //Debug.logInfo("in mruadd, viewPK :" + viewPK , "");
+ lookupCaches = session.getAttribute("lookupCaches")
+ viewPK = contentAssocDataResourceViewFrom.getPrimaryKey()
+ //Debug.logInfo("in mruadd, viewPK :" + viewPK , "")
if (viewPK) {
- ContentManagementWorker.mruAdd(session, viewPK);
+ ContentManagementWorker.mruAdd(session, viewPK)
}
}
diff --git a/specialpurpose/ecommerce/groovyScripts/order/AnonymousCheckoutLinks.groovy b/specialpurpose/ecommerce/groovyScripts/order/AnonymousCheckoutLinks.groovy
index 1d7175ab1f..74c84aa65e 100644
--- a/specialpurpose/ecommerce/groovyScripts/order/AnonymousCheckoutLinks.groovy
+++ b/specialpurpose/ecommerce/groovyScripts/order/AnonymousCheckoutLinks.groovy
@@ -17,30 +17,30 @@
* 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)
if (userLogin) {
- context.enableShippingAddress = true;
+ context.enableShippingAddress = true
}
-shippingContactMechId = shoppingCart.getShippingContactMechId();
+shippingContactMechId = shoppingCart.getShippingContactMechId()
if (shippingContactMechId) {
- context.enableShipmentMethod = true;
+ context.enableShipmentMethod = true
}
-shipmentMethodTypeId = shoppingCart.getShipmentMethodTypeId();
+shipmentMethodTypeId = shoppingCart.getShipmentMethodTypeId()
if (shipmentMethodTypeId) {
- context.enablePaymentOptions = true;
+ context.enablePaymentOptions = true
}
-paymentMethodIds = shoppingCart.getPaymentMethodIds();
-paymentMethodTypeId = parameters.paymentMethodTypeId;
+paymentMethodIds = shoppingCart.getPaymentMethodIds()
+paymentMethodTypeId = parameters.paymentMethodTypeId
if (paymentMethodIds || paymentMethodTypeId) {
- context.enablePaymentInformation = true;
+ context.enablePaymentInformation = true
}
if (paymentMethodIds) {
- context.enableReviewOrder = true;
+ context.enableReviewOrder = true
}
diff --git a/specialpurpose/ecommerce/groovyScripts/order/AnonymousTrail.groovy b/specialpurpose/ecommerce/groovyScripts/order/AnonymousTrail.groovy
index 919f1c45c2..977cb65934 100644
--- a/specialpurpose/ecommerce/groovyScripts/order/AnonymousTrail.groovy
+++ b/specialpurpose/ecommerce/groovyScripts/order/AnonymousTrail.groovy
@@ -17,26 +17,26 @@
* under the License.
*/
-import org.apache.ofbiz.order.shoppingcart.*;
+import org.apache.ofbiz.order.shoppingcart.*
-cart = session.getAttribute("shoppingCart");
+cart = session.getAttribute("shoppingCart")
-trailClassMap = [:];
+trailClassMap = [:]
if (cart.getShippingContactMechId()) {
- context.shipAddr = "Y";
- trailClassMap.shipAddr = "submenutextright";
+ context.shipAddr = "Y"
+ trailClassMap.shipAddr = "submenutextright"
}
if (cart.getShipmentMethodTypeId()) {
- context.shipOptions = "Y";
- trailClassMap.shipAddr = "submenutext";
- trailClassMap.shipOptions = "submenutextright";
+ context.shipOptions = "Y"
+ trailClassMap.shipAddr = "submenutext"
+ trailClassMap.shipOptions = "submenutextright"
}
if (parameters.paymentMethodType || cart.getPaymentMethodIds() || cart.getPaymentMethodTypeIds()) {
- context.billing = "Y";
- trailClassMap.shipOptions = "submenutext";
- trailClassMap.paymentType = "submenutextright";
+ context.billing = "Y"
+ trailClassMap.shipOptions = "submenutext"
+ trailClassMap.paymentType = "submenutextright"
}
-context.trailClass = trailClassMap;
+context.trailClass = trailClassMap
diff --git a/specialpurpose/ecommerce/groovyScripts/order/BillSettings.groovy b/specialpurpose/ecommerce/groovyScripts/order/BillSettings.groovy
index e3602d5e45..57fa17a8c2 100644
--- a/specialpurpose/ecommerce/groovyScripts/order/BillSettings.groovy
+++ b/specialpurpose/ecommerce/groovyScripts/order/BillSettings.groovy
@@ -17,92 +17,92 @@
* 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 = session.getAttribute("shoppingCart");
-currencyUomId = cart.getCurrency();
-payType = parameters.paymentMethodType;
+cart = session.getAttribute("shoppingCart")
+currencyUomId = cart.getCurrency()
+payType = parameters.paymentMethodType
if (!payType && parameters.useGc) {
- payType = "GC";
+ payType = "GC"
}
-context.cart = cart;
-context.paymentMethodType = payType;
+context.cart = cart
+context.paymentMethodType = payType
-partyId = cart.getPartyId() ?: userLogin.partyId;
-context.partyId = partyId;
+partyId = cart.getPartyId() ?: userLogin.partyId
+context.partyId = partyId
// 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 (party) {
- context.paymentMethodList = EntityUtil.filterByDate(party.getRelated("PaymentMethod", null, null, false));
+ context.paymentMethodList = EntityUtil.filterByDate(party.getRelated("PaymentMethod", null, null, false))
- billingAccountList = BillingAccountWorker.makePartyBillingAccountList(userLogin, currencyUomId, partyId, delegator, dispatcher);
+ billingAccountList = BillingAccountWorker.makePartyBillingAccountList(userLogin, currencyUomId, partyId, delegator, dispatcher)
if (billingAccountList) {
- context.selectedBillingAccountId = cart.getBillingAccountId();
- context.billingAccountList = billingAccountList;
+ context.selectedBillingAccountId = cart.getBillingAccountId()
+ context.billingAccountList = billingAccountList
}
}
}
if (parameters.useShipAddr && cart.getShippingContactMechId()) {
- shippingContactMech = cart.getShippingContactMechId();
- postalAddress = from("PostalAddress").where("contactMechId", shippingContactMech).queryOne();
- context.useEntityFields = "Y";
- context.postalFields = postalAddress;
+ shippingContactMech = cart.getShippingContactMechId()
+ postalAddress = from("PostalAddress").where("contactMechId", shippingContactMech).queryOne()
+ context.useEntityFields = "Y"
+ context.postalFields = 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.postalFields = UtilHttp.getParameterMap(request);
+ context.postalFields = UtilHttp.getParameterMap(request)
}
if (cart && !parameters.singleUsePayment) {
if (cart.getPaymentMethodIds() ) {
- checkOutPaymentId = cart.getPaymentMethodIds()[0];
- context.checkOutPaymentId = checkOutPaymentId;
- paymentMethod = from("PaymentMethod").where("paymentMethodId", checkOutPaymentId).queryOne();
- account = null;
+ checkOutPaymentId = cart.getPaymentMethodIds()[0]
+ context.checkOutPaymentId = checkOutPaymentId
+ paymentMethod = from("PaymentMethod").where("paymentMethodId", checkOutPaymentId).queryOne()
+ account = null
if ("CREDIT_CARD".equals(paymentMethod.paymentMethodTypeId)) {
- account = paymentMethod.getRelatedOne("CreditCard", false);
- context.creditCard = account;
- context.paymentMethodType = "CC";
+ account = paymentMethod.getRelatedOne("CreditCard", false)
+ context.creditCard = account
+ context.paymentMethodType = "CC"
} else if ("EFT_ACCOUNT".equals(paymentMethod.paymentMethodTypeId)) {
- account = paymentMethod.getRelatedOne("EftAccount", false);
- context.eftAccount = account;
- context.paymentMethodType = "EFT";
+ account = paymentMethod.getRelatedOne("EftAccount", false)
+ context.eftAccount = account
+ context.paymentMethodType = "EFT"
} else if ("GIFT_CARD".equals(paymentMethod.paymentMethodTypeId)) {
- account = paymentMethod.getRelatedOne("GiftCard", false);
- context.giftCard = account;
- context.paymentMethodType = "GC";
+ account = paymentMethod.getRelatedOne("GiftCard", false)
+ context.giftCard = account
+ context.paymentMethodType = "GC"
} else {
- context.paymentMethodType = "offline";
+ context.paymentMethodType = "offline"
}
if (account && parameters.useShipAddr) {
- address = account.getRelatedOne("PostalAddress", false);
- context.postalAddress = address;
- context.postalFields = address;
+ address = account.getRelatedOne("PostalAddress", false)
+ context.postalAddress = address
+ context.postalFields = address
}
} else if (cart.getPaymentMethodTypeIds()) {
- checkOutPaymentId = cart.getPaymentMethodTypeIds()[0];
- context.checkOutPaymentId = checkOutPaymentId;
+ checkOutPaymentId = cart.getPaymentMethodTypeIds()[0]
+ context.checkOutPaymentId = checkOutPaymentId
}
}
-requestPaymentMethodType = parameters.paymentMethodType;
+requestPaymentMethodType = parameters.paymentMethodType
if (requestPaymentMethodType) {
- context.paymentMethodType = requestPaymentMethodType;
+ context.paymentMethodType = requestPaymentMethodType
}
diff --git a/specialpurpose/ecommerce/groovyScripts/order/CheckoutReview.groovy b/specialpurpose/ecommerce/groovyScripts/order/CheckoutReview.groovy
index 25018057f2..25b30ece8d 100644
--- a/specialpurpose/ecommerce/groovyScripts/order/CheckoutReview.groovy
+++ b/specialpurpose/ecommerce/groovyScripts/order/CheckoutReview.groovy
@@ -17,94 +17,94 @@
* under the License.
*/
-import java.lang.*;
-import org.apache.ofbiz.base.util.*;
-import org.apache.ofbiz.entity.*;
-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 org.apache.ofbiz.webapp.website.WebSiteWorker;
+import java.lang.*
+import org.apache.ofbiz.base.util.*
+import org.apache.ofbiz.entity.*
+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 org.apache.ofbiz.webapp.website.WebSiteWorker
-cart = session.getAttribute("shoppingCart");
-context.cart = cart;
+cart = session.getAttribute("shoppingCart")
+context.cart = cart
-orderItems = cart.makeOrderItems();
-context.orderItems = orderItems;
+orderItems = cart.makeOrderItems()
+context.orderItems = orderItems
-orderAdjustments = cart.makeAllAdjustments();
+orderAdjustments = cart.makeAllAdjustments()
-orderItemShipGroupInfo = cart.makeAllShipGroupInfos();
+orderItemShipGroupInfo = cart.makeAllShipGroupInfos()
if (orderItemShipGroupInfo) {
orderItemShipGroupInfo.each { valueObj ->
if ("OrderAdjustment".equals(valueObj.getEntityName())) {
// shipping / tax adjustment(s)
- orderAdjustments.add(valueObj);
+ orderAdjustments.add(valueObj)
}
}
}
-context.orderAdjustments = orderAdjustments;
+context.orderAdjustments = orderAdjustments
-workEfforts = cart.makeWorkEfforts(); // if required make workefforts for rental fixed assets too.
-context.workEfforts = workEfforts;
+workEfforts = cart.makeWorkEfforts() // if required make workefforts for rental fixed assets too.
+context.workEfforts = workEfforts
-orderHeaderAdjustments = OrderReadHelper.getOrderHeaderAdjustments(orderAdjustments, null);
-context.orderHeaderAdjustments = orderHeaderAdjustments;
-context.orderItemShipGroups = cart.getShipGroups();
-context.headerAdjustmentsToShow = OrderReadHelper.filterOrderAdjustments(orderHeaderAdjustments, true, false, false, false, false);
+orderHeaderAdjustments = OrderReadHelper.getOrderHeaderAdjustments(orderAdjustments, null)
+context.orderHeaderAdjustments = orderHeaderAdjustments
+context.orderItemShipGroups = cart.getShipGroups()
+context.headerAdjustmentsToShow = OrderReadHelper.filterOrderAdjustments(orderHeaderAdjustments, true, false, false, false, false)
-orderSubTotal = OrderReadHelper.getOrderItemsSubTotal(orderItems, orderAdjustments, workEfforts);
-context.orderSubTotal = orderSubTotal;
-context.placingCustomerPerson = userLogin?.getRelatedOne("Person", false);
-context.paymentMethods = cart.getPaymentMethods();
+orderSubTotal = OrderReadHelper.getOrderItemsSubTotal(orderItems, orderAdjustments, workEfforts)
+context.orderSubTotal = orderSubTotal
+context.placingCustomerPerson = userLogin?.getRelatedOne("Person", false)
+context.paymentMethods = cart.getPaymentMethods()
-paymentMethodTypeIds = cart.getPaymentMethodTypeIds();
-paymentMethodType = null;
-paymentMethodTypeId = null;
+paymentMethodTypeIds = cart.getPaymentMethodTypeIds()
+paymentMethodType = null
+paymentMethodTypeId = null
if (paymentMethodTypeIds) {
- paymentMethodTypeId = paymentMethodTypeIds[0];
- paymentMethodType = from("PaymentMethodType").where("paymentMethodTypeId", paymentMethodTypeId).queryOne();
- context.paymentMethodType = paymentMethodType;
+ paymentMethodTypeId = paymentMethodTypeIds[0]
+ paymentMethodType = from("PaymentMethodType").where("paymentMethodTypeId", paymentMethodTypeId).queryOne()
+ context.paymentMethodType = paymentMethodType
}
-webSiteId = WebSiteWorker.getWebSiteId(request);
+webSiteId = WebSiteWorker.getWebSiteId(request)
-productStore = ProductStoreWorker.getProductStore(request);
-context.productStore = productStore;
+productStore = ProductStoreWorker.getProductStore(request)
+context.productStore = productStore
-isDemoStore = !"N".equals(productStore.isDemoStore);
-context.isDemoStore = isDemoStore;
+isDemoStore = !"N".equals(productStore.isDemoStore)
+context.isDemoStore = isDemoStore
-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
// TODO: FIXME!
/*
-billingAccount = cart.getBillingAccountId() ? delegator.findOne("BillingAccount", [billingAccountId : cart.getBillingAccountId()], false) : null;
+billingAccount = cart.getBillingAccountId() ? delegator.findOne("BillingAccount", [billingAccountId : cart.getBillingAccountId()], false) : null
if (billingAccount)
- context.billingAccount = billingAccount;
+ context.billingAccount = billingAccount
*/
-context.customerPoNumber = cart.getPoNumber();
-context.carrierPartyId = cart.getCarrierPartyId();
-context.shipmentMethodTypeId = cart.getShipmentMethodTypeId();
-context.shippingInstructions = cart.getShippingInstructions();
-context.maySplit = cart.getMaySplit();
-context.giftMessage = cart.getGiftMessage();
-context.isGift = cart.getIsGift();
-context.currencyUomId = cart.getCurrency();
+context.customerPoNumber = cart.getPoNumber()
+context.carrierPartyId = cart.getCarrierPartyId()
+context.shipmentMethodTypeId = cart.getShipmentMethodTypeId()
+context.shippingInstructions = cart.getShippingInstructions()
+context.maySplit = cart.getMaySplit()
+context.giftMessage = cart.getGiftMessage()
+context.isGift = cart.getIsGift()
+context.currencyUomId = cart.getCurrency()
-shipmentMethodType = from("ShipmentMethodType").where("shipmentMethodTypeId", cart.getShipmentMethodTypeId()).queryOne();
-if (shipmentMethodType) context.shipMethDescription = shipmentMethodType.description;
+shipmentMethodType = from("ShipmentMethodType").where("shipmentMethodTypeId", cart.getShipmentMethodTypeId()).queryOne()
+if (shipmentMethodType) context.shipMethDescription = shipmentMethodType.description
-orh = new OrderReadHelper(orderAdjustments, orderItems);
-context.localOrderReadHelper = orh;
-context.orderShippingTotal = cart.getTotalShipping();
-context.orderTaxTotal = cart.getTotalSalesTax();
-context.orderGrandTotal = cart.getGrandTotal();
+orh = new OrderReadHelper(orderAdjustments, orderItems)
+context.localOrderReadHelper = orh
+context.orderShippingTotal = cart.getTotalShipping()
+context.orderTaxTotal = cart.getTotalSalesTax()
+context.orderGrandTotal = cart.getGrandTotal()
// nuke the event messages
-request.removeAttribute("_EVENT_MESSAGE_");
+request.removeAttribute("_EVENT_MESSAGE_")
diff --git a/specialpurpose/ecommerce/groovyScripts/order/CheckoutShippingOptions.groovy b/specialpurpose/ecommerce/groovyScripts/order/CheckoutShippingOptions.groovy
index d65089d80f..68d9a65c68 100644
--- a/specialpurpose/ecommerce/groovyScripts/order/CheckoutShippingOptions.groovy
+++ b/specialpurpose/ecommerce/groovyScripts/order/CheckoutShippingOptions.groovy
@@ -17,29 +17,29 @@
* under the License.
*/
-import org.apache.ofbiz.base.util.*;
-import org.apache.ofbiz.entity.*;
-import org.apache.ofbiz.entity.util.*;
-import org.apache.ofbiz.party.contact.*;
-import org.apache.ofbiz.product.store.*;
-import org.apache.ofbiz.order.shoppingcart.shipping.*;
+import org.apache.ofbiz.base.util.*
+import org.apache.ofbiz.entity.*
+import org.apache.ofbiz.entity.util.*
+import org.apache.ofbiz.party.contact.*
+import org.apache.ofbiz.product.store.*
+import org.apache.ofbiz.order.shoppingcart.shipping.*
-cart = session.getAttribute("shoppingCart");
-party = userLogin.getRelatedOne("Party", false);
-productStore = ProductStoreWorker.getProductStore(request);
+cart = session.getAttribute("shoppingCart")
+party = userLogin.getRelatedOne("Party", false)
+productStore = ProductStoreWorker.getProductStore(request)
if (cart) {
- shippingEstWpr = new ShippingEstimateWrapper(dispatcher, cart, 0);
- context.shippingEstWpr = shippingEstWpr;
- context.carrierShipmentMethodList = shippingEstWpr.getShippingMethods();
+ shippingEstWpr = new ShippingEstimateWrapper(dispatcher, cart, 0)
+ context.shippingEstWpr = shippingEstWpr
+ context.carrierShipmentMethodList = shippingEstWpr.getShippingMethods()
}
-context.shoppingCart = cart;
-context.userLogin = userLogin;
-context.productStoreId = productStore.productStoreId;
-context.productStore = productStore;
-context.emailList = ContactHelper.getContactMechByType(party, "EMAIL_ADDRESS", false);
+context.shoppingCart = cart
+context.userLogin = userLogin
+context.productStoreId = productStore.productStoreId
+context.productStore = productStore
+context.emailList = ContactHelper.getContactMechByType(party, "EMAIL_ADDRESS", false)
if (cart.getShipmentMethodTypeId() && cart.getCarrierPartyId()) {
- context.chosenShippingMethod = cart.getShipmentMethodTypeId() + '@' + cart.getCarrierPartyId();
+ context.chosenShippingMethod = cart.getShipmentMethodTypeId() + '@' + cart.getCarrierPartyId()
}
diff --git a/specialpurpose/ecommerce/groovyScripts/order/CustSettings.groovy b/specialpurpose/ecommerce/groovyScripts/order/CustSettings.groovy
index 23e64fa210..6edaa63b85 100644
--- a/specialpurpose/ecommerce/groovyScripts/order/CustSettings.groovy
+++ b/specialpurpose/ecommerce/groovyScripts/order/CustSettings.groovy
@@ -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
}
}
}
diff --git a/specialpurpose/ecommerce/groovyScripts/order/OptionSettings.groovy b/specialpurpose/ecommerce/groovyScripts/order/OptionSettings.groovy
index 02828ce1e3..9fe996df8d 100644
--- a/specialpurpose/ecommerce/groovyScripts/order/OptionSettings.groovy
+++ b/specialpurpose/ecommerce/groovyScripts/order/OptionSettings.groovy
@@ -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.*;
+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);
+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
diff --git a/specialpurpose/ecommerce/groovyScripts/order/OrderHistory.groovy b/specialpurpose/ecommerce/groovyScripts/order/OrderHistory.groovy
index d091bf9dfd..0d08daac09 100644
--- a/specialpurpose/ecommerce/groovyScripts/order/OrderHistory.groovy
+++ b/specialpurpose/ecommerce/groovyScripts/order/OrderHistory.groovy
@@ -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
diff --git a/specialpurpose/ecommerce/groovyScripts/order/OrderStatus.groovy b/specialpurpose/ecommerce/groovyScripts/order/OrderStatus.groovy
index af5ce01c49..f6c1830139 100644
--- a/specialpurpose/ecommerce/groovyScripts/order/OrderStatus.groovy
+++ b/specialpurpose/ecommerce/groovyScripts/order/OrderStatus.groovy
@@ -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();
+ 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));
+ 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));
+ 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.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.orderShippingTotal = orderShippingTotal
+ context.orderTaxTotal = orderTaxTotal
+ context.orderGrandTotal = OrderReadHelper.getOrderGrandTotal(orderItems, orderAdjustments)
+ context.placingCustomerPerson = placingCustomerPerson
- context.billingAccount = billingAccount;
- context.paymentMethods = paymentMethods;
+ 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
}
diff --git a/specialpurpose/ecommerce/groovyScripts/order/PaymentInformation.groovy b/specialpurpose/ecommerce/groovyScripts/order/PaymentInformation.groovy
index 54d41fa010..25cbc48ccf 100644
--- a/specialpurpose/ecommerce/groovyScripts/order/PaymentInformation.groovy
+++ b/specialpurpose/ecommerce/groovyScripts/order/PaymentInformation.groovy
@@ -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
}
}
diff --git a/specialpurpose/ecommerce/groovyScripts/order/PaymentOptions.groovy b/specialpurpose/ecommerce/groovyScripts/order/PaymentOptions.groovy
index 3e04c41820..cc1612d459 100644
--- a/specialpurpose/ecommerce/groovyScripts/order/PaymentOptions.groovy
+++ b/specialpurpose/ecommerce/groovyScripts/order/PaymentOptions.groovy
@@ -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
}
}
diff --git a/specialpurpose/ecommerce/groovyScripts/order/QuickAnonCheckoutLinks.groovy b/specialpurpose/ecommerce/groovyScripts/order/QuickAnonCheckoutLinks.groovy
index fcc8808e46..8d886fc242 100644
--- a/specialpurpose/ecommerce/groovyScripts/order/QuickAnonCheckoutLinks.groovy
+++ b/specialpurpose/ecommerce/groovyScripts/order/QuickAnonCheckoutLinks.groovy
@@ -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
}
diff --git a/specialpurpose/ecommerce/groovyScripts/order/QuickAnonCustSettings.groovy b/specialpurpose/ecommerce/groovyScripts/order/QuickAnonCustSettings.groovy
index 0f2f87762f..a8e97bfd82 100644
--- a/specialpurpose/ecommerce/groovyScripts/order/QuickAnonCustSettings.groovy
+++ b/specialpurpose/ecommerce/groovyScripts/order/QuickAnonCustSettings.groovy
@@ -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"
diff --git a/specialpurpose/ecommerce/groovyScripts/order/QuickAnonOptionSettings.groovy b/specialpurpose/ecommerce/groovyScripts/order/QuickAnonOptionSettings.groovy
index e21942981c..399d703132 100644
--- a/specialpurpose/ecommerce/groovyScripts/order/QuickAnonOptionSettings.groovy
+++ b/specialpurpose/ecommerce/groovyScripts/order/QuickAnonOptionSettings.groovy
@@ -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.*;
+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);
+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
diff --git a/specialpurpose/ecommerce/groovyScripts/order/QuickAnonPaymentInformation.groovy b/specialpurpose/ecommerce/groovyScripts/order/QuickAnonPaymentInformation.groovy
index b1fca05c18..57e3bbda15 100644
--- a/specialpurpose/ecommerce/groovyScripts/order/QuickAnonPaymentInformation.groovy
+++ b/specialpurpose/ecommerce/groovyScripts/order/QuickAnonPaymentInformation.groovy
@@ -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
}
}
}
diff --git a/specialpurpose/ecommerce/groovyScripts/order/RequestReturn.groovy b/specialpurpose/ecommerce/groovyScripts/order/RequestReturn.groovy
index e523d6d0fa..39bd5e2477 100644
--- a/specialpurpose/ecommerce/groovyScripts/order/RequestReturn.groovy
+++ b/specialpurpose/ecommerce/groovyScripts/order/RequestReturn.groovy
@@ -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)
diff --git a/specialpurpose/ecommerce/groovyScripts/order/ShipSettings.groovy b/specialpurpose/ecommerce/groovyScripts/order/ShipSettings.groovy
index 1979ae6598..7a8d96f240 100644
--- a/specialpurpose/ecommerce/groovyScripts/order/ShipSettings.groovy
+++ b/specialpurpose/ecommerce/groovyScripts/order/ShipSettings.groovy
@@ -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.*;
+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;
+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)
}
diff --git a/specialpurpose/ecommerce/groovyScripts/order/ShipmentStatus.groovy b/specialpurpose/ecommerce/groovyScripts/order/ShipmentStatus.groovy
index 4ad612fa06..3ba9e52a09 100644
--- a/specialpurpose/ecommerce/groovyScripts/order/ShipmentStatus.groovy
+++ b/specialpurpose/ecommerce/groovyScripts/order/ShipmentStatus.groovy
@@ -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
}
diff --git a/specialpurpose/ecommerce/groovyScripts/shoppinglist/EditShoppingList.groovy b/specialpurpose/ecommerce/groovyScripts/shoppinglist/EditShoppingList.groovy
index 75edadec8e..c27379d541 100644
--- a/specialpurpose/ecommerce/groovyScripts/shoppinglist/EditShoppingList.groovy
+++ b/specialpurpose/ecommerce/groovyScripts/shoppinglist/EditShoppingList.groovy
@@ -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;
+ 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;
+ 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;
+ 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;
+ 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);
+ 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()
}
}
}
diff --git a/specialpurpose/example/groovyScripts/FindExampleFeatures.groovy b/specialpurpose/example/groovyScripts/FindExampleFeatures.groovy
index 3feafc00fb..74c826f21a 100644
--- a/specialpurpose/example/groovyScripts/FindExampleFeatures.groovy
+++ b/specialpurpose/example/groovyScripts/FindExampleFeatures.groovy
@@ -17,24 +17,24 @@
* under the License.
*/
-import org.apache.ofbiz.entity.condition.EntityCondition;
-import org.apache.ofbiz.entity.condition.EntityFieldValue;
-import org.apache.ofbiz.entity.condition.EntityFunction;
-import org.apache.ofbiz.entity.condition.EntityOperator;
+import org.apache.ofbiz.entity.condition.EntityCondition
+import org.apache.ofbiz.entity.condition.EntityFieldValue
+import org.apache.ofbiz.entity.condition.EntityFunction
+import org.apache.ofbiz.entity.condition.EntityOperator
-delegator = request.getAttribute("delegator");
+delegator = request.getAttribute("delegator")
-andExprs = [];
-fieldValue = request.getParameter("exampleFeatureId");
+andExprs = []
+fieldValue = request.getParameter("exampleFeatureId")
if (fieldValue) {
andExprs.add(EntityCondition.makeCondition(EntityFunction.UPPER(EntityFieldValue.makeFieldValue("exampleFeatureId")),
- EntityOperator.LIKE, "%" + fieldValue.toUpperCase() + "%"));
+ EntityOperator.LIKE, "%" + fieldValue.toUpperCase() + "%"))
}
-autocompleteOptions = [];
+autocompleteOptions = []
if (andExprs) {
- autocompleteOptions = select("exampleFeatureId", "description").from("ExampleFeature").where(andExprs).orderBy("-exampleFeatureId").queryList();
- //context.autocompleteOptions = autocompleteOptions;
- request.setAttribute("autocompleteOptions", autocompleteOptions);
+ autocompleteOptions = select("exampleFeatureId", "description").from("ExampleFeature").where(andExprs).orderBy("-exampleFeatureId").queryList()
+ //context.autocompleteOptions = autocompleteOptions
+ request.setAttribute("autocompleteOptions", autocompleteOptions)
}
-return "success";
+return "success"
diff --git a/specialpurpose/example/groovyScripts/PrepareLocalesForDropDown.groovy b/specialpurpose/example/groovyScripts/PrepareLocalesForDropDown.groovy
index 5e408d1fb8..d73fae61c4 100644
--- a/specialpurpose/example/groovyScripts/PrepareLocalesForDropDown.groovy
+++ b/specialpurpose/example/groovyScripts/PrepareLocalesForDropDown.groovy
@@ -18,5 +18,5 @@ under the License.
*/
def localeMap = []
-org.apache.ofbiz.base.util.UtilMisc.availableLocales().each { localeMap.add(localeId:it.toString()) };
-parameters.localeList = localeMap;
\ No newline at end of file
+org.apache.ofbiz.base.util.UtilMisc.availableLocales().each { localeMap.add(localeId:it.toString()) }
+parameters.localeList = localeMap
diff --git a/specialpurpose/hhfacility/groovyScripts/ProductList.groovy b/specialpurpose/hhfacility/groovyScripts/ProductList.groovy
index b7e4cb1cfb..ebb1bf5e7a 100644
--- a/specialpurpose/hhfacility/groovyScripts/ProductList.groovy
+++ b/specialpurpose/hhfacility/groovyScripts/ProductList.groovy
@@ -17,7 +17,7 @@
* under the License.
*/
-productList = request.getAttribute("productList");
+productList = request.getAttribute("productList")
if (productList) {
- context.productList = productList;
+ context.productList = productList
}
diff --git a/specialpurpose/hhfacility/groovyScripts/ProductStockTake.groovy b/specialpurpose/hhfacility/groovyScripts/ProductStockTake.groovy
index 6dde25c302..a635abe943 100644
--- a/specialpurpose/hhfacility/groovyScripts/ProductStockTake.groovy
+++ b/specialpurpose/hhfacility/groovyScripts/ProductStockTake.groovy
@@ -17,79 +17,79 @@
* under the License.
*/
-productId = request.getParameter("productId");
+productId = request.getParameter("productId")
if (!productId) {
- productId = session.getAttribute("productId");
+ productId = session.getAttribute("productId")
}
if (productId) {
- product = from("Product").where("productId", productId).cache(true).queryOne();
- context.product = product;
+ product = from("Product").where("productId", productId).cache(true).queryOne()
+ context.product = product
- facilityId = request.getParameter("facilityId");
- resultOutput = runService('getInventoryAvailableByFacility', [productId : productId, facilityId : facilityId]);
- quantitySummary = [:];
- quantitySummary.facilityId = facilityId;
+ facilityId = request.getParameter("facilityId")
+ resultOutput = runService('getInventoryAvailableByFacility', [productId : productId, facilityId : facilityId])
+ quantitySummary = [:]
+ quantitySummary.facilityId = facilityId
quantitySummary.atp_qoh = ((Double)resultOutput.availableToPromiseTotal).intValue() + " / " +
- ((Double)resultOutput.quantityOnHandTotal).intValue();
- context.quantitySummary = quantitySummary;
+ ((Double)resultOutput.quantityOnHandTotal).intValue()
+ context.quantitySummary = quantitySummary
// For now this just generates a visual list of locations set against the product for this facility.
// todo: Will need to be able to edit and change these values at some point in the future.
- productFacilityLocList = from("ProductFacilityLocation").where("productId", productId, "facilityId", facilityId).queryList();
- facStr = null;
+ productFacilityLocList = from("ProductFacilityLocation").where("productId", productId, "facilityId", facilityId).queryList()
+ facStr = null
productFacilityLocList.each { facilityLoc ->
if (!facStr) {
- facStr = facilityLoc.locationSeqId;
+ facStr = facilityLoc.locationSeqId
} else {
- facStr = facStr + ", " + facilityLoc.locationSeqId;
+ facStr = facStr + ", " + facilityLoc.locationSeqId
}
}
- context.productFacilityLocations = facStr;
+ context.productFacilityLocations = facStr
// Now we build a list of locations for inventory items against the facility.
// todo: change this to a select from inv_items where productId and facilityId matches distinct (locationSeqId).
- invItemList = from("InventoryItem").where("productId", productId, "facilityId", facilityId).queryList();
+ invItemList = from("InventoryItem").where("productId", productId, "facilityId", facilityId).queryList()
- locations = [:];
+ locations = [:]
- boolean negativeQOH = false;
+ boolean negativeQOH = false
invItemList.each { invItem ->
- int qoh = ((Double)invItem.quantityOnHandTotal).intValue();
+ int qoh = ((Double)invItem.quantityOnHandTotal).intValue()
if (qoh < 0) {
- negativeQOH = true;
+ negativeQOH = true
}
- locationFound = (String)invItem.locationSeqId;
+ locationFound = (String)invItem.locationSeqId
if (!locationFound) {
- locationFound = "nullField";
+ locationFound = "nullField"
}
if (!locations.get(locationFound)) {
- locations.put(locationFound, locationFound);
+ locations.put(locationFound, locationFound)
}
}
// Go through and build the list of atp/qoh against each location
- productFacilityLocations = new ArrayList();
- locationsIter = locations.keySet().iterator();
+ productFacilityLocations = new ArrayList()
+ locationsIter = locations.keySet().iterator()
while (locationsIter.hasNext()) {
- location = locationsIter.next();
- resultOutput = runService('getInventoryAvailableByLocation', [productId : productId, facilityId : facilityId, locationSeqId : location]);
- quantitySummary = [:];
- quantitySummary.productId = productId;
- quantitySummary.facilityId = facilityId;
+ location = locationsIter.next()
+ resultOutput = runService('getInventoryAvailableByLocation', [productId : productId, facilityId : facilityId, locationSeqId : location])
+ quantitySummary = [:]
+ quantitySummary.productId = productId
+ quantitySummary.facilityId = facilityId
if ("nullField".equals( location ) == true) {
- quantitySummary.locationSeqId = "";
+ quantitySummary.locationSeqId = ""
} else {
- quantitySummary.locationSeqId = location;
+ quantitySummary.locationSeqId = location
}
quantitySummary.atp_qoh = ((Double)resultOutput.availableToPromiseTotal).intValue() + " / " +
- ((Double)resultOutput.quantityOnHandTotal).intValue();
- productFacilityLocations.add(quantitySummary);
+ ((Double)resultOutput.quantityOnHandTotal).intValue()
+ productFacilityLocations.add(quantitySummary)
}
- context.productQtyByLocations = productFacilityLocations;
+ context.productQtyByLocations = productFacilityLocations
if (negativeQOH) {
- context.negativeQOH = "true";
+ context.negativeQOH = "true"
}
}
diff --git a/specialpurpose/lucene/groovyScripts/content/AdvancedSearchPrep.groovy b/specialpurpose/lucene/groovyScripts/content/AdvancedSearchPrep.groovy
index 45ce2bf243..6c07ef671c 100644
--- a/specialpurpose/lucene/groovyScripts/content/AdvancedSearchPrep.groovy
+++ b/specialpurpose/lucene/groovyScripts/content/AdvancedSearchPrep.groovy
@@ -17,22 +17,22 @@
* under the License.
*/
-import org.apache.ofbiz.product.feature.ParametricSearch;
-import org.apache.ofbiz.product.product.ProductSearchSession;
+import org.apache.ofbiz.product.feature.ParametricSearch
+import org.apache.ofbiz.product.product.ProductSearchSession
-productFeaturesByTypeMap = ParametricSearch.getAllFeaturesByType(delegator, 2000);
-productFeatureTypeIdsOrdered = new ArrayList(new TreeSet(productFeaturesByTypeMap.keySet()));
+productFeaturesByTypeMap = ParametricSearch.getAllFeaturesByType(delegator, 2000)
+productFeatureTypeIdsOrdered = new ArrayList(new TreeSet(productFeaturesByTypeMap.keySet()))
-searchOperator = request.getParameter("SEARCH_OPERATOR");
+searchOperator = request.getParameter("SEARCH_OPERATOR")
if (!"AND".equals(searchOperator) && !"OR".equals(searchOperator)) {
- searchOperator = "OR";
+ searchOperator = "OR"
}
-searchConstraintStrings = ProductSearchSession.searchGetConstraintStrings(false, session, delegator);
-searchSortOrderString = ProductSearchSession.searchGetSortOrderString(false, request);
+searchConstraintStrings = ProductSearchSession.searchGetConstraintStrings(false, session, delegator)
+searchSortOrderString = ProductSearchSession.searchGetSortOrderString(false, request)
-context.productFeaturesByTypeMap = productFeaturesByTypeMap;
-context.productFeatureTypeIdsOrdered = productFeatureTypeIdsOrdered;
-context.searchOperator = searchOperator;
-context.searchConstraintStrings = searchConstraintStrings;
-context.searchSortOrderString = searchSortOrderString;
+context.productFeaturesByTypeMap = productFeaturesByTypeMap
+context.productFeatureTypeIdsOrdered = productFeatureTypeIdsOrdered
+context.searchOperator = searchOperator
+context.searchConstraintStrings = searchConstraintStrings
+context.searchSortOrderString = searchSortOrderString
diff --git a/specialpurpose/lucene/groovyScripts/content/IndexProducts.groovy b/specialpurpose/lucene/groovyScripts/content/IndexProducts.groovy
index 61a8f793b4..c2a3b6c50d 100644
--- a/specialpurpose/lucene/groovyScripts/content/IndexProducts.groovy
+++ b/specialpurpose/lucene/groovyScripts/content/IndexProducts.groovy
@@ -29,7 +29,7 @@ if (pi) {
beganTransaction = TransactionUtil.begin()
EntityListIterator products
try {
- products = select("productId").from("Product").queryIterator();
+ products = select("productId").from("Product").queryIterator()
while (product = products.next()) {
pi.queue(new ProductDocument(product.productId))
productsCounter++
diff --git a/specialpurpose/lucene/groovyScripts/content/Search.groovy b/specialpurpose/lucene/groovyScripts/content/Search.groovy
index f9daca765f..35b0beec2d 100644
--- a/specialpurpose/lucene/groovyScripts/content/Search.groovy
+++ b/specialpurpose/lucene/groovyScripts/content/Search.groovy
@@ -27,87 +27,87 @@ import org.apache.ofbiz.content.search.SearchWorker
import org.apache.ofbiz.product.feature.ParametricSearch
import org.apache.lucene.search.*
import org.apache.lucene.index.DirectoryReader
-import org.apache.ofbiz.base.util.UtilProperties;
+import org.apache.ofbiz.base.util.UtilProperties
-queryLine = parameters.queryLine;
+queryLine = parameters.queryLine
-siteId = parameters.lcSiteId;
+siteId = parameters.lcSiteId
-searchFeature1 = (String) parameters.SEARCH_FEAT;
-searchFeature2 = (String) parameters.SEARCH_FEAT2;
-searchFeature3 = (String) parameters.SEARCH_FEAT3;
+searchFeature1 = (String) parameters.SEARCH_FEAT
+searchFeature2 = (String) parameters.SEARCH_FEAT2
+searchFeature3 = (String) parameters.SEARCH_FEAT3
-featureIdByType = ParametricSearch.makeFeatureIdByTypeMap(UtilHttp.getParameterMap(request));
+featureIdByType = ParametricSearch.makeFeatureIdByTypeMap(UtilHttp.getParameterMap(request))
-combQuery = new BooleanQuery();
+combQuery = new BooleanQuery()
try {
- DirectoryReader reader = DirectoryReader.open(FSDirectory.open(new File(SearchWorker.getIndexPath("content")).toPath()));
- searcher = new IndexSearcher(reader);
- analyzer = new StandardAnalyzer();
+ DirectoryReader reader = DirectoryReader.open(FSDirectory.open(new File(SearchWorker.getIndexPath("content")).toPath()))
+ searcher = new IndexSearcher(reader)
+ analyzer = new StandardAnalyzer()
} catch (java.io.FileNotFoundException e) {
- context.errorMessageList.add(UtilProperties.getMessage("ContentErrorUiLabels", "ContentSearchNotIndexed", locale));
- return;
+ context.errorMessageList.add(UtilProperties.getMessage("ContentErrorUiLabels", "ContentSearchNotIndexed", locale))
+ return
}
if (queryLine || siteId) {
- Query query = null;
+ Query query = null
if (queryLine) {
- QueryParser parser = new QueryParser("content", analyzer);
- query = parser.parse(queryLine);
- combQuery.add(query, BooleanClause.Occur.MUST);
+ QueryParser parser = new QueryParser("content", analyzer)
+ query = parser.parse(queryLine)
+ combQuery.add(query, BooleanClause.Occur.MUST)
}
if (siteId) {
- termQuery = new TermQuery(new Term("site", siteId.toString()));
- combQuery.add(termQuery, BooleanClause.Occur.MUST);
+ termQuery = new TermQuery(new Term("site", siteId.toString()))
+ combQuery.add(termQuery, BooleanClause.Occur.MUST)
}
}
if (searchFeature1 || searchFeature2 || searchFeature3 || !featureIdByType.isEmpty()) {
- featureQuery = new BooleanQuery();
- featuresRequired = BooleanClause.Occur.MUST;
+ featureQuery = new BooleanQuery()
+ featuresRequired = BooleanClause.Occur.MUST
if ("any".equals(parameters.any_or_all)) {
- featuresRequired = BooleanClause.Occur.SHOULD;
+ featuresRequired = BooleanClause.Occur.SHOULD
}
if (searchFeature1) {
- termQuery = new TermQuery(new Term("feature", searchFeature1));
- featureQuery.add(termQuery, featuresRequired);
+ termQuery = new TermQuery(new Term("feature", searchFeature1))
+ featureQuery.add(termQuery, featuresRequired)
}
if (searchFeature2) {
- termQuery = new TermQuery(new Term("feature", searchFeature2));
- featureQuery.add(termQuery, featuresRequired);
+ termQuery = new TermQuery(new Term("feature", searchFeature2))
+ featureQuery.add(termQuery, featuresRequired)
}
if (searchFeature3) {
- termQuery = new TermQuery(new Term("feature", searchFeature3));
- featureQuery.add(termQuery, featuresRequired);
+ termQuery = new TermQuery(new Term("feature", searchFeature3))
+ featureQuery.add(termQuery, featuresRequired)
}
if (featureIdByType) {
featureIdByType.each { key, value ->
- termQuery = new TermQuery(new Term("feature", value));
- featureQuery.add(termQuery, featuresRequired);
+ termQuery = new TermQuery(new Term("feature", value))
+ featureQuery.add(termQuery, featuresRequired)
}
- combQuery.add(featureQuery, featuresRequired);
+ combQuery.add(featureQuery, featuresRequired)
}
}
if (searcher) {
- TopScoreDocCollector collector = TopScoreDocCollector.create(100); //defaulting to 100 results
- searcher.search(combQuery, collector);
- ScoreDoc[] hits = collector.topDocs().scoreDocs;
+ TopScoreDocCollector collector = TopScoreDocCollector.create(100) //defaulting to 100 results
+ searcher.search(combQuery, collector)
+ ScoreDoc[] hits = collector.topDocs().scoreDocs
- contentList = [] as ArrayList;
- hitSet = [:] as HashSet;
+ contentList = [] as ArrayList
+ hitSet = [:] as HashSet
for (int start = 0; start < collector.getTotalHits(); start++) {
Document doc = searcher.doc(hits[start].doc)
- contentId = doc.get("contentId");
- content = from("Content").where("contentId", contentId).cache(true).queryOne();
+ contentId = doc.get("contentId")
+ content = from("Content").where("contentId", contentId).cache(true).queryOne()
if (!hitSet.contains(contentId)) {
- contentList.add(content);
- hitSet.add(contentId);
+ contentList.add(content)
+ hitSet.add(contentId)
}
}
- context.queryResults = contentList;
+ context.queryResults = contentList
}
diff --git a/specialpurpose/lucene/groovyScripts/content/SearchProducts.groovy b/specialpurpose/lucene/groovyScripts/content/SearchProducts.groovy
index 4188b6cc98..6ae4a9c813 100644
--- a/specialpurpose/lucene/groovyScripts/content/SearchProducts.groovy
+++ b/specialpurpose/lucene/groovyScripts/content/SearchProducts.groovy
@@ -23,7 +23,7 @@ import org.apache.ofbiz.content.search.SearchWorker
import org.apache.lucene.document.Document
import org.apache.lucene.index.DirectoryReader
-import org.apache.lucene.queryparser.classic.ParseException;
+import org.apache.lucene.queryparser.classic.ParseException
import org.apache.lucene.queryparser.classic.QueryParser
import org.apache.lucene.search.BooleanClause
import org.apache.lucene.search.BooleanQuery
@@ -34,40 +34,40 @@ import org.apache.lucene.search.TopScoreDocCollector
import org.apache.lucene.store.FSDirectory
if (parameters.luceneQuery) {
- Query combQuery = new BooleanQuery();
- IndexSearcher searcher;
- WhitespaceAnalyzer analyzer;
+ Query combQuery = new BooleanQuery()
+ IndexSearcher searcher
+ WhitespaceAnalyzer analyzer
try {
- DirectoryReader reader = DirectoryReader.open(FSDirectory.open(new File(SearchWorker.getIndexPath("products")).toPath()));
- searcher = new IndexSearcher(reader);
- analyzer = new WhitespaceAnalyzer();
+ DirectoryReader reader = DirectoryReader.open(FSDirectory.open(new File(SearchWorker.getIndexPath("products")).toPath()))
+ searcher = new IndexSearcher(reader)
+ analyzer = new WhitespaceAnalyzer()
} catch (FileNotFoundException e) {
- context.errorMessageList.add(e.getMessage());
- return;
+ context.errorMessageList.add(e.getMessage())
+ return
}
- QueryParser parser = new QueryParser("fullText", analyzer);
- parser.setLocale(locale);
- Query query;
+ QueryParser parser = new QueryParser("fullText", analyzer)
+ parser.setLocale(locale)
+ Query query
try {
- query = parser.parse(parameters.luceneQuery);
+ query = parser.parse(parameters.luceneQuery)
} catch(ParseException pe) {
- context.errorMessageList.add(pe.getMessage());
- return;
+ context.errorMessageList.add(pe.getMessage())
+ return
}
- combQuery.add(query, BooleanClause.Occur.MUST);
+ combQuery.add(query, BooleanClause.Occur.MUST)
- TopScoreDocCollector collector = TopScoreDocCollector.create(100); // defaulting to 100 results
- searcher.search(combQuery, collector);
- ScoreDoc[] hits = collector.topDocs().scoreDocs;
+ TopScoreDocCollector collector = TopScoreDocCollector.create(100) // defaulting to 100 results
+ searcher.search(combQuery, collector)
+ ScoreDoc[] hits = collector.topDocs().scoreDocs
productList = []
hits.each { hit ->
Document doc = searcher.doc(hit.doc)
productId = doc.productId
- product = from("Product").where("productId", productId).cache(true).queryOne();
+ product = from("Product").where("productId", productId).cache(true).queryOne()
if (product) {
productList.add(product)
}
}
- context.queryResults = productList;
+ context.queryResults = productList
}
diff --git a/specialpurpose/passport/groovyScripts/login/GetThirdPartyLogins.groovy b/specialpurpose/passport/groovyScripts/login/GetThirdPartyLogins.groovy
index 5b53b30734..d2287b2499 100644
--- a/specialpurpose/passport/groovyScripts/login/GetThirdPartyLogins.groovy
+++ b/specialpurpose/passport/groovyScripts/login/GetThirdPartyLogins.groovy
@@ -17,33 +17,33 @@
* under the License.
*/
-package org.apache.ofbiz.passport;
+package org.apache.ofbiz.passport
-import org.apache.ofbiz.entity.util.EntityUtil;
-import org.apache.ofbiz.product.store.ProductStoreWorker;
+import org.apache.ofbiz.entity.util.EntityUtil
+import org.apache.ofbiz.product.store.ProductStoreWorker
final String module = "GetThirdPartyLogins.groovy"
-adminErrorInfo = context.adminErrorInfo;
-productStoreId = context.productStoreId;
+adminErrorInfo = context.adminErrorInfo
+productStoreId = context.productStoreId
if (!productStoreId) {
- productStore = ProductStoreWorker.getProductStore(request);
- productStoreId = productStore.productStoreId;
+ productStore = ProductStoreWorker.getProductStore(request)
+ productStoreId = productStore.productStoreId
}
if (!adminErrorInfo || !adminErrorInfo.hasError()) {
- storePassportLoginMethList = null;
+ storePassportLoginMethList = null
// Get lists of passport login methods
if (productStoreId) {
- storePassportLoginMethList = delegator.findByAnd("ThirdPartyLogin", ["productStoreId": productStoreId], ["sequenceNum ASC"], false);
- storePassportLoginMethList = EntityUtil.filterByDate(storePassportLoginMethList);
+ storePassportLoginMethList = delegator.findByAnd("ThirdPartyLogin", ["productStoreId": productStoreId], ["sequenceNum ASC"], false)
+ storePassportLoginMethList = EntityUtil.filterByDate(storePassportLoginMethList)
}
// Extra data preparation for each login method.
if (storePassportLoginMethList) {
storeLoginMethList = []
for (storeLoginMeth in storePassportLoginMethList) {
- storeLoginMethDetail = EntityUtil.getFirst(EntityUtil.filterByDate(delegator.findByAnd(storeLoginMeth.loginMethTypeId + storeLoginMeth.loginProviderId, ["productStoreId": productStoreId], null, false)));
+ storeLoginMethDetail = EntityUtil.getFirst(EntityUtil.filterByDate(delegator.findByAnd(storeLoginMeth.loginMethTypeId + storeLoginMeth.loginProviderId, ["productStoreId": productStoreId], null, false)))
storeLoginMethList.add(storeLoginMethDetail)
}
context.storeLoginMethList = storeLoginMethList
diff --git a/specialpurpose/projectmgr/groovyScripts/EditWeekTimesheet.groovy b/specialpurpose/projectmgr/groovyScripts/EditWeekTimesheet.groovy
index bdceb4504a..74c2f18b98 100644
--- a/specialpurpose/projectmgr/groovyScripts/EditWeekTimesheet.groovy
+++ b/specialpurpose/projectmgr/groovyScripts/EditWeekTimesheet.groovy
@@ -25,181 +25,181 @@ import org.apache.ofbiz.entity.condition.EntityCondition
import org.apache.ofbiz.entity.condition.EntityOperator
import org.apache.ofbiz.entity.util.EntityUtil
-uiLabelMap = UtilProperties.getResourceBundleMap("ProjectMgrUiLabels", locale);
+uiLabelMap = UtilProperties.getResourceBundleMap("ProjectMgrUiLabels", locale)
-partyId = parameters.partyId;
+partyId = parameters.partyId
if (!partyId) {
- partyId = parameters.userLogin.partyId;
+ partyId = parameters.userLogin.partyId
}
// show the requested timesheet, otherwise the current , if not exist create
-timesheet = null;
-timesheetId = parameters.timesheetId;
+timesheet = null
+timesheetId = parameters.timesheetId
if (timesheetId) {
- timesheet = from("Timesheet").where("timesheetId", timesheetId).queryOne();
- partyId = timesheet.partyId; // use the party from this timesheet
+ timesheet = from("Timesheet").where("timesheetId", timesheetId).queryOne()
+ partyId = timesheet.partyId // use the party from this timesheet
} else {
// make sure because of timezone changes, not a duplicate timesheet is created
- midweek = UtilDateTime.addDaysToTimestamp(UtilDateTime.getWeekStart(UtilDateTime.nowTimestamp()),3);
+ midweek = UtilDateTime.addDaysToTimestamp(UtilDateTime.getWeekStart(UtilDateTime.nowTimestamp()),3)
entryExprs = EntityCondition.makeCondition([
EntityCondition.makeCondition("fromDate", EntityComparisonOperator.LESS_THAN, midweek),
EntityCondition.makeCondition("thruDate", EntityComparisonOperator.GREATER_THAN, midweek),
EntityCondition.makeCondition("partyId", EntityComparisonOperator.EQUALS, partyId)
- ], EntityOperator.AND);
- entryIterator = from("Timesheet").where(entryExprs).queryIterator();
- timesheet = entryIterator.next();
- entryIterator.close();
+ ], EntityOperator.AND)
+ entryIterator = from("Timesheet").where(entryExprs).queryIterator()
+ timesheet = entryIterator.next()
+ entryIterator.close()
if (timesheet == null) {
- result = runService('createProjectTimesheet', ["userLogin" : parameters.userLogin, "partyId" : partyId]);
+ result = runService('createProjectTimesheet', ["userLogin" : parameters.userLogin, "partyId" : partyId])
if (result && result.timesheetId) {
- timesheet = from("Timesheet").where("timesheetId", result.timesheetId).queryOne();
+ timesheet = from("Timesheet").where("timesheetId", result.timesheetId).queryOne()
}
}
}
-if (!timesheet) return;
-context.timesheet = timesheet;
-context.weekNumber = UtilDateTime.weekNumber(timesheet.fromDate);
+if (!timesheet) return
+context.timesheet = timesheet
+context.weekNumber = UtilDateTime.weekNumber(timesheet.fromDate)
// get the user names
-context.partyNameView = from("PartyNameView").where("partyId", partyId).queryOne();
+context.partyNameView = from("PartyNameView").where("partyId", partyId).queryOne()
// get the default rate for this person
-rateTypes = from("PartyRate").where("partyId", partyId, "defaultRate", "Y").filterByDate().queryList();
+rateTypes = from("PartyRate").where("partyId", partyId, "defaultRate", "Y").filterByDate().queryList()
if (rateTypes) {
- context.defaultRateTypeId = rateTypes[0].rateTypeId;
+ context.defaultRateTypeId = rateTypes[0].rateTypeId
}
-entries = [];
-entry = ["timesheetId" : timesheet.timesheetId];
-taskTotal = 0.00;
-day0Total = 0.00; day1Total=0.00; day2Total=0.00; day3Total=0.00; day4Total=0.00; day5Total=0.00; day6Total=0.00;
-pHours = 0.00;
-timeEntry = null;
-lastTimeEntry = null;
+entries = []
+entry = ["timesheetId" : timesheet.timesheetId]
+taskTotal = 0.00
+day0Total = 0.00; day1Total=0.00; day2Total=0.00; day3Total=0.00; day4Total=0.00; day5Total=0.00; day6Total=0.00
+pHours = 0.00
+timeEntry = null
+lastTimeEntry = null
// retrieve work effort data when the workeffortId has changed.
void retrieveWorkEffortData() {
// get the planned number of hours
- entryWorkEffort = lastTimeEntry.getRelatedOne("WorkEffort", false);
+ entryWorkEffort = lastTimeEntry.getRelatedOne("WorkEffort", false)
if (entryWorkEffort) {
- plannedHours = entryWorkEffort.getRelated("WorkEffortSkillStandard", null, null, false);
- pHours = 0.00;
+ plannedHours = entryWorkEffort.getRelated("WorkEffortSkillStandard", null, null, false)
+ pHours = 0.00
plannedHours.each { plannedHour ->
if (plannedHour.estimatedDuration) {
- pHours += plannedHour.estimatedDuration;
+ pHours += plannedHour.estimatedDuration
}
}
- entry.plannedHours = pHours;
- actualHours = entryWorkEffort.getRelated("TimeEntry", null, null, false);
- aHours = 0.00;
+ entry.plannedHours = pHours
+ actualHours = entryWorkEffort.getRelated("TimeEntry", null, null, false)
+ aHours = 0.00
actualHours.each { actualHour ->
if (actualHour.hours) {
- aHours += actualHour.hours;
+ aHours += actualHour.hours
}
}
- entry.actualHours = aHours;
+ entry.actualHours = aHours
// get party assignment data to be able to set the task to complete
- workEffortPartyAssigns = EntityUtil.filterByDate(entryWorkEffort.getRelated("WorkEffortPartyAssignment", ["partyId" : partyId], null, false));
+ workEffortPartyAssigns = EntityUtil.filterByDate(entryWorkEffort.getRelated("WorkEffortPartyAssignment", ["partyId" : partyId], null, false))
if (workEffortPartyAssigns) {
- workEffortPartyAssign = workEffortPartyAssigns[0];
- entry.fromDate = workEffortPartyAssign.getTimestamp("fromDate");
- entry.roleTypeId = workEffortPartyAssign.roleTypeId;
+ workEffortPartyAssign = workEffortPartyAssigns[0]
+ entry.fromDate = workEffortPartyAssign.getTimestamp("fromDate")
+ entry.roleTypeId = workEffortPartyAssign.roleTypeId
if ("PAS_COMPLETED".equals(workEffortPartyAssign.statusId)) {
- entry.checkComplete = "Y";
+ entry.checkComplete = "Y"
}
}
// get project/phase information
- entry.workEffortId = entryWorkEffort.workEffortId;
- entry.workEffortName = entryWorkEffort.workEffortName;
- result = runService('getProjectIdAndNameFromTask', ["userLogin" : parameters.userLogin,"taskId" : entryWorkEffort.workEffortId]);
- entry.phaseId = result.phaseId;
- entry.phaseName = result.phaseName;
- entry.projectId = result.projectId;
- entry.projectName = result.projectName;
- entry.taskWbsId = result.taskWbsId;
+ entry.workEffortId = entryWorkEffort.workEffortId
+ entry.workEffortName = entryWorkEffort.workEffortName
+ result = runService('getProjectIdAndNameFromTask', ["userLogin" : parameters.userLogin,"taskId" : entryWorkEffort.workEffortId])
+ entry.phaseId = result.phaseId
+ entry.phaseName = result.phaseName
+ entry.projectId = result.projectId
+ entry.projectName = result.projectName
+ entry.taskWbsId = result.taskWbsId
}
- entry.total = taskTotal;
+ entry.total = taskTotal
//Drop Down Lists
- entries.add(entry);
+ entries.add(entry)
// start new entry
- taskTotal = 0.00;
- entry = ["timesheetId" : timesheet.timesheetId];
+ taskTotal = 0.00
+ entry = ["timesheetId" : timesheet.timesheetId]
}
-timeEntries = timesheet.getRelated("TimeEntry", null, ["workEffortId", "rateTypeId", "fromDate"], false);
-te = timeEntries.iterator();
+timeEntries = timesheet.getRelated("TimeEntry", null, ["workEffortId", "rateTypeId", "fromDate"], false)
+te = timeEntries.iterator()
while (te.hasNext()) {
// only fill lastTimeEntry when not the first time
if (timeEntry!=void) {
- lastTimeEntry = timeEntry;
+ lastTimeEntry = timeEntry
}
- timeEntry = te.next();
+ timeEntry = te.next()
if (lastTimeEntry &&
(!lastTimeEntry.workEffortId.equals(timeEntry.workEffortId) ||
!lastTimeEntry.rateTypeId.equals(timeEntry.rateTypeId))) {
- retrieveWorkEffortData();
+ retrieveWorkEffortData()
}
if (timeEntry.hours) {
- dayNumber = "d" + (timeEntry.fromDate.getTime() - timesheet.fromDate.getTime()) / (24*60*60*1000);
- hours = timeEntry.hours.doubleValue();
- entry.put(String.valueOf(dayNumber), hours);
- if (dayNumber.equals("d0")) day0Total += hours;
- if (dayNumber.equals("d1")) day1Total += hours;
- if (dayNumber.equals("d2")) day2Total += hours;
- if (dayNumber.equals("d3")) day3Total += hours;
- if (dayNumber.equals("d4")) day4Total += hours;
- if (dayNumber.equals("d5")) day5Total += hours;
- if (dayNumber.equals("d6")) day6Total += hours;
- taskTotal += hours;
+ dayNumber = "d" + (timeEntry.fromDate.getTime() - timesheet.fromDate.getTime()) / (24*60*60*1000)
+ hours = timeEntry.hours.doubleValue()
+ entry.put(String.valueOf(dayNumber), hours)
+ if (dayNumber.equals("d0")) day0Total += hours
+ if (dayNumber.equals("d1")) day1Total += hours
+ if (dayNumber.equals("d2")) day2Total += hours
+ if (dayNumber.equals("d3")) day3Total += hours
+ if (dayNumber.equals("d4")) day4Total += hours
+ if (dayNumber.equals("d5")) day5Total += hours
+ if (dayNumber.equals("d6")) day6Total += hours
+ taskTotal += hours
}
- entry.rateTypeId = timeEntry.rateTypeId;
+ entry.rateTypeId = timeEntry.rateTypeId
}
if (timeEntry) {
- lastTimeEntry = timeEntry;
- retrieveWorkEffortData();
+ lastTimeEntry = timeEntry
+ retrieveWorkEffortData()
}
// add empty lines if timesheet not completed
if (!timesheet.statusId.equals("TIMESHEET_COMPLETED")) {
for (c=0; c < 3; c++) { // add empty lines
- entries.add(["timesheetId" : timesheet.timesheetId]);
+ entries.add(["timesheetId" : timesheet.timesheetId])
}
}
// add the totals line if at least one entry
if (timeEntry) {
- entry = ["timesheetId" : timesheet.timesheetId];
- entry.d0 = day0Total;
- entry.d1 = day1Total;
- entry.d2 = day2Total;
- entry.d3 = day3Total;
- entry.d4 = day4Total;
- entry.d5 = day5Total;
- entry.d6 = day6Total;
- entry.phaseName = uiLabelMap.ProjectMgrTotals;
- entry.workEffortId = "Totals";
- entry.total = day0Total + day1Total + day2Total + day3Total + day4Total + day5Total + day6Total;
- entries.add(entry);
+ entry = ["timesheetId" : timesheet.timesheetId]
+ entry.d0 = day0Total
+ entry.d1 = day1Total
+ entry.d2 = day2Total
+ entry.d3 = day3Total
+ entry.d4 = day4Total
+ entry.d5 = day5Total
+ entry.d6 = day6Total
+ entry.phaseName = uiLabelMap.ProjectMgrTotals
+ entry.workEffortId = "Totals"
+ entry.total = day0Total + day1Total + day2Total + day3Total + day4Total + day5Total + day6Total
+ entries.add(entry)
}
-context.timeEntries = entries;
+context.timeEntries = entries
// get all timesheets of this user, including the planned hours
-timesheetsDb = from("Timesheet").where("partyId", partyId).orderBy("fromDate DESC").queryList();
-timesheets = new LinkedList();
+timesheetsDb = from("Timesheet").where("partyId", partyId).orderBy("fromDate DESC").queryList()
+timesheets = new LinkedList()
timesheetsDb.each { timesheetDb ->
- timesheet = [:];
- timesheet.putAll(timesheetDb);
- entries = timesheetDb.getRelated("TimeEntry", null, null, false);
- hours = 0.00;
+ timesheet = [:]
+ timesheet.putAll(timesheetDb)
+ entries = timesheetDb.getRelated("TimeEntry", null, null, false)
+ hours = 0.00
entries.each { timeEntry ->
if (timeEntry.hours) {
- hours += timeEntry.hours.doubleValue();
+ hours += timeEntry.hours.doubleValue()
}
}
- timesheet.weekNumber = UtilDateTime.weekNumber(timesheetDb.fromDate);
- timesheet.hours = hours;
- timesheets.add(timesheet);
+ timesheet.weekNumber = UtilDateTime.weekNumber(timesheetDb.fromDate)
+ timesheet.hours = hours
+ timesheets.add(timesheet)
}
-context.timesheets = timesheets;
+context.timesheets = timesheets
diff --git a/specialpurpose/projectmgr/groovyScripts/GanttChart.groovy b/specialpurpose/projectmgr/groovyScripts/GanttChart.groovy
index 486b18c8e7..a583626115 100644
--- a/specialpurpose/projectmgr/groovyScripts/GanttChart.groovy
+++ b/specialpurpose/projectmgr/groovyScripts/GanttChart.groovy
@@ -23,118 +23,118 @@ import org.apache.ofbiz.base.util.UtilValidate
import org.apache.ofbiz.entity.condition.EntityCondition
import org.apache.ofbiz.entity.condition.EntityOperator
-projectId = parameters.projectId;
-userLogin = parameters.userLogin;
+projectId = parameters.projectId
+userLogin = parameters.userLogin
//project info
-result = runService('getProject', [projectId : projectId, userLogin : userLogin]);
-project = result.projectInfo;
+result = runService('getProject', [projectId : projectId, userLogin : userLogin])
+project = result.projectInfo
if (project && project.startDate)
- context.chartStart = project.startDate;
+ context.chartStart = project.startDate
else
- context.chartStart = UtilDateTime.nowTimestamp(); // default todays date
+ context.chartStart = UtilDateTime.nowTimestamp() // default todays date
if (project && project.completionDate)
- context.chartEnd = project.completionDate;
+ context.chartEnd = project.completionDate
else
- context.chartEnd = UtilDateTime.addDaysToTimestamp(UtilDateTime.nowTimestamp(), 14); // default 14 days long
+ context.chartEnd = UtilDateTime.addDaysToTimestamp(UtilDateTime.nowTimestamp(), 14) // default 14 days long
-if (project == null) return;
+if (project == null) return
-ganttList = new LinkedList();
-result = runService('getProjectPhaseList', [userLogin : userLogin , projectId : projectId]);
-phases = result.phaseList;
+ganttList = new LinkedList()
+result = runService('getProjectPhaseList', [userLogin : userLogin , projectId : projectId])
+phases = result.phaseList
if (phases) {
phases.each { phase ->
- newPhase = phase;
- newPhase.phaseNr = phase.phaseId;
+ newPhase = phase
+ newPhase.phaseNr = phase.phaseId
if (!newPhase.estimatedStartDate && newPhase.actualStartDate) {
- newPhase.estimatedStartDate = newPhase.actualStartDate;
+ newPhase.estimatedStartDate = newPhase.actualStartDate
}
if (!newPhase.estimatedStartDate) {
- newPhase.estimatedStartDate = context.chartStart;
+ newPhase.estimatedStartDate = context.chartStart
}
if (!newPhase.estimatedCompletionDate && newPhase.actualCompletionDate) {
- newPhase.estimatedCompletionDate = newPhase.actualCompletionDateDate;
+ newPhase.estimatedCompletionDate = newPhase.actualCompletionDateDate
}
if (!newPhase.estimatedCompletionDate) {
- newPhase.estimatedCompletionDate = UtilDateTime.addDaysToTimestamp(newPhase.estimatedStartDate, 3);
+ newPhase.estimatedCompletionDate = UtilDateTime.addDaysToTimestamp(newPhase.estimatedStartDate, 3)
}
- newPhase.workEffortTypeId = "PHASE";
- ganttList.add(newPhase);
+ newPhase.workEffortTypeId = "PHASE"
+ ganttList.add(newPhase)
cond = EntityCondition.makeCondition(
[
EntityCondition.makeCondition("currentStatusId", EntityOperator.NOT_EQUAL, "PTS_CANCELLED"),
EntityCondition.makeCondition("workEffortParentId", EntityOperator.EQUALS, phase.phaseId)
- ], EntityOperator.AND);
- tasks = from("WorkEffort").where(cond).orderBy("sequenceNum","workEffortName").queryList();
+ ], EntityOperator.AND)
+ tasks = from("WorkEffort").where(cond).orderBy("sequenceNum","workEffortName").queryList()
if (tasks) {
tasks.each { task ->
- resultTaskInfo = runService('getProjectTask', [userLogin : userLogin , taskId : task.workEffortId]);
- taskInfo = resultTaskInfo.taskInfo;
- taskInfo.taskNr = task.workEffortId;
- taskInfo.phaseNr = phase.phaseId;
+ resultTaskInfo = runService('getProjectTask', [userLogin : userLogin , taskId : task.workEffortId])
+ taskInfo = resultTaskInfo.taskInfo
+ taskInfo.taskNr = task.workEffortId
+ taskInfo.phaseNr = phase.phaseId
if (taskInfo.plannedHours && !taskInfo.currentStatusId.equals("PTS_COMPLETED") && taskInfo.plannedHours > taskInfo.actualHours) {
- taskInfo.resource = taskInfo.plannedHours + " Hrs";
+ taskInfo.resource = taskInfo.plannedHours + " Hrs"
} else {
- taskInfo.resource = taskInfo.actualHours + " Hrs";
+ taskInfo.resource = taskInfo.actualHours + " Hrs"
}
- Double duration = resultTaskInfo.plannedHours;
+ Double duration = resultTaskInfo.plannedHours
if (taskInfo.currentStatusId.equals("PTS_COMPLETED")) {
- taskInfo.completion = 100;
+ taskInfo.completion = 100
} else {
if (taskInfo.actualHours && taskInfo.plannedHours) {
- taskInfo.completion = new BigDecimal(taskInfo.actualHours * 100 / taskInfo.plannedHours).setScale(0, BigDecimal.ROUND_UP);
+ taskInfo.completion = new BigDecimal(taskInfo.actualHours * 100 / taskInfo.plannedHours).setScale(0, BigDecimal.ROUND_UP)
} else {
- taskInfo.completion = 0;
+ taskInfo.completion = 0
}
}
if (!taskInfo.estimatedStartDate && taskInfo.actualStartDate) {
- taskInfo.estimatedStartDate = taskInfo.actualStartDate;
+ taskInfo.estimatedStartDate = taskInfo.actualStartDate
}
if (!taskInfo.estimatedStartDate) {
- taskInfo.estimatedStartDate = newPhase.estimatedStartDate;
+ taskInfo.estimatedStartDate = newPhase.estimatedStartDate
}
if (!taskInfo.estimatedCompletionDate && taskInfo.actualCompletionDate) {
- taskInfo.estimatedCompletionDate = taskInfo.actualCompletionDate;
+ taskInfo.estimatedCompletionDate = taskInfo.actualCompletionDate
}
if (!taskInfo.estimatedCompletionDate && !duration) {
- taskInfo.estimatedCompletionDate = UtilDateTime.addDaysToTimestamp(newPhase.estimatedStartDate, 3);
+ taskInfo.estimatedCompletionDate = UtilDateTime.addDaysToTimestamp(newPhase.estimatedStartDate, 3)
} else if (!taskInfo.estimatedCompletionDate && duration) {
- taskInfo.estimatedCompletionDate = UtilDateTime.addDaysToTimestamp(newPhase.estimatedStartDate, duration/8);
+ taskInfo.estimatedCompletionDate = UtilDateTime.addDaysToTimestamp(newPhase.estimatedStartDate, duration/8)
}
- taskInfo.estimatedStartDate = UtilDateTime.toDateString(taskInfo.estimatedStartDate, "MM/dd/yyyy");
- taskInfo.estimatedCompletionDate = UtilDateTime.toDateString(taskInfo.estimatedCompletionDate, "MM/dd/yyyy");
- taskInfo.workEffortTypeId = task.workEffortTypeId;
+ taskInfo.estimatedStartDate = UtilDateTime.toDateString(taskInfo.estimatedStartDate, "MM/dd/yyyy")
+ taskInfo.estimatedCompletionDate = UtilDateTime.toDateString(taskInfo.estimatedCompletionDate, "MM/dd/yyyy")
+ taskInfo.workEffortTypeId = task.workEffortTypeId
if (security.hasEntityPermission("PROJECTMGR", "_READ", session) || security.hasEntityPermission("PROJECTMGR", "_ADMIN", session)) {
- taskInfo.url = "/projectmgr/control/taskView?workEffortId="+task.workEffortId;
+ taskInfo.url = "/projectmgr/control/taskView?workEffortId="+task.workEffortId
} else {
- taskInfo.url = "";
+ taskInfo.url = ""
}
// dependency can only show one in the ganttchart, so onl show the latest one..
- preTasks = from("WorkEffortAssoc").where("workEffortIdTo", task.workEffortId).orderBy("workEffortIdFrom").queryList();
- latestTaskIds = new LinkedList();
+ preTasks = from("WorkEffortAssoc").where("workEffortIdTo", task.workEffortId).orderBy("workEffortIdFrom").queryList()
+ latestTaskIds = new LinkedList()
preTasks.each { preTask ->
- wf = preTask.getRelatedOne("FromWorkEffort", false);
- latestTaskIds.add(wf.workEffortId);
+ wf = preTask.getRelatedOne("FromWorkEffort", false)
+ latestTaskIds.add(wf.workEffortId)
}
- count = 0;
+ count = 0
if (UtilValidate.isNotEmpty(latestTaskIds)) {
- taskInfo.preDecessor = "";
+ taskInfo.preDecessor = ""
for (i in latestTaskIds) {
if (count > 0) {
- taskInfo.preDecessor = taskInfo.preDecessor +", " + i;
+ taskInfo.preDecessor = taskInfo.preDecessor +", " + i
} else {
- taskInfo.preDecessor = taskInfo.preDecessor + i;
+ taskInfo.preDecessor = taskInfo.preDecessor + i
}
- count ++;
+ count ++
}
}
- ganttList.add(taskInfo);
+ ganttList.add(taskInfo)
}
}
}
}
-context.phaseTaskList = ganttList;
+context.phaseTaskList = ganttList
diff --git a/specialpurpose/projectmgr/groovyScripts/GetLastRequestAssignment.groovy b/specialpurpose/projectmgr/groovyScripts/GetLastRequestAssignment.groovy
index b8f6bf1166..6e418791a5 100644
--- a/specialpurpose/projectmgr/groovyScripts/GetLastRequestAssignment.groovy
+++ b/specialpurpose/projectmgr/groovyScripts/GetLastRequestAssignment.groovy
@@ -20,17 +20,17 @@
// get last request from this user and use that project/task assignment as default on the screen
-custRequestList = from("CustRequest").where("fromPartyId", fromPartyId).orderBy("-createdDate").queryList();
+custRequestList = from("CustRequest").where("fromPartyId", fromPartyId).orderBy("-createdDate").queryList()
if (custRequestList) {
- custReqTaskList = custRequestList.get(0).getRelated("CustRequestWorkEffort", null, null, false);
+ custReqTaskList = custRequestList.get(0).getRelated("CustRequestWorkEffort", null, null, false)
if (custReqTaskList) {
- custReqTask = custReqTaskList.get(0).getRelatedOne("WorkEffort", false); // phase
- projectChildWorkEffort = custReqTask.getRelatedOne("ParentWorkEffort", false); // phase name
+ custReqTask = custReqTaskList.get(0).getRelatedOne("WorkEffort", false) // phase
+ projectChildWorkEffort = custReqTask.getRelatedOne("ParentWorkEffort", false) // phase name
if (projectChildWorkEffort) {
- partyList = custReqTask.getRelated("WorkEffortPartyAssignment", null, null, false);
+ partyList = custReqTask.getRelated("WorkEffortPartyAssignment", null, null, false)
if (partyList) {
- context.childWorkEffortId = projectChildWorkEffort.workEffortId;
- context.partyId= partyList.get(0).partyId;
+ context.childWorkEffortId = projectChildWorkEffort.workEffortId
+ context.partyId= partyList.get(0).partyId
}
}
}
diff --git a/specialpurpose/projectmgr/groovyScripts/GetProjectId.groovy b/specialpurpose/projectmgr/groovyScripts/GetProjectId.groovy
index 53bb0965aa..02a1af18f3 100644
--- a/specialpurpose/projectmgr/groovyScripts/GetProjectId.groovy
+++ b/specialpurpose/projectmgr/groovyScripts/GetProjectId.groovy
@@ -17,14 +17,14 @@
* under the License.
*/
-import org.apache.ofbiz.base.util.UtilValidate;
+import org.apache.ofbiz.base.util.UtilValidate
if (parameters.workEffortId) {
- workEffortId = parameters.workEffortId;
- projects = from("ProjectAndPhaseAndTask").where("workEffortId", workEffortId).queryList();
+ workEffortId = parameters.workEffortId
+ projects = from("ProjectAndPhaseAndTask").where("workEffortId", workEffortId).queryList()
if (UtilValidate.isNotEmpty(projects)) {
- context.put("projectId", projects.get(0).getString("projectId"));
- context.put("projectName", projects.get(0).getString("projectName"));
- context.put("phaseName", projects.get(0).getString("phaseName"));
+ context.put("projectId", projects.get(0).getString("projectId"))
+ context.put("projectName", projects.get(0).getString("projectName"))
+ context.put("phaseName", projects.get(0).getString("phaseName"))
}
}
diff --git a/specialpurpose/projectmgr/groovyScripts/ListCurrentProjects.groovy b/specialpurpose/projectmgr/groovyScripts/ListCurrentProjects.groovy
index 6e418f7cdb..ff3c8707ef 100644
--- a/specialpurpose/projectmgr/groovyScripts/ListCurrentProjects.groovy
+++ b/specialpurpose/projectmgr/groovyScripts/ListCurrentProjects.groovy
@@ -25,20 +25,20 @@ import org.apache.ofbiz.entity.condition.EntityOperator
cond = EntityCondition.makeCondition([
EntityCondition.makeCondition ("workEffortTypeId", EntityOperator.EQUALS, "PROJECT"),
EntityCondition.makeCondition ("currentStatusId", EntityOperator.NOT_EQUAL, "PRJ_CLOSED")
- ], EntityJoinOperator.AND);
-allProjects = select("workEffortId").from("WorkEffort").where(cond).orderBy("workEffortName").queryList();
+ ], EntityJoinOperator.AND)
+allProjects = select("workEffortId").from("WorkEffort").where(cond).orderBy("workEffortName").queryList()
-projects = [];
+projects = []
allProjects.each { project ->
- result = runService('getProject', ["userLogin" : parameters.userLogin, "projectId" : project.workEffortId]);
+ result = runService('getProject', ["userLogin" : parameters.userLogin, "projectId" : project.workEffortId])
if (result.projectInfo) {
- resultAssign = from("WorkEffortPartyAssignment").where("partyId", parameters.userLogin.partyId, "workEffortId", project.workEffortId).queryList();
+ resultAssign = from("WorkEffortPartyAssignment").where("partyId", parameters.userLogin.partyId, "workEffortId", project.workEffortId).queryList()
if (security.hasEntityPermission("PROJECTMGR", "_ADMIN", session)
|| ((security.hasEntityPermission("PROJECTMGR", "_ROLE_ADMIN", session) || security.hasEntityPermission("PROJECTMGR", "_ROLE_VIEW", session)) && resultAssign)) {
- projects.add(result.projectInfo);
+ projects.add(result.projectInfo)
}
}
}
if (projects) {
- context.projects = projects;
+ context.projects = projects
}
diff --git a/specialpurpose/projectmgr/groovyScripts/ListResourceBillingHours.groovy b/specialpurpose/projectmgr/groovyScripts/ListResourceBillingHours.groovy
index 40919932ee..23ddea3505 100644
--- a/specialpurpose/projectmgr/groovyScripts/ListResourceBillingHours.groovy
+++ b/specialpurpose/projectmgr/groovyScripts/ListResourceBillingHours.groovy
@@ -17,15 +17,15 @@
* under the License.
*/
-allProjects = select("workEffortId").from("WorkEffortAndPartyAssign").where("workEffortTypeId", "PROJECT", "partyId", parameters.partyId).orderBy("workEffortName").cache(true).queryList();
+allProjects = select("workEffortId").from("WorkEffortAndPartyAssign").where("workEffortTypeId", "PROJECT", "partyId", parameters.partyId).orderBy("workEffortName").cache(true).queryList()
-projects = [];
+projects = []
allProjects.each { project ->
- result = runService('getProject', ["userLogin" : parameters.userLogin, "projectId" : project.workEffortId, partyId : parameters.partyId]);
- projects.add(result.projectInfo);
+ result = runService('getProject', ["userLogin" : parameters.userLogin, "projectId" : project.workEffortId, partyId : parameters.partyId])
+ projects.add(result.projectInfo)
}
if (projects) {
- context.billingList = projects;
+ context.billingList = projects
}
diff --git a/specialpurpose/projectmgr/groovyScripts/ProjectBilling.groovy b/specialpurpose/projectmgr/groovyScripts/ProjectBilling.groovy
index eae354f0d1..ab03660efe 100644
--- a/specialpurpose/projectmgr/groovyScripts/ProjectBilling.groovy
+++ b/specialpurpose/projectmgr/groovyScripts/ProjectBilling.groovy
@@ -23,13 +23,13 @@ import org.apache.ofbiz.base.util.UtilDateTime
import org.apache.ofbiz.entity.condition.EntityCondition
import org.apache.ofbiz.entity.condition.EntityOperator
-projectId = parameters.projectId;
+projectId = parameters.projectId
entryExprs =
EntityCondition.makeCondition([
EntityCondition.makeCondition("projectId", EntityOperator.EQUALS, projectId),
EntityCondition.makeCondition("invoiceId", EntityOperator.NOT_EQUAL, null),
- ], EntityOperator.AND);
-orderBy = ["-fromDate"];
+ ], EntityOperator.AND)
+orderBy = ["-fromDate"]
// check if latest invoice generated is still in process so allow re-generation to correct errors
entryIterator = from("ProjectPhaseTaskAndTimeEntryTimeSheet")
.where(EntityCondition.makeCondition([
@@ -37,16 +37,16 @@ entryIterator = from("ProjectPhaseTaskAndTimeEntryTimeSheet")
EntityCondition.makeCondition("invoiceId", EntityOperator.NOT_EQUAL, null),
], EntityOperator.AND))
.orderBy("-fromDate")
- .queryIterator();
+ .queryIterator()
while (entryItem = entryIterator.next()) {
- invoice = entryItem.getRelatedOne("Invoice", false);
+ invoice = entryItem.getRelatedOne("Invoice", false)
if (invoice.getString("statusId").equals("INVOICE_IN_PROCESS")) {
- context.partyIdFrom = invoice.partyIdFrom;
- context.partyId = invoice.partyId;
- context.invoiceId = invoice.invoiceId;
- break;
+ context.partyIdFrom = invoice.partyIdFrom
+ context.partyId = invoice.partyId
+ context.invoiceId = invoice.invoiceId
+ break
}
}
-entryIterator.close();
+entryIterator.close()
//start of this month
-context.thruDate = UtilDateTime.getMonthStart(UtilDateTime.nowTimestamp());
+context.thruDate = UtilDateTime.getMonthStart(UtilDateTime.nowTimestamp())
diff --git a/specialpurpose/projectmgr/groovyScripts/ProjectIsBillable.groovy b/specialpurpose/projectmgr/groovyScripts/ProjectIsBillable.groovy
index cb71e02854..7054e621cd 100644
--- a/specialpurpose/projectmgr/groovyScripts/ProjectIsBillable.groovy
+++ b/specialpurpose/projectmgr/groovyScripts/ProjectIsBillable.groovy
@@ -17,22 +17,22 @@
* under the License.
*/
-projectMembers = from("WorkEffortPartyAssignment").where("workEffortId", context.projectId).filterByDate().queryList();
+projectMembers = from("WorkEffortPartyAssignment").where("workEffortId", context.projectId).filterByDate().queryList()
-toPartyId = null;
-fromPartyId = null;
+toPartyId = null
+fromPartyId = null
projectMembers.each {member ->
if (member.roleTypeId.equals("INTERNAL_ORGANIZATIO")) {
- fromPartyId = member.partyId;
+ fromPartyId = member.partyId
}
if (member.roleTypeId.equals("CLIENT_BILLING")) {
- toPartyId = member.partyId;
+ toPartyId = member.partyId
}
if (fromPartyId && toPartyId && fromPartyId.equals(toPartyId)) {
- context.isBillable = false;
+ context.isBillable = false
} else if (!toPartyId || !fromPartyId){
- context.isBillable = false;
+ context.isBillable = false
} else {
- context.isBillable = true;
+ context.isBillable = true
}
}
diff --git a/specialpurpose/scrum/groovyScripts/AddProductBacklogItem.groovy b/specialpurpose/scrum/groovyScripts/AddProductBacklogItem.groovy
index f33fdb8009..edbf4dbb43 100644
--- a/specialpurpose/scrum/groovyScripts/AddProductBacklogItem.groovy
+++ b/specialpurpose/scrum/groovyScripts/AddProductBacklogItem.groovy
@@ -17,116 +17,116 @@
* under the License.
*/
-import java.sql.*;
-import java.sql.Timestamp;
-import java.util.Calendar;
-import net.fortuna.ical4j.model.DateTime;
-import org.apache.ofbiz.base.util.*;
-import org.apache.ofbiz.entity.condition.*;
-import sun.util.calendar.LocalGregorianCalendar.Date;
+import java.sql.*
+import java.sql.Timestamp
+import java.util.Calendar
+import net.fortuna.ical4j.model.DateTime
+import org.apache.ofbiz.base.util.*
+import org.apache.ofbiz.entity.condition.*
+import sun.util.calendar.LocalGregorianCalendar.Date
-def module = "AddProductBacklogItem.groovy";
+def module = "AddProductBacklogItem.groovy"
// find cust request and items
-def inputFields = [:];
+def inputFields = [:]
if(parameters.statusId == null){
- parameters.statusId = "";
+ parameters.statusId = ""
}else if("Any".equals(parameters.statusId)){
- parameters.statusId = "";
+ parameters.statusId = ""
}
-inputFields.putAll(parameters);
-inputFields.custRequestTypeId = "RF_PROD_BACKLOG";
-def performFindResults = runService('performFind', ["entityName": "CustRequestAndCustRequestItem", "inputFields": inputFields, "orderBy": "custSequenceNum"]);
-def custRequestAndItems = performFindResults.listIt.getCompleteList();
-performFindResults.listIt.close();
+inputFields.putAll(parameters)
+inputFields.custRequestTypeId = "RF_PROD_BACKLOG"
+def performFindResults = runService('performFind', ["entityName": "CustRequestAndCustRequestItem", "inputFields": inputFields, "orderBy": "custSequenceNum"])
+def custRequestAndItems = performFindResults.listIt.getCompleteList()
+performFindResults.listIt.close()
// prepare cust request item list [cust request and item Map]
-def countSequence = 1;
-def custRequestAndCustRequestItems = [];
+def countSequence = 1
+def custRequestAndCustRequestItems = []
custRequestAndItems.each() { custRequestAndItem ->
- def tempCustRequestAndItem = [:];
- tempCustRequestAndItem.putAll(custRequestAndItem);
- tempCustRequestAndItem.custSequenceNum = countSequence;
- tempCustRequestAndItem.realSequenceNum = custRequestAndItem.custSequenceNum;
+ def tempCustRequestAndItem = [:]
+ tempCustRequestAndItem.putAll(custRequestAndItem)
+ tempCustRequestAndItem.custSequenceNum = countSequence
+ tempCustRequestAndItem.realSequenceNum = custRequestAndItem.custSequenceNum
// if custRequest has task then get Actual Hours
- custWorkEffortList = from("CustRequestWorkEffort").where("custRequestId", custRequestAndItem.custRequestId).queryList();
+ custWorkEffortList = from("CustRequestWorkEffort").where("custRequestId", custRequestAndItem.custRequestId).queryList()
if (custWorkEffortList) {
- actualHours = 0.00;
+ actualHours = 0.00
custWorkEffortList.each() { custWorkEffortMap ->
- result = runService('getScrumActualHour', ["taskId" : custWorkEffortMap.workEffortId,"partyId" : null, "userLogin" : userLogin]);
- actualHours += result.actualHours;
+ result = runService('getScrumActualHour', ["taskId" : custWorkEffortMap.workEffortId,"partyId" : null, "userLogin" : userLogin])
+ actualHours += result.actualHours
}
if(actualHours) {
- tempCustRequestAndItem.actualHours = actualHours;
+ tempCustRequestAndItem.actualHours = actualHours
} else {
- tempCustRequestAndItem.actualHours = null;
+ tempCustRequestAndItem.actualHours = null
}
} else {
- tempCustRequestAndItem.actualHours = null;
+ tempCustRequestAndItem.actualHours = null
}
- custRequestAndCustRequestItems.add(tempCustRequestAndItem);
- countSequence ++;
+ custRequestAndCustRequestItems.add(tempCustRequestAndItem)
+ countSequence ++
}
if ("N".equals(parameters.sequence)) { // re-order category list item
- custRequestAndCustRequestItems = UtilMisc.sortMaps(custRequestAndCustRequestItems, ["parentCustRequestId"]);
+ custRequestAndCustRequestItems = UtilMisc.sortMaps(custRequestAndCustRequestItems, ["parentCustRequestId"])
}
//set status back for display in Find screen
if("".equals(parameters.statusId)){
- parameters.statusId = "Any";
+ parameters.statusId = "Any"
}
-context.custRequestAndCustRequestItems = custRequestAndCustRequestItems;
+context.custRequestAndCustRequestItems = custRequestAndCustRequestItems
// unplanned backlog item list
-productId = parameters.productId;
+productId = parameters.productId
-conditionList = [];
-orConditionList = [];
-mainConditionList = [];
+conditionList = []
+orConditionList = []
+mainConditionList = []
-conditionList.add(EntityCondition.makeCondition("custRequestTypeId", EntityOperator.EQUALS, "RF_UNPLAN_BACKLOG"));
-conditionList.add(EntityCondition.makeCondition("productId", EntityOperator.EQUALS, parameters.productId));
+conditionList.add(EntityCondition.makeCondition("custRequestTypeId", EntityOperator.EQUALS, "RF_UNPLAN_BACKLOG"))
+conditionList.add(EntityCondition.makeCondition("productId", EntityOperator.EQUALS, parameters.productId))
-orConditionList.add(EntityCondition.makeCondition("statusId", EntityOperator.EQUALS, "CRQ_ACCEPTED"));
-orConditionList.add(EntityCondition.makeCondition("statusId", EntityOperator.EQUALS, "CRQ_REOPENED"));
+orConditionList.add(EntityCondition.makeCondition("statusId", EntityOperator.EQUALS, "CRQ_ACCEPTED"))
+orConditionList.add(EntityCondition.makeCondition("statusId", EntityOperator.EQUALS, "CRQ_REOPENED"))
-orConditions = EntityCondition.makeCondition(orConditionList, EntityOperator.OR);
-conditions = EntityCondition.makeCondition(conditionList, EntityOperator.AND);
+orConditions = EntityCondition.makeCondition(orConditionList, EntityOperator.OR)
+conditions = EntityCondition.makeCondition(conditionList, EntityOperator.AND)
-mainConditionList.add(orConditions);
-mainConditionList.add(conditions);
+mainConditionList.add(orConditions)
+mainConditionList.add(conditions)
-unplannedList = select("custRequestId", "custSequenceNum", "statusId", "description", "custEstimatedMilliSeconds", "custRequestName", "parentCustRequestId").from("CustRequestAndCustRequestItem").where(mainConditionList).orderBy("custSequenceNum").queryList();
+unplannedList = select("custRequestId", "custSequenceNum", "statusId", "description", "custEstimatedMilliSeconds", "custRequestName", "parentCustRequestId").from("CustRequestAndCustRequestItem").where(mainConditionList).orderBy("custSequenceNum").queryList()
-def countSequenceUnplanned = 1;
-def unplanBacklogItems = [];
+def countSequenceUnplanned = 1
+def unplanBacklogItems = []
unplannedList.each() { unplannedItem ->
- def tempUnplanned = [:];
- tempUnplanned.putAll(unplannedItem);
- tempUnplanned.custSequenceNum = countSequenceUnplanned;
- tempUnplanned.realSequenceNum = unplannedItem.custSequenceNum;
+ def tempUnplanned = [:]
+ tempUnplanned.putAll(unplannedItem)
+ tempUnplanned.custSequenceNum = countSequenceUnplanned
+ tempUnplanned.realSequenceNum = unplannedItem.custSequenceNum
// if custRequest has task then get Actual Hours
- unplanCustWorkEffortList = from("CustRequestWorkEffort").where("custRequestId", unplannedItem.custRequestId).queryList();
+ unplanCustWorkEffortList = from("CustRequestWorkEffort").where("custRequestId", unplannedItem.custRequestId).queryList()
if (unplanCustWorkEffortList) {
- actualHours = 0.00;
+ actualHours = 0.00
unplanCustWorkEffortList.each() { custWorkEffortMap ->
- result = runService('getScrumActualHour', ["taskId" : custWorkEffortMap.workEffortId,"partyId" : null, "userLogin" : userLogin]);
- actualHours += result.actualHours;
+ result = runService('getScrumActualHour', ["taskId" : custWorkEffortMap.workEffortId,"partyId" : null, "userLogin" : userLogin])
+ actualHours += result.actualHours
}
if(actualHours) {
- tempUnplanned.actualHours = actualHours;
+ tempUnplanned.actualHours = actualHours
} else {
- tempUnplanned.actualHours = null;
+ tempUnplanned.actualHours = null
}
} else {
- tempUnplanned.actualHours = null;
+ tempUnplanned.actualHours = null
}
- unplanBacklogItems.add(tempUnplanned);
- countSequenceUnplanned ++;
+ unplanBacklogItems.add(tempUnplanned)
+ countSequenceUnplanned ++
}
if ("N".equals(parameters.UnplannedSequence)) { // re-order category list item
- unplanBacklogItems = UtilMisc.sortMaps(unplanBacklogItems, ["parentCustRequestId"]);
+ unplanBacklogItems = UtilMisc.sortMaps(unplanBacklogItems, ["parentCustRequestId"])
}
-context.unplanBacklogItems = unplanBacklogItems;
+context.unplanBacklogItems = unplanBacklogItems
diff --git a/specialpurpose/scrum/groovyScripts/AddResourceTaskParty.groovy b/specialpurpose/scrum/groovyScripts/AddResourceTaskParty.groovy
index 79b67590ea..382108bb5b 100644
--- a/specialpurpose/scrum/groovyScripts/AddResourceTaskParty.groovy
+++ b/specialpurpose/scrum/groovyScripts/AddResourceTaskParty.groovy
@@ -17,40 +17,40 @@
* under the License.
*/
-import java.util.*;
-import org.apache.ofbiz.base.util.Debug;
+import java.util.*
+import org.apache.ofbiz.base.util.Debug
partyId = parameters.partyId
// get existing task that no assign
-projectSprintBacklogAndTaskList = [];
-projectAndTaskList = from("ProjectSprintBacklogAndTask").where("sprintTypeId", "SCRUM_SPRINT","taskCurrentStatusId", "STS_CREATED").orderBy("taskId DESC").queryList();
+projectSprintBacklogAndTaskList = []
+projectAndTaskList = from("ProjectSprintBacklogAndTask").where("sprintTypeId", "SCRUM_SPRINT","taskCurrentStatusId", "STS_CREATED").orderBy("taskId DESC").queryList()
projectAndTaskList.each { projectAndTaskMap ->
-userLoginId = userLogin.partyId;
- projectId = projectAndTaskMap.projectId;
- partyAssignmentProjectList = from("WorkEffortPartyAssignment").where("workEffortId", projectId, "partyId", partyId).queryList();
- partyAssignmentProjectMap = partyAssignmentProjectList[0];
+userLoginId = userLogin.partyId
+ projectId = projectAndTaskMap.projectId
+ partyAssignmentProjectList = from("WorkEffortPartyAssignment").where("workEffortId", projectId, "partyId", partyId).queryList()
+ partyAssignmentProjectMap = partyAssignmentProjectList[0]
// if this userLoginId is a member of project
if (partyAssignmentProjectMap) {
- sprintId = projectAndTaskMap.sprintId;
- partyAssignmentSprintList = from("WorkEffortPartyAssignment").where("workEffortId", sprintId, "partyId", partyId).queryList();
- partyAssignmentSprintMap = partyAssignmentSprintList[0];
+ sprintId = projectAndTaskMap.sprintId
+ partyAssignmentSprintList = from("WorkEffortPartyAssignment").where("workEffortId", sprintId, "partyId", partyId).queryList()
+ partyAssignmentSprintMap = partyAssignmentSprintList[0]
// if this userLoginId is a member of sprint
if (partyAssignmentSprintMap) {
- workEffortId = projectAndTaskMap.taskId;
- partyAssignmentTaskList = from("WorkEffortPartyAssignment").where("workEffortId", workEffortId).queryList();
- partyAssignmentTaskMap = partyAssignmentTaskList[0];
+ workEffortId = projectAndTaskMap.taskId
+ partyAssignmentTaskList = from("WorkEffortPartyAssignment").where("workEffortId", workEffortId).queryList()
+ partyAssignmentTaskMap = partyAssignmentTaskList[0]
// if the task do not assigned
if (!partyAssignmentTaskMap) {
- projectSprintBacklogAndTaskList.add(projectAndTaskMap);
+ projectSprintBacklogAndTaskList.add(projectAndTaskMap)
// if the task do not assigned and assigned with custRequestTypeId = RF_SCRUM_MEETINGS
} else {
- custRequestTypeId = projectAndTaskMap.custRequestTypeId;
- backlogStatusId = projectAndTaskMap.backlogStatusId;
+ custRequestTypeId = projectAndTaskMap.custRequestTypeId
+ backlogStatusId = projectAndTaskMap.backlogStatusId
if (custRequestTypeId.equals("RF_SCRUM_MEETINGS") && backlogStatusId.equals("CRQ_REVIEWED")) {
- projectSprintBacklogAndTaskList.add(projectAndTaskMap);
+ projectSprintBacklogAndTaskList.add(projectAndTaskMap)
}
}
}
}
}
-context.projectSprintBacklogAndTaskList = projectSprintBacklogAndTaskList;
+context.projectSprintBacklogAndTaskList = projectSprintBacklogAndTaskList
diff --git a/specialpurpose/scrum/groovyScripts/BacklogNotifications.groovy b/specialpurpose/scrum/groovyScripts/BacklogNotifications.groovy
index 30ef0326ac..4f60054806 100644
--- a/specialpurpose/scrum/groovyScripts/BacklogNotifications.groovy
+++ b/specialpurpose/scrum/groovyScripts/BacklogNotifications.groovy
@@ -17,48 +17,48 @@
* under the License.
*/
-import org.apache.ofbiz.base.util.*;
-import org.apache.ofbiz.entity.condition.*;
+import org.apache.ofbiz.base.util.*
+import org.apache.ofbiz.entity.condition.*
-def module = "BacklogNotifications.groovy";
+def module = "BacklogNotifications.groovy"
-custRequest = from("CustRequest").where("custRequestId", custRequestId).queryOne();
-person = from("PartyNameView").where("partyId", partyIdTo).queryOne();
-informationMap = [:];
-informationMap.internalName = null;
-informationMap.productId = null;
-informationMap.workEffortName = null;
-informationMap.workEffortId = null;
+custRequest = from("CustRequest").where("custRequestId", custRequestId).queryOne()
+person = from("PartyNameView").where("partyId", partyIdTo).queryOne()
+informationMap = [:]
+informationMap.internalName = null
+informationMap.productId = null
+informationMap.workEffortName = null
+informationMap.workEffortId = null
//check in sprint
-backlogList = select("productId", "workEffortId", "custRequestId").from("ProductBacklog").where("workEffortTypeId", "SCRUM_SPRINT", "custRequestId", custRequestId).queryList();
+backlogList = select("productId", "workEffortId", "custRequestId").from("ProductBacklog").where("workEffortTypeId", "SCRUM_SPRINT", "custRequestId", custRequestId).queryList()
if (backlogList) {
- product = from("Product").where("productId", backlogList[0].productId).queryOne();
- sprint = from("WorkEffort").where("workEffortId", backlogList[0].workEffortId).queryOne();
- informationMap.internalName = product.internalName;
- informationMap.productId = product.productId;
- informationMap.workEffortName = sprint.workEffortName;
- informationMap.workEffortId = sprint.workEffortId;
+ product = from("Product").where("productId", backlogList[0].productId).queryOne()
+ sprint = from("WorkEffort").where("workEffortId", backlogList[0].workEffortId).queryOne()
+ informationMap.internalName = product.internalName
+ informationMap.productId = product.productId
+ informationMap.workEffortName = sprint.workEffortName
+ informationMap.workEffortId = sprint.workEffortId
} else {
- backlogList = select("productId", "workEffortId", "custRequestId").from("ProductBacklog").where("custRequestId", custRequestId).queryList();
+ backlogList = select("productId", "workEffortId", "custRequestId").from("ProductBacklog").where("custRequestId", custRequestId).queryList()
if (backlogList) {
if (backlogList[0].productId) {
- product = from("Product").where("productId", backlogList[0].productId).queryOne();
- informationMap.internalName = product.internalName;
- informationMap.productId = product.productId;
+ product = from("Product").where("productId", backlogList[0].productId).queryOne()
+ informationMap.internalName = product.internalName
+ informationMap.productId = product.productId
}
}
}
// check backlog removed from sprint.
-removedFromSprint = false;
+removedFromSprint = false
if ("CRQ_ACCEPTED".equals(custRequest.statusId)) {
- custStatusList = custRequest.getRelated("CustRequestStatus", null, ["-custRequestStatusId"], false);
+ custStatusList = custRequest.getRelated("CustRequestStatus", null, ["-custRequestStatusId"], false)
if (custStatusList.size() > 2 && "CRQ_REVIEWED".equals(custStatusList[1].statusId)) {
- removedFromSprint = true;
+ removedFromSprint = true
}
}
-context.custRequest = custRequest;
-context.person = person;
-context.informationMap = informationMap;
-context.removedFromSprint = removedFromSprint;
+context.custRequest = custRequest
+context.person = person
+context.informationMap = informationMap
+context.removedFromSprint = removedFromSprint
diff --git a/specialpurpose/scrum/groovyScripts/EditDailyHourReport.groovy b/specialpurpose/scrum/groovyScripts/EditDailyHourReport.groovy
index 8cd6a03bd7..32d833d715 100644
--- a/specialpurpose/scrum/groovyScripts/EditDailyHourReport.groovy
+++ b/specialpurpose/scrum/groovyScripts/EditDailyHourReport.groovy
@@ -17,420 +17,420 @@
* under the License.
*/
-import java.util.*;
-import java.lang.*;
-import org.apache.ofbiz.base.util.*;
-import org.apache.ofbiz.entity.*;
-import org.apache.ofbiz.base.util.Debug;
-import org.apache.ofbiz.base.util.UtilMisc;
-import org.apache.ofbiz.base.util.UtilValidate;
-import org.apache.ofbiz.base.util.UtilDateTime;
-import org.apache.ofbiz.entity.util.*;
-import org.apache.ofbiz.entity.condition.*;
-import org.apache.ofbiz.webapp.website.WebSiteWorker;
-import java.sql.Timestamp;
+import java.util.*
+import java.lang.*
+import org.apache.ofbiz.base.util.*
+import org.apache.ofbiz.entity.*
+import org.apache.ofbiz.base.util.Debug
+import org.apache.ofbiz.base.util.UtilMisc
+import org.apache.ofbiz.base.util.UtilValidate
+import org.apache.ofbiz.base.util.UtilDateTime
+import org.apache.ofbiz.entity.util.*
+import org.apache.ofbiz.entity.condition.*
+import org.apache.ofbiz.webapp.website.WebSiteWorker
+import java.sql.Timestamp
-uiLabelMap = UtilProperties.getResourceBundleMap("scrumUiLabels", locale);
-partyId = parameters.partyId;
+uiLabelMap = UtilProperties.getResourceBundleMap("scrumUiLabels", locale)
+partyId = parameters.partyId
if (!partyId) {
- partyId = parameters.userLogin.partyId;
+ partyId = parameters.userLogin.partyId
}
// show the requested timesheet, otherwise the current , if not exist create
-timesheet = null;
-timesheetId = parameters.timesheetId;
+timesheet = null
+timesheetId = parameters.timesheetId
if (timesheetId) {
- timesheet = from("Timesheet").where("timesheetId", timesheetId).queryOne();
- partyId = timesheet.partyId; // use the party from this timesheet
+ timesheet = from("Timesheet").where("timesheetId", timesheetId).queryOne()
+ partyId = timesheet.partyId // use the party from this timesheet
} else {
// make sure because of timezone changes, not a duplicate timesheet is created
- midweek = UtilDateTime.addDaysToTimestamp(UtilDateTime.getWeekStart(UtilDateTime.nowTimestamp()),3);
+ midweek = UtilDateTime.addDaysToTimestamp(UtilDateTime.getWeekStart(UtilDateTime.nowTimestamp()),3)
entryExprs = EntityCondition.makeCondition([
EntityCondition.makeCondition("fromDate", EntityComparisonOperator.LESS_THAN, midweek),
EntityCondition.makeCondition("thruDate", EntityComparisonOperator.GREATER_THAN, midweek),
EntityCondition.makeCondition("partyId", EntityComparisonOperator.EQUALS, partyId)
- ], EntityOperator.AND);
- entryIterator = from("Timesheet").where(entryExprs).queryIterator();
- timesheet = entryIterator.next();
- entryIterator.close();
+ ], EntityOperator.AND)
+ entryIterator = from("Timesheet").where(entryExprs).queryIterator()
+ timesheet = entryIterator.next()
+ entryIterator.close()
if (timesheet == null) {
- result = runService('createProjectTimesheet', ["userLogin" : parameters.userLogin, "partyId" : partyId]);
+ result = runService('createProjectTimesheet', ["userLogin" : parameters.userLogin, "partyId" : partyId])
if (result && result.timesheetId) {
- timesheet = from("Timesheet").where("timesheetId", result.timesheetId).queryOne();
+ timesheet = from("Timesheet").where("timesheetId", result.timesheetId).queryOne()
}
}
}
-if (!timesheet) return;
-context.timesheet = timesheet;
-context.weekNumber = UtilDateTime.weekNumber(timesheet.fromDate);
+if (!timesheet) return
+context.timesheet = timesheet
+context.weekNumber = UtilDateTime.weekNumber(timesheet.fromDate)
// get the user names
-context.partyNameView = from("PartyNameView").where("partyId", partyId).queryOne();
+context.partyNameView = from("PartyNameView").where("partyId", partyId).queryOne()
// get the default rate for this person
-rateTypes = from("PartyRate").where("partyId", partyId, "defaultRate", "Y").filterByDate().queryList();
+rateTypes = from("PartyRate").where("partyId", partyId, "defaultRate", "Y").filterByDate().queryList()
if (rateTypes) {
- context.defaultRateTypeId = rateTypes[0].rateTypeId;
+ context.defaultRateTypeId = rateTypes[0].rateTypeId
}
-entries = [];
-entry = ["timesheetId" : timesheet.timesheetId];
-leaveEntry = ["timesheetId" : timesheet.timesheetId];
-taskTotal = 0.00;
-planTotal = 0.00;
-leaveTaskTotal = 0.00;
-leavePlanTotal = 0.00;
-day0Total = 0.00; day1Total=0.00; day2Total=0.00; day3Total=0.00; day4Total=0.00; day5Total=0.00; day6Total=0.00;
-pDay0Total = 0.00; pDay1Total=0.00; pDay2Total=0.00; pDay3Total=0.00; pDay4Total=0.00; pDay5Total=0.00; pDay6Total=0.00;
-pHours = 0.00;
-timeEntry = null;
-lastTimeEntry = null;
-emplLeaveEntry = null;
-lastEmplLeaveEntry = null;
+entries = []
+entry = ["timesheetId" : timesheet.timesheetId]
+leaveEntry = ["timesheetId" : timesheet.timesheetId]
+taskTotal = 0.00
+planTotal = 0.00
+leaveTaskTotal = 0.00
+leavePlanTotal = 0.00
+day0Total = 0.00; day1Total=0.00; day2Total=0.00; day3Total=0.00; day4Total=0.00; day5Total=0.00; day6Total=0.00
+pDay0Total = 0.00; pDay1Total=0.00; pDay2Total=0.00; pDay3Total=0.00; pDay4Total=0.00; pDay5Total=0.00; pDay6Total=0.00
+pHours = 0.00
+timeEntry = null
+lastTimeEntry = null
+emplLeaveEntry = null
+lastEmplLeaveEntry = null
// retrieve work effort data when the workeffortId has changed.
void retrieveWorkEffortData() {
// get the planned number of hours
- entryWorkEffort = lastTimeEntry.getRelatedOne("WorkEffort", false);
+ entryWorkEffort = lastTimeEntry.getRelatedOne("WorkEffort", false)
if (entryWorkEffort) {
- plannedHours = entryWorkEffort.getRelated("WorkEffortSkillStandard", null, null, false);
- pHours = 0.00;
+ plannedHours = entryWorkEffort.getRelated("WorkEffortSkillStandard", null, null, false)
+ pHours = 0.00
plannedHours.each { plannedHour ->
if (plannedHour.estimatedDuration) {
- pHours += plannedHour.estimatedDuration;
+ pHours += plannedHour.estimatedDuration
}
}
- estimatedHour = 0.00;
+ estimatedHour = 0.00
estimatedMilliSeconds = entryWorkEffort.estimatedMilliSeconds
if (estimatedMilliSeconds > 0)
- estimatedHour = estimatedMilliSeconds/3600000;
- entry.plannedHours = estimatedHour;
- //entry.plannedHours = pHours;
- planHours = 0.0;
- planHours = lastTimeEntry.planHours;
- lastTimeEntryOfTasks = from("TimeEntry").where("workEffortId", lastTimeEntry.workEffortId, "partyId", partyId).orderBy("-fromDate").queryList();
- if (lastTimeEntryOfTasks.size() != 0) lastTimeEntry = lastTimeEntryOfTasks[0];
+ estimatedHour = estimatedMilliSeconds/3600000
+ entry.plannedHours = estimatedHour
+ //entry.plannedHours = pHours
+ planHours = 0.0
+ planHours = lastTimeEntry.planHours
+ lastTimeEntryOfTasks = from("TimeEntry").where("workEffortId", lastTimeEntry.workEffortId, "partyId", partyId).orderBy("-fromDate").queryList()
+ if (lastTimeEntryOfTasks.size() != 0) lastTimeEntry = lastTimeEntryOfTasks[0]
if (planHours < 1) {
- planHours = estimatedHour;
+ planHours = estimatedHour
}
- entry.planHours = lastTimeEntry.planHours;
- actualHours = entryWorkEffort.getRelated("TimeEntry", null, null, false);
- aHours = 0.00;
+ entry.planHours = lastTimeEntry.planHours
+ actualHours = entryWorkEffort.getRelated("TimeEntry", null, null, false)
+ aHours = 0.00
actualHours.each { actualHour ->
if (actualHour.hours) {
- aHours += actualHour.hours;
+ aHours += actualHour.hours
}
}
- entry.actualHours = aHours;
+ entry.actualHours = aHours
// get party assignment data to be able to set the task to complete
- workEffortPartyAssigns = EntityUtil.filterByDate(entryWorkEffort.getRelated("WorkEffortPartyAssignment", ["partyId" : partyId], null, false));
+ workEffortPartyAssigns = EntityUtil.filterByDate(entryWorkEffort.getRelated("WorkEffortPartyAssignment", ["partyId" : partyId], null, false))
if (workEffortPartyAssigns) {
- workEffortPartyAssign = workEffortPartyAssigns[0];
- entry.fromDate = workEffortPartyAssign.getTimestamp("fromDate");
- entry.roleTypeId = workEffortPartyAssign.roleTypeId;
+ workEffortPartyAssign = workEffortPartyAssigns[0]
+ entry.fromDate = workEffortPartyAssign.getTimestamp("fromDate")
+ entry.roleTypeId = workEffortPartyAssign.roleTypeId
if ("SCAS_COMPLETED".equals(workEffortPartyAssign.statusId)) {
- entry.checkComplete = "Y";
+ entry.checkComplete = "Y"
}
} else {
if ("STS_COMPLETED".equals(entryWorkEffort.currentStatusId)) {
- entry.checkComplete = "Y";
+ entry.checkComplete = "Y"
}
}
// get project/phase information
- entry.workEffortId = entryWorkEffort.workEffortId;
- entry.workEffortName = entryWorkEffort.workEffortName;
- result = runService('getProjectInfoFromTask', ["userLogin" : parameters.userLogin,"taskId" : entryWorkEffort.workEffortId]);
- entry.phaseId = result.phaseId;
- entry.phaseName = result.phaseName;
- entry.projectId = result.projectId;
- entry.projectName = result.projectName;
- entry.taskWbsId = result.taskWbsId;
+ entry.workEffortId = entryWorkEffort.workEffortId
+ entry.workEffortName = entryWorkEffort.workEffortName
+ result = runService('getProjectInfoFromTask', ["userLogin" : parameters.userLogin,"taskId" : entryWorkEffort.workEffortId])
+ entry.phaseId = result.phaseId
+ entry.phaseName = result.phaseName
+ entry.projectId = result.projectId
+ entry.projectName = result.projectName
+ entry.taskWbsId = result.taskWbsId
}
- entry.acualTotal = taskTotal;
- entry.planTotal = planTotal;
+ entry.acualTotal = taskTotal
+ entry.planTotal = planTotal
//Drop Down Lists
if (entry.checkComplete != "Y") {
if (aHours > 0.00)
- entries.add(entry);
+ entries.add(entry)
} else {
- entries.add(entry);
+ entries.add(entry)
}
// start new entry
- taskTotal = 0.00;
- planTotal = 0.00;
- entry = ["timesheetId" : timesheet.timesheetId];
+ taskTotal = 0.00
+ planTotal = 0.00
+ entry = ["timesheetId" : timesheet.timesheetId]
}
-timeEntries = timesheet.getRelated("TimeEntry", null, ["workEffortId", "rateTypeId", "fromDate"], false);
-te = timeEntries.iterator();
+timeEntries = timesheet.getRelated("TimeEntry", null, ["workEffortId", "rateTypeId", "fromDate"], false)
+te = timeEntries.iterator()
while (te.hasNext()) {
// only fill lastTimeEntry when not the first time
if (timeEntry!=void) {
- lastTimeEntry = timeEntry;
+ lastTimeEntry = timeEntry
}
- timeEntry = te.next();
+ timeEntry = te.next()
if (lastTimeEntry &&
(!lastTimeEntry.workEffortId.equals(timeEntry.workEffortId) ||
!lastTimeEntry.rateTypeId.equals(timeEntry.rateTypeId))) {
- retrieveWorkEffortData();
+ retrieveWorkEffortData()
}
if (timeEntry.hours) {
- dayNumber = "d" + (timeEntry.fromDate.getTime() - timesheet.fromDate.getTime()) / (24*60*60*1000);
- hours = timeEntry.hours.doubleValue();
- entry.put(String.valueOf(dayNumber), hours);
- if (dayNumber.equals("d0")) day0Total += hours;
- if (dayNumber.equals("d1")) day1Total += hours;
- if (dayNumber.equals("d2")) day2Total += hours;
- if (dayNumber.equals("d3")) day3Total += hours;
- if (dayNumber.equals("d4")) day4Total += hours;
- if (dayNumber.equals("d5")) day5Total += hours;
- if (dayNumber.equals("d6")) day6Total += hours;
- taskTotal += hours;
+ dayNumber = "d" + (timeEntry.fromDate.getTime() - timesheet.fromDate.getTime()) / (24*60*60*1000)
+ hours = timeEntry.hours.doubleValue()
+ entry.put(String.valueOf(dayNumber), hours)
+ if (dayNumber.equals("d0")) day0Total += hours
+ if (dayNumber.equals("d1")) day1Total += hours
+ if (dayNumber.equals("d2")) day2Total += hours
+ if (dayNumber.equals("d3")) day3Total += hours
+ if (dayNumber.equals("d4")) day4Total += hours
+ if (dayNumber.equals("d5")) day5Total += hours
+ if (dayNumber.equals("d6")) day6Total += hours
+ taskTotal += hours
}
if (timeEntry.planHours) {
- dayNumber = "pd" + (timeEntry.fromDate.getTime() - timesheet.fromDate.getTime()) / (24*60*60*1000);
- planHours = timeEntry.planHours.doubleValue();
- entry.put(String.valueOf(dayNumber), planHours);
- if (dayNumber.equals("pd0")) pDay0Total += planHours;
- if (dayNumber.equals("pd1")) pDay1Total += planHours;
- if (dayNumber.equals("pd2")) pDay2Total += planHours;
- if (dayNumber.equals("pd3")) pDay3Total += planHours;
- if (dayNumber.equals("pd4")) pDay4Total += planHours;
- if (dayNumber.equals("pd5")) pDay5Total += planHours;
- if (dayNumber.equals("pd6")) pDay6Total += planHours;
- planTotal += planHours;
+ dayNumber = "pd" + (timeEntry.fromDate.getTime() - timesheet.fromDate.getTime()) / (24*60*60*1000)
+ planHours = timeEntry.planHours.doubleValue()
+ entry.put(String.valueOf(dayNumber), planHours)
+ if (dayNumber.equals("pd0")) pDay0Total += planHours
+ if (dayNumber.equals("pd1")) pDay1Total += planHours
+ if (dayNumber.equals("pd2")) pDay2Total += planHours
+ if (dayNumber.equals("pd3")) pDay3Total += planHours
+ if (dayNumber.equals("pd4")) pDay4Total += planHours
+ if (dayNumber.equals("pd5")) pDay5Total += planHours
+ if (dayNumber.equals("pd6")) pDay6Total += planHours
+ planTotal += planHours
}
- entry.rateTypeId = timeEntry.rateTypeId;
+ entry.rateTypeId = timeEntry.rateTypeId
}
//retrieve Empl Leave data.
void retrieveEmplLeaveData() {
if (lastEmplLeaveEntry) {
//service get Hours
result = runService('getPartyLeaveHoursForDate',
- ["userLogin": parameters.userLogin, "partyId": lastEmplLeaveEntry.partyId, "leaveTypeId": lastEmplLeaveEntry.leaveTypeId, "fromDate": lastEmplLeaveEntry.fromDate]);
+ ["userLogin": parameters.userLogin, "partyId": lastEmplLeaveEntry.partyId, "leaveTypeId": lastEmplLeaveEntry.leaveTypeId, "fromDate": lastEmplLeaveEntry.fromDate])
if (result.hours) {
- leaveEntry.plannedHours = result.hours;
- leaveEntry.planHours = result.hours;
+ leaveEntry.plannedHours = result.hours
+ leaveEntry.planHours = result.hours
}
if (lastEmplLeaveEntry.leaveStatus == "LEAVE_APPROVED") {
- leaveEntry.checkComplete = "Y";
+ leaveEntry.checkComplete = "Y"
}
- leaveEntry.partyId = lastEmplLeaveEntry.partyId;
- leaveEntry.leaveTypeId = lastEmplLeaveEntry.leaveTypeId;
- leaveEntry.leavefromDate = lastEmplLeaveEntry.fromDate;
- leaveEntry.leavethruDate = lastEmplLeaveEntry.thruDate;
- leaveEntry.description = lastEmplLeaveEntry.description;
+ leaveEntry.partyId = lastEmplLeaveEntry.partyId
+ leaveEntry.leaveTypeId = lastEmplLeaveEntry.leaveTypeId
+ leaveEntry.leavefromDate = lastEmplLeaveEntry.fromDate
+ leaveEntry.leavethruDate = lastEmplLeaveEntry.thruDate
+ leaveEntry.description = lastEmplLeaveEntry.description
}
- leaveEntry.acualTotal = leaveTaskTotal;
- leaveEntry.planHours = leavePlanTotal;
- leaveEntry.actualHours = leaveTaskTotal;
+ leaveEntry.acualTotal = leaveTaskTotal
+ leaveEntry.planHours = leavePlanTotal
+ leaveEntry.actualHours = leaveTaskTotal
//Drop Down Lists
- entries.add(leaveEntry);
+ entries.add(leaveEntry)
// start new leaveEntry
- leaveTaskTotal = 0.00;
- leavePlanTotal = 0.00;
- leaveEntry = ["timesheetId" : timesheet.timesheetId];
+ leaveTaskTotal = 0.00
+ leavePlanTotal = 0.00
+ leaveEntry = ["timesheetId" : timesheet.timesheetId]
}
// define condition
-leaveExprs = [];
-leaveExprs.add(EntityCondition.makeCondition("fromDate", EntityOperator.GREATER_THAN_EQUAL_TO, timesheet.fromDate));
-leaveExprs.add(EntityCondition.makeCondition("fromDate", EntityOperator.LESS_THAN_EQUAL_TO, timesheet.thruDate));
-leaveExprs.add(EntityCondition.makeCondition("partyId", EntityOperator.EQUALS, partyId));
-emplLeave = from("EmplLeave").where(leaveExprs).cursorScrollInsensitive().distinct().queryIterator();
+leaveExprs = []
+leaveExprs.add(EntityCondition.makeCondition("fromDate", EntityOperator.GREATER_THAN_EQUAL_TO, timesheet.fromDate))
+leaveExprs.add(EntityCondition.makeCondition("fromDate", EntityOperator.LESS_THAN_EQUAL_TO, timesheet.thruDate))
+leaveExprs.add(EntityCondition.makeCondition("partyId", EntityOperator.EQUALS, partyId))
+emplLeave = from("EmplLeave").where(leaveExprs).cursorScrollInsensitive().distinct().queryIterator()
while ((emplLeaveMap = emplLeave.next())) {
if (emplLeaveEntry!=void) {
- lastEmplLeaveEntry = emplLeaveEntry;
+ lastEmplLeaveEntry = emplLeaveEntry
}
- emplLeaveEntry = emplLeaveMap;
+ emplLeaveEntry = emplLeaveMap
if (lastEmplLeaveEntry && (
!lastEmplLeaveEntry.leaveTypeId.equals(emplLeaveEntry.leaveTypeId) ||
!lastEmplLeaveEntry.partyId.equals(emplLeaveEntry.partyId))) {
- retrieveEmplLeaveData();
+ retrieveEmplLeaveData()
}
resultHours = runService('getPartyLeaveHoursForDate',
- ["userLogin": parameters.userLogin, "partyId": emplLeaveEntry.partyId, "leaveTypeId": emplLeaveEntry.leaveTypeId, "fromDate": emplLeaveEntry.fromDate]);
+ ["userLogin": parameters.userLogin, "partyId": emplLeaveEntry.partyId, "leaveTypeId": emplLeaveEntry.leaveTypeId, "fromDate": emplLeaveEntry.fromDate])
if (resultHours.hours) {
- leaveDayNumber = "d" + (emplLeaveEntry.fromDate.getTime() - timesheet.fromDate.getTime()) / (24*60*60*1000);
+ leaveDayNumber = "d" + (emplLeaveEntry.fromDate.getTime() - timesheet.fromDate.getTime()) / (24*60*60*1000)
resultHours = runService('getPartyLeaveHoursForDate',
- ["userLogin": parameters.userLogin, "partyId": emplLeaveEntry.partyId, "leaveTypeId": emplLeaveEntry.leaveTypeId, "fromDate": emplLeaveEntry.fromDate]);
- leaveHours = resultHours.hours.doubleValue();
- leaveEntry.put(String.valueOf(leaveDayNumber), leaveHours);
- if (leaveDayNumber.equals("d0")) day0Total += leaveHours;
- if (leaveDayNumber.equals("d1")) day1Total += leaveHours;
- if (leaveDayNumber.equals("d2")) day2Total += leaveHours;
- if (leaveDayNumber.equals("d3")) day3Total += leaveHours;
- if (leaveDayNumber.equals("d4")) day4Total += leaveHours;
- if (leaveDayNumber.equals("d5")) day5Total += leaveHours;
- if (leaveDayNumber.equals("d6")) day6Total += leaveHours;
- leaveTaskTotal += leaveHours;
+ ["userLogin": parameters.userLogin, "partyId": emplLeaveEntry.partyId, "leaveTypeId": emplLeaveEntry.leaveTypeId, "fromDate": emplLeaveEntry.fromDate])
+ leaveHours = resultHours.hours.doubleValue()
+ leaveEntry.put(String.valueOf(leaveDayNumber), leaveHours)
+ if (leaveDayNumber.equals("d0")) day0Total += leaveHours
+ if (leaveDayNumber.equals("d1")) day1Total += leaveHours
+ if (leaveDayNumber.equals("d2")) day2Total += leaveHours
+ if (leaveDayNumber.equals("d3")) day3Total += leaveHours
+ if (leaveDayNumber.equals("d4")) day4Total += leaveHours
+ if (leaveDayNumber.equals("d5")) day5Total += leaveHours
+ if (leaveDayNumber.equals("d6")) day6Total += leaveHours
+ leaveTaskTotal += leaveHours
}
if (resultHours.hours) {
- leavePlanDay = "pd" + (emplLeaveEntry.fromDate.getTime() - timesheet.fromDate.getTime()) / (24*60*60*1000);
+ leavePlanDay = "pd" + (emplLeaveEntry.fromDate.getTime() - timesheet.fromDate.getTime()) / (24*60*60*1000)
resultPlanHours = runService('getPartyLeaveHoursForDate',
- ["userLogin": parameters.userLogin, "partyId": emplLeaveEntry.partyId, "leaveTypeId": emplLeaveEntry.leaveTypeId, "fromDate": emplLeaveEntry.fromDate]);
- leavePlanHours = resultPlanHours.hours.doubleValue();
- leaveEntry.put(String.valueOf(leavePlanDay), leavePlanHours);
- if (leavePlanDay.equals("pd0")) pDay0Total += leavePlanHours;
- if (leavePlanDay.equals("pd1")) pDay1Total += leavePlanHours;
- if (leavePlanDay.equals("pd2")) pDay2Total += leavePlanHours;
- if (leavePlanDay.equals("pd3")) pDay3Total += leavePlanHours;
- if (leavePlanDay.equals("pd4")) pDay4Total += leavePlanHours;
- if (leavePlanDay.equals("pd5")) pDay5Total += leavePlanHours;
- if (leavePlanDay.equals("pd6")) pDay6Total += leavePlanHours;
- leavePlanTotal += leavePlanHours;
+ ["userLogin": parameters.userLogin, "partyId": emplLeaveEntry.partyId, "leaveTypeId": emplLeaveEntry.leaveTypeId, "fromDate": emplLeaveEntry.fromDate])
+ leavePlanHours = resultPlanHours.hours.doubleValue()
+ leaveEntry.put(String.valueOf(leavePlanDay), leavePlanHours)
+ if (leavePlanDay.equals("pd0")) pDay0Total += leavePlanHours
+ if (leavePlanDay.equals("pd1")) pDay1Total += leavePlanHours
+ if (leavePlanDay.equals("pd2")) pDay2Total += leavePlanHours
+ if (leavePlanDay.equals("pd3")) pDay3Total += leavePlanHours
+ if (leavePlanDay.equals("pd4")) pDay4Total += leavePlanHours
+ if (leavePlanDay.equals("pd5")) pDay5Total += leavePlanHours
+ if (leavePlanDay.equals("pd6")) pDay6Total += leavePlanHours
+ leavePlanTotal += leavePlanHours
}
- leaveEntry.rateTypeId = "STANDARD";
+ leaveEntry.rateTypeId = "STANDARD"
}
-emplLeave.close();
+emplLeave.close()
if (timeEntry) {
- lastTimeEntry = timeEntry;
- retrieveWorkEffortData();
+ lastTimeEntry = timeEntry
+ retrieveWorkEffortData()
}
if (emplLeaveEntry) {
- lastEmplLeaveEntry = emplLeaveEntry;
- retrieveEmplLeaveData();
+ lastEmplLeaveEntry = emplLeaveEntry
+ retrieveEmplLeaveData()
}
// add empty lines if timesheet not completed
if (!timesheet.statusId.equals("TIMESHEET_COMPLETED")) {
for (c=0; c < 3; c++) { // add empty lines
- entries.add(["timesheetId" : timesheet.timesheetId]);
+ entries.add(["timesheetId" : timesheet.timesheetId])
}
}
// add the totals line if at least one entry
if (timeEntry || emplLeaveEntry) {
- entry = ["timesheetId" : timesheet.timesheetId];
- entry.d0 = day0Total;
- entry.d1 = day1Total;
- entry.d2 = day2Total;
- entry.d3 = day3Total;
- entry.d4 = day4Total;
- entry.d5 = day5Total;
- entry.d6 = day6Total;
- entry.pd0 = pDay0Total;
- entry.pd1 = pDay1Total;
- entry.pd2 = pDay2Total;
- entry.pd3 = pDay3Total;
- entry.pd4 = pDay4Total;
- entry.pd5 = pDay5Total;
- entry.pd6 = pDay6Total;
- entry.phaseName = uiLabelMap.ScrumTotals;
- entry.workEffortId = "Totals";
- entry.total = day0Total + day1Total + day2Total + day3Total + day4Total + day5Total + day6Total;
- entries.add(entry);
+ entry = ["timesheetId" : timesheet.timesheetId]
+ entry.d0 = day0Total
+ entry.d1 = day1Total
+ entry.d2 = day2Total
+ entry.d3 = day3Total
+ entry.d4 = day4Total
+ entry.d5 = day5Total
+ entry.d6 = day6Total
+ entry.pd0 = pDay0Total
+ entry.pd1 = pDay1Total
+ entry.pd2 = pDay2Total
+ entry.pd3 = pDay3Total
+ entry.pd4 = pDay4Total
+ entry.pd5 = pDay5Total
+ entry.pd6 = pDay6Total
+ entry.phaseName = uiLabelMap.ScrumTotals
+ entry.workEffortId = "Totals"
+ entry.total = day0Total + day1Total + day2Total + day3Total + day4Total + day5Total + day6Total
+ entries.add(entry)
}
-context.timeEntries = entries;
+context.timeEntries = entries
// get all timesheets of this user, including the planned hours
-timesheetsDb = from("Timesheet").where("partyId", partyId).orderBy("fromDate DESC").queryList();
-timesheets = new LinkedList();
+timesheetsDb = from("Timesheet").where("partyId", partyId).orderBy("fromDate DESC").queryList()
+timesheets = new LinkedList()
timesheetsDb.each { timesheetDb ->
- //get hours from EmplLeave;
- findOpts = new EntityFindOptions(true, EntityFindOptions.TYPE_SCROLL_INSENSITIVE, EntityFindOptions.CONCUR_READ_ONLY, true);
- leaveExprsList = [];
- leaveExprsList.add(EntityCondition.makeCondition("fromDate", EntityOperator.GREATER_THAN_EQUAL_TO, timesheetDb.fromDate));
- leaveExprsList.add(EntityCondition.makeCondition("fromDate", EntityOperator.LESS_THAN_EQUAL_TO, timesheetDb.thruDate));
- leaveExprsList.add(EntityCondition.makeCondition("partyId", EntityOperator.EQUALS, partyId));
- emplLeaveList = from("EmplLeave").where(leaveExprsList).cursorScrollInsensitive().distinct().queryIterator();
- leaveHours = 0.00;
+ //get hours from EmplLeave
+ findOpts = new EntityFindOptions(true, EntityFindOptions.TYPE_SCROLL_INSENSITIVE, EntityFindOptions.CONCUR_READ_ONLY, true)
+ leaveExprsList = []
+ leaveExprsList.add(EntityCondition.makeCondition("fromDate", EntityOperator.GREATER_THAN_EQUAL_TO, timesheetDb.fromDate))
+ leaveExprsList.add(EntityCondition.makeCondition("fromDate", EntityOperator.LESS_THAN_EQUAL_TO, timesheetDb.thruDate))
+ leaveExprsList.add(EntityCondition.makeCondition("partyId", EntityOperator.EQUALS, partyId))
+ emplLeaveList = from("EmplLeave").where(leaveExprsList).cursorScrollInsensitive().distinct().queryIterator()
+ leaveHours = 0.00
while ((emplLeaveMap = emplLeaveList.next())) {
- emplLeaveEntry = emplLeaveMap;
+ emplLeaveEntry = emplLeaveMap
resultHour = runService('getPartyLeaveHoursForDate',
- ["userLogin": parameters.userLogin, "partyId": emplLeaveEntry.partyId, "leaveTypeId": emplLeaveEntry.leaveTypeId, "fromDate": emplLeaveEntry.fromDate]);
+ ["userLogin": parameters.userLogin, "partyId": emplLeaveEntry.partyId, "leaveTypeId": emplLeaveEntry.leaveTypeId, "fromDate": emplLeaveEntry.fromDate])
if (resultHour) {
- leaveActualHours = resultHour.hours.doubleValue();
- leaveHours += leaveActualHours;
+ leaveActualHours = resultHour.hours.doubleValue()
+ leaveHours += leaveActualHours
}
}
- //get hours from TimeEntry;
- timesheet = [:];
- timesheet.putAll(timesheetDb);
- entries = timesheetDb.getRelated("TimeEntry", null, null, false);
- hours = 0.00;
+ //get hours from TimeEntry
+ timesheet = [:]
+ timesheet.putAll(timesheetDb)
+ entries = timesheetDb.getRelated("TimeEntry", null, null, false)
+ hours = 0.00
entries.each { timeEntry ->
if (timeEntry.hours) {
- hours += timeEntry.hours.doubleValue();
+ hours += timeEntry.hours.doubleValue()
}
}
- timesheet.weekNumber = UtilDateTime.weekNumber(timesheetDb.fromDate);
- timesheet.hours = hours + leaveHours;
- timesheets.add(timesheet);
- emplLeaveList.close();
+ timesheet.weekNumber = UtilDateTime.weekNumber(timesheetDb.fromDate)
+ timesheet.hours = hours + leaveHours
+ timesheets.add(timesheet)
+ emplLeaveList.close()
}
-context.timesheets = timesheets;
+context.timesheets = timesheets
// get existing task that no assign
-taskList=[];
-projectSprintBacklogAndTaskList = [];
-backlogIndexList = [];
-projectAndTaskList = from("ProjectSprintBacklogAndTask").where("sprintTypeId" : "SCRUM_SPRINT","taskCurrentStatusId" : "STS_CREATED").orderBy("projectName ASC","taskActualStartDate DESC").queryList();
+taskList=[]
+projectSprintBacklogAndTaskList = []
+backlogIndexList = []
+projectAndTaskList = from("ProjectSprintBacklogAndTask").where("sprintTypeId" : "SCRUM_SPRINT","taskCurrentStatusId" : "STS_CREATED").orderBy("projectName ASC","taskActualStartDate DESC").queryList()
projectAndTaskList.each { projectAndTaskMap ->
-userLoginId = userLogin.partyId;
- sprintId = projectAndTaskMap.sprintId;
- workEffortList = from("WorkEffortAndProduct").where("workEffortId", projectAndTaskMap.projectId).queryList();
- backlogIndexList.add(workEffortList[0].productId);
+userLoginId = userLogin.partyId
+ sprintId = projectAndTaskMap.sprintId
+ workEffortList = from("WorkEffortAndProduct").where("workEffortId", projectAndTaskMap.projectId).queryList()
+ backlogIndexList.add(workEffortList[0].productId)
- partyAssignmentSprintList = from("WorkEffortPartyAssignment").where("workEffortId", sprintId, "partyId", userLoginId).queryList();
- partyAssignmentSprintMap = partyAssignmentSprintList[0];
+ partyAssignmentSprintList = from("WorkEffortPartyAssignment").where("workEffortId", sprintId, "partyId", userLoginId).queryList()
+ partyAssignmentSprintMap = partyAssignmentSprintList[0]
// if this userLoginId is a member of sprint
if (partyAssignmentSprintMap) {
- workEffortId = projectAndTaskMap.taskId;
- partyAssignmentTaskList = from("WorkEffortPartyAssignment").where("workEffortId", workEffortId).queryList();
- partyAssignmentTaskMap = partyAssignmentTaskList[0];
+ workEffortId = projectAndTaskMap.taskId
+ partyAssignmentTaskList = from("WorkEffortPartyAssignment").where("workEffortId", workEffortId).queryList()
+ partyAssignmentTaskMap = partyAssignmentTaskList[0]
// if the task do not assigned
if (partyAssignmentTaskMap) {
- custRequestTypeId = projectAndTaskMap.custRequestTypeId;
- backlogStatusId = projectAndTaskMap.backlogStatusId;
+ custRequestTypeId = projectAndTaskMap.custRequestTypeId
+ backlogStatusId = projectAndTaskMap.backlogStatusId
if (custRequestTypeId.equals("RF_SCRUM_MEETINGS") && backlogStatusId.equals("CRQ_REVIEWED")) {
- projectSprintBacklogAndTaskList.add(projectAndTaskMap);
+ projectSprintBacklogAndTaskList.add(projectAndTaskMap)
}
} else {
- projectSprintBacklogAndTaskList.add(0,projectAndTaskMap);
+ projectSprintBacklogAndTaskList.add(0,projectAndTaskMap)
}
}
}
// for unplanned taks.
-unplanList=[];
+unplanList=[]
if (backlogIndexList) {
- backlogIndex = new HashSet(backlogIndexList);
- custRequestList = from("CustRequest").where("custRequestTypeId", "RF_UNPLAN_BACKLOG","statusId", "CRQ_REVIEWED").orderBy("custRequestDate DESC").queryList();
+ backlogIndex = new HashSet(backlogIndexList)
+ custRequestList = from("CustRequest").where("custRequestTypeId", "RF_UNPLAN_BACKLOG","statusId", "CRQ_REVIEWED").orderBy("custRequestDate DESC").queryList()
if (custRequestList) {
custRequestList.each { custRequestMap ->
- custRequestItemList = custRequestMap.getRelated("CustRequestItem", null, null, false);
+ custRequestItemList = custRequestMap.getRelated("CustRequestItem", null, null, false)
custRequestItem =
- productOut = custRequestItemList[0].productId;
- product = from("Product").where("productId", productOut).queryOne();
+ productOut = custRequestItemList[0].productId
+ product = from("Product").where("productId", productOut).queryOne()
backlogIndex.each { backlogProduct ->
productId = backlogProduct
if (productId.equals(productOut)) {
- custRequestWorkEffortList = from("CustRequestWorkEffort").where("custRequestId", custRequestItemList[0].custRequestId).queryList();
+ custRequestWorkEffortList = from("CustRequestWorkEffort").where("custRequestId", custRequestItemList[0].custRequestId).queryList()
custRequestWorkEffortList.each { custRequestWorkEffortMap ->
- partyAssignmentTaskList = from("WorkEffortPartyAssignment").where("workEffortId", custRequestWorkEffortMap.workEffortId).queryList();
- partyAssignmentTaskMap = partyAssignmentTaskList[0];
+ partyAssignmentTaskList = from("WorkEffortPartyAssignment").where("workEffortId", custRequestWorkEffortMap.workEffortId).queryList()
+ partyAssignmentTaskMap = partyAssignmentTaskList[0]
// if the task do not assigned
if (!partyAssignmentTaskMap) {
- result = [:];
- workEffortMap = from("WorkEffort").where("workEffortId", custRequestWorkEffortMap.workEffortId).queryOne();
- result.description = custRequestMap.description;
- result.productName = product.internalName;
- result.taskId = workEffortMap.workEffortId;
- result.taskName = workEffortMap.workEffortName;
- result.custRequestTypeId = custRequestMap.custRequestTypeId;
- result.taskTypeId = workEffortMap.workEffortTypeId;
- unplanList.add(result);
+ result = [:]
+ workEffortMap = from("WorkEffort").where("workEffortId", custRequestWorkEffortMap.workEffortId).queryOne()
+ result.description = custRequestMap.description
+ result.productName = product.internalName
+ result.taskId = workEffortMap.workEffortId
+ result.taskName = workEffortMap.workEffortName
+ result.custRequestTypeId = custRequestMap.custRequestTypeId
+ result.taskTypeId = workEffortMap.workEffortTypeId
+ unplanList.add(result)
}
}
}
@@ -438,26 +438,26 @@ if (backlogIndexList) {
}
}
}
-projectSprintBacklogAndTaskList = UtilMisc.sortMaps(projectSprintBacklogAndTaskList, ["projectName","sprintName","-taskTypeId","custRequestId"]);
+projectSprintBacklogAndTaskList = UtilMisc.sortMaps(projectSprintBacklogAndTaskList, ["projectName","sprintName","-taskTypeId","custRequestId"])
projectSprintBacklogAndTaskList.each { projectSprintBacklogAndTaskMap ->
- blTypeId = projectSprintBacklogAndTaskMap.custRequestTypeId;
+ blTypeId = projectSprintBacklogAndTaskMap.custRequestTypeId
if (blTypeId == "RF_SCRUM_MEETINGS"){
- taskList.add(projectSprintBacklogAndTaskMap);
+ taskList.add(projectSprintBacklogAndTaskMap)
}
}
-projectSprintBacklogAndTaskList = UtilMisc.sortMaps(projectSprintBacklogAndTaskList, ["-projectName","sprintName","-taskTypeId","custRequestId"]);
+projectSprintBacklogAndTaskList = UtilMisc.sortMaps(projectSprintBacklogAndTaskList, ["-projectName","sprintName","-taskTypeId","custRequestId"])
projectSprintBacklogAndTaskList.each { projectSprintBacklogAndTaskMap ->
- blTypeId = projectSprintBacklogAndTaskMap.custRequestTypeId;
+ blTypeId = projectSprintBacklogAndTaskMap.custRequestTypeId
if (blTypeId == "RF_PROD_BACKLOG"){
- taskList.add(0,projectSprintBacklogAndTaskMap);
+ taskList.add(0,projectSprintBacklogAndTaskMap)
}
}
-unplanList = UtilMisc.sortMaps(unplanList,["-productName","-taskTypeId","custRequestId"]);
+unplanList = UtilMisc.sortMaps(unplanList,["-productName","-taskTypeId","custRequestId"])
unplanList.each { unplanMap->
- taskList.add(0,unplanMap);
+ taskList.add(0,unplanMap)
}
-context.taskList = taskList;
+context.taskList = taskList
// notification context
-webSiteId = WebSiteWorker.getWebSiteId(request);
-context.webSiteId = webSiteId;
+webSiteId = WebSiteWorker.getWebSiteId(request)
+context.webSiteId = webSiteId
diff --git a/specialpurpose/scrum/groovyScripts/EditWeekTimesheet.groovy b/specialpurpose/scrum/groovyScripts/EditWeekTimesheet.groovy
index a7bd1c2c80..fa5d7b718c 100644
--- a/specialpurpose/scrum/groovyScripts/EditWeekTimesheet.groovy
+++ b/specialpurpose/scrum/groovyScripts/EditWeekTimesheet.groovy
@@ -17,192 +17,192 @@
* under the License.
*/
-import java.util.*;
-import java.lang.*;
-import org.apache.ofbiz.base.util.*;
-import org.apache.ofbiz.entity.*;
-import org.apache.ofbiz.base.util.UtilMisc;
-import org.apache.ofbiz.base.util.UtilValidate;
-import org.apache.ofbiz.base.util.UtilDateTime;
-import org.apache.ofbiz.entity.util.*;
-import org.apache.ofbiz.entity.condition.*;
-import java.sql.Timestamp;
+import java.util.*
+import java.lang.*
+import org.apache.ofbiz.base.util.*
+import org.apache.ofbiz.entity.*
+import org.apache.ofbiz.base.util.UtilMisc
+import org.apache.ofbiz.base.util.UtilValidate
+import org.apache.ofbiz.base.util.UtilDateTime
+import org.apache.ofbiz.entity.util.*
+import org.apache.ofbiz.entity.condition.*
+import java.sql.Timestamp
-uiLabelMap = UtilProperties.getResourceBundleMap("scrumUiLabels", locale);
+uiLabelMap = UtilProperties.getResourceBundleMap("scrumUiLabels", locale)
-partyId = parameters.partyId;
+partyId = parameters.partyId
if (!partyId) {
- partyId = parameters.userLogin.partyId;
+ partyId = parameters.userLogin.partyId
}
// show the requested timesheet, otherwise the current , if not exist create
-timesheet = null;
-timesheetId = parameters.timesheetId;
+timesheet = null
+timesheetId = parameters.timesheetId
if (timesheetId) {
- timesheet = from("Timesheet").where("timesheetId", timesheetId).queryOne();
- partyId = timesheet.partyId; // use the party from this timesheet
+ timesheet = from("Timesheet").where("timesheetId", timesheetId).queryOne()
+ partyId = timesheet.partyId // use the party from this timesheet
} else {
// make sure because of timezone changes, not a duplicate timesheet is created
- midweek = UtilDateTime.addDaysToTimestamp(UtilDateTime.getWeekStart(UtilDateTime.nowTimestamp()),3);
+ midweek = UtilDateTime.addDaysToTimestamp(UtilDateTime.getWeekStart(UtilDateTime.nowTimestamp()),3)
entryExprs = EntityCondition.makeCondition([
EntityCondition.makeCondition("fromDate", EntityComparisonOperator.LESS_THAN, midweek),
EntityCondition.makeCondition("thruDate", EntityComparisonOperator.GREATER_THAN, midweek),
EntityCondition.makeCondition("partyId", EntityComparisonOperator.EQUALS, partyId)
- ], EntityOperator.AND);
- entryIterator = from("Timesheet").where(entryExprs).queryIterator();
- timesheet = entryIterator.next();
- entryIterator.close();
+ ], EntityOperator.AND)
+ entryIterator = from("Timesheet").where(entryExprs).queryIterator()
+ timesheet = entryIterator.next()
+ entryIterator.close()
if (timesheet == null) {
- result = runService('createProjectTimesheet', ["userLogin" : parameters.userLogin, "partyId" : partyId]);
+ result = runService('createProjectTimesheet', ["userLogin" : parameters.userLogin, "partyId" : partyId])
if (result && result.timesheetId) {
- timesheet = from("Timesheet").where("timesheetId", result.timesheetId).queryOne();
+ timesheet = from("Timesheet").where("timesheetId", result.timesheetId).queryOne()
}
}
}
-if (!timesheet) return;
-context.timesheet = timesheet;
-context.weekNumber = UtilDateTime.weekNumber(timesheet.fromDate);
+if (!timesheet) return
+context.timesheet = timesheet
+context.weekNumber = UtilDateTime.weekNumber(timesheet.fromDate)
// get the user names
-context.partyNameView = from("PartyNameView").where("partyId", partyId).queryOne();
+context.partyNameView = from("PartyNameView").where("partyId", partyId).queryOne()
// get the default rate for this person
-rateTypes = from("PartyRate").where("partyId", partyId, "defaultRate", "Y").filterByDate().queryList();
+rateTypes = from("PartyRate").where("partyId", partyId, "defaultRate", "Y").filterByDate().queryList()
if (rateTypes) {
- context.defaultRateTypeId = rateTypes[0].rateTypeId;
+ context.defaultRateTypeId = rateTypes[0].rateTypeId
}
-entries = [];
-entry = ["timesheetId" : timesheet.timesheetId];
-taskTotal = 0.00;
-day0Total = 0.00; day1Total=0.00; day2Total=0.00; day3Total=0.00; day4Total=0.00; day5Total=0.00; day6Total=0.00;
-pHours = 0.00;
-timeEntry = null;
-lastTimeEntry = null;
+entries = []
+entry = ["timesheetId" : timesheet.timesheetId]
+taskTotal = 0.00
+day0Total = 0.00; day1Total=0.00; day2Total=0.00; day3Total=0.00; day4Total=0.00; day5Total=0.00; day6Total=0.00
+pHours = 0.00
+timeEntry = null
+lastTimeEntry = null
// retrieve work effort data when the workeffortId has changed.
void retrieveWorkEffortData() {
// get the planned number of hours
- entryWorkEffort = lastTimeEntry.getRelatedOne("WorkEffort", false);
+ entryWorkEffort = lastTimeEntry.getRelatedOne("WorkEffort", false)
if (entryWorkEffort) {
- plannedHours = entryWorkEffort.getRelated("WorkEffortSkillStandard", null, null, false);
- pHours = 0.00;
+ plannedHours = entryWorkEffort.getRelated("WorkEffortSkillStandard", null, null, false)
+ pHours = 0.00
plannedHours.each { plannedHour ->
if (plannedHour.estimatedDuration) {
- pHours += plannedHour.estimatedDuration;
+ pHours += plannedHour.estimatedDuration
}
}
- entry.plannedHours = pHours;
- actualHours = entryWorkEffort.getRelated("TimeEntry", null, null, false);
- aHours = 0.00;
+ entry.plannedHours = pHours
+ actualHours = entryWorkEffort.getRelated("TimeEntry", null, null, false)
+ aHours = 0.00
actualHours.each { actualHour ->
if (actualHour.hours) {
- aHours += actualHour.hours;
+ aHours += actualHour.hours
}
}
- entry.actualHours = aHours;
+ entry.actualHours = aHours
// get party assignment data to be able to set the task to complete
- workEffortPartyAssigns = EntityUtil.filterByDate(entryWorkEffort.getRelated("WorkEffortPartyAssignment", ["partyId" : partyId], null, false));
+ workEffortPartyAssigns = EntityUtil.filterByDate(entryWorkEffort.getRelated("WorkEffortPartyAssignment", ["partyId" : partyId], null, false))
if (workEffortPartyAssigns) {
- workEffortPartyAssign = workEffortPartyAssigns[0];
- entry.fromDate = workEffortPartyAssign.getTimestamp("fromDate");
- entry.roleTypeId = workEffortPartyAssign.roleTypeId;
+ workEffortPartyAssign = workEffortPartyAssigns[0]
+ entry.fromDate = workEffortPartyAssign.getTimestamp("fromDate")
+ entry.roleTypeId = workEffortPartyAssign.roleTypeId
if ("PAS_COMPLETED".equals(workEffortPartyAssign.statusId)) {
- entry.checkComplete = "Y";
+ entry.checkComplete = "Y"
}
}
// get project/phase information
- entry.workEffortId = entryWorkEffort.workEffortId;
- entry.workEffortName = entryWorkEffort.workEffortName;
- result = runService('getProjectIdAndNameFromTask', ["userLogin" : parameters.userLogin,"taskId" : entryWorkEffort.workEffortId]);
- entry.sprintId = result.phaseId;
- entry.sprintName = result.phaseName;
- entry.projectId = result.projectId;
- entry.projectName = result.projectName;
- entry.taskWbsId = result.taskWbsId;
+ entry.workEffortId = entryWorkEffort.workEffortId
+ entry.workEffortName = entryWorkEffort.workEffortName
+ result = runService('getProjectIdAndNameFromTask', ["userLogin" : parameters.userLogin,"taskId" : entryWorkEffort.workEffortId])
+ entry.sprintId = result.phaseId
+ entry.sprintName = result.phaseName
+ entry.projectId = result.projectId
+ entry.projectName = result.projectName
+ entry.taskWbsId = result.taskWbsId
}
- entry.total = taskTotal;
+ entry.total = taskTotal
//Drop Down Lists
- entries.add(entry);
+ entries.add(entry)
// start new entry
- taskTotal = 0.00;
- entry = ["timesheetId" : timesheet.timesheetId];
+ taskTotal = 0.00
+ entry = ["timesheetId" : timesheet.timesheetId]
}
-timeEntries = timesheet.getRelated("TimeEntry", null, ["workEffortId", "rateTypeId", "fromDate"], false);
-te = timeEntries.iterator();
+timeEntries = timesheet.getRelated("TimeEntry", null, ["workEffortId", "rateTypeId", "fromDate"], false)
+te = timeEntries.iterator()
while (te.hasNext()) {
// only fill lastTimeEntry when not the first time
if (timeEntry!=void) {
- lastTimeEntry = timeEntry;
+ lastTimeEntry = timeEntry
}
- timeEntry = te.next();
+ timeEntry = te.next()
if (lastTimeEntry &&
(!lastTimeEntry.workEffortId.equals(timeEntry.workEffortId) ||
!lastTimeEntry.rateTypeId.equals(timeEntry.rateTypeId))) {
- retrieveWorkEffortData();
+ retrieveWorkEffortData()
}
if (timeEntry.hours) {
- dayNumber = "d" + (timeEntry.fromDate.getTime() - timesheet.fromDate.getTime()) / (24*60*60*1000);
- hours = timeEntry.hours.doubleValue();
- entry.put(String.valueOf(dayNumber), hours);
- if (dayNumber.equals("d0")) day0Total += hours;
- if (dayNumber.equals("d1")) day1Total += hours;
- if (dayNumber.equals("d2")) day2Total += hours;
- if (dayNumber.equals("d3")) day3Total += hours;
- if (dayNumber.equals("d4")) day4Total += hours;
- if (dayNumber.equals("d5")) day5Total += hours;
- if (dayNumber.equals("d6")) day6Total += hours;
- taskTotal += hours;
+ dayNumber = "d" + (timeEntry.fromDate.getTime() - timesheet.fromDate.getTime()) / (24*60*60*1000)
+ hours = timeEntry.hours.doubleValue()
+ entry.put(String.valueOf(dayNumber), hours)
+ if (dayNumber.equals("d0")) day0Total += hours
+ if (dayNumber.equals("d1")) day1Total += hours
+ if (dayNumber.equals("d2")) day2Total += hours
+ if (dayNumber.equals("d3")) day3Total += hours
+ if (dayNumber.equals("d4")) day4Total += hours
+ if (dayNumber.equals("d5")) day5Total += hours
+ if (dayNumber.equals("d6")) day6Total += hours
+ taskTotal += hours
}
- entry.rateTypeId = timeEntry.rateTypeId;
+ entry.rateTypeId = timeEntry.rateTypeId
}
if (timeEntry) {
- lastTimeEntry = timeEntry;
- retrieveWorkEffortData();
+ lastTimeEntry = timeEntry
+ retrieveWorkEffortData()
}
// add empty lines if timesheet not completed
if (!timesheet.statusId.equals("TIMESHEET_COMPLETED")) {
for (c=0; c < 3; c++) { // add empty lines
- entries.add(["timesheetId" : timesheet.timesheetId]);
+ entries.add(["timesheetId" : timesheet.timesheetId])
}
}
// add the totals line if at least one entry
if (timeEntry) {
- entry = ["timesheetId" : timesheet.timesheetId];
- entry.d0 = day0Total;
- entry.d1 = day1Total;
- entry.d2 = day2Total;
- entry.d3 = day3Total;
- entry.d4 = day4Total;
- entry.d5 = day5Total;
- entry.d6 = day6Total;
- entry.phaseName = uiLabelMap.ScrumTotals;
- entry.workEffortId = "Totals";
- entry.total = day0Total + day1Total + day2Total + day3Total + day4Total + day5Total + day6Total;
- entries.add(entry);
+ entry = ["timesheetId" : timesheet.timesheetId]
+ entry.d0 = day0Total
+ entry.d1 = day1Total
+ entry.d2 = day2Total
+ entry.d3 = day3Total
+ entry.d4 = day4Total
+ entry.d5 = day5Total
+ entry.d6 = day6Total
+ entry.phaseName = uiLabelMap.ScrumTotals
+ entry.workEffortId = "Totals"
+ entry.total = day0Total + day1Total + day2Total + day3Total + day4Total + day5Total + day6Total
+ entries.add(entry)
}
-context.timeEntries = entries;
+context.timeEntries = entries
// get all timesheets of this user, including the planned hours
-timesheetsDb = from("Timesheet").where("partyId", partyId).orderBy("fromDate DESC").queryList();
-timesheets = new LinkedList();
+timesheetsDb = from("Timesheet").where("partyId", partyId).orderBy("fromDate DESC").queryList()
+timesheets = new LinkedList()
timesheetsDb.each { timesheetDb ->
- timesheet = [:];
- timesheet.putAll(timesheetDb);
- entries = timesheetDb.getRelated("TimeEntry", null, null, false);
- hours = 0.00;
+ timesheet = [:]
+ timesheet.putAll(timesheetDb)
+ entries = timesheetDb.getRelated("TimeEntry", null, null, false)
+ hours = 0.00
entries.each { timeEntry ->
if (timeEntry.hours) {
- hours += timeEntry.hours.doubleValue();
+ hours += timeEntry.hours.doubleValue()
}
}
- timesheet.weekNumber = UtilDateTime.weekNumber(timesheetDb.fromDate);
- timesheet.hours = hours;
- timesheets.add(timesheet);
+ timesheet.weekNumber = UtilDateTime.weekNumber(timesheetDb.fromDate)
+ timesheet.hours = hours
+ timesheets.add(timesheet)
}
-context.timesheets = timesheets;
+context.timesheets = timesheets
diff --git a/specialpurpose/scrum/groovyScripts/FindBacklogItem.groovy b/specialpurpose/scrum/groovyScripts/FindBacklogItem.groovy
index f6be2baa8d..39dd3cb598 100644
--- a/specialpurpose/scrum/groovyScripts/FindBacklogItem.groovy
+++ b/specialpurpose/scrum/groovyScripts/FindBacklogItem.groovy
@@ -17,71 +17,71 @@
* under the License.
*/
-import java.util.*;
-import java.lang.*;
-import org.apache.ofbiz.base.util.*;
-import org.apache.ofbiz.entity.*;
-import org.apache.ofbiz.base.util.UtilMisc;
-import org.apache.ofbiz.base.util.UtilValidate;
-import org.apache.ofbiz.base.util.UtilDateTime;
-import org.apache.ofbiz.entity.util.*;
-import org.apache.ofbiz.entity.condition.*;
-import java.sql.Timestamp;
+import java.util.*
+import java.lang.*
+import org.apache.ofbiz.base.util.*
+import org.apache.ofbiz.entity.*
+import org.apache.ofbiz.base.util.UtilMisc
+import org.apache.ofbiz.base.util.UtilValidate
+import org.apache.ofbiz.base.util.UtilDateTime
+import org.apache.ofbiz.entity.util.*
+import org.apache.ofbiz.entity.condition.*
+import java.sql.Timestamp
-productId =parameters.productId;
-custRequestList=[];
-backlogList=[];
-custRequestList = from("CustRequestItem").where("productId", productId).queryList();
+productId =parameters.productId
+custRequestList=[]
+backlogList=[]
+custRequestList = from("CustRequestItem").where("productId", productId).queryList()
custRequestList.each { custRequestListMap ->
- custRequestId=custRequestListMap.custRequestId;
- exprBldr = [];
- exprBldr.add(EntityCondition.makeCondition("statusId", EntityOperator.EQUALS, "CRQ_REOPENED"));
- exprBldr.add(EntityCondition.makeCondition("statusId", EntityOperator.EQUALS, "CRQ_REVIEWED"));
- andExprs = [];
- andExprs.add(EntityCondition.makeCondition("custRequestId", EntityOperator.EQUALS, custRequestId));
- andExprs.add(EntityCondition.makeCondition(exprBldr, EntityOperator.OR));
- custRequestTypeCond = EntityCondition.makeCondition(andExprs, EntityOperator.AND);
- orderBy = ["custRequestTypeId"];
- productBacklogList = from("CustRequest").where(andExprs).orderBy("custRequestTypeId").queryList();
+ custRequestId=custRequestListMap.custRequestId
+ exprBldr = []
+ exprBldr.add(EntityCondition.makeCondition("statusId", EntityOperator.EQUALS, "CRQ_REOPENED"))
+ exprBldr.add(EntityCondition.makeCondition("statusId", EntityOperator.EQUALS, "CRQ_REVIEWED"))
+ andExprs = []
+ andExprs.add(EntityCondition.makeCondition("custRequestId", EntityOperator.EQUALS, custRequestId))
+ andExprs.add(EntityCondition.makeCondition(exprBldr, EntityOperator.OR))
+ custRequestTypeCond = EntityCondition.makeCondition(andExprs, EntityOperator.AND)
+ orderBy = ["custRequestTypeId"]
+ productBacklogList = from("CustRequest").where(andExprs).orderBy("custRequestTypeId").queryList()
productBacklogList.each { productBacklogMap ->
- productBackId = productBacklogMap.custRequestId;
- taskBacklogList = from("CustRequestWorkEffort").where("custRequestId", productBackId).queryList();
- int countImplTask=0, countImplTaskComplete=0, countInstallTask=0, countInstallTaskComplete=0, countErrTask=0, countErrTaskComplete=0, countTestTask=0;
+ productBackId = productBacklogMap.custRequestId
+ taskBacklogList = from("CustRequestWorkEffort").where("custRequestId", productBackId).queryList()
+ int countImplTask=0, countImplTaskComplete=0, countInstallTask=0, countInstallTaskComplete=0, countErrTask=0, countErrTaskComplete=0, countTestTask=0
taskBacklogList.each { taskBacklogMap ->
- taskId = taskBacklogMap.workEffortId;
+ taskId = taskBacklogMap.workEffortId
- task = from("WorkEffort").where("workEffortId", taskId).queryOne();
+ task = from("WorkEffort").where("workEffortId", taskId).queryOne()
if (task.workEffortTypeId == "SCRUM_TASK_IMPL") {
- countImplTask+=1;
+ countImplTask+=1
if ( task.currentStatusId == "STS_COMPLETED" || task.currentStatusId == "STS_CANCELLED") {
- countImplTaskComplete+=1;
+ countImplTaskComplete+=1
}
}
else if (task.workEffortTypeId == "SCRUM_TASK_INST") {
- countInstallTask+=1;
+ countInstallTask+=1
if ( task.currentStatusId == "STS_COMPLETED" || task.currentStatusId == "STS_CANCELLED") {
- countInstallTaskComplete+=1;
+ countInstallTaskComplete+=1
}
}
else if (task.workEffortTypeId == "SCRUM_TASK_ERROR") {
- countErrTask+=1;
+ countErrTask+=1
if ( task.currentStatusId == "STS_COMPLETED" || task.currentStatusId == "STS_CANCELLED") {
- countErrTaskComplete+=1;
+ countErrTaskComplete+=1
}
}
else if (task.workEffortTypeId == "SCRUM_TASK_TEST" || task.currentStatusId == "STS_CANCELLED") {
- countTestTask+=1;
+ countTestTask+=1
}
}
if ((countImplTask > 0 || countErrTask > 0 || countInstallTask > 0) && countImplTask == countImplTaskComplete
&& countInstallTask == countInstallTaskComplete && countErrTask == countErrTaskComplete && countTestTask > 0) {
- productBacklogMap = productBacklogMap.getAllFields();
- backlogList.add(productBacklogMap);
+ productBacklogMap = productBacklogMap.getAllFields()
+ backlogList.add(productBacklogMap)
}
}
}
if (backlogList) {
backlogList = UtilMisc.sortMaps(backlogList, ["-custRequestName"])
- context.backlogList = backlogList;
+ context.backlogList = backlogList
}
diff --git a/specialpurpose/scrum/groovyScripts/FindProductBacklogItem.groovy b/specialpurpose/scrum/groovyScripts/FindProductBacklogItem.groovy
index 34da0495cb..46e126c469 100644
--- a/specialpurpose/scrum/groovyScripts/FindProductBacklogItem.groovy
+++ b/specialpurpose/scrum/groovyScripts/FindProductBacklogItem.groovy
@@ -17,122 +17,122 @@
* under the License.
*/
-import java.sql.*;
-import java.sql.Timestamp;
-import java.util.Calendar;
-import net.fortuna.ical4j.model.DateTime;
-import org.apache.ofbiz.base.util.*;
-import org.apache.ofbiz.entity.condition.*;
-import sun.util.calendar.LocalGregorianCalendar.Date;
+import java.sql.*
+import java.sql.Timestamp
+import java.util.Calendar
+import net.fortuna.ical4j.model.DateTime
+import org.apache.ofbiz.base.util.*
+import org.apache.ofbiz.entity.condition.*
+import sun.util.calendar.LocalGregorianCalendar.Date
-def module = "FindProductBacklogItem.groovy";
+def module = "FindProductBacklogItem.groovy"
// list planned and unplanned backlog
-conditionBacklogList = [];
-orConditionBacklogList = [];
-mainConditionBacklogList = [];
-orConditionsBacklog = null;
-orderBy = "custRequestDate";
+conditionBacklogList = []
+orConditionBacklogList = []
+mainConditionBacklogList = []
+orConditionsBacklog = null
+orderBy = "custRequestDate"
// Prevents the query on all records when loading the screen for the first time
if ("Y".equals(parameters.noConditionFind)) {
if(parameters.productId){
- conditionBacklogList.add(EntityCondition.makeCondition("productId", EntityOperator.EQUALS, parameters.productId));
+ conditionBacklogList.add(EntityCondition.makeCondition("productId", EntityOperator.EQUALS, parameters.productId))
}
if(parameters.custRequestTypeId){
- conditionBacklogList.add(EntityCondition.makeCondition("custRequestTypeId", EntityOperator.EQUALS, parameters.custRequestTypeId));
+ conditionBacklogList.add(EntityCondition.makeCondition("custRequestTypeId", EntityOperator.EQUALS, parameters.custRequestTypeId))
}else{
// Adding both possibilities to the condition
- orConditionBacklogList.add(EntityCondition.makeCondition("custRequestTypeId", EntityOperator.EQUALS, "RF_UNPLAN_BACKLOG"));
- orConditionBacklogList.add(EntityCondition.makeCondition("custRequestTypeId", EntityOperator.EQUALS, "RF_PROD_BACKLOG"));
- orConditionsBacklog = EntityCondition.makeCondition(orConditionBacklogList, EntityOperator.OR);
+ orConditionBacklogList.add(EntityCondition.makeCondition("custRequestTypeId", EntityOperator.EQUALS, "RF_UNPLAN_BACKLOG"))
+ orConditionBacklogList.add(EntityCondition.makeCondition("custRequestTypeId", EntityOperator.EQUALS, "RF_PROD_BACKLOG"))
+ orConditionsBacklog = EntityCondition.makeCondition(orConditionBacklogList, EntityOperator.OR)
}
if(parameters.billed){
- conditionBacklogList.add(EntityCondition.makeCondition("billed", EntityOperator.EQUALS, parameters.billed));
+ conditionBacklogList.add(EntityCondition.makeCondition("billed", EntityOperator.EQUALS, parameters.billed))
}else{
// Adding both choices to the condition
- orConditionBacklogList.add(EntityCondition.makeCondition("billed", EntityOperator.EQUALS, "Y"));
- orConditionBacklogList.add(EntityCondition.makeCondition("billed", EntityOperator.EQUALS, "N"));
- orConditionsBacklog = EntityCondition.makeCondition(orConditionBacklogList, EntityOperator.OR);
+ orConditionBacklogList.add(EntityCondition.makeCondition("billed", EntityOperator.EQUALS, "Y"))
+ orConditionBacklogList.add(EntityCondition.makeCondition("billed", EntityOperator.EQUALS, "N"))
+ orConditionsBacklog = EntityCondition.makeCondition(orConditionBacklogList, EntityOperator.OR)
}
if(parameters.statusId){
- orderBy = "custSequenceNum";
- conditionBacklogList.add(EntityCondition.makeCondition("statusId", EntityOperator.EQUALS, parameters.statusId));
+ orderBy = "custSequenceNum"
+ conditionBacklogList.add(EntityCondition.makeCondition("statusId", EntityOperator.EQUALS, parameters.statusId))
}
if(parameters.parentCustRequestId){
- conditionBacklogList.add(EntityCondition.makeCondition("parentCustRequestId", EntityOperator.EQUALS, parameters.parentCustRequestId));
+ conditionBacklogList.add(EntityCondition.makeCondition("parentCustRequestId", EntityOperator.EQUALS, parameters.parentCustRequestId))
}
if(parameters.description){
- conditionBacklogList.add(EntityCondition.makeCondition("description", EntityOperator.LIKE, "%" + parameters.description + "%"));
+ conditionBacklogList.add(EntityCondition.makeCondition("description", EntityOperator.LIKE, "%" + parameters.description + "%"))
}
if(parameters.fromPartyId){
- conditionBacklogList.add(EntityCondition.makeCondition("fromPartyId", EntityOperator.LIKE, "%" + parameters.fromPartyId + "%"));
+ conditionBacklogList.add(EntityCondition.makeCondition("fromPartyId", EntityOperator.LIKE, "%" + parameters.fromPartyId + "%"))
}
if (parameters.custRequestDate){
- fromDate = parameters.custRequestDate;
- fromDate = fromDate + " " + "00:00:00.000";
- conditionBacklogList.add(EntityCondition.makeCondition("custRequestDate", EntityOperator.GREATER_THAN_EQUAL_TO, Timestamp.valueOf(fromDate)));
- thruDate = parameters.custRequestDate;
- thruDate = thruDate + " " + "23:59:59.999";
- conditionBacklogList.add(EntityCondition.makeCondition("custRequestDate", EntityOperator.LESS_THAN_EQUAL_TO, Timestamp.valueOf(thruDate)));
+ fromDate = parameters.custRequestDate
+ fromDate = fromDate + " " + "00:00:00.000"
+ conditionBacklogList.add(EntityCondition.makeCondition("custRequestDate", EntityOperator.GREATER_THAN_EQUAL_TO, Timestamp.valueOf(fromDate)))
+ thruDate = parameters.custRequestDate
+ thruDate = thruDate + " " + "23:59:59.999"
+ conditionBacklogList.add(EntityCondition.makeCondition("custRequestDate", EntityOperator.LESS_THAN_EQUAL_TO, Timestamp.valueOf(thruDate)))
}
if(parameters.custRequestId){
- conditionBacklogList.add(EntityCondition.makeCondition("custRequestId", EntityOperator.LIKE, parameters.custRequestId + "%"));
+ conditionBacklogList.add(EntityCondition.makeCondition("custRequestId", EntityOperator.LIKE, parameters.custRequestId + "%"))
}
- conditionsBacklog = EntityCondition.makeCondition(conditionBacklogList, EntityOperator.AND);
+ conditionsBacklog = EntityCondition.makeCondition(conditionBacklogList, EntityOperator.AND)
if(UtilValidate.isNotEmpty(orConditionsBacklog)){
- mainConditionBacklogList.add(orConditionsBacklog);
+ mainConditionBacklogList.add(orConditionsBacklog)
}
- mainConditionBacklogList.add(conditionsBacklog);
+ mainConditionBacklogList.add(conditionsBacklog)
// Request
backlogList = select("custRequestId","custRequestTypeId", "custSequenceNum", "statusId", "description", "custEstimatedMilliSeconds", "custRequestName", "parentCustRequestId","productId","billed","custRequestDate","fromPartyId")
.from("CustRequestAndCustRequestItem")
.where(mainConditionBacklogList)
.orderBy("-custRequestTypeId", orderBy)
- .queryList();
+ .queryList()
- def countSequenceBacklog = 1;
- def backlogItems = [];
+ def countSequenceBacklog = 1
+ def backlogItems = []
backlogList.each() { backlogItem ->
- def tempBacklog = [:];
- tempBacklog.putAll(backlogItem);
- tempBacklog.custSequenceNum = countSequenceBacklog;
- tempBacklog.realSequenceNum = backlogItem.custSequenceNum;
+ def tempBacklog = [:]
+ tempBacklog.putAll(backlogItem)
+ tempBacklog.custSequenceNum = countSequenceBacklog
+ tempBacklog.realSequenceNum = backlogItem.custSequenceNum
// if custRequest has task then get Actual Hours
- backlogCustWorkEffortList = from("CustRequestWorkEffort").where("custRequestId", backlogItem.custRequestId).queryList();
+ backlogCustWorkEffortList = from("CustRequestWorkEffort").where("custRequestId", backlogItem.custRequestId).queryList()
if (backlogCustWorkEffortList) {
- actualHours = 0.00;
+ actualHours = 0.00
backlogCustWorkEffortList.each() { custWorkEffortMap ->
- result = runService('getScrumActualHour', ["taskId" : custWorkEffortMap.workEffortId,"partyId" : null, "userLogin" : userLogin]);
- actualHours += result.actualHours;
+ result = runService('getScrumActualHour', ["taskId" : custWorkEffortMap.workEffortId,"partyId" : null, "userLogin" : userLogin])
+ actualHours += result.actualHours
}
if(actualHours) {
- tempBacklog.actualHours = actualHours;
+ tempBacklog.actualHours = actualHours
} else {
- tempBacklog.actualHours = null;
+ tempBacklog.actualHours = null
}
} else {
- tempBacklog.actualHours = null;
+ tempBacklog.actualHours = null
}
- backlogItems.add(tempBacklog);
- countSequenceBacklog ++;
+ backlogItems.add(tempBacklog)
+ countSequenceBacklog ++
}
// re-order category list item
if ("N".equals(parameters.sequence)) {
- backlogItems = UtilMisc.sortMaps(backlogItems, ["parentCustRequestId"]);
+ backlogItems = UtilMisc.sortMaps(backlogItems, ["parentCustRequestId"])
}
- context.backlogItems = backlogItems;
+ context.backlogItems = backlogItems
}
diff --git a/specialpurpose/scrum/groovyScripts/FindTaskList.groovy b/specialpurpose/scrum/groovyScripts/FindTaskList.groovy
index 61d507819c..028ae5d9c6 100644
--- a/specialpurpose/scrum/groovyScripts/FindTaskList.groovy
+++ b/specialpurpose/scrum/groovyScripts/FindTaskList.groovy
@@ -17,37 +17,37 @@
* under the License.
*/
-import java.util.*;
-import java.lang.*;
-import org.apache.tools.ant.taskdefs.Parallel.TaskList;
-import org.apache.ofbiz.base.util.*;
-import org.apache.ofbiz.entity.*;
-import org.apache.ofbiz.base.util.UtilMisc;
-import org.apache.ofbiz.base.util.UtilValidate;
-import org.apache.ofbiz.base.util.UtilDateTime;
-import org.apache.ofbiz.entity.util.*;
-import org.apache.ofbiz.entity.condition.*;
-import java.sql.Timestamp;
+import java.util.*
+import java.lang.*
+import org.apache.tools.ant.taskdefs.Parallel.TaskList
+import org.apache.ofbiz.base.util.*
+import org.apache.ofbiz.entity.*
+import org.apache.ofbiz.base.util.UtilMisc
+import org.apache.ofbiz.base.util.UtilValidate
+import org.apache.ofbiz.base.util.UtilDateTime
+import org.apache.ofbiz.entity.util.*
+import org.apache.ofbiz.entity.condition.*
+import java.sql.Timestamp
-taskId = parameters.taskId;;
-taskName = parameters.taskName;
-sprintId = parameters.sprintId;
-sprintName = parameters.sprintName;
-taskTypeId = parameters.taskTypeId;
-projectId = parameters.projectId;
-projectName = parameters.projectName;
-backlogTypeId = parameters.unplannedFlag;
-statusId = parameters.statusId;
-partyId = parameters.partyId;
+taskId = parameters.taskId
+taskName = parameters.taskName
+sprintId = parameters.sprintId
+sprintName = parameters.sprintName
+taskTypeId = parameters.taskTypeId
+projectId = parameters.projectId
+projectName = parameters.projectName
+backlogTypeId = parameters.unplannedFlag
+statusId = parameters.statusId
+partyId = parameters.partyId
-unplannedTaskList = [];
-plannedTaskList = [];
-resultList=[];
-taskList=[];
-implementTaskList=[];
-testTaskList=[];
-errorTaskList = [];
-installTaskList = [];
+unplannedTaskList = []
+plannedTaskList = []
+resultList=[]
+taskList=[]
+implementTaskList=[]
+testTaskList=[]
+errorTaskList = []
+installTaskList = []
// get Unplaned task list
if ((taskId != null)||(taskName != null)||(taskTypeId != null)||(sprintId != null)||(sprintName != null)
@@ -55,164 +55,164 @@ if ((taskId != null)||(taskName != null)||(taskTypeId != null)||(sprintId != nul
||(partyId != null)||(viewIndex_1 > 0)||(viewIndex_2 > 0)||(viewIndex_3 > 0)||(viewIndex_4 > 0)
||(viewIndexNo_1 > 0)||(viewIndexNo_2 > 0)||(viewIndexNo_3 > 0)||(viewIndexNo_4 > 0)){
if ((taskId != null)||(taskName != null)||(taskTypeId != null)){
- exprBldr = [];
+ exprBldr = []
if (taskId) {
- exprBldr.add(EntityCondition.makeCondition("workEffortId", EntityOperator.EQUALS, taskId));
+ exprBldr.add(EntityCondition.makeCondition("workEffortId", EntityOperator.EQUALS, taskId))
}
if (taskName){
- exprBldr.add(EntityCondition.makeCondition("workEffortName", EntityOperator.LIKE, "%"+taskName+"%"));
+ exprBldr.add(EntityCondition.makeCondition("workEffortName", EntityOperator.LIKE, "%"+taskName+"%"))
}
if (taskTypeId){
- exprBldr.add(EntityCondition.makeCondition("workEffortTypeId", EntityOperator.EQUALS, taskTypeId));
+ exprBldr.add(EntityCondition.makeCondition("workEffortTypeId", EntityOperator.EQUALS, taskTypeId))
}
if (statusId){
- exprBldr.add(EntityCondition.makeCondition("currentStatusId", EntityOperator.EQUALS, statusId));
+ exprBldr.add(EntityCondition.makeCondition("currentStatusId", EntityOperator.EQUALS, statusId))
}
- unplannedTaskList = from("UnPlannedBacklogsAndTasks").where(exprBldr).orderBy("-createdDate").queryList();
+ unplannedTaskList = from("UnPlannedBacklogsAndTasks").where(exprBldr).orderBy("-createdDate").queryList()
}
else{
- unplannedTaskList = from("UnPlannedBacklogsAndTasks").orderBy("-createdDate").queryList();
+ unplannedTaskList = from("UnPlannedBacklogsAndTasks").orderBy("-createdDate").queryList()
}
- exprBldr2 = [];
+ exprBldr2 = []
if (taskId) {
- exprBldr2.add(EntityCondition.makeCondition("taskId", EntityOperator.EQUALS, taskId));
+ exprBldr2.add(EntityCondition.makeCondition("taskId", EntityOperator.EQUALS, taskId))
}
if (taskName){
- exprBldr2.add(EntityCondition.makeCondition("taskName", EntityOperator.LIKE, "%"+taskName+"%"));
+ exprBldr2.add(EntityCondition.makeCondition("taskName", EntityOperator.LIKE, "%"+taskName+"%"))
}
if (taskTypeId){
- exprBldr2.add(EntityCondition.makeCondition("taskTypeId", EntityOperator.EQUALS, taskTypeId));
+ exprBldr2.add(EntityCondition.makeCondition("taskTypeId", EntityOperator.EQUALS, taskTypeId))
}
if (statusId){
- exprBldr2.add(EntityCondition.makeCondition("taskCurrentStatusId", EntityOperator.EQUALS, statusId));
+ exprBldr2.add(EntityCondition.makeCondition("taskCurrentStatusId", EntityOperator.EQUALS, statusId))
}
if (sprintId){
- exprBldr2.add(EntityCondition.makeCondition("sprintId", EntityOperator.EQUALS, sprintId));
+ exprBldr2.add(EntityCondition.makeCondition("sprintId", EntityOperator.EQUALS, sprintId))
}
if (sprintName){
- exprBldr2.add(EntityCondition.makeCondition("sprintName", EntityOperator.LIKE, "%"+sprintName+"%"));
+ exprBldr2.add(EntityCondition.makeCondition("sprintName", EntityOperator.LIKE, "%"+sprintName+"%"))
}
if (projectId){
- exprBldr2.add(EntityCondition.makeCondition("projectId", EntityOperator.EQUALS, projectId));
+ exprBldr2.add(EntityCondition.makeCondition("projectId", EntityOperator.EQUALS, projectId))
}
if (projectName){
- exprBldr2.add(EntityCondition.makeCondition("projectName", EntityOperator.LIKE, "%"+projectName+"%"));
+ exprBldr2.add(EntityCondition.makeCondition("projectName", EntityOperator.LIKE, "%"+projectName+"%"))
}
- exprBldr2.add(EntityCondition.makeCondition("sprintTypeId", EntityOperator.EQUALS, "SCRUM_SPRINT"));
- plannedTaskList = from("ProjectSprintBacklogAndTask").where(exprBldr2).orderBy("-taskCreatedDate").queryList();
+ exprBldr2.add(EntityCondition.makeCondition("sprintTypeId", EntityOperator.EQUALS, "SCRUM_SPRINT"))
+ plannedTaskList = from("ProjectSprintBacklogAndTask").where(exprBldr2).orderBy("-taskCreatedDate").queryList()
unplannedTaskList.each{ unplannedTaskMap ->
- unplannedMap = [:];
- unplannedMap.taskId = unplannedTaskMap.workEffortId;
- unplannedMap.sprintId = null;
- unplannedMap.projectId = null;
- unplannedMap.productId = unplannedTaskMap.productId;
- unplannedMap.taskName = unplannedTaskMap.workEffortName;
- unplannedMap.taskTypeId = unplannedTaskMap.workEffortTypeId;
- unplannedMap.taskCurrentStatusId = unplannedTaskMap.currentStatusId;
- unplannedMap.taskEstimatedMilliSeconds = unplannedTaskMap.estimatedMilliSeconds;
- unplannedMap.taskCreatedDate = unplannedTaskMap.createdDate;
- unplannedMap.custRequestId = unplannedTaskMap.custRequestId;
- unplannedMap.description = unplannedTaskMap.description;
- unplannedMap.custRequestTypeId = unplannedTaskMap.custRequestTypeId;
- unplannedMap.taskActualMilliSeconds = unplannedTaskMap.actualMilliSeconds;
- unplannedMap.taskEstimatedStartDate = unplannedTaskMap.estimatedStartDate;
- taskList.add(unplannedMap);
+ unplannedMap = [:]
+ unplannedMap.taskId = unplannedTaskMap.workEffortId
+ unplannedMap.sprintId = null
+ unplannedMap.projectId = null
+ unplannedMap.productId = unplannedTaskMap.productId
+ unplannedMap.taskName = unplannedTaskMap.workEffortName
+ unplannedMap.taskTypeId = unplannedTaskMap.workEffortTypeId
+ unplannedMap.taskCurrentStatusId = unplannedTaskMap.currentStatusId
+ unplannedMap.taskEstimatedMilliSeconds = unplannedTaskMap.estimatedMilliSeconds
+ unplannedMap.taskCreatedDate = unplannedTaskMap.createdDate
+ unplannedMap.custRequestId = unplannedTaskMap.custRequestId
+ unplannedMap.description = unplannedTaskMap.description
+ unplannedMap.custRequestTypeId = unplannedTaskMap.custRequestTypeId
+ unplannedMap.taskActualMilliSeconds = unplannedTaskMap.actualMilliSeconds
+ unplannedMap.taskEstimatedStartDate = unplannedTaskMap.estimatedStartDate
+ taskList.add(unplannedMap)
}
plannedTaskList.each{ plannedTaskMap ->
- plannedMap = [:];
- plannedMap.taskId = plannedTaskMap.taskId;
- plannedMap.taskName = plannedTaskMap.taskName;
- plannedMap.taskTypeId = plannedTaskMap.taskTypeId;
- plannedMap.taskCurrentStatusId = plannedTaskMap.taskCurrentStatusId;
- plannedMap.taskEstimatedMilliSeconds = plannedTaskMap.taskEstimatedMilliSeconds;
- plannedMap.taskCreatedDate = plannedTaskMap.taskCreatedDate;
- plannedMap.sprintId = plannedTaskMap.sprintId;
- plannedMap.sprintName = plannedTaskMap.sprintName;
- plannedMap.projectId = plannedTaskMap.projectId;
- plannedMap.projectName = plannedTaskMap.projectName;
- plannedMap.custRequestId = plannedTaskMap.custRequestId;
- plannedMap.description = plannedTaskMap.description;
- plannedMap.custRequestTypeId = plannedTaskMap.custRequestTypeId;
- plannedMap.taskActualMilliSeconds = plannedTaskMap.taskActualMilliSeconds;
- plannedMap.taskEstimatedStartDate = plannedTaskMap.taskEstimatedStartDate;
- taskList.add(plannedMap);
+ plannedMap = [:]
+ plannedMap.taskId = plannedTaskMap.taskId
+ plannedMap.taskName = plannedTaskMap.taskName
+ plannedMap.taskTypeId = plannedTaskMap.taskTypeId
+ plannedMap.taskCurrentStatusId = plannedTaskMap.taskCurrentStatusId
+ plannedMap.taskEstimatedMilliSeconds = plannedTaskMap.taskEstimatedMilliSeconds
+ plannedMap.taskCreatedDate = plannedTaskMap.taskCreatedDate
+ plannedMap.sprintId = plannedTaskMap.sprintId
+ plannedMap.sprintName = plannedTaskMap.sprintName
+ plannedMap.projectId = plannedTaskMap.projectId
+ plannedMap.projectName = plannedTaskMap.projectName
+ plannedMap.custRequestId = plannedTaskMap.custRequestId
+ plannedMap.description = plannedTaskMap.description
+ plannedMap.custRequestTypeId = plannedTaskMap.custRequestTypeId
+ plannedMap.taskActualMilliSeconds = plannedTaskMap.taskActualMilliSeconds
+ plannedMap.taskEstimatedStartDate = plannedTaskMap.taskEstimatedStartDate
+ taskList.add(plannedMap)
}
//Check the backlog
if (backlogTypeId){
if (backlogTypeId=="Y"){
taskList.each{taskMap ->
if(taskMap.custRequestTypeId=="RF_UNPLAN_BACKLOG"){
- resultList.add(taskMap);
+ resultList.add(taskMap)
}
}
}
if (backlogTypeId=="N"){
taskList.each{taskMap ->
if(taskMap.custRequestTypeId=="RF_PROD_BACKLOG"){
- resultList.add(taskMap);
+ resultList.add(taskMap)
}
}
}
} else {
taskList.each { taskMap ->
- resultList.add(taskMap);
+ resultList.add(taskMap)
}
}
// Check party assigned
if (partyId){
- assignedList = resultList;
- resultList = [];
+ assignedList = resultList
+ resultList = []
assignedList.each { assignedMap ->
- workEffortId = assignedMap.taskId;
- assignToList = from("WorkEffortPartyAssignment").where("workEffortId", workEffortId, "partyId", partyId).queryList();
+ workEffortId = assignedMap.taskId
+ assignToList = from("WorkEffortPartyAssignment").where("workEffortId", workEffortId, "partyId", partyId).queryList()
if (assignToList) {
- assignedMap.partyId = assignToList[0].partyId;
- resultList.add(assignedMap);
+ assignedMap.partyId = assignToList[0].partyId
+ resultList.add(assignedMap)
}
}
} else {
- assignedList = resultList;
- resultList = [];
+ assignedList = resultList
+ resultList = []
assignedList.each { assignedMap ->
- workEffortId = assignedMap.taskId;
- assignToList = from("WorkEffortPartyAssignment").where("workEffortId", workEffortId).queryList();
+ workEffortId = assignedMap.taskId
+ assignToList = from("WorkEffortPartyAssignment").where("workEffortId", workEffortId).queryList()
if (assignToList) {
- assignedMap.partyId = assignToList[0].partyId;
- resultList.add(assignedMap);
+ assignedMap.partyId = assignToList[0].partyId
+ resultList.add(assignedMap)
} else {
- resultList.add(assignedMap);
+ resultList.add(assignedMap)
}
}
}
resultList.each{resultMap ->
if (resultMap.taskTypeId=="SCRUM_TASK_IMPL"){
- implementTaskList.add(resultMap);
+ implementTaskList.add(resultMap)
}
if (resultMap.taskTypeId=="SCRUM_TASK_INST"){
- installTaskList.add(resultMap);
+ installTaskList.add(resultMap)
}
if (resultMap.taskTypeId=="SCRUM_TASK_TEST"){
- testTaskList.add(resultMap);
+ testTaskList.add(resultMap)
}
if (resultMap.taskTypeId=="SCRUM_TASK_ERROR"){
- errorTaskList.add(resultMap);
+ errorTaskList.add(resultMap)
}
}
if (implementTaskList){
- context.implementTaskList = implementTaskList;
+ context.implementTaskList = implementTaskList
}
if (installTaskList){
- context.installTaskList = installTaskList;
+ context.installTaskList = installTaskList
}
if (testTaskList){
- context.testTaskList = testTaskList;
+ context.testTaskList = testTaskList
}
if (errorTaskList){
- context.errorTaskList = errorTaskList;
+ context.errorTaskList = errorTaskList
}
}
diff --git a/specialpurpose/scrum/groovyScripts/ListCurrentProducts.groovy b/specialpurpose/scrum/groovyScripts/ListCurrentProducts.groovy
index e8c948f5a5..7c4c41fcca 100644
--- a/specialpurpose/scrum/groovyScripts/ListCurrentProducts.groovy
+++ b/specialpurpose/scrum/groovyScripts/ListCurrentProducts.groovy
@@ -16,50 +16,50 @@
* specific language governing permissions and limitations
* under the License.
*/
-import org.apache.ofbiz.entity.condition.*;
-import org.apache.ofbiz.base.util.*;
-import org.apache.ofbiz.entity.util.EntityUtil;
+import org.apache.ofbiz.entity.condition.*
+import org.apache.ofbiz.base.util.*
+import org.apache.ofbiz.entity.util.EntityUtil
-roleTypeId = null;
-paramCond = [];
-products = [];
-productId = parameters.productId;
-internalName = parameters.internalName;
-statusId = parameters.statusId;
+roleTypeId = null
+paramCond = []
+products = []
+productId = parameters.productId
+internalName = parameters.internalName
+statusId = parameters.statusId
if ("Any".equals(statusId)) {
- statusId = null;
+ statusId = null
}
-partyId = parameters.partyId;
+partyId = parameters.partyId
if(!security.hasEntityPermission("SCRUM", "_ADMIN", session)){
if(security.hasEntityPermission("SCRUM_PRODUCT", "_ADMIN", session)){
- roleTypeId = "PRODUCT_OWNER";
+ roleTypeId = "PRODUCT_OWNER"
}
}
if (userLogin) {
if(UtilValidate.isNotEmpty(partyId)){
- paramCond.add(EntityCondition.makeCondition("partyId", EntityOperator.EQUALS, partyId));
+ paramCond.add(EntityCondition.makeCondition("partyId", EntityOperator.EQUALS, partyId))
}
if(UtilValidate.isNotEmpty(productId)){
- paramCond.add(EntityCondition.makeCondition("productId", EntityOperator.LIKE, productId + "%"));
+ paramCond.add(EntityCondition.makeCondition("productId", EntityOperator.LIKE, productId + "%"))
}
if(UtilValidate.isNotEmpty(internalName)){
- paramCond.add(EntityCondition.makeCondition("internalName", EntityOperator.LIKE, "%" + internalName + "%"));
+ paramCond.add(EntityCondition.makeCondition("internalName", EntityOperator.LIKE, "%" + internalName + "%"))
}
if(UtilValidate.isNotEmpty(statusId)){
if ("PRODUCT_ACTIVE".equals(statusId)) {
- paramCond.add(EntityCondition.makeCondition("supportDiscontinuationDate", EntityOperator.EQUALS, null));
+ paramCond.add(EntityCondition.makeCondition("supportDiscontinuationDate", EntityOperator.EQUALS, null))
} else {
- paramCond.add(EntityCondition.makeCondition("supportDiscontinuationDate", EntityOperator.NOT_EQUAL, null));
+ paramCond.add(EntityCondition.makeCondition("supportDiscontinuationDate", EntityOperator.NOT_EQUAL, null))
}
}
- paramCond.add(EntityCondition.makeCondition("productTypeId", EntityOperator.EQUALS, "SCRUM_ITEM"));
- paramCond.add(EntityCondition.makeCondition("roleTypeId", EntityOperator.EQUALS, "PRODUCT_OWNER_COMP"));
- paramCond.add(EntityCondition.makeCondition("thruDate", EntityOperator.EQUALS, null));
+ paramCond.add(EntityCondition.makeCondition("productTypeId", EntityOperator.EQUALS, "SCRUM_ITEM"))
+ paramCond.add(EntityCondition.makeCondition("roleTypeId", EntityOperator.EQUALS, "PRODUCT_OWNER_COMP"))
+ paramCond.add(EntityCondition.makeCondition("thruDate", EntityOperator.EQUALS, null))
- allProducts = from("ProductAndRole").where(paramCond).orderBy("groupName", "internalName").queryList();
+ allProducts = from("ProductAndRole").where(paramCond).orderBy("groupName", "internalName").queryList()
partyAndSecurityGroupList = select("partyId", "groupId")
.from("ScrumMemberUserLoginAndSecurityGroup").where(EntityCondition.makeCondition([
@@ -68,27 +68,27 @@ if (userLogin) {
EntityCondition.makeCondition ("thruDate", EntityOperator.EQUALS, null)
], EntityJoinOperator.AND))
.orderBy("partyId")
- .queryList();
+ .queryList()
- context.partyAndSecurityGroupList = partyAndSecurityGroupList;
- boolean addAllProducts = false;
+ context.partyAndSecurityGroupList = partyAndSecurityGroupList
+ boolean addAllProducts = false
allProducts.each { product ->
- product = product.getAllFields();
- productMap = from("Product").where("productId", product.productId).queryOne();
+ product = product.getAllFields()
+ productMap = from("Product").where("productId", product.productId).queryOne()
product.put("longDescription",productMap.longDescription)
if(security.hasEntityPermission("SCRUM", "_ADMIN", session)){
- addAllProducts = true;
+ addAllProducts = true
}else{
- ismember = false;
+ ismember = false
if (partyAndSecurityGroupList) {
- groupId = partyAndSecurityGroupList[0].groupId;
+ groupId = partyAndSecurityGroupList[0].groupId
if ("SCRUM_PRODUCT_OWNER".equals(groupId)) {
- productAndRoleList = from("ProductRole").where("productId", product.productId, "partyId", userLogin.partyId, "thruDate", null).queryList();
+ productAndRoleList = from("ProductRole").where("productId", product.productId, "partyId", userLogin.partyId, "thruDate", null).queryList()
if (productAndRoleList) {
productAndRoleList.each { productAndRoleMap ->
- productIdInner = productAndRoleMap.productId;
+ productIdInner = productAndRoleMap.productId
if (productIdInner.equals(product.productId)) {
- ismember = true;
+ ismember = true
}
}
}
@@ -99,14 +99,14 @@ if (userLogin) {
EntityCondition.makeCondition ("roleTypeId", EntityOperator.EQUALS, "STAKEHOLDER"),
EntityCondition.makeCondition ("partyStatusId", EntityOperator.NOT_EQUAL, "PARTY_DISABLED"),
EntityCondition.makeCondition ("thruDate", EntityOperator.EQUALS, null)
- ], EntityJoinOperator.AND);
- scrumRolesPersonAndCompanyList = from("ScrumRolesPersonAndCompany").where(scrumRolesCond).queryList();
- productRoleList = from("ProductRole").where("partyId", scrumRolesPersonAndCompanyList[0].partyIdFrom, "roleTypeId", "PRODUCT_OWNER_COMP", "thruDate", null).queryList();
+ ], EntityJoinOperator.AND)
+ scrumRolesPersonAndCompanyList = from("ScrumRolesPersonAndCompany").where(scrumRolesCond).queryList()
+ productRoleList = from("ProductRole").where("partyId", scrumRolesPersonAndCompanyList[0].partyIdFrom, "roleTypeId", "PRODUCT_OWNER_COMP", "thruDate", null).queryList()
if (productRoleList) {
productRoleList.each { productRoleMap ->
- stakeholderProduct = productRoleMap.productId;
+ stakeholderProduct = productRoleMap.productId
if (stakeholderProduct.equals(product.productId)) {
- ismember = true;
+ ismember = true
}
}
}
@@ -114,25 +114,25 @@ if (userLogin) {
if (ismember == false) {
productAndRoleList = from("ProductAndRole").where("productId" : product.productId, "partyId" : userLogin.partyId, "roleTypeId" : "STAKEHOLDER", "supportDiscontinuationDate" : null, "thruDate" : null).queryList()
if (productAndRoleList) {
- ismember = true;
+ ismember = true
}
}
} else if ("SCRUM_MASTER".equals(groupId)) {
//check in product.
- productRoleList = [];
- productRoleList = from("ProductAndRole").where("productId" : product.productId, "partyId" : userLogin.partyId, "roleTypeId" : "SCRUM_MASTER", "supportDiscontinuationDate" : null, "thruDate" : null).queryList();
+ productRoleList = []
+ productRoleList = from("ProductAndRole").where("productId" : product.productId, "partyId" : userLogin.partyId, "roleTypeId" : "SCRUM_MASTER", "supportDiscontinuationDate" : null, "thruDate" : null).queryList()
if (productRoleList) {
- ismember = true;
+ ismember = true
}
//check in project.
if (ismember == false) {
- projects = [];
- projects = from("WorkEffortAndProduct").where("productId", product.productId, "workEffortTypeId", "SCRUM_PROJECT", "currentStatusId", "SPJ_ACTIVE").queryList();
+ projects = []
+ projects = from("WorkEffortAndProduct").where("productId", product.productId, "workEffortTypeId", "SCRUM_PROJECT", "currentStatusId", "SPJ_ACTIVE").queryList()
if (projects) {
projects.each { project ->
- projectPartyAssignment = from("WorkEffortPartyAssignment").where("partyId", userLogin.partyId, "workEffortId", project.workEffortId).queryList();
+ projectPartyAssignment = from("WorkEffortPartyAssignment").where("partyId", userLogin.partyId, "workEffortId", project.workEffortId).queryList()
if (projectPartyAssignment) {
- ismember = true;
+ ismember = true
}
}
}
@@ -140,47 +140,47 @@ if (userLogin) {
//check in sprint.
if (ismember == false) {
projects.each { project ->
- allSprintList = [];
- allSprintList = from("WorkEffort").where("workEffortParentId", project.workEffortId, "currentStatusId", "SPRINT_ACTIVE").queryList();
+ allSprintList = []
+ allSprintList = from("WorkEffort").where("workEffortParentId", project.workEffortId, "currentStatusId", "SPRINT_ACTIVE").queryList()
allSprintList.each { SprintListMap ->
- sprintId = SprintListMap.workEffortId;
- workEffortPartyAssignment = from("WorkEffortPartyAssignment").where("partyId", userLogin.partyId, "workEffortId", sprintId).queryList();
+ sprintId = SprintListMap.workEffortId
+ workEffortPartyAssignment = from("WorkEffortPartyAssignment").where("partyId", userLogin.partyId, "workEffortId", sprintId).queryList()
if (workEffortPartyAssignment) {
- ismember = true;
+ ismember = true
}
}
}
}
} else {
- projects = [];
- projects = from("WorkEffortAndProduct").where("productId", product.productId, "workEffortTypeId", "SCRUM_PROJECT", "currentStatusId", "SPJ_ACTIVE").queryList();
+ projects = []
+ projects = from("WorkEffortAndProduct").where("productId", product.productId, "workEffortTypeId", "SCRUM_PROJECT", "currentStatusId", "SPJ_ACTIVE").queryList()
if (projects) {
projects.each { project ->
- allSprintList = [];
- allSprintList = from("WorkEffort").where("workEffortParentId", project.workEffortId, "currentStatusId", "SPRINT_ACTIVE").queryList();
+ allSprintList = []
+ allSprintList = from("WorkEffort").where("workEffortParentId", project.workEffortId, "currentStatusId", "SPRINT_ACTIVE").queryList()
allSprintList.each { SprintListMap ->
- sprintId = SprintListMap.workEffortId;
- workEffortPartyAssignment = from("WorkEffortPartyAssignment").where("partyId", userLogin.partyId, "workEffortId", sprintId).queryList();
+ sprintId = SprintListMap.workEffortId
+ workEffortPartyAssignment = from("WorkEffortPartyAssignment").where("partyId", userLogin.partyId, "workEffortId", sprintId).queryList()
if (workEffortPartyAssignment) {
- ismember = true;
+ ismember = true
}
}
}
}
if (ismember == false) {
exprBldr = [EntityCondition.makeCondition("statusId", EntityOperator.EQUALS, "CRQ_REVIEWED"),
- EntityCondition.makeCondition("statusId", EntityOperator.EQUALS, "CRQ_REOPENED")];
+ EntityCondition.makeCondition("statusId", EntityOperator.EQUALS, "CRQ_REOPENED")]
andExprs = [EntityCondition.makeCondition("productId", EntityOperator.EQUALS, product.productId),
EntityCondition.makeCondition("currentStatusId", EntityOperator.EQUALS, "STS_CREATED"),
- EntityCondition.makeCondition(exprBldr, EntityOperator.OR)];
- unplannedBacklogCond = EntityCondition.makeCondition(andExprs, EntityOperator.AND);
- unplannedBacklogList = from("UnPlannedBacklogsAndTasks").where(unplannedBacklogCond).queryList();
+ EntityCondition.makeCondition(exprBldr, EntityOperator.OR)]
+ unplannedBacklogCond = EntityCondition.makeCondition(andExprs, EntityOperator.AND)
+ unplannedBacklogList = from("UnPlannedBacklogsAndTasks").where(unplannedBacklogCond).queryList()
if (unplannedBacklogList) {
unplannedBacklogList.each { unplannedMap ->
- workEffortId = unplannedMap.workEffortId;
- workEffortPartyAssignment = from("WorkEffortPartyAssignment").where("partyId", userLogin.partyId, "workEffortId", workEffortId).queryList();
+ workEffortId = unplannedMap.workEffortId
+ workEffortPartyAssignment = from("WorkEffortPartyAssignment").where("partyId", userLogin.partyId, "workEffortId", workEffortId).queryList()
if (workEffortPartyAssignment) {
- ismember = true;
+ ismember = true
}
}
}
@@ -188,17 +188,17 @@ if (userLogin) {
}
if (ismember) {
- products.add(product);
+ products.add(product)
}
}
}
if(addAllProducts)
- products.add(product);
+ products.add(product)
}
} else {
- Debug.logError("Party ID missing =========>>> : null ", "");
+ Debug.logError("Party ID missing =========>>> : null ", "")
}
if (products){
- context.listIt = products;
+ context.listIt = products
}
diff --git a/specialpurpose/scrum/groovyScripts/ListCurrentSprints.groovy b/specialpurpose/scrum/groovyScripts/ListCurrentSprints.groovy
index 56c4695f78..11ed080d78 100644
--- a/specialpurpose/scrum/groovyScripts/ListCurrentSprints.groovy
+++ b/specialpurpose/scrum/groovyScripts/ListCurrentSprints.groovy
@@ -17,53 +17,53 @@
* under the License.
*/
-import org.apache.ofbiz.entity.condition.*;
-import org.apache.ofbiz.base.util.*;
+import org.apache.ofbiz.entity.condition.*
+import org.apache.ofbiz.base.util.*
cond = EntityCondition.makeCondition([
EntityCondition.makeCondition ("projectTypeId", EntityOperator.EQUALS, "SCRUM_PROJECT"),
EntityCondition.makeCondition ("projectStatusId", EntityOperator.NOT_EQUAL, "SPJ_CLOSED")
- ], EntityJoinOperator.AND);
+ ], EntityJoinOperator.AND)
securityGroupCond = EntityCondition.makeCondition([
EntityCondition.makeCondition ("partyId", EntityOperator.EQUALS, userLogin.partyId),
EntityCondition.makeCondition ("partyStatusId", EntityOperator.NOT_EQUAL, "PARTY_DISABLED"),
EntityCondition.makeCondition ("thruDate", EntityOperator.EQUALS, null)
- ], EntityJoinOperator.AND);
-fields = new HashSet(["partyId", "groupId"]);
+ ], EntityJoinOperator.AND)
+fields = new HashSet(["partyId", "groupId"])
-allSprints = from("ProjectSprint").where(cond).orderBy("projectName", "-sprintActualStartDate").queryList();
-partyAndSecurityGroupList = select("partyId", "groupId").from("ScrumMemberUserLoginAndSecurityGroup").where(securityGroupCond).orderBy("partyId").queryList();
-oldProjectId = null;
-newProjectId = null;
-countSprint = 0;
-sprints = [];
+allSprints = from("ProjectSprint").where(cond).orderBy("projectName", "-sprintActualStartDate").queryList()
+partyAndSecurityGroupList = select("partyId", "groupId").from("ScrumMemberUserLoginAndSecurityGroup").where(securityGroupCond).orderBy("partyId").queryList()
+oldProjectId = null
+newProjectId = null
+countSprint = 0
+sprints = []
allSprints.each { sprint ->
- newProjectId = sprint.projectId;
- productAndRole = from("ProductAndRole").where("roleTypeId", "PRODUCT_OWNER_COMP", "productId", sprint.productId).queryList();
- companyId = "";
- companyName = "";
+ newProjectId = sprint.projectId
+ productAndRole = from("ProductAndRole").where("roleTypeId", "PRODUCT_OWNER_COMP", "productId", sprint.productId).queryList()
+ companyId = ""
+ companyName = ""
if (productAndRole.size() > 0) {
- companyName = productAndRole.get(0).groupName;
- companyId = productAndRole.get(0).partyId;
+ companyName = productAndRole.get(0).groupName
+ companyId = productAndRole.get(0).partyId
}
- sprint = sprint.getAllFields();
+ sprint = sprint.getAllFields()
sprint.put("companyId", companyId)
sprint.put("companyName", companyName)
- product = from("Product").where("productId", sprint.productId).queryOne();
- productName = "";
- if (product != null) productName = product.internalName;
- sprint.put("productName", productName);
+ product = from("Product").where("productId", sprint.productId).queryOne()
+ productName = ""
+ if (product != null) productName = product.internalName
+ sprint.put("productName", productName)
//sprint.add("companyName", companyName, "String")
if (oldProjectId != newProjectId) {
- oldProjectId = newProjectId;
- countSprint = 0;
- ismember = false;
+ oldProjectId = newProjectId
+ countSprint = 0
+ ismember = false
if (partyAndSecurityGroupList) {
- groupId = partyAndSecurityGroupList[0].groupId;
+ groupId = partyAndSecurityGroupList[0].groupId
if ("SCRUM_PRODUCT_OWNER".equals(groupId)) {
- productAndRoleList = from("ProductRole").where("productId", sprint.productId, "partyId", partyAndSecurityGroupList.getAt(0).partyId, "thruDate", null).queryList();
+ productAndRoleList = from("ProductRole").where("productId", sprint.productId, "partyId", partyAndSecurityGroupList.getAt(0).partyId, "thruDate", null).queryList()
if (productAndRoleList) {
- ismember = true;
+ ismember = true
}
}else if("SCRUM_STAKEHOLDER".equals(groupId)) {
// check in company relationship.
@@ -72,14 +72,14 @@ allSprints.each { sprint ->
EntityCondition.makeCondition ("roleTypeId", EntityOperator.EQUALS, "STAKEHOLDER"),
EntityCondition.makeCondition ("partyStatusId", EntityOperator.NOT_EQUAL, "PARTY_DISABLED"),
EntityCondition.makeCondition ("thruDate", EntityOperator.EQUALS, null)
- ], EntityJoinOperator.AND);
- scrumRolesPersonAndCompanyList = from("ScrumRolesPersonAndCompany").where(scrumRolesCond).queryList();
- productRoleList = from("ProductRole").where("partyId", scrumRolesPersonAndCompanyList[0].partyIdFrom, "roleTypeId", "PRODUCT_OWNER_COMP", "thruDate", null).queryList();
+ ], EntityJoinOperator.AND)
+ scrumRolesPersonAndCompanyList = from("ScrumRolesPersonAndCompany").where(scrumRolesCond).queryList()
+ productRoleList = from("ProductRole").where("partyId", scrumRolesPersonAndCompanyList[0].partyIdFrom, "roleTypeId", "PRODUCT_OWNER_COMP", "thruDate", null).queryList()
if (productRoleList) {
productRoleList.each { productRoleMap ->
- stakeholderProduct = productRoleMap.productId;
+ stakeholderProduct = productRoleMap.productId
if (stakeholderProduct.equals(sprint.productId)) {
- ismember = true;
+ ismember = true
}
}
}
@@ -88,49 +88,49 @@ allSprints.each { sprint ->
productAndRoleList = from("ProductAndRole")
.where("productId", sprint.productId, "partyId", userLogin.partyId, "roleTypeId", "STAKEHOLDER",
"supportDiscontinuationDate", null, "thruDate", null)
- .queryList();
+ .queryList()
if (productAndRoleList) {
- ismember = true;
+ ismember = true
}
}
} else if("SCRUM_MASTER".equals(groupId)) {
//check in product
- productRoleList = [];
+ productRoleList = []
productRoleList = from("ProductAndRole")
.where("productId" : sprint.productId, "partyId" : userLogin.partyId,
"roleTypeId" : "SCRUM_MASTER", "supportDiscontinuationDate" : null, "thruDate" : null)
- .queryList();
+ .queryList()
if (productRoleList) {
- ismember = true;
+ ismember = true
}
//check in project.
if (ismember == false) {
- projectPartyAssignment = from("WorkEffortPartyAssignment").where("workEffortId", sprint.projectId, "partyId", userLogin.partyId).queryList();
+ projectPartyAssignment = from("WorkEffortPartyAssignment").where("workEffortId", sprint.projectId, "partyId", userLogin.partyId).queryList()
if (projectPartyAssignment) {
- ismember = true;
+ ismember = true
}
}
//check in sprint.
if (ismember == false) {
- allSprintList = [];
- allSprintList = from("WorkEffort").where("workEffortParentId", sprint.projectId).queryList();
+ allSprintList = []
+ allSprintList = from("WorkEffort").where("workEffortParentId", sprint.projectId).queryList()
allSprintList.each { SprintListMap ->
- sprintId = SprintListMap.workEffortId;
- workEffortPartyAssignment = from("WorkEffortPartyAssignment").where("workEffortId", sprintId, "partyId", userLogin.partyId).queryList();
+ sprintId = SprintListMap.workEffortId
+ workEffortPartyAssignment = from("WorkEffortPartyAssignment").where("workEffortId", sprintId, "partyId", userLogin.partyId).queryList()
if (workEffortPartyAssignment) {
- ismember = true;
+ ismember = true
}
}
}
} else {
- allSprintList = [];
- allSprintList = from("WorkEffort").where("workEffortParentId", sprint.projectId).queryList();
+ allSprintList = []
+ allSprintList = from("WorkEffort").where("workEffortParentId", sprint.projectId).queryList()
allSprintList.each { SprintListMap ->
- sprintId = SprintListMap.workEffortId;
- workEffortPartyAssignment = from("WorkEffortPartyAssignment").where("workEffortId", sprintId, "partyId", userLogin.partyId).queryList();
+ sprintId = SprintListMap.workEffortId
+ workEffortPartyAssignment = from("WorkEffortPartyAssignment").where("workEffortId", sprintId, "partyId", userLogin.partyId).queryList()
if (workEffortPartyAssignment) {
- ismember = true;
+ ismember = true
}
}
}
@@ -139,18 +139,18 @@ allSprints.each { sprint ->
|| ((security.hasEntityPermission("SCRUM", "_ROLE_ADMIN", session) || security.hasEntityPermission("SCRUM", "_ROLE_VIEW", session)
|| security.hasEntityPermission("SCRUM_PROJECT", "_ROLE_ADMIN", session) || security.hasEntityPermission("SCRUM_PROJECT", "_ROLE_VIEW", session)
|| security.hasEntityPermission("SCRUM_PROJECT", "_VIEW", session)) && ismember)) {
- sprints.add(sprint);
- countSprint++;
+ sprints.add(sprint)
+ countSprint++
}
} else {
if (countSprint < 4) {
- ismember = false;
+ ismember = false
if (partyAndSecurityGroupList) {
- groupId = partyAndSecurityGroupList[0].groupId;
+ groupId = partyAndSecurityGroupList[0].groupId
if ("SCRUM_PRODUCT_OWNER".equals(groupId)) {
- productAndRoleList = from("ProductRole").where("productId", sprint.productId, "partyId", partyAndSecurityGroupList.getAt(0).partyId, "thruDate", null).queryList();
+ productAndRoleList = from("ProductRole").where("productId", sprint.productId, "partyId", partyAndSecurityGroupList.getAt(0).partyId, "thruDate", null).queryList()
if (productAndRoleList) {
- ismember = true;
+ ismember = true
}
}else if("SCRUM_STAKEHOLDER".equals(groupId)) {
// check in company relationship.
@@ -159,58 +159,58 @@ allSprints.each { sprint ->
EntityCondition.makeCondition ("roleTypeId", EntityOperator.EQUALS, "STAKEHOLDER"),
EntityCondition.makeCondition ("partyStatusId", EntityOperator.NOT_EQUAL, "PARTY_DISABLED"),
EntityCondition.makeCondition ("thruDate", EntityOperator.EQUALS, null)
- ], EntityJoinOperator.AND);
- scrumRolesPersonAndCompanyList = from("ScrumRolesPersonAndCompany").where(scrumRolesCond).queryList();
- productRoleList = from("ProductRole").where("partyId", scrumRolesPersonAndCompanyList[0].partyIdFrom, "roleTypeId", "PRODUCT_OWNER_COMP", "thruDate", null).queryList();
+ ], EntityJoinOperator.AND)
+ scrumRolesPersonAndCompanyList = from("ScrumRolesPersonAndCompany").where(scrumRolesCond).queryList()
+ productRoleList = from("ProductRole").where("partyId", scrumRolesPersonAndCompanyList[0].partyIdFrom, "roleTypeId", "PRODUCT_OWNER_COMP", "thruDate", null).queryList()
if (productRoleList) {
productRoleList.each { productRoleMap ->
- stakeholderProduct = productRoleMap.productId;
+ stakeholderProduct = productRoleMap.productId
if (stakeholderProduct.equals(sprint.productId)) {
- ismember = true;
+ ismember = true
}
}
}
//check in product.
if (ismember == false) {
- productAndRoleList = from("ProductAndRole").where("productId" : sprint.productId, "partyId" : userLogin.partyId, "roleTypeId" : "STAKEHOLDER", "supportDiscontinuationDate" : null, "thruDate" : null).queryList();
+ productAndRoleList = from("ProductAndRole").where("productId" : sprint.productId, "partyId" : userLogin.partyId, "roleTypeId" : "STAKEHOLDER", "supportDiscontinuationDate" : null, "thruDate" : null).queryList()
if (productAndRoleList) {
- ismember = true;
+ ismember = true
}
}
} else if("SCRUM_MASTER".equals(groupId)) {
//check in product
- productRoleList = [];
- productRoleList = from("ProductAndRole").where("productId" : sprint.productId, "partyId" : userLogin.partyId, "roleTypeId" : "SCRUM_MASTER", "supportDiscontinuationDate" : null, "thruDate" : null).queryList();
+ productRoleList = []
+ productRoleList = from("ProductAndRole").where("productId" : sprint.productId, "partyId" : userLogin.partyId, "roleTypeId" : "SCRUM_MASTER", "supportDiscontinuationDate" : null, "thruDate" : null).queryList()
if (productRoleList) {
- ismember = true;
+ ismember = true
}
//check in project.
if (ismember == false) {
- projectPartyAssignment = from("WorkEffortPartyAssignment").where("workEffortId", sprint.projectId, "partyId", userLogin.partyId).queryList();
+ projectPartyAssignment = from("WorkEffortPartyAssignment").where("workEffortId", sprint.projectId, "partyId", userLogin.partyId).queryList()
if (projectPartyAssignment) {
- ismember = true;
+ ismember = true
}
}
//check in sprint.
if (ismember == false) {
- allSprintList = [];
- allSprintList = from("WorkEffort").where("workEffortParentId", sprint.projectId).queryList();
+ allSprintList = []
+ allSprintList = from("WorkEffort").where("workEffortParentId", sprint.projectId).queryList()
allSprintList.each { SprintListMap ->
- sprintId = SprintListMap.workEffortId;
- workEffortPartyAssignment = from("WorkEffortPartyAssignment").where("workEffortId", sprintId, "partyId", userLogin.partyId).queryList();
+ sprintId = SprintListMap.workEffortId
+ workEffortPartyAssignment = from("WorkEffortPartyAssignment").where("workEffortId", sprintId, "partyId", userLogin.partyId).queryList()
if (workEffortPartyAssignment) {
- ismember = true;
+ ismember = true
}
}
}
} else {
- allSprintList = [];
- allSprintList = from("WorkEffort").where("workEffortParentId", sprint.projectId).queryList();
+ allSprintList = []
+ allSprintList = from("WorkEffort").where("workEffortParentId", sprint.projectId).queryList()
allSprintList.each { SprintListMap ->
- sprintId = SprintListMap.workEffortId;
- workEffortPartyAssignment = from("WorkEffortPartyAssignment").where("workEffortId", sprintId, "partyId", userLogin.partyId).queryList();
+ sprintId = SprintListMap.workEffortId
+ workEffortPartyAssignment = from("WorkEffortPartyAssignment").where("workEffortId", sprintId, "partyId", userLogin.partyId).queryList()
if (workEffortPartyAssignment) {
- ismember = true;
+ ismember = true
}
}
}
@@ -219,13 +219,13 @@ allSprints.each { sprint ->
|| ((security.hasEntityPermission("SCRUM", "_ROLE_ADMIN", session) || security.hasEntityPermission("SCRUM", "_ROLE_VIEW", session)
|| security.hasEntityPermission("SCRUM_PROJECT", "_ROLE_ADMIN", session) || security.hasEntityPermission("SCRUM_PROJECT", "_ROLE_VIEW", session)
|| security.hasEntityPermission("SCRUM_PROJECT", "_VIEW", session)) && ismember)) {
- sprints.add(sprint);
- countSprint++;
+ sprints.add(sprint)
+ countSprint++
}
}
}
}
if (sprints) {
sprints = UtilMisc.sortMaps(sprints, ["companyName", "projectName", "productName"])
- context.sprints = sprints;
+ context.sprints = sprints
}
diff --git a/specialpurpose/scrum/groovyScripts/ListRevision.groovy b/specialpurpose/scrum/groovyScripts/ListRevision.groovy
index 5b53fd44c1..128a682f66 100644
--- a/specialpurpose/scrum/groovyScripts/ListRevision.groovy
+++ b/specialpurpose/scrum/groovyScripts/ListRevision.groovy
@@ -17,76 +17,76 @@
* under the License.
*/
-import org.apache.ofbiz.base.util.UtilMisc;
-import org.apache.ofbiz.base.util.Debug;
-import org.apache.ofbiz.entity.util.*;
-import org.apache.ofbiz.entity.condition.*;
+import org.apache.ofbiz.base.util.UtilMisc
+import org.apache.ofbiz.base.util.Debug
+import org.apache.ofbiz.entity.util.*
+import org.apache.ofbiz.entity.condition.*
-custRequestList = [];
-custAndWorkEffortList = [];
-revisionList = [];
-listIt = [];
+custRequestList = []
+custAndWorkEffortList = []
+revisionList = []
+listIt = []
//for productId and custRequestId
if ((parameters.productId != null)||(parameters.custRequestId != null)||(parameters.workEffortId != null)||(viewIndex > 0)) {
- orList = [];
- orList.add(EntityCondition.makeCondition("custRequestTypeId", EntityOperator.EQUALS, "RF_PROD_BACKLOG"));
- orList.add(EntityCondition.makeCondition("custRequestTypeId", EntityOperator.EQUALS, "RF_UNPLAN_BACKLOG"));
- andList = [];
+ orList = []
+ orList.add(EntityCondition.makeCondition("custRequestTypeId", EntityOperator.EQUALS, "RF_PROD_BACKLOG"))
+ orList.add(EntityCondition.makeCondition("custRequestTypeId", EntityOperator.EQUALS, "RF_UNPLAN_BACKLOG"))
+ andList = []
if (parameters.productId) {
- andList.add(EntityCondition.makeCondition("productId", EntityOperator.LIKE, parameters.productId + "%"));
+ andList.add(EntityCondition.makeCondition("productId", EntityOperator.LIKE, parameters.productId + "%"))
}
if (parameters.custRequestId) {
- andList.add(EntityCondition.makeCondition("custRequestId", EntityOperator.LIKE, parameters.custRequestId + "%"));
+ andList.add(EntityCondition.makeCondition("custRequestId", EntityOperator.LIKE, parameters.custRequestId + "%"))
}
- andList.add(EntityCondition.makeCondition(orList, EntityOperator.OR));
- custRequestCond = EntityCondition.makeCondition(andList, EntityOperator.AND);
- custRequestList = from("CustRequestAndCustRequestItem").where(custRequestCond).queryList();
+ andList.add(EntityCondition.makeCondition(orList, EntityOperator.OR))
+ custRequestCond = EntityCondition.makeCondition(andList, EntityOperator.AND)
+ custRequestList = from("CustRequestAndCustRequestItem").where(custRequestCond).queryList()
- custRequestIds = EntityUtil.getFieldListFromEntityList(custRequestList, "custRequestId", true);
- taskOrList = [];
- taskOrList.add(EntityCondition.makeCondition("workEffortTypeId", EntityOperator.EQUALS, "SCRUM_TASK_ERROR"));
- taskOrList.add(EntityCondition.makeCondition("workEffortTypeId", EntityOperator.EQUALS, "SCRUM_TASK_TEST"));
- taskOrList.add(EntityCondition.makeCondition("workEffortTypeId", EntityOperator.EQUALS, "SCRUM_TASK_IMPL"));
- taskOrList.add(EntityCondition.makeCondition("workEffortTypeId", EntityOperator.EQUALS, "SCRUM_TASK_INST"));
- taskAndList = [];
- taskAndList.add(EntityCondition.makeCondition("custRequestId", EntityOperator.IN, custRequestIds));
- taskAndList.add(EntityCondition.makeCondition(taskOrList, EntityOperator.OR));
- custAndWorkEffortCond = EntityCondition.makeCondition(taskAndList, EntityOperator.AND);
- custAndWorkEffortList = from("CustRequestAndWorkEffort").where(custAndWorkEffortCond).queryList();
+ custRequestIds = EntityUtil.getFieldListFromEntityList(custRequestList, "custRequestId", true)
+ taskOrList = []
+ taskOrList.add(EntityCondition.makeCondition("workEffortTypeId", EntityOperator.EQUALS, "SCRUM_TASK_ERROR"))
+ taskOrList.add(EntityCondition.makeCondition("workEffortTypeId", EntityOperator.EQUALS, "SCRUM_TASK_TEST"))
+ taskOrList.add(EntityCondition.makeCondition("workEffortTypeId", EntityOperator.EQUALS, "SCRUM_TASK_IMPL"))
+ taskOrList.add(EntityCondition.makeCondition("workEffortTypeId", EntityOperator.EQUALS, "SCRUM_TASK_INST"))
+ taskAndList = []
+ taskAndList.add(EntityCondition.makeCondition("custRequestId", EntityOperator.IN, custRequestIds))
+ taskAndList.add(EntityCondition.makeCondition(taskOrList, EntityOperator.OR))
+ custAndWorkEffortCond = EntityCondition.makeCondition(taskAndList, EntityOperator.AND)
+ custAndWorkEffortList = from("CustRequestAndWorkEffort").where(custAndWorkEffortCond).queryList()
//for workEffortId
- workEffortIds = EntityUtil.getFieldListFromEntityList(custAndWorkEffortList, "workEffortId", true);
- revisionAndList = [];
+ workEffortIds = EntityUtil.getFieldListFromEntityList(custAndWorkEffortList, "workEffortId", true)
+ revisionAndList = []
if (parameters.workEffortId) {
- revisionAndList.add(EntityCondition.makeCondition("workEffortId", EntityOperator.LIKE, parameters.workEffortId + "%"));
+ revisionAndList.add(EntityCondition.makeCondition("workEffortId", EntityOperator.LIKE, parameters.workEffortId + "%"))
} else {
- revisionAndList.add(EntityCondition.makeCondition("workEffortId", EntityOperator.IN, workEffortIds));
+ revisionAndList.add(EntityCondition.makeCondition("workEffortId", EntityOperator.IN, workEffortIds))
}
- revisionAndList.add(EntityCondition.makeCondition("workEffortContentTypeId", EntityOperator.EQUALS, "TASK_SUB_INFO"));
- revisionCond = EntityCondition.makeCondition(revisionAndList, EntityOperator.AND);
- revisionList = from("WorkEffortAndContentDataResource").where(revisionCond).orderBy("-fromDate").queryList();
+ revisionAndList.add(EntityCondition.makeCondition("workEffortContentTypeId", EntityOperator.EQUALS, "TASK_SUB_INFO"))
+ revisionCond = EntityCondition.makeCondition(revisionAndList, EntityOperator.AND)
+ revisionList = from("WorkEffortAndContentDataResource").where(revisionCond).orderBy("-fromDate").queryList()
if (revisionList) {
revisionList.each { revisionMap ->
- inputMap = [:];
- inputMap.workEffortId = revisionMap.workEffortId;
- inputMap.contentId = revisionMap.contentId;
- inputMap.fromDate = revisionMap.fromDate;
- inputMap.contentName = revisionMap.contentName;
- inputMap.description = revisionMap.description;
- inputMap.drObjectInfo = revisionMap.drObjectInfo;
- custAndWorkEfffList = from("CustRequestAndWorkEffort").where("workEffortId", revisionMap.workEffortId).queryList();
+ inputMap = [:]
+ inputMap.workEffortId = revisionMap.workEffortId
+ inputMap.contentId = revisionMap.contentId
+ inputMap.fromDate = revisionMap.fromDate
+ inputMap.contentName = revisionMap.contentName
+ inputMap.description = revisionMap.description
+ inputMap.drObjectInfo = revisionMap.drObjectInfo
+ custAndWorkEfffList = from("CustRequestAndWorkEffort").where("workEffortId", revisionMap.workEffortId).queryList()
if (custAndWorkEfffList) {
- custAndWorkEfffMap = custAndWorkEfffList[0];
- custAndCustItemList = from("CustRequestAndCustRequestItem").where("custRequestId", custAndWorkEfffMap.custRequestId).queryList();
+ custAndWorkEfffMap = custAndWorkEfffList[0]
+ custAndCustItemList = from("CustRequestAndCustRequestItem").where("custRequestId", custAndWorkEfffMap.custRequestId).queryList()
if (custAndCustItemList) {
- custAndCustItemMap = custAndCustItemList[0];
- inputMap.productId = custAndCustItemMap.productId;
- inputMap.custRequestId = custAndCustItemMap.custRequestId;
+ custAndCustItemMap = custAndCustItemList[0]
+ inputMap.productId = custAndCustItemMap.productId
+ inputMap.custRequestId = custAndCustItemMap.custRequestId
}
}
- listIt.add(inputMap);
+ listIt.add(inputMap)
}
- context.listIt = listIt;
+ context.listIt = listIt
}
}
diff --git a/specialpurpose/scrum/groovyScripts/ListScrumPreferenceSecurityGroup.groovy b/specialpurpose/scrum/groovyScripts/ListScrumPreferenceSecurityGroup.groovy
index 4ee0050f59..b82a676b50 100644
--- a/specialpurpose/scrum/groovyScripts/ListScrumPreferenceSecurityGroup.groovy
+++ b/specialpurpose/scrum/groovyScripts/ListScrumPreferenceSecurityGroup.groovy
@@ -17,70 +17,70 @@
* under the License.
*/
-import org.apache.ofbiz.entity.condition.*;
-import org.apache.ofbiz.base.util.*;
-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.entity.condition.*
+import org.apache.ofbiz.base.util.*
+import org.apache.ofbiz.entity.util.EntityUtil
+import org.apache.ofbiz.entity.condition.EntityCondition
+import org.apache.ofbiz.entity.condition.EntityOperator
-partyId = parameters.partyId;
+partyId = parameters.partyId
-andCond = [];
-orCond = [];
-combinedCondList = [];
+andCond = []
+orCond = []
+combinedCondList = []
-andCond.add(EntityCondition.makeCondition("partyId", EntityOperator.EQUALS, partyId));
-andCond.add(EntityCondition.makeCondition("partyStatusId", EntityOperator.EQUALS, "PARTY_ENABLED"));
+andCond.add(EntityCondition.makeCondition("partyId", EntityOperator.EQUALS, partyId))
+andCond.add(EntityCondition.makeCondition("partyStatusId", EntityOperator.EQUALS, "PARTY_ENABLED"))
-orCond.add(EntityCondition.makeCondition("groupId", EntityOperator.EQUALS, "SCRUM_PRODUCT_OWNER"));
-orCond.add(EntityCondition.makeCondition("groupId", EntityOperator.EQUALS, "SCRUM_MASTER"));
-orCond.add(EntityCondition.makeCondition("groupId", EntityOperator.EQUALS, "SCRUM_TEAM"));
-orCond.add(EntityCondition.makeCondition("enabled", EntityOperator.EQUALS, "Y"));
-orCond.add(EntityCondition.makeCondition("enabled", EntityOperator.EQUALS, null));
+orCond.add(EntityCondition.makeCondition("groupId", EntityOperator.EQUALS, "SCRUM_PRODUCT_OWNER"))
+orCond.add(EntityCondition.makeCondition("groupId", EntityOperator.EQUALS, "SCRUM_MASTER"))
+orCond.add(EntityCondition.makeCondition("groupId", EntityOperator.EQUALS, "SCRUM_TEAM"))
+orCond.add(EntityCondition.makeCondition("enabled", EntityOperator.EQUALS, "Y"))
+orCond.add(EntityCondition.makeCondition("enabled", EntityOperator.EQUALS, null))
-orCondList = EntityCondition.makeCondition(orCond, EntityOperator.OR);
-andCondList = EntityCondition.makeCondition(andCond, EntityOperator.AND);
+orCondList = EntityCondition.makeCondition(orCond, EntityOperator.OR)
+andCondList = EntityCondition.makeCondition(andCond, EntityOperator.AND)
-combinedCondList.add(orCondList);
-combinedCondList.add(andCondList);
+combinedCondList.add(orCondList)
+combinedCondList.add(andCondList)
-combinedConds = EntityCondition.makeCondition(combinedCondList, EntityOperator.AND);
+combinedConds = EntityCondition.makeCondition(combinedCondList, EntityOperator.AND)
-scrumUserLoginSecurityGroupList = from("ScrumMemberUserLoginAndSecurityGroup").where(combinedConds).queryList();
-userPreferenceList = [];
-userPreferenceOutList = [];
+scrumUserLoginSecurityGroupList = from("ScrumMemberUserLoginAndSecurityGroup").where(combinedConds).queryList()
+userPreferenceList = []
+userPreferenceOutList = []
if (scrumUserLoginSecurityGroupList) {
scrumUserLoginSecurityGroupList.each { scrumUserLoginSecurityGroupMap ->
if (scrumUserLoginSecurityGroupMap.groupId == "SCRUM_PRODUCT_OWNER") {
- ownerCond = [];
- ownerCond.add(EntityCondition.makeCondition("enumTypeId", EntityOperator.EQUALS, "SCRUM_PREFERENCE"));
- ownerCond.add(EntityCondition.makeCondition("enumId", EntityOperator.NOT_EQUAL, "MASTER_NOTIFY"));
- ownerConds = EntityCondition.makeCondition(ownerCond, EntityOperator.AND);
- userPreferenceList = from("Enumeration").where(ownerConds).queryList();
+ ownerCond = []
+ ownerCond.add(EntityCondition.makeCondition("enumTypeId", EntityOperator.EQUALS, "SCRUM_PREFERENCE"))
+ ownerCond.add(EntityCondition.makeCondition("enumId", EntityOperator.NOT_EQUAL, "MASTER_NOTIFY"))
+ ownerConds = EntityCondition.makeCondition(ownerCond, EntityOperator.AND)
+ userPreferenceList = from("Enumeration").where(ownerConds).queryList()
} else if (scrumUserLoginSecurityGroupMap.groupId == "SCRUM_MASTER") {
- masterCond = [];
- masterCond.add(EntityCondition.makeCondition("enumTypeId", EntityOperator.EQUALS, "SCRUM_PREFERENCE"));
- masterCond.add(EntityCondition.makeCondition("enumId", EntityOperator.EQUALS, "MASTER_NOTIFY"));
- masterConds = EntityCondition.makeCondition(masterCond, EntityOperator.AND);
- userPreferenceList = from("Enumeration").where(masterConds).queryList();
+ masterCond = []
+ masterCond.add(EntityCondition.makeCondition("enumTypeId", EntityOperator.EQUALS, "SCRUM_PREFERENCE"))
+ masterCond.add(EntityCondition.makeCondition("enumId", EntityOperator.EQUALS, "MASTER_NOTIFY"))
+ masterConds = EntityCondition.makeCondition(masterCond, EntityOperator.AND)
+ userPreferenceList = from("Enumeration").where(masterConds).queryList()
} /*else if (scrumUserLoginSecurityGroupMap.groupId == "SCRUM_TEAM") {
- teamCond = [];
- teamCond.add(EntityCondition.makeCondition("enumTypeId", EntityOperator.EQUALS, "SCRUM_PREFERENCE"));
- teamCond.add(EntityCondition.makeCondition("enumId", EntityOperator.EQUALS, "INVITE_NOTIFI"));
- teamConds = EntityCondition.makeCondition(teamCond, EntityOperator.AND);
- userPreferenceList = delegator.findList("Enumeration" , teamConds, null, null, null, false);
+ teamCond = []
+ teamCond.add(EntityCondition.makeCondition("enumTypeId", EntityOperator.EQUALS, "SCRUM_PREFERENCE"))
+ teamCond.add(EntityCondition.makeCondition("enumId", EntityOperator.EQUALS, "INVITE_NOTIFI"))
+ teamConds = EntityCondition.makeCondition(teamCond, EntityOperator.AND)
+ userPreferenceList = delegator.findList("Enumeration" , teamConds, null, null, null, false)
}*/
if (userPreferenceList) {
userPreferenceList.each { userPreferenceMap ->
- userPreferenceOutList.add(userPreferenceMap);
+ userPreferenceOutList.add(userPreferenceMap)
}
}
}
- context.userPreferenceList = userPreferenceOutList;
+ context.userPreferenceList = userPreferenceOutList
} else {
if (security.hasEntityPermission("SCRUM", "_ADMIN", session)) {
- userPreferenceList = from("Enumeration").where("enumTypeId", "SCRUM_PREFERENCE").queryList();
- context.userPreferenceList = userPreferenceList;
+ userPreferenceList = from("Enumeration").where("enumTypeId", "SCRUM_PREFERENCE").queryList()
+ context.userPreferenceList = userPreferenceList
}
}
diff --git a/specialpurpose/scrum/groovyScripts/ListScrumResource.groovy b/specialpurpose/scrum/groovyScripts/ListScrumResource.groovy
index 64c71757b9..68bdf50ec4 100644
--- a/specialpurpose/scrum/groovyScripts/ListScrumResource.groovy
+++ b/specialpurpose/scrum/groovyScripts/ListScrumResource.groovy
@@ -17,37 +17,37 @@
* under the License.
*/
-import java.util.*;
-import java.lang.*;
-import org.apache.ofbiz.entity.*;
-import org.apache.ofbiz.entity.condition.*;
-import org.apache.ofbiz.entity.util.*;
-import org.apache.ofbiz.base.util.*;
-import org.apache.ofbiz.entity.condition.EntityFunction;
+import java.util.*
+import java.lang.*
+import org.apache.ofbiz.entity.*
+import org.apache.ofbiz.entity.condition.*
+import org.apache.ofbiz.entity.util.*
+import org.apache.ofbiz.base.util.*
+import org.apache.ofbiz.entity.condition.EntityFunction
-def module = "ListScrumResource.groovy";
+def module = "ListScrumResource.groovy"
-performFindInMap = [:];
-performFindInMap.entityName = "ScrumMemberUserLoginAndSecurityGroup";
-inputFields = [:];
-outputList = [];
+performFindInMap = [:]
+performFindInMap.entityName = "ScrumMemberUserLoginAndSecurityGroup"
+inputFields = [:]
+outputList = []
-inputFields.putAll(parameters);
-performFindInMap.noConditionFind = "Y";
-performFindInMap.inputFields = inputFields;
-performFindInMap.orderBy = parameters.sortField;
+inputFields.putAll(parameters)
+performFindInMap.noConditionFind = "Y"
+performFindInMap.inputFields = inputFields
+performFindInMap.orderBy = parameters.sortField
if (parameters.sortField) {
- performFindInMap.orderBy = "lastName";
+ performFindInMap.orderBy = "lastName"
}
-performFindResults = runService('performFind', performFindInMap);
-resultList = performFindResults.listIt.getCompleteList();
-performFindResults.listIt.close();
+performFindResults = runService('performFind', performFindInMap)
+resultList = performFindResults.listIt.getCompleteList()
+performFindResults.listIt.close()
resultList.each() { result ->
if (!"N".equals(result.enabled)) {
- outputList.add(result);
+ outputList.add(result)
}
}
if (outputList) {
- context.listIt = outputList;
+ context.listIt = outputList
}
\ No newline at end of file
diff --git a/specialpurpose/scrum/groovyScripts/ListScrumRolesPersonAndCompany.groovy b/specialpurpose/scrum/groovyScripts/ListScrumRolesPersonAndCompany.groovy
index 95afcca160..b3ccd53c0c 100644
--- a/specialpurpose/scrum/groovyScripts/ListScrumRolesPersonAndCompany.groovy
+++ b/specialpurpose/scrum/groovyScripts/ListScrumRolesPersonAndCompany.groovy
@@ -17,51 +17,51 @@
* under the License.
*/
-import org.apache.ofbiz.entity.condition.*;
-import org.apache.ofbiz.base.util.*;
-import org.apache.ofbiz.entity.util.EntityUtil;
+import org.apache.ofbiz.entity.condition.*
+import org.apache.ofbiz.base.util.*
+import org.apache.ofbiz.entity.util.EntityUtil
productId = parameters.productId
-personAndCompanyList = [];
+personAndCompanyList = []
if (productId) {
- productRoleList = from("ProductRole").where("productId" : productId, "roleTypeId" : "PRODUCT_OWNER_COMP").queryList();
+ productRoleList = from("ProductRole").where("productId" : productId, "roleTypeId" : "PRODUCT_OWNER_COMP").queryList()
if (productRoleList) {
personAndComCond = EntityCondition.makeCondition([
EntityCondition.makeCondition ("roleTypeId", EntityOperator.EQUALS, "PRODUCT_OWNER"),
EntityCondition.makeCondition ("partyIdFrom", EntityOperator.EQUALS, productRoleList[0].partyId),
EntityCondition.makeCondition ("partyStatusId", EntityOperator.NOT_EQUAL, "PARTY_DISABLED"),
EntityCondition.makeCondition ("thruDate", EntityOperator.EQUALS, null)
- ], EntityJoinOperator.AND);
- personAndCompanyList = from("ScrumRolesPersonAndCompany").where(personAndComCond).orderBy("groupName").queryList();
+ ], EntityJoinOperator.AND)
+ personAndCompanyList = from("ScrumRolesPersonAndCompany").where(personAndComCond).orderBy("groupName").queryList()
}
}
if (personAndCompanyList) {
- context.companyCurrentList = personAndCompanyList;
- context.companyCurrent = personAndCompanyList[0].partyId;
+ context.companyCurrentList = personAndCompanyList
+ context.companyCurrent = personAndCompanyList[0].partyId
} else {
- context.companyCurrent = null;
+ context.companyCurrent = null
}
// Get owner with security group
-scrumRolesPersonAndCompanyList = [];
+scrumRolesPersonAndCompanyList = []
personAndComConds = EntityCondition.makeCondition([
EntityCondition.makeCondition ("roleTypeId", EntityOperator.EQUALS, "PRODUCT_OWNER"),
EntityCondition.makeCondition ("partyStatusId", EntityOperator.NOT_EQUAL, "PARTY_DISABLED"),
EntityCondition.makeCondition ("thruDate", EntityOperator.EQUALS, null)
- ], EntityJoinOperator.AND);
-personAndCompanyList = from("ScrumRolesPersonAndCompany").where(personAndComConds).orderBy("groupName").queryList();
+ ], EntityJoinOperator.AND)
+personAndCompanyList = from("ScrumRolesPersonAndCompany").where(personAndComConds).orderBy("groupName").queryList()
if (personAndCompanyList) {
personAndCompanyList.each { personAndCompanyMap ->
- partyId = personAndCompanyMap.partyId;
+ partyId = personAndCompanyMap.partyId
securityGroupCond = EntityCondition.makeCondition([
EntityCondition.makeCondition ("partyId", EntityOperator.EQUALS, partyId),
EntityCondition.makeCondition ("partyStatusId", EntityOperator.NOT_EQUAL, "PARTY_DISABLED")
- ], EntityJoinOperator.AND);
- securityGroupList = from("ScrumMemberUserLoginAndSecurityGroup").where(securityGroupCond).queryList();
+ ], EntityJoinOperator.AND)
+ securityGroupList = from("ScrumMemberUserLoginAndSecurityGroup").where(securityGroupCond).queryList()
if (securityGroupList) {
- scrumRolesPersonAndCompanyList.add(personAndCompanyMap);
+ scrumRolesPersonAndCompanyList.add(personAndCompanyMap)
}
}
}
-context.scrumRolesPersonAndCompanyList = scrumRolesPersonAndCompanyList;
+context.scrumRolesPersonAndCompanyList = scrumRolesPersonAndCompanyList
diff --git a/specialpurpose/scrum/groovyScripts/ListTimeSheets.groovy b/specialpurpose/scrum/groovyScripts/ListTimeSheets.groovy
index 65ad25015c..0f758c6666 100644
--- a/specialpurpose/scrum/groovyScripts/ListTimeSheets.groovy
+++ b/specialpurpose/scrum/groovyScripts/ListTimeSheets.groovy
@@ -17,58 +17,58 @@
* 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.Debug;
-import org.apache.ofbiz.base.util.UtilDateTime;
+import org.apache.ofbiz.entity.*
+import org.apache.ofbiz.entity.util.*
+import org.apache.ofbiz.entity.condition.*
+import org.apache.ofbiz.base.util.Debug
+import org.apache.ofbiz.base.util.UtilDateTime
// get all timesheets of all user, including the planned hours
-timesheets = [];
-inputFields = [:];
+timesheets = []
+inputFields = [:]
if (!parameters.noConditionFind) {
parameters.noConditionFind = "N"
}
-inputFields.putAll(parameters);
-performFindResults = runService('performFind', ["entityName": "Timesheet", "inputFields": inputFields, "orderBy": "fromDate DESC"]);
+inputFields.putAll(parameters)
+performFindResults = runService('performFind', ["entityName": "Timesheet", "inputFields": inputFields, "orderBy": "fromDate DESC"])
if (performFindResults.listSize > 0) {
- timesheetsDb = performFindResults.listIt.getCompleteList();
- performFindResults.listIt.close();
+ timesheetsDb = performFindResults.listIt.getCompleteList()
+ performFindResults.listIt.close()
timesheetsDb.each { timesheetDb ->
- //get hours from EmplLeave;
- findOpts = new EntityFindOptions(true, EntityFindOptions.TYPE_SCROLL_INSENSITIVE, EntityFindOptions.CONCUR_READ_ONLY, true);
- leaveExprsList = [];
- leaveExprsList.add(EntityCondition.makeCondition("fromDate", EntityOperator.GREATER_THAN_EQUAL_TO, timesheetDb.fromDate));
- leaveExprsList.add(EntityCondition.makeCondition("fromDate", EntityOperator.LESS_THAN_EQUAL_TO, timesheetDb.thruDate));
- leaveExprsList.add(EntityCondition.makeCondition("partyId", EntityOperator.EQUALS, timesheetDb.partyId));
- emplLeaveList = from("EmplLeave").where(leaveExprsList).cursorScrollInsensitive().distinct().queryIterator();
- leaveHours = 0.00;
+ //get hours from EmplLeave
+ findOpts = new EntityFindOptions(true, EntityFindOptions.TYPE_SCROLL_INSENSITIVE, EntityFindOptions.CONCUR_READ_ONLY, true)
+ leaveExprsList = []
+ leaveExprsList.add(EntityCondition.makeCondition("fromDate", EntityOperator.GREATER_THAN_EQUAL_TO, timesheetDb.fromDate))
+ leaveExprsList.add(EntityCondition.makeCondition("fromDate", EntityOperator.LESS_THAN_EQUAL_TO, timesheetDb.thruDate))
+ leaveExprsList.add(EntityCondition.makeCondition("partyId", EntityOperator.EQUALS, timesheetDb.partyId))
+ emplLeaveList = from("EmplLeave").where(leaveExprsList).cursorScrollInsensitive().distinct().queryIterator()
+ leaveHours = 0.00
while ((emplLeaveMap = emplLeaveList.next())) {
- emplLeaveEntry = emplLeaveMap;
+ emplLeaveEntry = emplLeaveMap
resultHour = runService('getPartyLeaveHoursForDate',
- ["userLogin": parameters.userLogin, "partyId": emplLeaveEntry.partyId, "leaveTypeId": emplLeaveEntry.leaveTypeId, "fromDate": emplLeaveEntry.fromDate]);
+ ["userLogin": parameters.userLogin, "partyId": emplLeaveEntry.partyId, "leaveTypeId": emplLeaveEntry.leaveTypeId, "fromDate": emplLeaveEntry.fromDate])
if (resultHour) {
- leaveActualHours = resultHour.hours.doubleValue();
- leaveHours += leaveActualHours;
+ leaveActualHours = resultHour.hours.doubleValue()
+ leaveHours += leaveActualHours
}
}
- //get hours from TimeEntry;
- timesheet = [:];
- timesheet.putAll(timesheetDb);
- entries = timesheetDb.getRelated("TimeEntry", null, null, false);
- hours = 0.00;
+ //get hours from TimeEntry
+ timesheet = [:]
+ timesheet.putAll(timesheetDb)
+ entries = timesheetDb.getRelated("TimeEntry", null, null, false)
+ hours = 0.00
entries.each { timeEntry ->
if (timeEntry.hours) {
- hours += timeEntry.hours.doubleValue();
+ hours += timeEntry.hours.doubleValue()
}
}
- timesheet.weekNumber = UtilDateTime.weekNumber(timesheetDb.fromDate);
- timesheet.hours = hours + leaveHours;
- timesheets.add(timesheet);
- emplLeaveList.close();
+ timesheet.weekNumber = UtilDateTime.weekNumber(timesheetDb.fromDate)
+ timesheet.hours = hours + leaveHours
+ timesheets.add(timesheet)
+ emplLeaveList.close()
}
- context.timesheets = timesheets;
+ context.timesheets = timesheets
}
diff --git a/specialpurpose/scrum/groovyScripts/ListUnplanBacklog.groovy b/specialpurpose/scrum/groovyScripts/ListUnplanBacklog.groovy
index 30d6b83433..2aa7716c2a 100644
--- a/specialpurpose/scrum/groovyScripts/ListUnplanBacklog.groovy
+++ b/specialpurpose/scrum/groovyScripts/ListUnplanBacklog.groovy
@@ -17,32 +17,32 @@
* under the License.
*/
-import org.apache.ofbiz.entity.condition.*;
-import org.apache.ofbiz.base.util.*;
+import org.apache.ofbiz.entity.condition.*
+import org.apache.ofbiz.base.util.*
-taskStatusId = null;
-paraBacklogStatusId = backlogStatusId;
+taskStatusId = null
+paraBacklogStatusId = backlogStatusId
-orStsExprs = [];
+orStsExprs = []
if (backlogStatusId != "Any") {
- taskStatusId = "STS_CREATED";
- orStsExprs.add(EntityCondition.makeCondition("statusId", EntityOperator.EQUALS, "CRQ_REVIEWED"));
+ taskStatusId = "STS_CREATED"
+ orStsExprs.add(EntityCondition.makeCondition("statusId", EntityOperator.EQUALS, "CRQ_REVIEWED"))
} else {
- orStsExprs.add(EntityCondition.makeCondition("statusId", EntityOperator.EQUALS, "CRQ_REVIEWED"));
- orStsExprs.add(EntityCondition.makeCondition("statusId", EntityOperator.EQUALS, "CRQ_COMPLETED"));
+ orStsExprs.add(EntityCondition.makeCondition("statusId", EntityOperator.EQUALS, "CRQ_REVIEWED"))
+ orStsExprs.add(EntityCondition.makeCondition("statusId", EntityOperator.EQUALS, "CRQ_COMPLETED"))
}
-orCurentExprs = [];
+orCurentExprs = []
if (taskStatusId) {
- orCurentExprs.add(EntityCondition.makeCondition("currentStatusId", EntityOperator.EQUALS, taskStatusId));
- orCurentExprs.add(EntityCondition.makeCondition("currentStatusId", EntityOperator.EQUALS, null));
+ orCurentExprs.add(EntityCondition.makeCondition("currentStatusId", EntityOperator.EQUALS, taskStatusId))
+ orCurentExprs.add(EntityCondition.makeCondition("currentStatusId", EntityOperator.EQUALS, null))
}
-andExprs = [];
- andExprs.add(EntityCondition.makeCondition("productId", EntityOperator.EQUALS, parameters.productId));
- andExprs.add(EntityCondition.makeCondition("custRequestTypeId", EntityOperator.EQUALS, "RF_UNPLAN_BACKLOG"));
- andExprs.add(EntityCondition.makeCondition(orStsExprs, EntityOperator.OR));
- andExprs.add(EntityCondition.makeCondition(orCurentExprs, EntityOperator.OR));
-unplannedBacklogCond = EntityCondition.makeCondition(andExprs, EntityOperator.AND);
-unplannedBacklogList = from("UnPlannedBacklogsAndTasks").where(unplannedBacklogCond).orderBy("-custRequestId","workEffortTypeId","custSequenceNum").queryList();
+andExprs = []
+ andExprs.add(EntityCondition.makeCondition("productId", EntityOperator.EQUALS, parameters.productId))
+ andExprs.add(EntityCondition.makeCondition("custRequestTypeId", EntityOperator.EQUALS, "RF_UNPLAN_BACKLOG"))
+ andExprs.add(EntityCondition.makeCondition(orStsExprs, EntityOperator.OR))
+ andExprs.add(EntityCondition.makeCondition(orCurentExprs, EntityOperator.OR))
+unplannedBacklogCond = EntityCondition.makeCondition(andExprs, EntityOperator.AND)
+unplannedBacklogList = from("UnPlannedBacklogsAndTasks").where(unplannedBacklogCond).orderBy("-custRequestId","workEffortTypeId","custSequenceNum").queryList()
-context.listIt = unplannedBacklogList;
-context.paraBacklogStatusId = paraBacklogStatusId;
+context.listIt = unplannedBacklogList
+context.paraBacklogStatusId = paraBacklogStatusId
diff --git a/specialpurpose/scrum/groovyScripts/ProductBilling.groovy b/specialpurpose/scrum/groovyScripts/ProductBilling.groovy
index 5b2f479f39..0ddcbf55be 100644
--- a/specialpurpose/scrum/groovyScripts/ProductBilling.groovy
+++ b/specialpurpose/scrum/groovyScripts/ProductBilling.groovy
@@ -18,76 +18,76 @@
* under the License.
*/
-import java.sql.Timestamp;
-import org.apache.ofbiz.base.util.*;
-import org.apache.ofbiz.base.util.UtilDateTime;
-import org.apache.ofbiz.entity.*;
-import org.apache.ofbiz.entity.condition.*;
-import org.apache.ofbiz.entity.util.*;
+import java.sql.Timestamp
+import org.apache.ofbiz.base.util.*
+import org.apache.ofbiz.base.util.UtilDateTime
+import org.apache.ofbiz.entity.*
+import org.apache.ofbiz.entity.condition.*
+import org.apache.ofbiz.entity.util.*
-productId = parameters.productId;
+productId = parameters.productId
entryExprs =
EntityCondition.makeCondition([
EntityCondition.makeCondition("productId", EntityOperator.EQUALS, productId),
EntityCondition.makeCondition("invoiceId", EntityOperator.NOT_EQUAL, null),
- ], EntityOperator.AND);
+ ], EntityOperator.AND)
// check if latest invoice generated is still in process so allow re-generation to correct errors
-entryIterator = from("ProjectSprintBacklogTaskAndTimeEntryTimeSheet").where(entryExprs).orderBy("-fromDate").queryIterator();
+entryIterator = from("ProjectSprintBacklogTaskAndTimeEntryTimeSheet").where(entryExprs).orderBy("-fromDate").queryIterator()
while (entryItem = entryIterator.next()) {
- invoice = entryItem.getRelatedOne("Invoice", false);
+ invoice = entryItem.getRelatedOne("Invoice", false)
if (invoice.getString("statusId").equals("INVOICE_IN_PROCESS")) {
- context.partyIdFrom = invoice.partyIdFrom;
- context.partyId = invoice.partyId;
- context.invoiceId = invoice.invoiceId;
- context.invoiceDate = invoice.invoiceDate;
- break;
+ context.partyIdFrom = invoice.partyIdFrom
+ context.partyId = invoice.partyId
+ context.invoiceId = invoice.invoiceId
+ context.invoiceDate = invoice.invoiceDate
+ break
}
}
-entryIterator.close();
+entryIterator.close()
//start of this month
-context.thruDate = UtilDateTime.getMonthStart(UtilDateTime.nowTimestamp());
+context.thruDate = UtilDateTime.getMonthStart(UtilDateTime.nowTimestamp())
// build find task conditions
-def taskConds = UtilMisc.toList(EntityCondition.makeCondition("productId", parameters.productId));
-taskConds.add(EntityCondition.makeCondition("invoiceId", null));
-taskConds.add(EntityCondition.makeCondition("timesheetStatusId", "TIMESHEET_COMPLETED"));
+def taskConds = UtilMisc.toList(EntityCondition.makeCondition("productId", parameters.productId))
+taskConds.add(EntityCondition.makeCondition("invoiceId", null))
+taskConds.add(EntityCondition.makeCondition("timesheetStatusId", "TIMESHEET_COMPLETED"))
if (parameters.fromDate) {
- fromDate = parameters.fromDate;
+ fromDate = parameters.fromDate
if (fromDate.length() < 14) {
- fromDate = fromDate + " " + "00:00:00.000";
+ fromDate = fromDate + " " + "00:00:00.000"
}
- taskConds.add(EntityCondition.makeCondition("fromDate", EntityOperator.GREATER_THAN_EQUAL_TO, Timestamp.valueOf(fromDate)));
+ taskConds.add(EntityCondition.makeCondition("fromDate", EntityOperator.GREATER_THAN_EQUAL_TO, Timestamp.valueOf(fromDate)))
}
if (parameters.thruDate) {
- thruDate = parameters.thruDate;
+ thruDate = parameters.thruDate
if (thruDate.length() < 14) {
- thruDate = thruDate + " " + "00:00:00.000";
+ thruDate = thruDate + " " + "00:00:00.000"
}
- taskConds.add(EntityCondition.makeCondition("fromDate", EntityOperator.LESS_THAN, Timestamp.valueOf(thruDate)));
+ taskConds.add(EntityCondition.makeCondition("fromDate", EntityOperator.LESS_THAN, Timestamp.valueOf(thruDate)))
} else {
- taskConds.add(EntityCondition.makeCondition("fromDate", EntityOperator.LESS_THAN, context.thruDate));
+ taskConds.add(EntityCondition.makeCondition("fromDate", EntityOperator.LESS_THAN, context.thruDate))
}
// include meeting ?
if ("N".equals(includeMeeting)) {
- taskConds.add(EntityCondition.makeCondition("custRequestTypeId", EntityOperator.NOT_EQUAL, "RF_SCRUM_MEETINGS"));
+ taskConds.add(EntityCondition.makeCondition("custRequestTypeId", EntityOperator.NOT_EQUAL, "RF_SCRUM_MEETINGS"))
}
// get sprint task list
-def sprintTasks = from("ProjectSprintBacklogTaskAndTimeEntryTimeSheet").where(taskConds).queryList();
+def sprintTasks = from("ProjectSprintBacklogTaskAndTimeEntryTimeSheet").where(taskConds).queryList()
// get cancelled backlog task list
-def cancelledBacklogTasks = from("CancelledBacklogsTaskAndTimeEntryTimeSheet").where(taskConds).queryList();
+def cancelledBacklogTasks = from("CancelledBacklogsTaskAndTimeEntryTimeSheet").where(taskConds).queryList()
// get unplanned task list
-def unplannedTasks = from("UnPlannedBacklogsTaskAndTimeEntryTimeSheet").where(taskConds).queryList();
+def unplannedTasks = from("UnPlannedBacklogsTaskAndTimeEntryTimeSheet").where(taskConds).queryList()
-def hoursNotYetBilledTasks = [];
-hoursNotYetBilledTasks.addAll(sprintTasks);
-hoursNotYetBilledTasks.addAll(cancelledBacklogTasks);
-hoursNotYetBilledTasks.addAll(unplannedTasks);
+def hoursNotYetBilledTasks = []
+hoursNotYetBilledTasks.addAll(sprintTasks)
+hoursNotYetBilledTasks.addAll(cancelledBacklogTasks)
+hoursNotYetBilledTasks.addAll(unplannedTasks)
context.hoursNotYetBilledTasks = UtilMisc.sortMaps(hoursNotYetBilledTasks, ["productId","custRequestId","taskId","fromDate"])
// get time entry date
timeEntryList = UtilMisc.sortMaps(hoursNotYetBilledTasks, ["fromDate"])
if (!parameters.fromDate && timeEntryList) {
- context.resultDate = timeEntryList[0].fromDate;
+ context.resultDate = timeEntryList[0].fromDate
}
diff --git a/specialpurpose/scrum/groovyScripts/ProductEmail.groovy b/specialpurpose/scrum/groovyScripts/ProductEmail.groovy
index 271f2756f1..e329ac8e36 100644
--- a/specialpurpose/scrum/groovyScripts/ProductEmail.groovy
+++ b/specialpurpose/scrum/groovyScripts/ProductEmail.groovy
@@ -17,86 +17,86 @@
* under the License.
*/
-import java.util.*;
-import java.lang.*;
-import org.apache.ofbiz.base.util.*;
-import org.apache.ofbiz.entity.*;
-import org.apache.ofbiz.base.util.Debug;
-import org.apache.ofbiz.base.util.UtilValidate;
-import org.apache.ofbiz.entity.util.*;
+import java.util.*
+import java.lang.*
+import org.apache.ofbiz.base.util.*
+import org.apache.ofbiz.entity.*
+import org.apache.ofbiz.base.util.Debug
+import org.apache.ofbiz.base.util.UtilValidate
+import org.apache.ofbiz.entity.util.*
-productId = parameters.productId;
-loginPartyId = userLogin.partyId;
-communicationEventId = parameters.communicationEventId;
-now = UtilDateTime.nowTimestamp();
+productId = parameters.productId
+loginPartyId = userLogin.partyId
+communicationEventId = parameters.communicationEventId
+now = UtilDateTime.nowTimestamp()
try{
if (UtilValidate.isNotEmpty(loginPartyId)) {
if (UtilValidate.isNotEmpty(productId)) {
- context.product = from("Product").where("productId", productId).queryOne();
+ context.product = from("Product").where("productId", productId).queryOne()
}
- communicationEvent = from("CommunicationEvent").where("communicationEventId", communicationEventId).queryOne();
- communicationEvent.communicationEventTypeId = "EMAIL_COMMUNICATION";
- communicationEvent.contactMechTypeId = "EMAIL_ADDRESS";
- communicationEvent.datetimeStarted = now;
- checkOwner = from("ProductRole").where("productId", productId,"partyId", loginPartyId,"roleTypeId", "PRODUCT_OWNER").queryList();
+ communicationEvent = from("CommunicationEvent").where("communicationEventId", communicationEventId).queryOne()
+ communicationEvent.communicationEventTypeId = "EMAIL_COMMUNICATION"
+ communicationEvent.contactMechTypeId = "EMAIL_ADDRESS"
+ communicationEvent.datetimeStarted = now
+ checkOwner = from("ProductRole").where("productId", productId,"partyId", loginPartyId,"roleTypeId", "PRODUCT_OWNER").queryList()
if (checkOwner) {
/* for product owner to our company */
// for owner
- productRole = from("ProductRole").where("productId", productId,"roleTypeId", "PRODUCT_OWNER").queryList();
+ productRole = from("ProductRole").where("productId", productId,"roleTypeId", "PRODUCT_OWNER").queryList()
context.productOwnerId = productRole[0].partyId
- parentCom = from("CommunicationEvent").where("communicationEventId", communicationEventId).queryOne();
+ parentCom = from("CommunicationEvent").where("communicationEventId", communicationEventId).queryOne()
if (parentCom) {
- context.partyIdFrom = productRole[0].partyId;
+ context.partyIdFrom = productRole[0].partyId
} else {
- context.partyIdFrom = parentCom.partyIdTo;
+ context.partyIdFrom = parentCom.partyIdTo
}
- resultsIdFrom = runService('getPartyEmail', ["partyId" : productRole[0].partyId, "userLogin" : userLogin]);
+ resultsIdFrom = runService('getPartyEmail', ["partyId" : productRole[0].partyId, "userLogin" : userLogin])
if (resultsIdFrom.contactMechId != null) {
- context.contactMechIdFrom = resultsIdFrom.contactMechId;
- communicationEvent.contactMechIdFrom = resultsIdFrom.contactMechId;
+ context.contactMechIdFrom = resultsIdFrom.contactMechId
+ communicationEvent.contactMechIdFrom = resultsIdFrom.contactMechId
}
// for team
- defaultPartyIdTo = organizationPartyId;
- resultsIdTo = runService('getPartyEmail', ["partyId" : defaultPartyIdTo,"contactMechPurposeTypeId" :"SUPPORT_EMAIL", "userLogin" : userLogin]);
+ defaultPartyIdTo = organizationPartyId
+ resultsIdTo = runService('getPartyEmail', ["partyId" : defaultPartyIdTo,"contactMechPurposeTypeId" :"SUPPORT_EMAIL", "userLogin" : userLogin])
if (resultsIdTo.contactMechId != null) {
- context.contactMechIdTo = resultsIdTo.contactMechId;
- communicationEvent.contactMechIdTo = resultsIdTo.contactMechId;
+ context.contactMechIdTo = resultsIdTo.contactMechId
+ communicationEvent.contactMechIdTo = resultsIdTo.contactMechId
}
- context.partyIdTo = defaultPartyIdTo;
- communicationEvent.store();
- context.communicationEvent = communicationEvent;
+ context.partyIdTo = defaultPartyIdTo
+ communicationEvent.store()
+ context.communicationEvent = communicationEvent
} else {
/* from company to owner */
// for team
- defaultPartyIdFrom = organizationPartyId;
- context.partyIdFrom = defaultPartyIdFrom;
- resultsIdFrom = runService('getPartyEmail', ["partyId" : defaultPartyIdFrom,"contactMechPurposeTypeId" :"SUPPORT_EMAIL", "userLogin" : userLogin]);
+ defaultPartyIdFrom = organizationPartyId
+ context.partyIdFrom = defaultPartyIdFrom
+ resultsIdFrom = runService('getPartyEmail', ["partyId" : defaultPartyIdFrom,"contactMechPurposeTypeId" :"SUPPORT_EMAIL", "userLogin" : userLogin])
if (resultsIdFrom.contactMechId != null) {
- context.contactMechIdFrom = resultsIdFrom.contactMechId;
- communicationEvent.contactMechIdFrom = resultsIdFrom.contactMechId;
+ context.contactMechIdFrom = resultsIdFrom.contactMechId
+ communicationEvent.contactMechIdFrom = resultsIdFrom.contactMechId
}
// for owner
- productRole = from("ProductRole").where("productId", productId,"roleTypeId", "PRODUCT_OWNER").queryList();
- context.productOwnerId = productRole[0].partyId;
- parentCom = from("CommunicationEvent").where("communicationEventId", communicationEventId).queryOne();
+ productRole = from("ProductRole").where("productId", productId,"roleTypeId", "PRODUCT_OWNER").queryList()
+ context.productOwnerId = productRole[0].partyId
+ parentCom = from("CommunicationEvent").where("communicationEventId", communicationEventId).queryOne()
if(parentCom){
- context.partyIdTo = productRole[0].partyId;
+ context.partyIdTo = productRole[0].partyId
} else {
- context.partyIdTo = parentCom.partyIdFrom;
+ context.partyIdTo = parentCom.partyIdFrom
}
- resultsIdTo = runService('getPartyEmail', ["partyId" : productRole[0].partyId, "userLogin" : userLogin]);
+ resultsIdTo = runService('getPartyEmail', ["partyId" : productRole[0].partyId, "userLogin" : userLogin])
if (resultsIdTo.contactMechId != null) {
- context.contactMechIdTo = resultsIdTo.contactMechId;
- communicationEvent.contactMechIdTo = resultsIdTo.contactMechId;
+ context.contactMechIdTo = resultsIdTo.contactMechId
+ communicationEvent.contactMechIdTo = resultsIdTo.contactMechId
}
- communicationEvent.store();
- context.communicationEvent = communicationEvent;
+ communicationEvent.store()
+ context.communicationEvent = communicationEvent
}
}
} catch (exeption) {
- Debug.logInfo("catch exeption ================" + exeption,"");
+ Debug.logInfo("catch exeption ================" + exeption,"")
} catch (GenericEntityException e) {
- Debug.logInfo("catch GenericEntityException ================" + e.getMessage(),"");
+ Debug.logInfo("catch GenericEntityException ================" + e.getMessage(),"")
}
diff --git a/specialpurpose/scrum/groovyScripts/QuickAddBacklog.groovy b/specialpurpose/scrum/groovyScripts/QuickAddBacklog.groovy
index 0e1360279b..76c2156a33 100644
--- a/specialpurpose/scrum/groovyScripts/QuickAddBacklog.groovy
+++ b/specialpurpose/scrum/groovyScripts/QuickAddBacklog.groovy
@@ -17,77 +17,77 @@
* under the License.
*/
-import org.apache.ofbiz.base.util.Debug;
+import org.apache.ofbiz.base.util.Debug
try{
// for sprint dropdown
- workEffortList = [];
- sprintList = from("WorkEffort").where("workEffortTypeId", "SCRUM_SPRINT","currentStatusId", "SPRINT_ACTIVE").queryList();
+ workEffortList = []
+ sprintList = from("WorkEffort").where("workEffortTypeId", "SCRUM_SPRINT","currentStatusId", "SPRINT_ACTIVE").queryList()
if (sprintList) {
sprintList.each{ sprintMap ->
- workEffortMap = [:];
- workEffortParentId = sprintMap.workEffortParentId;
+ workEffortMap = [:]
+ workEffortParentId = sprintMap.workEffortParentId
if (workEffortParentId) {
- projectList = from("WorkEffortAndProduct").where("workEffortId", workEffortParentId).queryList();
- projectMap = projectList[0];
+ projectList = from("WorkEffortAndProduct").where("workEffortId", workEffortParentId).queryList()
+ projectMap = projectList[0]
// make sure that project dose not closed
if (projectMap.currentStatusId != "SPJ_CLOSED") {
- productMap = from("Product").where("productId", projectMap.productId).queryOne();
- workEffortMap.productId = productMap.productId;
- workEffortMap.internalName = returnNameAsString(productMap.internalName,30);
- workEffortMap.projectId = projectMap.workEffortId;
- workEffortMap.projectName = returnNameAsString(projectMap.workEffortName,30);
- workEffortMap.sprintId = sprintMap.workEffortId;
- workEffortMap.sprintName = returnNameAsString(sprintMap.workEffortName,30);
- workEffortMap.keyId = productMap.productId+","+projectMap.workEffortId+","+sprintMap.workEffortId;
- workEffortList.add(workEffortMap);
+ productMap = from("Product").where("productId", projectMap.productId).queryOne()
+ workEffortMap.productId = productMap.productId
+ workEffortMap.internalName = returnNameAsString(productMap.internalName,30)
+ workEffortMap.projectId = projectMap.workEffortId
+ workEffortMap.projectName = returnNameAsString(projectMap.workEffortName,30)
+ workEffortMap.sprintId = sprintMap.workEffortId
+ workEffortMap.sprintName = returnNameAsString(sprintMap.workEffortName,30)
+ workEffortMap.keyId = productMap.productId+","+projectMap.workEffortId+","+sprintMap.workEffortId
+ workEffortList.add(workEffortMap)
}
}
}
- context.workEffortList = workEffortList;
+ context.workEffortList = workEffortList
}
// for backlog category
- productId = null;
+ productId = null
if (parameters.productId) {
- productId = parameters.productId;
+ productId = parameters.productId
} else {
if (parameters.keyId) {
- indexList = parameters.keyId.tokenize(",");
- productId = indexList[0].toString().trim();
+ indexList = parameters.keyId.tokenize(",")
+ productId = indexList[0].toString().trim()
}
}
- categoryList = [];
+ categoryList = []
if (productId) {
- sprintList = from("CustRequestAndCustRequestItem").where("custRequestTypeId", "RF_PARENT_BACKLOG","productId", productId).queryList();
+ sprintList = from("CustRequestAndCustRequestItem").where("custRequestTypeId", "RF_PARENT_BACKLOG","productId", productId).queryList()
} else {
- sprintList = from("CustRequestAndCustRequestItem").where("custRequestTypeId", "RF_PARENT_BACKLOG").queryList();
+ sprintList = from("CustRequestAndCustRequestItem").where("custRequestTypeId", "RF_PARENT_BACKLOG").queryList()
}
if (sprintList) {
sprintList.each{ categoryMap ->
- inputMap = [:];
- productIdIn = categoryMap.productId;
+ inputMap = [:]
+ productIdIn = categoryMap.productId
if (productIdIn) {
- productMap = from("Product").where("productId", productIdIn).queryOne();
- inputMap.productId = productMap.productId;
- inputMap.internalName = productMap.internalName;
- inputMap.custRequestId = categoryMap.custRequestId;
- inputMap.custRequestName = categoryMap.custRequestName;
- categoryList.add(inputMap);
+ productMap = from("Product").where("productId", productIdIn).queryOne()
+ inputMap.productId = productMap.productId
+ inputMap.internalName = productMap.internalName
+ inputMap.custRequestId = categoryMap.custRequestId
+ inputMap.custRequestName = categoryMap.custRequestName
+ categoryList.add(inputMap)
}
}
- context.categoryList = categoryList;
+ context.categoryList = categoryList
}
}catch(e){
- Debug.logInfo("catch e ================" + e,"");
+ Debug.logInfo("catch e ================" + e,"")
}
//subString function
def String returnNameAsString(input,length) {
if (input.length() > length ) {
- ansValue = input.toString().substring(0,Math.min(input.toString().length(),length));
- return ansValue;
+ ansValue = input.toString().substring(0,Math.min(input.toString().length(),length))
+ return ansValue
} else {
- return input;
+ return input
}
}
diff --git a/specialpurpose/scrum/groovyScripts/SprintBacklogListItems.groovy b/specialpurpose/scrum/groovyScripts/SprintBacklogListItems.groovy
index 64ce827f72..5d8bf1bdb0 100644
--- a/specialpurpose/scrum/groovyScripts/SprintBacklogListItems.groovy
+++ b/specialpurpose/scrum/groovyScripts/SprintBacklogListItems.groovy
@@ -17,105 +17,105 @@
* under the License.
*/
-import org.apache.ofbiz.entity.condition.*;
-import org.apache.ofbiz.base.util.*;
+import org.apache.ofbiz.entity.condition.*
+import org.apache.ofbiz.base.util.*
-taskStatusId = null;
-reopenedStatusId = null;
-backlogStatusId = parameters.backlogStatusId;
-paraBacklogStatusId = backlogStatusId;
-currentStatus = sprintStatus.currentStatusId;
-projectSprintList = [];
+taskStatusId = null
+reopenedStatusId = null
+backlogStatusId = parameters.backlogStatusId
+paraBacklogStatusId = backlogStatusId
+currentStatus = sprintStatus.currentStatusId
+projectSprintList = []
if ("SPRINT_CLOSED".equals(currentStatus)) {
- backlogStatusId = null;
+ backlogStatusId = null
} else {
if (backlogStatusId == "Any") {
- backlogStatusId = null;
+ backlogStatusId = null
} else {
- backlogStatusId = "CRQ_REVIEWED";
- reopenedStatusId = "CRQ_REOPENED";
- taskStatusId = "STS_CREATED";
+ backlogStatusId = "CRQ_REVIEWED"
+ reopenedStatusId = "CRQ_REOPENED"
+ taskStatusId = "STS_CREATED"
}
}
-orCurentExprs = [];
+orCurentExprs = []
if (taskStatusId) {
- orCurentExprs.add(EntityCondition.makeCondition("taskCurrentStatusId", EntityOperator.EQUALS, taskStatusId));
- orCurentExprs.add(EntityCondition.makeCondition("taskCurrentStatusId", EntityOperator.EQUALS, "SPRINT_ACTIVE"));
+ orCurentExprs.add(EntityCondition.makeCondition("taskCurrentStatusId", EntityOperator.EQUALS, taskStatusId))
+ orCurentExprs.add(EntityCondition.makeCondition("taskCurrentStatusId", EntityOperator.EQUALS, "SPRINT_ACTIVE"))
}
-orBacklogExprs = [];
+orBacklogExprs = []
if (backlogStatusId) {
- orBacklogExprs.add(EntityCondition.makeCondition("backlogStatusId", EntityOperator.EQUALS, backlogStatusId));
+ orBacklogExprs.add(EntityCondition.makeCondition("backlogStatusId", EntityOperator.EQUALS, backlogStatusId))
}
if (reopenedStatusId) {
- orBacklogExprs.add(EntityCondition.makeCondition("backlogStatusId", EntityOperator.EQUALS, reopenedStatusId));
+ orBacklogExprs.add(EntityCondition.makeCondition("backlogStatusId", EntityOperator.EQUALS, reopenedStatusId))
}
-andExprs = [];
+andExprs = []
if (parameters.projectId) {
- andExprs.add(EntityCondition.makeCondition("projectId", EntityOperator.EQUALS, parameters.projectId));
+ andExprs.add(EntityCondition.makeCondition("projectId", EntityOperator.EQUALS, parameters.projectId))
} else {
- andExprs.add(EntityCondition.makeCondition("projectId", EntityOperator.EQUALS, sprintStatus.workEffortParentId));
+ andExprs.add(EntityCondition.makeCondition("projectId", EntityOperator.EQUALS, sprintStatus.workEffortParentId))
}
if (orBacklogExprs) {
- andExprs.add(EntityCondition.makeCondition(orBacklogExprs, EntityOperator.OR));
+ andExprs.add(EntityCondition.makeCondition(orBacklogExprs, EntityOperator.OR))
}
if (orCurentExprs) {
- andExprs.add(EntityCondition.makeCondition(orCurentExprs, EntityOperator.OR));
+ andExprs.add(EntityCondition.makeCondition(orCurentExprs, EntityOperator.OR))
}
- andExprs.add(EntityCondition.makeCondition("sprintId", EntityOperator.EQUALS, parameters.sprintId));
- andExprs.add(EntityCondition.makeCondition("sprintTypeId", EntityOperator.EQUALS, "SCRUM_SPRINT"));
+ andExprs.add(EntityCondition.makeCondition("sprintId", EntityOperator.EQUALS, parameters.sprintId))
+ andExprs.add(EntityCondition.makeCondition("sprintTypeId", EntityOperator.EQUALS, "SCRUM_SPRINT"))
-projectSprintCond = EntityCondition.makeCondition(andExprs, EntityOperator.AND);
-projectSprintList = from("ProjectSprintBacklogAndTask").where(andExprs).orderBy("custSequenceNum","custRequestId","taskTypeId").queryList();
+projectSprintCond = EntityCondition.makeCondition(andExprs, EntityOperator.AND)
+projectSprintList = from("ProjectSprintBacklogAndTask").where(andExprs).orderBy("custSequenceNum","custRequestId","taskTypeId").queryList()
-context.listIt = projectSprintList;
-context.paraBacklogStatusId = paraBacklogStatusId;
+context.listIt = projectSprintList
+context.paraBacklogStatusId = paraBacklogStatusId
//get backlog and task information
if (parameters.sprintId) {
//get total backlog size
- completedBacklog = 0;
- reviewedBacklog = 0;
- totalbacklog = 0;
- allTask = [];
- sprintList = from("CustRequestWorkEffort").where("workEffortId", parameters.sprintId).queryList();
+ completedBacklog = 0
+ reviewedBacklog = 0
+ totalbacklog = 0
+ allTask = []
+ sprintList = from("CustRequestWorkEffort").where("workEffortId", parameters.sprintId).queryList()
sprintList.each { sprintMap ->
- custMap = sprintMap.getRelatedOne("CustRequest", false);
+ custMap = sprintMap.getRelatedOne("CustRequest", false)
//if ("RF_PROD_BACKLOG".equals(custMap.custRequestTypeId)) {
- totalbacklog += 1;
+ totalbacklog += 1
if ("CRQ_REVIEWED".equals(custMap.statusId)){
- reviewedBacklog += 1;
+ reviewedBacklog += 1
} else {
- completedBacklog += 1;
+ completedBacklog += 1
}
//get task
- workEffortList = custMap.getRelated("CustRequestWorkEffort", null, null, false);
+ workEffortList = custMap.getRelated("CustRequestWorkEffort", null, null, false)
if (workEffortList) {
- allTask.addAll(workEffortList);
+ allTask.addAll(workEffortList)
}
//}
}
//get total task size
- completedTask = 0;
- createdTask = 0;
- totalTask = 0;
+ completedTask = 0
+ createdTask = 0
+ totalTask = 0
if (allTask) {
allTask.each { taskMap ->
- workEffMap = taskMap.getRelatedOne("WorkEffort", false);
+ workEffMap = taskMap.getRelatedOne("WorkEffort", false)
if (!"SCRUM_SPRINT".equals(workEffMap.workEffortTypeId)) {
- totalTask += 1;
+ totalTask += 1
if ("STS_CREATED".equals(workEffMap.currentStatusId)){
- createdTask += 1;
+ createdTask += 1
} else {
- completedTask += 1;
+ completedTask += 1
}
}
}
}
- context.completedBacklog = completedBacklog;
- context.reviewedBacklog = reviewedBacklog;
- context.totalbacklog = totalbacklog;
- context.completedTask = completedTask;
- context.createdTask = createdTask;
- context.totalTask = totalTask;
+ context.completedBacklog = completedBacklog
+ context.reviewedBacklog = reviewedBacklog
+ context.totalbacklog = totalbacklog
+ context.completedTask = completedTask
+ context.createdTask = createdTask
+ context.totalTask = totalTask
}
diff --git a/specialpurpose/scrum/groovyScripts/SprintBacklogOptions.groovy b/specialpurpose/scrum/groovyScripts/SprintBacklogOptions.groovy
index 8935b8191c..00084b05cf 100644
--- a/specialpurpose/scrum/groovyScripts/SprintBacklogOptions.groovy
+++ b/specialpurpose/scrum/groovyScripts/SprintBacklogOptions.groovy
@@ -17,21 +17,21 @@
* under the License.
*/
-import org.apache.ofbiz.base.util.Debug;
+import org.apache.ofbiz.base.util.Debug
-custRequestWorkEffortList = [];
-sprintStatusId = "SPRINT_CLOSED";
-sprintId = null;
-custRequestWorkEffortList = custRequestMap.getRelated("CustRequestWorkEffort", null, null, false);
+custRequestWorkEffortList = []
+sprintStatusId = "SPRINT_CLOSED"
+sprintId = null
+custRequestWorkEffortList = custRequestMap.getRelated("CustRequestWorkEffort", null, null, false)
if (custRequestWorkEffortList) {
custRequestWorkEffortList.each { custWorkEffortMap ->
- workEffortMap = custWorkEffortMap.getRelatedOne("WorkEffort", false);
+ workEffortMap = custWorkEffortMap.getRelatedOne("WorkEffort", false)
if ("SCRUM_SPRINT".equals(workEffortMap.workEffortTypeId) && "SPRINT_ACTIVE".equals(workEffortMap.currentStatusId)) {
- sprintId = workEffortMap.workEffortId;
- sprintStatusId = "SPRINT_ACTIVE";
+ sprintId = workEffortMap.workEffortId
+ sprintStatusId = "SPRINT_ACTIVE"
}
}
}
-context.sprintId = sprintId;
-context.sprintStatusId = sprintStatusId;
+context.sprintId = sprintId
+context.sprintStatusId = sprintStatusId
diff --git a/specialpurpose/scrum/groovyScripts/TaskList.groovy b/specialpurpose/scrum/groovyScripts/TaskList.groovy
index f8e7914770..514b7fc0e5 100644
--- a/specialpurpose/scrum/groovyScripts/TaskList.groovy
+++ b/specialpurpose/scrum/groovyScripts/TaskList.groovy
@@ -17,101 +17,101 @@
* under the License.
*/
-import java.util.*;
-import java.lang.*;
-import org.apache.tools.ant.taskdefs.Parallel.TaskList;
-import org.apache.ofbiz.base.util.*;
-import org.apache.ofbiz.entity.*;
-import org.apache.ofbiz.base.util.UtilMisc;
-import org.apache.ofbiz.base.util.UtilValidate;
-import org.apache.ofbiz.base.util.UtilDateTime;
-import org.apache.ofbiz.entity.util.*;
-import org.apache.ofbiz.entity.condition.*;
-import java.sql.Timestamp;
+import java.util.*
+import java.lang.*
+import org.apache.tools.ant.taskdefs.Parallel.TaskList
+import org.apache.ofbiz.base.util.*
+import org.apache.ofbiz.entity.*
+import org.apache.ofbiz.base.util.UtilMisc
+import org.apache.ofbiz.base.util.UtilValidate
+import org.apache.ofbiz.base.util.UtilDateTime
+import org.apache.ofbiz.entity.util.*
+import org.apache.ofbiz.entity.condition.*
+import java.sql.Timestamp
-partyId = userLogin.partyId;
-taskUnplanList = [];
-taskPlanList = [];
-taskPartyList = [];
-taskListDropdown = [];
+partyId = userLogin.partyId
+taskUnplanList = []
+taskPlanList = []
+taskPartyList = []
+taskListDropdown = []
//${projectId} - ${projectName} - ${sprintName} - ${groovy:description.substring(0,Math.min(description.length(),30))}[${custRequestId}] - ${groovy:taskName.substring(0,Math.min(taskName.length(),20))}[${taskId}]"/>
-taskUnplanList = from("ProjectSprintBacklogTaskAndParty").where("partyId", partyId,"taskCurrentStatusId", "STS_CREATED","custRequestTypeId","RF_UNPLAN_BACKLOG").orderBy("taskTypeId").queryList();
+taskUnplanList = from("ProjectSprintBacklogTaskAndParty").where("partyId", partyId,"taskCurrentStatusId", "STS_CREATED","custRequestTypeId","RF_UNPLAN_BACKLOG").orderBy("taskTypeId").queryList()
taskUnplanList.each { taskUnplanMap ->
- unplanMap=[:];
- custRequestId = taskUnplanMap.custRequestId;
- productlist = from("CustRequestItem").where("custRequestId", custRequestId).orderBy("productId").queryList();
+ unplanMap=[:]
+ custRequestId = taskUnplanMap.custRequestId
+ productlist = from("CustRequestItem").where("custRequestId", custRequestId).orderBy("productId").queryList()
productlist.each { productMap ->
- productId = productMap.productId;
- product = from("Product").where("productId", productId).queryOne();
- productName = product.internalName;
- unplanMap.taskId = taskUnplanMap.taskId;
- unplanMap.taskName = taskUnplanMap.taskName;
- unplanMap.projectId = taskUnplanMap.projectId;
- unplanMap.projectName = taskUnplanMap.projectName;
- unplanMap.sprintId = taskUnplanMap.sprintId;
- unplanMap.sprintName = taskUnplanMap.sprintName;
- unplanMap.custRequestId = custRequestId;
- unplanMap.description = taskUnplanMap.description;
- unplanMap.productId = productId;
- unplanMap.productName = productName;
+ productId = productMap.productId
+ product = from("Product").where("productId", productId).queryOne()
+ productName = product.internalName
+ unplanMap.taskId = taskUnplanMap.taskId
+ unplanMap.taskName = taskUnplanMap.taskName
+ unplanMap.projectId = taskUnplanMap.projectId
+ unplanMap.projectName = taskUnplanMap.projectName
+ unplanMap.sprintId = taskUnplanMap.sprintId
+ unplanMap.sprintName = taskUnplanMap.sprintName
+ unplanMap.custRequestId = custRequestId
+ unplanMap.description = taskUnplanMap.description
+ unplanMap.productId = productId
+ unplanMap.productName = productName
}
- taskPartyList.add(taskUnplanMap);
- taskListDropdown.add(unplanMap);
+ taskPartyList.add(taskUnplanMap)
+ taskListDropdown.add(unplanMap)
}
-exprBldr = [];
-exprBldr.add(EntityCondition.makeCondition("custRequestTypeId", EntityOperator.EQUALS, "RF_PROD_BACKLOG"));
-exprBldr.add(EntityCondition.makeCondition("custRequestTypeId", EntityOperator.EQUALS, "RF_SCRUM_MEETINGS"));
-andExprs = [];
-andExprs.add(EntityCondition.makeCondition("taskCurrentStatusId", EntityOperator.EQUALS, "STS_CREATED"));
-andExprs.add(EntityCondition.makeCondition("partyId", EntityOperator.EQUALS, partyId));
-andExprs.add(EntityCondition.makeCondition(exprBldr, EntityOperator.OR));
-custRequestTypeCond = EntityCondition.makeCondition(andExprs, EntityOperator.AND);
+exprBldr = []
+exprBldr.add(EntityCondition.makeCondition("custRequestTypeId", EntityOperator.EQUALS, "RF_PROD_BACKLOG"))
+exprBldr.add(EntityCondition.makeCondition("custRequestTypeId", EntityOperator.EQUALS, "RF_SCRUM_MEETINGS"))
+andExprs = []
+andExprs.add(EntityCondition.makeCondition("taskCurrentStatusId", EntityOperator.EQUALS, "STS_CREATED"))
+andExprs.add(EntityCondition.makeCondition("partyId", EntityOperator.EQUALS, partyId))
+andExprs.add(EntityCondition.makeCondition(exprBldr, EntityOperator.OR))
+custRequestTypeCond = EntityCondition.makeCondition(andExprs, EntityOperator.AND)
-taskPlanList = from("ProjectSprintBacklogTaskAndParty").where(custRequestTypeCond).orderBy("taskTypeId","projectId","sprintId").queryList();
+taskPlanList = from("ProjectSprintBacklogTaskAndParty").where(custRequestTypeCond).orderBy("taskTypeId","projectId","sprintId").queryList()
taskPlanList.each { taskPlanMap ->
- planMap=[:];
+ planMap=[:]
if ("RF_SCRUM_MEETINGS".equals(taskPlanMap.custRequestTypeId)) {
- workEffPartyAssignedList = from("WorkEffortPartyAssignment").where("partyId", partyId, "workEffortId", taskPlanMap.taskId).queryList();
- workEffPartyAssignedMap = workEffPartyAssignedList[0];
+ workEffPartyAssignedList = from("WorkEffortPartyAssignment").where("partyId", partyId, "workEffortId", taskPlanMap.taskId).queryList()
+ workEffPartyAssignedMap = workEffPartyAssignedList[0]
if (!"SCAS_COMPLETED".equals(workEffPartyAssignedMap.statusId)) {
- taskPartyList.add(taskPlanMap);
- taskListDropdown.add(taskPlanMap);
+ taskPartyList.add(taskPlanMap)
+ taskListDropdown.add(taskPlanMap)
}
} else {
if (taskPlanMap.projectId) {
- taskPartyList.add(taskPlanMap);
- taskListDropdown.add(taskPlanMap);
+ taskPartyList.add(taskPlanMap)
+ taskListDropdown.add(taskPlanMap)
} else {
- custRequestId = taskPlanMap.custRequestId;
- productlist = from("CustRequestItem").where("custRequestId", custRequestId).orderBy("productId").queryList();
- product = from("Product").where("productId", productlist[0].productId).queryOne();
- productName = product.internalName;
- planMap.taskId = taskPlanMap.taskId;
- planMap.taskTypeId = taskPlanMap.taskTypeId;
- planMap.taskName = taskPlanMap.taskName;
- planMap.projectId = taskPlanMap.projectId;
- planMap.projectName = taskPlanMap.projectName;
- planMap.sprintId = taskPlanMap.sprintId;
- planMap.sprintName = taskPlanMap.sprintName;
- planMap.custRequestId = custRequestId;
- planMap.description = taskPlanMap.description;
- planMap.productId = productlist[0].productId;
- planMap.productName = productName;
- taskPartyList.add(planMap);
- taskListDropdown.add(planMap);
+ custRequestId = taskPlanMap.custRequestId
+ productlist = from("CustRequestItem").where("custRequestId", custRequestId).orderBy("productId").queryList()
+ product = from("Product").where("productId", productlist[0].productId).queryOne()
+ productName = product.internalName
+ planMap.taskId = taskPlanMap.taskId
+ planMap.taskTypeId = taskPlanMap.taskTypeId
+ planMap.taskName = taskPlanMap.taskName
+ planMap.projectId = taskPlanMap.projectId
+ planMap.projectName = taskPlanMap.projectName
+ planMap.sprintId = taskPlanMap.sprintId
+ planMap.sprintName = taskPlanMap.sprintName
+ planMap.custRequestId = custRequestId
+ planMap.description = taskPlanMap.description
+ planMap.productId = productlist[0].productId
+ planMap.productName = productName
+ taskPartyList.add(planMap)
+ taskListDropdown.add(planMap)
}
}
}
if (taskPartyList){
- context.taskPartyList = taskPartyList;
+ context.taskPartyList = taskPartyList
}
if (taskListDropdown){
- context.taskListDropdown = taskListDropdown;
+ context.taskListDropdown = taskListDropdown
}
diff --git a/specialpurpose/webpos/groovyScripts/Login.groovy b/specialpurpose/webpos/groovyScripts/Login.groovy
index beb9eb5431..c162203c90 100644
--- a/specialpurpose/webpos/groovyScripts/Login.groovy
+++ b/specialpurpose/webpos/groovyScripts/Login.groovy
@@ -17,30 +17,30 @@
* under the License.
*/
-import org.apache.ofbiz.product.store.ProductStoreWorker;
-import org.apache.ofbiz.webapp.control.LoginWorker;
+import org.apache.ofbiz.product.store.ProductStoreWorker
+import org.apache.ofbiz.webapp.control.LoginWorker
-context.autoUserLogin = session.getAttribute("autoUserLogin");
-context.autoLogoutUrl = LoginWorker.makeLoginUrl(request, "autoLogout");
+context.autoUserLogin = session.getAttribute("autoUserLogin")
+context.autoLogoutUrl = LoginWorker.makeLoginUrl(request, "autoLogout")
-previousParams = session.getAttribute("_PREVIOUS_PARAMS_");
+previousParams = session.getAttribute("_PREVIOUS_PARAMS_")
if (previousParams) {
- previousParams = UtilHttp.stripNamedParamsFromQueryString(previousParams, ['USERNAME', 'PASSWORD']);
- previousParams = "?" + previousParams;
+ previousParams = UtilHttp.stripNamedParamsFromQueryString(previousParams, ['USERNAME', 'PASSWORD'])
+ previousParams = "?" + previousParams
} else {
- previousParams = "";
+ previousParams = ""
}
-context.previousParams = previousParams;
+context.previousParams = previousParams
-productStoreId = ProductStoreWorker.getProductStoreId(request);
-productStore = ProductStoreWorker.getProductStore(productStoreId, delegator);
+productStoreId = ProductStoreWorker.getProductStoreId(request)
+productStore = ProductStoreWorker.getProductStore(productStoreId, delegator)
if (productStore) {
- facilityId = productStore.getString("inventoryFacilityId");
+ facilityId = productStore.getString("inventoryFacilityId")
if (facilityId) {
- context.posTerminals = from("PosTerminal").where("facilityId", facilityId).orderBy("posTerminalId").queryList();
+ context.posTerminals = from("PosTerminal").where("facilityId", facilityId).orderBy("posTerminalId").queryList()
} else {
- context.posTerminals = from("PosTerminal").orderBy("posTerminalId").queryList();
+ context.posTerminals = from("PosTerminal").orderBy("posTerminalId").queryList()
}
}
diff --git a/specialpurpose/webpos/groovyScripts/WebPosMenus.groovy b/specialpurpose/webpos/groovyScripts/WebPosMenus.groovy
index df68492982..464b51a4f0 100644
--- a/specialpurpose/webpos/groovyScripts/WebPosMenus.groovy
+++ b/specialpurpose/webpos/groovyScripts/WebPosMenus.groovy
@@ -17,22 +17,22 @@
* under the License.
*/
-import org.apache.ofbiz.webpos.WebPosEvents;
-import org.apache.ofbiz.webpos.session.WebPosSession;
-import org.apache.ofbiz.webpos.transaction.WebPosTransaction;
+import org.apache.ofbiz.webpos.WebPosEvents
+import org.apache.ofbiz.webpos.session.WebPosSession
+import org.apache.ofbiz.webpos.transaction.WebPosTransaction
-webPosSession = WebPosEvents.getWebPosSession(request, null);
+webPosSession = WebPosEvents.getWebPosSession(request, null)
if (webPosSession) {
- context.shoppingCartSize = webPosSession.getCart().size();
- context.isManagerLoggedIn = webPosSession.isManagerLoggedIn();
- webPosTransaction = webPosSession.getCurrentTransaction();
+ context.shoppingCartSize = webPosSession.getCart().size()
+ context.isManagerLoggedIn = webPosSession.isManagerLoggedIn()
+ webPosTransaction = webPosSession.getCurrentTransaction()
if (webPosTransaction) {
- context.isOpen = webPosTransaction.isOpen();
+ context.isOpen = webPosTransaction.isOpen()
}
- context.cart = webPosSession.getCart();
- context.totalDue = webPosSession.getCurrentTransaction().getTotalDue();
- context.totalPayments = webPosSession.getCurrentTransaction().getPaymentTotal();
+ context.cart = webPosSession.getCart()
+ context.totalDue = webPosSession.getCurrentTransaction().getTotalDue()
+ context.totalPayments = webPosSession.getCurrentTransaction().getPaymentTotal()
} else {
- context.shoppingCartSize = 0;
+ context.shoppingCartSize = 0
}
\ No newline at end of file
diff --git a/specialpurpose/webpos/groovyScripts/WebPosSetup.groovy b/specialpurpose/webpos/groovyScripts/WebPosSetup.groovy
index e2eb4db6a9..e99a0fdd47 100644
--- a/specialpurpose/webpos/groovyScripts/WebPosSetup.groovy
+++ b/specialpurpose/webpos/groovyScripts/WebPosSetup.groovy
@@ -17,24 +17,24 @@
* under the License.
*/
-import org.apache.ofbiz.product.catalog.CatalogWorker;
-import org.apache.ofbiz.product.store.ProductStoreWorker;
-import org.apache.ofbiz.webapp.control.LoginWorker;
+import org.apache.ofbiz.product.catalog.CatalogWorker
+import org.apache.ofbiz.product.store.ProductStoreWorker
+import org.apache.ofbiz.webapp.control.LoginWorker
-productStore = ProductStoreWorker.getProductStore(request);
+productStore = ProductStoreWorker.getProductStore(request)
-prodCatalog = CatalogWorker.getProdCatalog(request);
+prodCatalog = CatalogWorker.getProdCatalog(request)
if (prodCatalog) {
- catalogStyleSheet = prodCatalog.styleSheet;
+ catalogStyleSheet = prodCatalog.styleSheet
if (catalogStyleSheet) {
- globalContext.catalogStyleSheet = catalogStyleSheet;
+ globalContext.catalogStyleSheet = catalogStyleSheet
}
- catalogHeaderLogo = prodCatalog.headerLogo;
+ catalogHeaderLogo = prodCatalog.headerLogo
if (catalogHeaderLogo) {
- globalContext.catalogHeaderLogo = catalogHeaderLogo;
+ globalContext.catalogHeaderLogo = catalogHeaderLogo
}
}
-globalContext.productStore = productStore;
-globalContext.checkLoginUrl = LoginWorker.makeLoginUrl(request, "checkLogin");
-globalContext.catalogQuickaddUse = CatalogWorker.getCatalogQuickaddUse(request);
+globalContext.productStore = productStore
+globalContext.checkLoginUrl = LoginWorker.makeLoginUrl(request, "checkLogin")
+globalContext.catalogQuickaddUse = CatalogWorker.getCatalogQuickaddUse(request)
diff --git a/specialpurpose/webpos/groovyScripts/catalog/Category.groovy b/specialpurpose/webpos/groovyScripts/catalog/Category.groovy
index 5b2f689169..9a823f3871 100644
--- a/specialpurpose/webpos/groovyScripts/catalog/Category.groovy
+++ b/specialpurpose/webpos/groovyScripts/catalog/Category.groovy
@@ -22,41 +22,41 @@
* should not contain order component's specific code.
*/
-import org.apache.ofbiz.product.catalog.CatalogWorker;
-import org.apache.ofbiz.product.category.CategoryContentWrapper;
+import org.apache.ofbiz.product.catalog.CatalogWorker
+import org.apache.ofbiz.product.category.CategoryContentWrapper
-detailScreen = "categorydetail";
-catalogName = CatalogWorker.getCatalogName(request);
+detailScreen = "categorydetail"
+catalogName = CatalogWorker.getCatalogName(request)
-productCategoryId = parameters.productCategoryId;
+productCategoryId = parameters.productCategoryId
if (!(productCategoryId) && request.getAttribute("topCategoryId")) {
- productCategoryId = request.getAttribute("topCategoryId");
+ productCategoryId = request.getAttribute("topCategoryId")
}
-category = from("ProductCategory").where("productCategoryId", productCategoryId).cache(true).queryOne();
+category = from("ProductCategory").where("productCategoryId", productCategoryId).cache(true).queryOne()
if (category) {
if (category.detailScreen) {
- detailScreen = category.detailScreen;
+ detailScreen = category.detailScreen
}
- categoryContentWrapper = new CategoryContentWrapper(category, request);
- context.title = categoryContentWrapper.get("CATEGORY_NAME", "html");
- categoryDescription = categoryContentWrapper.get("DESCRIPTION", "html");
+ categoryContentWrapper = new CategoryContentWrapper(category, request)
+ context.title = categoryContentWrapper.get("CATEGORY_NAME", "html")
+ categoryDescription = categoryContentWrapper.get("DESCRIPTION", "html")
if (categoryDescription) {
- context.metaDescription = categoryDescription;
- context.metaKeywords = categoryDescription + ", " + catalogName;
+ context.metaDescription = categoryDescription
+ context.metaKeywords = categoryDescription + ", " + catalogName
} else {
- context.metaKeywords = catalogName;
+ context.metaKeywords = catalogName
}
- context.productCategory = category;
+ context.productCategory = category
}
// check the catalogs template path and update
-templatePathPrefix = CatalogWorker.getTemplatePathPrefix(request);
+templatePathPrefix = CatalogWorker.getTemplatePathPrefix(request)
if (templatePathPrefix) {
- detailScreen = templatePathPrefix + detailScreen;
+ detailScreen = templatePathPrefix + detailScreen
}
-context.detailScreen = detailScreen;
+context.detailScreen = detailScreen
-request.setAttribute("productCategoryId", productCategoryId);
-request.setAttribute("defaultViewSize", 10);
-request.setAttribute("limitView", true);
+request.setAttribute("productCategoryId", productCategoryId)
+request.setAttribute("defaultViewSize", 10)
+request.setAttribute("limitView", true)
diff --git a/specialpurpose/webpos/groovyScripts/catalog/SideDeepCategory.groovy b/specialpurpose/webpos/groovyScripts/catalog/SideDeepCategory.groovy
index 270464beae..56176a9268 100644
--- a/specialpurpose/webpos/groovyScripts/catalog/SideDeepCategory.groovy
+++ b/specialpurpose/webpos/groovyScripts/catalog/SideDeepCategory.groovy
@@ -16,21 +16,21 @@
* specific language governing permissions and limitations
* under the License.
*/
-import org.apache.ofbiz.product.catalog.CatalogWorker;
-import org.apache.ofbiz.product.category.CategoryWorker;
+import org.apache.ofbiz.product.catalog.CatalogWorker
+import org.apache.ofbiz.product.category.CategoryWorker
-CategoryWorker.getRelatedCategories(request, "topLevelList", CatalogWorker.getCatalogTopCategoryId(request, CatalogWorker.getCurrentCatalogId(request)), true);
-curCategoryId = parameters.category_id ?: parameters.CATEGORY_ID ?: "";
-request.setAttribute("curCategoryId", curCategoryId);
-CategoryWorker.setTrail(request, curCategoryId);
+CategoryWorker.getRelatedCategories(request, "topLevelList", CatalogWorker.getCatalogTopCategoryId(request, CatalogWorker.getCurrentCatalogId(request)), true)
+curCategoryId = parameters.category_id ?: parameters.CATEGORY_ID ?: ""
+request.setAttribute("curCategoryId", curCategoryId)
+CategoryWorker.setTrail(request, curCategoryId)
-categoryList = request.getAttribute("topLevelList");
+categoryList = request.getAttribute("topLevelList")
if (categoryList) {
- catContentWrappers = [:];
- CategoryWorker.getCategoryContentWrappers(catContentWrappers, categoryList, request);
- context.catContentWrappers = catContentWrappers;
+ catContentWrappers = [:]
+ CategoryWorker.getCategoryContentWrappers(catContentWrappers, categoryList, request)
+ context.catContentWrappers = catContentWrappers
}
if (!curCategoryId && categoryList) {
- curCategoryId = categoryList[0].productCategoryId;
- request.setAttribute("topCategoryId", curCategoryId);
+ curCategoryId = categoryList[0].productCategoryId
+ request.setAttribute("topCategoryId", curCategoryId)
}
\ No newline at end of file
diff --git a/specialpurpose/webpos/groovyScripts/customer/EditAddress.groovy b/specialpurpose/webpos/groovyScripts/customer/EditAddress.groovy
index 03390dbd1c..aa52f108fc 100644
--- a/specialpurpose/webpos/groovyScripts/customer/EditAddress.groovy
+++ b/specialpurpose/webpos/groovyScripts/customer/EditAddress.groovy
@@ -17,34 +17,34 @@
* under the License.
*/
-person = from("Person").where("partyId", parameters.partyId).queryOne();
+person = from("Person").where("partyId", parameters.partyId).queryOne()
if (person) {
- request.setAttribute("lastName", person.lastName);
- request.setAttribute("firstName", person.firstName);
- request.setAttribute("partyId", parameters.partyId);
+ request.setAttribute("lastName", person.lastName)
+ request.setAttribute("firstName", person.firstName)
+ request.setAttribute("partyId", parameters.partyId)
}
-contactMech = from("ContactMech").where("contactMechId", parameters.contactMechId).queryOne();
+contactMech = from("ContactMech").where("contactMechId", parameters.contactMechId).queryOne()
if (contactMech) {
- postalAddress = contactMech.getRelatedOne("PostalAddress", false);
+ postalAddress = contactMech.getRelatedOne("PostalAddress", false)
if (postalAddress) {
- request.setAttribute("contactMechId", postalAddress.contactMechId);
- request.setAttribute("toName", postalAddress.toName);
- request.setAttribute("attnName", postalAddress.attnName);
- request.setAttribute("address1", postalAddress.address1);
- request.setAttribute("address2", postalAddress.address2);
- request.setAttribute("city", postalAddress.city);
- request.setAttribute("postalCode", postalAddress.postalCode);
- request.setAttribute("stateProvinceGeoId", postalAddress.stateProvinceGeoId);
- request.setAttribute("countryGeoId", postalAddress.countryGeoId);
- stateProvinceGeo = from("Geo").where("geoId", postalAddress.stateProvinceGeoId).queryOne();
+ request.setAttribute("contactMechId", postalAddress.contactMechId)
+ request.setAttribute("toName", postalAddress.toName)
+ request.setAttribute("attnName", postalAddress.attnName)
+ request.setAttribute("address1", postalAddress.address1)
+ request.setAttribute("address2", postalAddress.address2)
+ request.setAttribute("city", postalAddress.city)
+ request.setAttribute("postalCode", postalAddress.postalCode)
+ request.setAttribute("stateProvinceGeoId", postalAddress.stateProvinceGeoId)
+ request.setAttribute("countryGeoId", postalAddress.countryGeoId)
+ stateProvinceGeo = from("Geo").where("geoId", postalAddress.stateProvinceGeoId).queryOne()
if (stateProvinceGeo) {
- request.setAttribute("stateProvinceGeo", stateProvinceGeo.get("geoName", locale));
+ request.setAttribute("stateProvinceGeo", stateProvinceGeo.get("geoName", locale))
}
- countryProvinceGeo = from("Geo").where("geoId", postalAddress.countryGeoId).queryOne();
+ countryProvinceGeo = from("Geo").where("geoId", postalAddress.countryGeoId).queryOne()
if (countryProvinceGeo) {
- request.setAttribute("countryProvinceGeo", countryProvinceGeo.get("geoName", locale));
+ request.setAttribute("countryProvinceGeo", countryProvinceGeo.get("geoName", locale))
}
}
}
-request.setAttribute("contactMechPurposeTypeId", parameters.contactMechPurposeTypeId);
+request.setAttribute("contactMechPurposeTypeId", parameters.contactMechPurposeTypeId)
diff --git a/specialpurpose/webpos/groovyScripts/manager/PaidOutAndIn.groovy b/specialpurpose/webpos/groovyScripts/manager/PaidOutAndIn.groovy
index b00a50ee0e..5544abca7c 100644
--- a/specialpurpose/webpos/groovyScripts/manager/PaidOutAndIn.groovy
+++ b/specialpurpose/webpos/groovyScripts/manager/PaidOutAndIn.groovy
@@ -17,5 +17,5 @@
* under the License.
*/
-context.paidReasonIn = from("Enumeration").where("enumTypeId", "POS_PAID_REASON_IN").orderBy("sequenceId").queryList();
-context.paidReasonOut = from("Enumeration").where("enumTypeId", "POS_PAID_REASON_OUT").orderBy("sequenceId").queryList();
+context.paidReasonIn = from("Enumeration").where("enumTypeId", "POS_PAID_REASON_IN").orderBy("sequenceId").queryList()
+context.paidReasonOut = from("Enumeration").where("enumTypeId", "POS_PAID_REASON_OUT").orderBy("sequenceId").queryList()
diff --git a/specialpurpose/webpos/groovyScripts/search/CustomerAddress.groovy b/specialpurpose/webpos/groovyScripts/search/CustomerAddress.groovy
index 6a880a6ec3..ee0e8a5c2e 100644
--- a/specialpurpose/webpos/groovyScripts/search/CustomerAddress.groovy
+++ b/specialpurpose/webpos/groovyScripts/search/CustomerAddress.groovy
@@ -16,32 +16,32 @@
* specific language governing permissions and limitations
* under the License.
*/
-import org.apache.ofbiz.base.util.UtilValidate;
-import org.apache.ofbiz.webpos.WebPosEvents;
+import org.apache.ofbiz.base.util.UtilValidate
+import org.apache.ofbiz.webpos.WebPosEvents
-webPosSession = WebPosEvents.getWebPosSession(request, null);
+webPosSession = WebPosEvents.getWebPosSession(request, null)
if (webPosSession) {
- shoppingCart = webPosSession.getCart();
- shipToCustomerPartyId = shoppingCart.getShipToCustomerPartyId();
+ shoppingCart = webPosSession.getCart()
+ shipToCustomerPartyId = shoppingCart.getShipToCustomerPartyId()
if (UtilValidate.isNotEmpty(shipToCustomerPartyId)) {
- context.personShipTo = from("Person").where("partyId", shipToCustomerPartyId).queryOne();
+ context.personShipTo = from("Person").where("partyId", shipToCustomerPartyId).queryOne()
}
- shippingContactMechId = shoppingCart.getContactMech("SHIPPING_LOCATION");
+ shippingContactMechId = shoppingCart.getContactMech("SHIPPING_LOCATION")
if (UtilValidate.isNotEmpty(shippingContactMechId)) {
- contactMech = from("ContactMech").where("contactMechId", shippingContactMechId).queryOne();
+ contactMech = from("ContactMech").where("contactMechId", shippingContactMechId).queryOne()
if (UtilValidate.isNotEmpty(contactMech) && "POSTAL_ADDRESS".equals(contactMech.contactMechTypeId)) {
- context.shippingPostalAddress = contactMech.getRelatedOne("PostalAddress", false);
+ context.shippingPostalAddress = contactMech.getRelatedOne("PostalAddress", false)
}
}
- billToCustomerPartyId = shoppingCart.getBillToCustomerPartyId();
+ billToCustomerPartyId = shoppingCart.getBillToCustomerPartyId()
if (UtilValidate.isNotEmpty(billToCustomerPartyId)) {
- context.personBillTo = from("Person").where("partyId", billToCustomerPartyId).queryOne();
+ context.personBillTo = from("Person").where("partyId", billToCustomerPartyId).queryOne()
}
- billingContactMechId = shoppingCart.getContactMech("BILLING_LOCATION");
+ billingContactMechId = shoppingCart.getContactMech("BILLING_LOCATION")
if (UtilValidate.isNotEmpty(billingContactMechId)) {
- contactMech = from("ContactMech").where("contactMechId", billingContactMechId).queryOne();
+ contactMech = from("ContactMech").where("contactMechId", billingContactMechId).queryOne()
if (UtilValidate.isNotEmpty(contactMech) && "POSTAL_ADDRESS".equals(contactMech.contactMechTypeId)) {
- context.billingPostalAddress = contactMech.getRelatedOne("PostalAddress", false);
+ context.billingPostalAddress = contactMech.getRelatedOne("PostalAddress", false)
}
}
}
diff --git a/specialpurpose/webpos/groovyScripts/search/SearchSalesReps.groovy b/specialpurpose/webpos/groovyScripts/search/SearchSalesReps.groovy
index f510d25200..bae6dd4efb 100644
--- a/specialpurpose/webpos/groovyScripts/search/SearchSalesReps.groovy
+++ b/specialpurpose/webpos/groovyScripts/search/SearchSalesReps.groovy
@@ -17,9 +17,9 @@
* under the License.
*/
-context.salesReps = from("PartyRoleNameDetail").where("roleTypeId", "SALES_REP").orderBy("lastName", "firstName").queryList();
+context.salesReps = from("PartyRoleNameDetail").where("roleTypeId", "SALES_REP").orderBy("lastName", "firstName").queryList()
-shoppingCart = session.getAttribute("shoppingCart");
+shoppingCart = session.getAttribute("shoppingCart")
if (shoppingCart) {
- context.cartSalesReps = shoppingCart.getAdditionalPartyRoleMap().SALES_REP;
+ context.cartSalesReps = shoppingCart.getAdditionalPartyRoleMap().SALES_REP
}
\ No newline at end of file