Applied patch from jira issue - OFBIZ-5892 - Replace all occurences of dispatcher.runSync in groovy files with runService() of DSL.

Thanks Arun for the contribution.

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1646167 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Ashish Vijaywargiya
2014-12-17 08:10:12 +00:00
parent fa7cb8eb15
commit d3e50d1e18
66 changed files with 155 additions and 201 deletions
@@ -45,7 +45,7 @@ if (invoiceTypeId) {
PastDueInvoices = delegator.findList("Invoice", expr, null, ["dueDate DESC"], null, false);
if (PastDueInvoices) {
invoiceIds = PastDueInvoices.invoiceId;
totalAmount = dispatcher.runSync("getInvoiceRunningTotal", [invoiceIds: invoiceIds, organizationPartyId: organizationPartyId, userLogin: userLogin]);
totalAmount = runService('getInvoiceRunningTotal', [invoiceIds: invoiceIds, organizationPartyId: organizationPartyId, userLogin: userLogin]);
if (totalAmount) {
context.PastDueInvoicestotalAmount = totalAmount.invoiceRunningTotal;
}
@@ -61,7 +61,7 @@ if (invoiceTypeId) {
InvoicesDueSoon = delegator.findList("Invoice", invoicesCond, null, ["dueDate ASC"], findOptions, false);
if (InvoicesDueSoon) {
invoiceIds = InvoicesDueSoon.invoiceId;
totalAmount = dispatcher.runSync("getInvoiceRunningTotal", [invoiceIds: invoiceIds, organizationPartyId: organizationPartyId, userLogin: userLogin]);
totalAmount = runService('getInvoiceRunningTotal', [invoiceIds: invoiceIds, organizationPartyId: organizationPartyId, userLogin: userLogin]);
if (totalAmount) {
context.InvoicesDueSoonTotalAmount = totalAmount.invoiceRunningTotal;
}
@@ -65,7 +65,7 @@ GenericValue accumAmortizationGlAccountClass = delegator.findOne("GlAccountClass
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 = dispatcher.runSync("findLastClosedDate", UtilMisc.toMap("organizationPartyId", organizationPartyId, "findDate", new Date(thruDate.getTime()),"userLogin", userLogin));
Map lastClosedTimePeriodResult = runService('findLastClosedDate', ["organizationPartyId": organizationPartyId, "findDate": new Date(thruDate.getTime()),"userLogin": userLogin]);
Timestamp fromDate = (Timestamp)lastClosedTimePeriodResult.lastClosedDate;
if (!fromDate) {
return;
@@ -410,7 +410,7 @@ transactionTotals.each { transactionTotal ->
transactionTotalsMap.put(transactionTotal.glAccountId, accountMap);
}
// Add the "retained earnings" account
Map netIncomeResult = dispatcher.runSync("prepareIncomeStatement", UtilMisc.toMap("organizationPartyId", organizationPartyId, "glFiscalTypeId", glFiscalTypeId, "fromDate", fromDate, "thruDate", thruDate,"userLogin", userLogin));
Map netIncomeResult = runService('prepareIncomeStatement', ["organizationPartyId": organizationPartyId, "glFiscalTypeId": glFiscalTypeId, "fromDate": fromDate, "thruDate": thruDate, "userLogin": userLogin]);
BigDecimal netIncome = (BigDecimal)netIncomeResult.totalNetIncome;
GenericValue retainedEarningsAccount = delegator.findOne("GlAccountTypeDefault", UtilMisc.toMap("glAccountTypeId", "RETAINED_EARNINGS", "organizationPartyId", organizationPartyId), true);
if (retainedEarningsAccount) {
@@ -56,7 +56,7 @@ List glAccountClassIds = UtilAccounting.getDescendantGlAccountClassIds(glAccount
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 = dispatcher.runSync("findLastClosedDate", ["organizationPartyId":organizationPartyId, "findDate":new Date(parametersFromDate.getTime()),"userLogin":userLogin]);
Map lastClosedTimePeriodResult = runService('findLastClosedDate', ["organizationPartyId":organizationPartyId, "findDate":new Date(parametersFromDate.getTime()),"userLogin":userLogin]);
Timestamp periodClosingFromDate = (Timestamp)lastClosedTimePeriodResult.lastClosedDate;
if (!periodClosingFromDate) {
return;
@@ -26,7 +26,7 @@ import com.ibm.icu.util.Calendar;
if (organizationPartyId) {
onlyIncludePeriodTypeIdList = [];
onlyIncludePeriodTypeIdList.add("FISCAL_YEAR");
customTimePeriodResults = dispatcher.runSync("findCustomTimePeriods", [findDate : UtilDateTime.nowTimestamp(), organizationPartyId : organizationPartyId, onlyIncludePeriodTypeIdList : onlyIncludePeriodTypeIdList, userLogin : userLogin]);
customTimePeriodResults = runService('findCustomTimePeriods', [findDate : UtilDateTime.nowTimestamp(), organizationPartyId : organizationPartyId, onlyIncludePeriodTypeIdList : onlyIncludePeriodTypeIdList, userLogin : userLogin]);
customTimePeriodList = customTimePeriodResults.customTimePeriodList;
if (UtilValidate.isNotEmpty(customTimePeriodList)) {
context.timePeriod = customTimePeriodList.first().customTimePeriodId;
@@ -46,8 +46,7 @@ if (organizationPartyId) {
if (parameters.timePeriod) {
currentTimePeriod = delegator.findOne("CustomTimePeriod", [customTimePeriodId : parameters.timePeriod], false);
previousTimePeriodResult = dispatcher.runSync("getPreviousTimePeriod",
[customTimePeriodId : parameters.timePeriod, userLogin : userLogin]);
previousTimePeriodResult = runService('getPreviousTimePeriod', [customTimePeriodId : parameters.timePeriod, userLogin : userLogin]);
previousTimePeriod = previousTimePeriodResult.previousTimePeriod;
if (UtilValidate.isNotEmpty(previousTimePeriod)) {
glAccountHistory = delegator.findOne("GlAccountHistory",
@@ -76,7 +75,7 @@ if (organizationPartyId) {
if ("ALL".equals(isPosted)) {
isPosted = "";
}
acctgTransEntriesAndTransTotal = dispatcher.runSync("getAcctgTransEntriesAndTransTotal",
acctgTransEntriesAndTransTotal = runService('getAcctgTransEntriesAndTransTotal',
[customTimePeriodStartDate : customTimePeriodStartDate, customTimePeriodEndDate : customTimePeriodEndDate, organizationPartyId : organizationPartyId, glAccountId : parameters.glAccountId, isPosted : isPosted, userLogin : userLogin]);
totalOfYearToDateDebit = totalOfYearToDateDebit + acctgTransEntriesAndTransTotal.debitTotal;
acctgTransEntriesAndTransTotal.totalOfYearToDateDebit = totalOfYearToDateDebit.setScale(decimals, rounding);
@@ -43,7 +43,7 @@ if (!glFiscalTypeId) {
}
// 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 = dispatcher.runSync("findLastClosedDate", UtilMisc.toMap("organizationPartyId", organizationPartyId, "findDate", new Date(fromDate.getTime()),"userLogin", userLogin));
Map lastClosedTimePeriodResult = runService('findLastClosedDate', ["organizationPartyId": organizationPartyId, "findDate": new Date(fromDate.getTime()),"userLogin": userLogin]);
Timestamp lastClosedDate = (Timestamp)lastClosedTimePeriodResult.lastClosedDate;
GenericValue lastClosedTimePeriod = null;
if (lastClosedDate) {
@@ -41,7 +41,7 @@ if (parameters.customTimePeriodId) {
postedCreditsTotal = 0
organizationGlAccounts.each { organizationGlAccount ->
accountBalance = [:]
accountBalance = dispatcher.runSync('computeGlAccountBalanceForTimePeriod', [organizationPartyId: organizationGlAccount.organizationPartyId, customTimePeriodId: customTimePeriod.customTimePeriodId, glAccountId: organizationGlAccount.glAccountId, userLogin: userLogin]);
accountBalance = runService('computeGlAccountBalanceForTimePeriod', [organizationPartyId: organizationGlAccount.organizationPartyId, customTimePeriodId: customTimePeriod.customTimePeriodId, glAccountId: organizationGlAccount.glAccountId, userLogin: userLogin]);
if (accountBalance.postedDebits != 0 || accountBalance.postedCredits != 0) {
accountBalance.glAccountId = organizationGlAccount.glAccountId
accountBalance.accountCode = organizationGlAccount.accountCode
@@ -39,7 +39,7 @@ if (fromDate) {
List invoices = [];
if (invoiceList) {
resultMap = dispatcher.runSync("getInvoicesFilterByAssocType", [invoiceItemAssocTypeId : "COMMISSION_INVOICE", invoiceList : invoiceList, userLogin : userLogin]);
resultMap = runService('getInvoicesFilterByAssocType', [invoiceItemAssocTypeId : "COMMISSION_INVOICE", invoiceList : invoiceList, userLogin : userLogin]);
invoices = resultMap.filteredInvoiceList;
context.invoices = invoices;
}
@@ -44,7 +44,7 @@ if (tree) {
try {
outMap = [:];
if (currencyUomId) {
outMap = dispatcher.runSync("getProductCost", [productId : node.getProduct().productId,
outMap = runService('getProductCost', [productId : node.getProduct().productId,
currencyUomId : currencyUomId,
costComponentTypePrefix : "EST_STD",
userLogin : userLogin]);
@@ -53,7 +53,7 @@ if (tree) {
grandTotalCost = grandTotalCost + totalCost ?: 0;
}
if (facilityId) {
outMap = dispatcher.runSync("getInventoryAvailableByFacility", [productId : node.getProduct().productId,
outMap = runService('getInventoryAvailableByFacility', [productId : node.getProduct().productId,
facilityId : facilityId,
userLogin : userLogin]);
qoh = outMap.quantityOnHandTotal;
@@ -49,7 +49,7 @@ if (shipment) {
userLogin: userLogin];
result = [:];
result = dispatcher.runSync("getNotAssembledComponents",inputPar);
result = runService('getNotAssembledComponents',inputPar);
if (result) {
components = (List)result.get("notAssembledComponents");
}
@@ -63,7 +63,7 @@ if (shipment) {
if (facilityId) {
if (!inventoryStock.containsKey(oneComponent.getProduct().productId)) {
serviceInput = [productId : oneComponent.getProduct().productId , facilityId : facilityId];
serviceOutput = dispatcher.runSync("getInventoryAvailableByFacility",serviceInput);
serviceOutput = runService('getInventoryAvailableByFacility',serviceInput);
qha = serviceOutput.quantityOnHandTotal ?: 0.0;
inventoryStock.put(oneComponent.getProduct().productId, qha);
}
@@ -75,7 +75,7 @@ if (shipment) {
// Now we get the products qty already reserved by production runs
serviceInput = [productId : oneComponent.getProduct().productId,
userLogin : userLogin];
serviceOutput = dispatcher.runSync("getProductionRunTotResQty", serviceInput);
serviceOutput = runSevice('getProductionRunTotResQty', serviceInput);
resQty = serviceOutput.reservedQuantity;
record.reservedQuantity = resQty;
records.add(record);
@@ -94,7 +94,7 @@ if (productStore) {
productStoreFacilityId = productStore.inventoryFacilityId;
}
context.facilityId = productStoreFacilityId;
inventorySummary = dispatcher.runSync("getProductInventorySummaryForItems", [orderItems : shoppingCart.makeOrderItems(), facilityId : productStoreFacilityId]);
inventorySummary = runService('getProductInventorySummaryForItems', [orderItems : shoppingCart.makeOrderItems(), facilityId : productStoreFacilityId]);
context.availableToPromiseMap = inventorySummary.availableToPromiseMap;
context.quantityOnHandMap = inventorySummary.quantityOnHandMap;
context.mktgPkgATPMap = inventorySummary.mktgPkgATPMap;
@@ -115,7 +115,7 @@ for (supplierProduct in supplierProducts) {
}
product = delegator.findOne("Product", ["productId" : productId], true);
productFacilityList.each { productFacility ->
result = dispatcher.runSync("getInventoryAvailableByFacility", ["productId" : productId, "facilityId" : productFacility.facilityId]);
result = runService('getInventoryAvailableByFacility', ["productId" : productId, "facilityId" : productFacility.facilityId]);
qohAtp = result.quantityOnHandTotal.toPlainString() + "/" + result.availableToPromiseTotal.toPlainString();
productInfoMap = [:];
@@ -64,7 +64,7 @@ if (context.orderByFields) {
} else {
andMap.put("orderByFields", ["sequenceNum", "productId"]);
}
catResult = dispatcher.runSync("getProductCategoryAndLimitedMembers", andMap);
catResult = runService('getProductCategoryAndLimitedMembers', andMap);
productCategory = catResult.productCategory;
productCategoryMembers = catResult.productCategoryMembers;
context.productCategoryMembers = productCategoryMembers;
@@ -54,7 +54,7 @@ compareList.each { product ->
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 = dispatcher.runSync("calculateProductPrice", priceContext);
productData.priceMap = runService('calculateProductPrice', priceContext);
condList = [
EntityCondition.makeCondition("productId", product.productId),
@@ -134,13 +134,13 @@ if (inlineProduct) {
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 = dispatcher.runSync("calculateProductPrice", priceContext);
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 = dispatcher.runSync("calculatePurchasePrice", priceContext);
priceMap = runService('calculatePurchasePrice', priceContext);
context.priceMap = priceMap;
}
@@ -154,10 +154,10 @@ if (inlineProduct) {
if ("VV_FEATURETREE".equals(ProductWorker.getProductVirtualVariantMethod(delegator, inlineProductId))) {
context.featureLists = ProductWorker.getSelectableProductFeaturesByTypesAndSeq(inlineProduct);
} else {
featureMap = dispatcher.runSync("getProductFeatureSet", [productId : inlineProductId]);
featureMap = runService("getProductFeatureSet", [productId : inlineProductId]);
featureSet = featureMap.featureSet;
if (featureSet) {
variantTreeMap = dispatcher.runSync("getProductVariantTree", [productId : inlineProductId, featureOrder : featureSet, productStoreId : productStoreId]);
variantTreeMap = runService('getProductVariantTree', [productId : inlineProductId, featureOrder : featureSet, productStoreId : productStoreId]);
variantTree = variantTreeMap.variantTree;
imageMap = variantTreeMap.variantSample;
virtualVariant = variantTreeMap.virtualVariant;
@@ -268,7 +268,7 @@ if (inlineProduct) {
}
// make a list of variant sku with requireAmount
variantsRes = dispatcher.runSync("getAssociatedProducts", [productId : inlineProductId, type : "PRODUCT_VARIANT", checkViewAllow : true, prodCatalogId : currentCatalogId]);
variantsRes = runService('getAssociatedProducts', [productId : inlineProductId, type : "PRODUCT_VARIANT", checkViewAllow : true, prodCatalogId : currentCatalogId]);
variants = variantsRes.assocProducts;
if (variants) {
amt = new StringBuffer();
@@ -289,7 +289,7 @@ if (inlineProduct) {
if (cart.isSalesOrder()) {
// sales order: run the "calculateProductPrice" service
priceContext.product = variant;
variantPriceMap = dispatcher.runSync("calculateProductPrice", priceContext);
variantPriceMap = runService('calculateProductPrice', priceContext);
}
amt.append(" if (sku == \"" + variant.productId + "\") return \"" + (variant.requireAmount ?: "N") + "\"; ");
variantPriceJS.append(" if (sku == \"" + variant.productId + "\") return \"" + numberFormat.format(variantPriceMap.basePrice) + "\"; ");
@@ -136,7 +136,7 @@ if (product) {
if (categoryId) {
prevNextMap = [categoryId : categoryId, productId : productId];
prevNextMap.orderByFields = context.orderByFields ?: ["sequenceNum", "productId"];
catNextPreviousResult = dispatcher.runSync("getPreviousNextProducts", prevNextMap);
catNextPreviousResult = runService('getPreviousNextProducts', prevNextMap);
if (ServiceUtil.isError(catNextPreviousResult)) {
request.setAttribute("errorMessageList", [ServiceUtil.getErrorMessage(catNextPreviousResult)]);
return;
@@ -182,13 +182,13 @@ if (product) {
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 = dispatcher.runSync("calculateProductPrice", priceContext);
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 = dispatcher.runSync("calculatePurchasePrice", priceContext);
priceMap = runService('calculatePurchasePrice', priceContext);
context.priceMap = priceMap;
}
@@ -219,7 +219,7 @@ if (product) {
context.daysToShip = productFacility?.daysToShip
*/
resultOutput = dispatcher.runSync("getInventoryAvailableByFacility", [productId : productId, facilityId : facilityId, useCache : false]);
resultOutput = runService('getInventoryAvailableByFacility', [productId : productId, facilityId : facilityId, useCache : false]);
totalAvailableToPromise = resultOutput.availableToPromiseTotal;
if (totalAvailableToPromise) {
productFacility = delegator.findOne("ProductFacility", [productId : productId, facilityId : facilityId], true);
@@ -236,7 +236,7 @@ if (product) {
}
// get the product distinguishing features
disFeatureMap = dispatcher.runSync("getProductFeatures", [productId : productId, type : "DISTINGUISHING_FEAT"]);
disFeatureMap = runService('getProductFeatures', [productId : productId, type : "DISTINGUISHING_FEAT"]);
disFeatureList = disFeatureMap.productFeatures;
context.disFeatureList = disFeatureList;
@@ -269,14 +269,14 @@ if (product) {
if ("VV_FEATURETREE".equals(ProductWorker.getProductVirtualVariantMethod(delegator, productId))) {
context.featureLists = ProductWorker.getSelectableProductFeaturesByTypesAndSeq(product);
} else {
featureMap = dispatcher.runSync("getProductFeatureSet", [productId : productId]);
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 = dispatcher.runSync("getProductVariantTree", [productId : productId, featureOrder : featureSet, checkInventory: false]);
variantTreeMap = runService('getProductVariantTree', [productId : productId, featureOrder : featureSet, checkInventory: false]);
} else {
variantTreeMap = dispatcher.runSync("getProductVariantTree", [productId : productId, featureOrder : featureSet, productStoreId : productStoreId]);
variantTreeMap = runService('getProductVariantTree', [productId : productId, featureOrder : featureSet, productStoreId : productStoreId]);
}
variantTree = variantTreeMap.variantTree;
imageMap = variantTreeMap.variantSample;
@@ -392,7 +392,7 @@ if (product) {
}
// make a list of variant sku with requireAmount
variantsRes = dispatcher.runSync("getAssociatedProducts", [productId : productId, type : "PRODUCT_VARIANT", checkViewAllow : true, prodCatalogId : currentCatalogId]);
variantsRes = runService('getAssociatedProducts', [productId : productId, type : "PRODUCT_VARIANT", checkViewAllow : true, prodCatalogId : currentCatalogId]);
variants = variantsRes.assocProducts;
variantPriceList = [];
if (variants) {
@@ -414,7 +414,7 @@ if (product) {
priceContext.product = variant;
if (cart.isSalesOrder()) {
// sales order: run the "calculateProductPrice" service
variantPriceMap = dispatcher.runSync("calculateProductPrice", priceContext);
variantPriceMap = runService('calculateProductPrice', priceContext);
BigDecimal calculatedPrice = (BigDecimal)variantPriceMap.get("price");
// Get the minimum quantity for variants if MINIMUM_ORDER_PRICE is set for variants.
variantPriceMap.put("minimumQuantity", ShoppingCart.getMinimumOrderQuantity(delegator, calculatedPrice, variant.get("productId")));
@@ -440,7 +440,7 @@ if (product) {
}
variantPriceList.add(variantPriceMap);
} else {
variantPriceMap = dispatcher.runSync("calculatePurchasePrice", priceContext);
variantPriceMap = runService('calculatePurchasePrice', priceContext);
}
amt.append(" if (sku == \"" + variant.productId + "\") return \"" + (variant.requireAmount ?: "N") + "\"; ");
if (variantPriceMap && variantPriceMap.basePrice) {
@@ -448,7 +448,7 @@ if (product) {
}
// make a list of virtual variants sku with requireAmount
virtualVariantsRes = dispatcher.runSync("getAssociatedProducts", [productIdTo : variant.productId, type : "ALTERNATIVE_PACKAGE", checkViewAllow : true, prodCatalogId : currentCatalogId]);
virtualVariantsRes = runService('getAssociatedProducts', [productIdTo : variant.productId, type : "ALTERNATIVE_PACKAGE", checkViewAllow : true, prodCatalogId : currentCatalogId]);
virtualVariants = virtualVariantsRes.assocProducts;
if(virtualVariants){
@@ -458,7 +458,7 @@ if (product) {
priceContext.product = virtual;
if (cart.isSalesOrder()) {
// sales order: run the "calculateProductPrice" service
virtualPriceMap = dispatcher.runSync("calculateProductPrice", priceContext);
virtualPriceMap = runService('calculateProductPrice', priceContext);
BigDecimal calculatedPrice = (BigDecimal)virtualPriceMap.get("price");
// Get the minimum quantity for variants if MINIMUM_ORDER_PRICE is set for variants.
virtualPriceMap.put("minimumQuantity", ShoppingCart.getMinimumOrderQuantity(delegator, calculatedPrice, virtual.get("productId")));
@@ -485,7 +485,7 @@ if (product) {
variantPriceList.add(virtualPriceMap);
variantPriceJS.append(" if (sku == \"" + virtual.productId + "\") return \"" + UtilFormatOut.formatCurrency(variantPriceMap.basePrice, currencyUomId, locale, 10) + "\"; ");
} else {
virtualPriceMap = dispatcher.runSync("calculatePurchasePrice", priceContext);
virtualPriceMap = runService('calculatePurchasePrice', priceContext);
variantPriceJS.append(" if (sku == \"" + virtual.productId + "\") return \"" + UtilFormatOut.formatCurrency(variantPriceMap.price, currencyUomId, locale, 10) + "\"; ");
}
}
@@ -512,7 +512,7 @@ if (product) {
jsBuf.append("<script language=\"JavaScript\" type=\"text/javascript\">");
// make a list of variant sku with requireAmount
virtualVariantsRes = dispatcher.runSync("getAssociatedProducts", [productIdTo : productId, type : "ALTERNATIVE_PACKAGE", checkViewAllow : true, prodCatalogId : categoryId]);
virtualVariantsRes = runService('getAssociatedProducts', [productIdTo : productId, type : "ALTERNATIVE_PACKAGE", checkViewAllow : true, prodCatalogId : categoryId]);
virtualVariants = virtualVariantsRes.assocProducts;
// Format to apply the currency code to the variant price in the javascript
if (productStore) {
@@ -535,13 +535,13 @@ if (product) {
priceContext.product = virtual;
if (cart.isSalesOrder()) {
// sales order: run the "calculateProductPrice" service
virtualPriceMap = dispatcher.runSync("calculateProductPrice", priceContext);
virtualPriceMap = runService('calculateProductPrice', priceContext);
BigDecimal calculatedPrice = (BigDecimal)virtualPriceMap.get("price");
// Get the minimum quantity for variants if MINIMUM_ORDER_PRICE is set for variants.
virtualVariantPriceList.add(virtualPriceMap);
variantPriceJS.append(" if (sku == \"" + virtual.productId + "\") return \"" + UtilFormatOut.formatCurrency(virtualPriceMap.basePrice, currencyUomId, locale, 10) + "\"; ");
} else {
virtualPriceMap = dispatcher.runSync("calculatePurchasePrice", priceContext);
virtualPriceMap = runService('calculatePurchasePrice', priceContext);
variantPriceJS.append(" if (sku == \"" + virtual.productId + "\") return \"" + UtilFormatOut.formatCurrency(virtualPriceMap.price, currencyUomId, locale, 10) + "\"; ");
}
}
@@ -560,7 +560,7 @@ if (product) {
// if the product is a MARKETING_PKG_AUTO/PICK, then also get the quantity which can be produced from components
if (isMarketingPackage) {
resultOutput = dispatcher.runSync("getMktgPackagesAvailable", [productId : productId]);
resultOutput = runService('getMktgPackagesAvailable', [productId : productId]);
availableInventory = resultOutput.availableToPromiseTotal;
} else {
//get last inventory count from product facility for the product
@@ -577,22 +577,22 @@ if (product) {
context.availableInventory = availableInventory;
// get product associations
alsoBoughtProducts = dispatcher.runSync("getAssociatedProducts", [productId : productId, type : "ALSO_BOUGHT", checkViewAllow : true, prodCatalogId : currentCatalogId, bidirectional : false, sortDescending : true]);
alsoBoughtProducts = runService('getAssociatedProducts', [productId : productId, type : "ALSO_BOUGHT", checkViewAllow : true, prodCatalogId : currentCatalogId, bidirectional : false, sortDescending : true]);
context.alsoBoughtProducts = alsoBoughtProducts.assocProducts;
obsoleteProducts = dispatcher.runSync("getAssociatedProducts", [productId : productId, type : "PRODUCT_OBSOLESCENCE", checkViewAllow : true, prodCatalogId : currentCatalogId]);
obsoleteProducts = runService('getAssociatedProducts', [productId : productId, type : "PRODUCT_OBSOLESCENCE", checkViewAllow : true, prodCatalogId : currentCatalogId]);
context.obsoleteProducts = obsoleteProducts.assocProducts;
crossSellProducts = dispatcher.runSync("getAssociatedProducts", [productId : productId, type : "PRODUCT_COMPLEMENT", checkViewAllow : true, prodCatalogId : currentCatalogId]);
crossSellProducts = runService('getAssociatedProducts', [productId : productId, type : "PRODUCT_COMPLEMENT", checkViewAllow : true, prodCatalogId : currentCatalogId]);
context.crossSellProducts = crossSellProducts.assocProducts;
upSellProducts = dispatcher.runSync("getAssociatedProducts", [productId : productId, type : "PRODUCT_UPGRADE", checkViewAllow : true, prodCatalogId : currentCatalogId]);
upSellProducts = runService('getAssociatedProducts', [productId : productId, type : "PRODUCT_UPGRADE", checkViewAllow : true, prodCatalogId : currentCatalogId]);
context.upSellProducts = upSellProducts.assocProducts;
obsolenscenseProducts = dispatcher.runSync("getAssociatedProducts", [productIdTo : productId, type : "PRODUCT_OBSOLESCENCE", checkViewAllow : true, prodCatalogId : currentCatalogId]);
obsolenscenseProducts = runService('getAssociatedProducts', [productIdTo : productId, type : "PRODUCT_OBSOLESCENCE", checkViewAllow : true, prodCatalogId : currentCatalogId]);
context.obsolenscenseProducts = obsolenscenseProducts.assocProducts;
accessoryProducts = dispatcher.runSync("getAssociatedProducts", [productId : productId, type : "PRODUCT_ACCESSORY", checkViewAllow : true, prodCatalogId : currentCatalogId]);
accessoryProducts = runService('getAssociatedProducts', [productId : productId, type : "PRODUCT_ACCESSORY", checkViewAllow : true, prodCatalogId : currentCatalogId]);
context.accessoryProducts = accessoryProducts.assocProducts;
/*
@@ -643,7 +643,7 @@ if (product) {
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);
runService('countProductView', [productId : productId, weight : new Long(1)], false);
//get product image from image management
productImageList = [];
@@ -75,7 +75,7 @@ if (!product && productId) {
if (product) {
//if order is purchase then don't calculate available inventory for product.
if (cart.isSalesOrder()) {
resultOutput = dispatcher.runSync("getInventoryAvailableByFacility", [productId : product.productId, facilityId : facilityId, useCache : true]);
resultOutput = runService('getInventoryAvailableByFacility', [productId : product.productId, facilityId : facilityId, useCache : true]);
totalAvailableToPromise = resultOutput.availableToPromiseTotal;
if (totalAvailableToPromise && totalAvailableToPromise.doubleValue() > 0) {
productFacility = delegator.findOne("ProductFacility", [productId : product.productId, facilityId : facilityId], true);
@@ -113,14 +113,14 @@ if (product) {
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 = dispatcher.runSync("calculateProductPrice", priceContext);
priceMap = runService('calculateProductPrice', priceContext);
context.price = priceMap;
} else {
// purchase order: run the "calculatePurchasePrice" service
priceContext = [product : product, currencyUomId : cart.getCurrency(),
partyId : cart.getPartyId(), userLogin : userLogin];
priceMap = dispatcher.runSync("calculatePurchasePrice", priceContext);
priceMap = runService('calculatePurchasePrice', priceContext);
context.price = priceMap;
}
@@ -160,7 +160,7 @@ if (product) {
jsBuf.append("<script language=\"JavaScript\" type=\"text/javascript\">");
// make a list of variant sku with requireAmount
virtualVariantsRes = dispatcher.runSync("getAssociatedProducts", [productIdTo : productId, type : "ALTERNATIVE_PACKAGE", checkViewAllow : true, prodCatalogId : categoryId]);
virtualVariantsRes = runService('getAssociatedProducts', [productIdTo : productId, type : "ALTERNATIVE_PACKAGE", checkViewAllow : true, prodCatalogId : categoryId]);
virtualVariants = virtualVariantsRes.assocProducts;
// Format to apply the currency code to the variant price in the javascript
if (productStore) {
@@ -184,12 +184,12 @@ if (product) {
priceContext.product = virtual;
if (cart.isSalesOrder()) {
// sales order: run the "calculateProductPrice" service
virtualPriceMap = dispatcher.runSync("calculateProductPrice", priceContext);
virtualPriceMap = runService('calculateProductPrice', priceContext);
BigDecimal calculatedPrice = (BigDecimal)virtualPriceMap.get("price");
// Get the minimum quantity for variants if MINIMUM_ORDER_PRICE is set for variants.
variantPriceList.add(virtualPriceMap);
} else {
virtualPriceMap = dispatcher.runSync("calculatePurchasePrice", priceContext);
virtualPriceMap = runService('calculatePurchasePrice', priceContext);
}
variantPriceJS.append(" if (sku == \"" + virtual.productId + "\") return \"" + numberFormat.format(virtualPriceMap.basePrice) + "\"; ");
}
@@ -39,7 +39,7 @@ context.categoryId = categoryId;
if (categoryId) {
fields = [productCategoryId : categoryId, defaultViewSize : 10,
limitView : false, prodCatalogId : currentCatalogId, checkViewAllow : true];
result = dispatcher.runSync("getProductCategoryAndLimitedMembers", fields);
result = runService('getProductCategoryAndLimitedMembers', fields);
if (result) {
result.each { key, value ->
context[key] = value;
@@ -32,8 +32,7 @@ if (orderHeader) {
schedule = delegator.findOne("OrderDeliverySchedule", [orderId : orderId, orderItemSeqId : "_NA_"], false);
// Determine whether the current user can VIEW the order
checkMap = [orderId : orderId, userLogin : session.getAttribute("userLogin"), checkAction : "VIEW"];
checkResult = dispatcher.runSync("checkSupplierRelatedOrderPermission", checkMap);
checkResult = runService('checkSupplierRelatedOrderPermission', [orderId : orderId, userLogin : session.getAttribute("userLogin"), checkAction : "VIEW"]);
hasSupplierRelatedPermissionStr = checkResult.hasSupplierRelatedPermission;
// Determine what the reuslt is, no result is FALSE
@@ -17,9 +17,9 @@
* under the License.
*/
prepare = dispatcher.runSync("prepareFind", [inputFields : parameters, entityName : "Requirement"]);
prepare = runService('prepareFind', [inputFields : parameters, entityName : "Requirement"]);
if (prepare.entityConditionList) {
results = dispatcher.runSync("getRequirementsForSupplier", [requirementConditions : prepare.entityConditionList, partyId : parameters.partyId]);
results = runService('getRequirementsForSupplier', [requirementConditions : prepare.entityConditionList, partyId : parameters.partyId]);
context.requirementsForSupplier = results.requirementsForSupplier;
context.quantityReport = [distinctProductCount : results.distinctProductCount, quantityTotal : results.quantityTotal, amountTotal : results.amountTotal];
}
@@ -24,7 +24,7 @@ import org.ofbiz.entity.condition.EntityConditionList;
import org.ofbiz.entity.condition.EntityExpr;
import org.ofbiz.entity.condition.EntityOperator;
prepare = dispatcher.runSync("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")],
@@ -35,5 +35,5 @@ if (prepare.entityConditionList) {
} else {
ecl = statusCondition;
}
results = dispatcher.runSync("executeFind", [entityConditionList : ecl, entityName : "Requirement"]);
results = runService('executeFind', [entityConditionList : ecl, entityName : "Requirement"]);
context.requirements = results.listIt;
@@ -92,7 +92,7 @@ returnItemTypeMap.each { value ->
context.returnItemTypeMap = typeMap;
if (orderId) {
returnRes = dispatcher.runSync("getReturnableItems", [orderId : orderId]);
returnRes = runService('getReturnableItems', [orderId : orderId]);
context.returnableItems = returnRes.returnableItems;
orderHeader = delegator.findOne("OrderHeader", [orderId : orderId], false);
context.orderHeader = orderHeader;
@@ -65,7 +65,7 @@ context.returnItemTypeMap = typeMap;
if (orderId) {
order = delegator.findOne("OrderHeader", [orderId : orderId], false);
returnRes = dispatcher.runSync("getReturnableItems", [orderId : orderId]);
returnRes = runService('getReturnableItems', [orderId : orderId]);
context.returnableItems = returnRes.returnableItems;
orh = new OrderReadHelper(order);
@@ -73,7 +73,7 @@ if (orderId) {
context.orderHeaderAdjustments = orh.getAvailableOrderHeaderAdjustments();
// get the order shipping amount
shipRes = dispatcher.runSync("getOrderShippingAmount", [orderId : orderId]);
shipRes = runService('getOrderShippingAmount', [orderId : orderId]);
shippingAmount = shipRes.shippingAmount;
context.shippingAmount = shippingAmount;
}
@@ -83,8 +83,7 @@ if (shoppingListId) {
product = shoppingListItem.getRelatedOne("Product", true);
// DEJ20050704 not sure about calculating price here, will have some bogus data when not in a store webapp
calcPriceInMap = [product : product, quantity : shoppingListItem.quantity , currencyUomId : currencyUomId, userLogin : userLogin, productStoreId : shoppingList.productStoreId];
calcPriceOutMap = dispatcher.runSync("calculateProductPrice", calcPriceInMap);
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;
@@ -30,7 +30,7 @@ if (context.noConditionFind == null) {
if (context.filterByDate == null) {
context.filterByDate = parameters.filterByDate;
}
prepareResult = dispatcher.runSync("prepareFind", [entityName : context.entityName,
prepareResult = runService('prepareFind', [entityName : context.entityName,
orderBy : context.orderBy,
inputFields : parameters,
filterByDate : context.filterByDate,
@@ -50,7 +50,7 @@ if (prepareResult.entityConditionList != null) {
entityConditionList = statusPartyDisable;
}
executeResult = dispatcher.runSync("executeFind", [entityName : context.entityName,
executeResult = runService('executeFind', [entityName : context.entityName,
orderByList : prepareResult.orderByList,
entityConditionList : entityConditionList,
noConditionFind :context.noConditionFind
@@ -27,9 +27,8 @@ if (partyId) {
monthsToInclude = 12;
Map serviceIn = UtilMisc.toMap("partyId", partyId, "roleTypeId", "PLACING_CUSTOMER", "orderTypeId", "SALES_ORDER",
"statusId", "ORDER_COMPLETED", "monthsToInclude", monthsToInclude, "userLogin", system);
Map result = dispatcher.runSync("getOrderedSummaryInformation", serviceIn);
Map result = runService('getOrderedSummaryInformation', ["partyId": partyId, "roleTypeId": "PLACING_CUSTOMER", "orderTypeId": "SALES_ORDER",
"statusId": "ORDER_COMPLETED", "monthsToInclude": monthsToInclude, "userLogin": system]);
context.monthsToInclude = monthsToInclude;
context.totalSubRemainingAmount = result.totalSubRemainingAmount;
@@ -34,7 +34,7 @@ paramInMap.viewIndexString = parameters.get("VIEW_INDEX");
paramInMap.viewSizeString = parameters.get("VIEW_SIZE");
// Returns: viewIndex, viewSize, lowIndex, highIndex, listSize, productCategory, productCategoryMembers
outMap = dispatcher.runSync("getProductCategoryAndLimitedMembers", paramInMap);
outMap = runService('getProductCategoryAndLimitedMembers', paramInMap);
context.viewIndex = outMap.viewIndex;
context.viewSize = outMap.viewSize;
context.lowIndex = outMap.lowIndex;
@@ -42,7 +42,7 @@ if (isOpen) {
paramInMap.checkViewAllow = false;
// Returns: viewIndex, viewSize, lowIndex, highIndex, listSize, productCategory, productCategoryMembers
outMap = dispatcher.runSync("getProductCategoryAndLimitedMembers", paramInMap);
outMap = runService('getProductCategoryAndLimitedMembers', paramInMap);
context.viewIndex = outMap.viewIndex;
context.viewSize = outMap.viewSize;
context.lowIndex = outMap.lowIndex;
@@ -24,7 +24,7 @@ productVariantId = productId + "_";
productFeatureIds = "";
product = delegator.findOne("Product", [productId : productId], false);
result = dispatcher.runSync("getProductFeaturesByType", [productId : productId, productFeatureApplTypeId : "SELECTABLE_FEATURE"]);
result = runService('getProductFeaturesByType', [productId : productId, productFeatureApplTypeId : "SELECTABLE_FEATURE"]);
featureTypes = result.productFeatureTypes;
featuresByTypes = result.productFeaturesByType;
searchFeatures = [];
@@ -48,7 +48,7 @@ if (featureTypes) {
variants = [];
//if (selectedFeatureTypeValues) {
result = dispatcher.runSync("getAllExistingVariants", [productId : productId, productFeatureAppls : selectedFeatureTypeValues]);
result = runService('getAllExistingVariants', [productId : productId, productFeatureAppls : selectedFeatureTypeValues]);
variants = result.variantProductIds;
//}
@@ -56,7 +56,7 @@ variants = [];
productFeatureIdsPar = request.getParameter("productFeatureIds");
productVariantIdPar = request.getParameter("productVariantId");
if (productVariantIdPar && productFeatureIdsPar) {
result = dispatcher.runSync("quickAddVariant", [productId : productId, productFeatureIds : productFeatureIdsPar, productVariantId : productVariantIdPar]);
result = runService('quickAddVariant', [productId : productId, productFeatureIds : productFeatureIdsPar, productVariantId : productVariantIdPar]);
}
context.product = product;
@@ -84,8 +84,7 @@ if ("FULFILLMENT_EMAIL".equals(productContentTypeId)) {
emailData.subject = subject.textData;
emailData.subjectDataResourceId = subject.dataResourceId;
}
serviceCtx = [userLogin : userLogin, contentId : contentId, mapKeys : ['plainBody', 'htmlBody']];
result = dispatcher.runSync("findAssocContent", serviceCtx);
result = runService('findAssocContent', [userLogin : userLogin, contentId : contentId, mapKeys : ['plainBody', 'htmlBody']]);
contentAssocs = result.get("contentAssocs");
if (contentAssocs) {
contentAssocs.each { contentAssoc ->
@@ -27,11 +27,11 @@ if (product) {
//If product is virtual gather summary data from variants
if (product.isVirtual && "Y".equals(product.isVirtual)) {
//Get the virtual product feature types
result = dispatcher.runSync("getProductFeaturesByType", [productId : productId, productFeatureApplTypeId : 'SELECTABLE_FEATURE']);
result = runService('getProductFeaturesByType', [productId : productId, productFeatureApplTypeId : 'SELECTABLE_FEATURE']);
featureTypeIds = result.productFeatureTypes;
//Get the variants
result = dispatcher.runSync("getAllProductVariants", [productId : productId]);
result = runService('getAllProductVariants', [productId : productId]);
variants = result.assocProducts;
variantIterator = variants.iterator();
variantInventorySummaries = [];
@@ -39,7 +39,7 @@ if (product) {
variant = variantIterator.next();
//create a map of each variant id and inventory summary (all facilities)
inventoryAvailable = dispatcher.runSync("getProductInventoryAvailable", [productId : variant.productIdTo]);
inventoryAvailable = runService('getProductInventoryAvailable', [productId : variant.productIdTo]);
variantInventorySummary = [productId : variant.productIdTo,
availableToPromiseTotal : inventoryAvailable.availableToPromiseTotal,
@@ -49,7 +49,7 @@ if (product) {
featureTypeIdsIterator = featureTypeIds.iterator();
while (featureTypeIdsIterator) {
featureTypeId = featureTypeIdsIterator.next();
result = dispatcher.runSync("getProductFeatures", [productId : variant.productIdTo, type : 'STANDARD_FEATURE', distinct : featureTypeId]);
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
@@ -80,7 +80,7 @@ if (product) {
// are obtained (calling the "getInventoryAvailableByFacility" service)
while (facilityIterator) {
facility = facilityIterator.next();
resultOutput = dispatcher.runSync("getInventoryAvailableByFacility", [productId : productId, facilityId : facility.facilityId]);
resultOutput = runService('getInventoryAvailableByFacility', [productId : productId, facilityId : facility.facilityId]);
quantitySummary = [:];
quantitySummary.facilityId = facility.facilityId;
@@ -89,7 +89,7 @@ if (product) {
// if the product is a MARKETING_PKG_AUTO/PICK, then also get the quantity which can be produced from components
if (isMarketingPackage) {
resultOutput = dispatcher.runSync("getMktgPackagesAvailable", [productId : productId, facilityId : facility.facilityId]);
resultOutput = runService('getMktgPackagesAvailable', [productId : productId, facilityId : facility.facilityId]);
quantitySummary.mktgPkgQOH = resultOutput.quantityOnHandTotal;
quantitySummary.mktgPkgATP = resultOutput.availableToPromiseTotal;
}
@@ -143,7 +143,7 @@ if (product) {
// --------------------
// Production Runs
resultOutput = dispatcher.runSync("getProductManufacturingSummaryByFacility",
resultOutput = runService('getProductManufacturingSummaryByFacility',
[productId : productId, userLogin : userLogin]);
// incoming products
manufacturingInQuantitySummaryByFacility = resultOutput.summaryInByFacility;
@@ -17,8 +17,8 @@
* under the License.
*/
result = dispatcher.runSync("getProductFeaturesByType", [productId : productId, productFeatureApplTypeId : 'SELECTABLE_FEATURE']);
result = runService('getProductFeaturesByType', [productId : productId, productFeatureApplTypeId : 'SELECTABLE_FEATURE']);
context.featureTypes = result.productFeatureTypes;
result = dispatcher.runSync("getVariantCombinations", [productId : productId]);
result = runService('getVariantCombinations', [productId : productId]);
context.featureCombinationInfos = result.featureCombinations;
@@ -28,9 +28,9 @@ if (parameters.fromDateSellThrough) {
fromDate = Timestamp.valueOf(parameters.fromDateSellThrough);
thruDate = Timestamp.valueOf(parameters.thruDateSellThrough);
} catch(Exception e) {}
inventoryCountResult = dispatcher.runSync("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 = dispatcher.runSync("countProductInventoryShippedForSales", [productId : productId, facilityId : facilityId, fromDate : fromDate, thruDate : thruDate, userLogin : userLogin]);
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));
@@ -173,7 +173,7 @@ if (action) {
oneInventory.reorderQuantity = oneProd.reorderQuantity;
oneInventory.daysToShip = oneProd.daysToShip;
resultMap = dispatcher.runSync("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;
@@ -53,7 +53,7 @@ if (conditions.size() > 2) {
// for each product, call the inventory counting service
productIds.each { productId ->
result = dispatcher.runSync("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);
@@ -35,7 +35,7 @@ inventoryAverageCosts = FastList.newInstance();
inventoryItemProducts.each { productId ->
productFacility = delegator.findOne("ProductFacility", UtilMisc.toMap("productId", productId, "facilityId", facilityId), false);
if (UtilValidate.isNotEmpty(productFacility)) {
result = dispatcher.runSync("calculateProductAverageCost", UtilMisc.toMap("productId", productId, "facilityId", facilityId, "userLogin", userLogin));
result = runService('calculateProductAverageCost', UtilMisc.toMap("productId": productId, "facilityId": facilityId, "userLogin": userLogin));
totalQuantityOnHand = result.get("totalQuantityOnHand");
totalInventoryCost = result.get("totalInventoryCost");
@@ -41,7 +41,7 @@ ownerAcctgPref = null;
if (facility) {
owner = facility.getRelatedOne("OwnerParty", false);
if (owner) {
result = dispatcher.runSync("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;
}
@@ -141,7 +141,7 @@ if (purchaseOrder && facility) {
if (!orderCurrencyUomId.equals(ownerCurrencyUomId)) {
purchaseOrderItems.each { item ->
orderCurrencyUnitPriceMap.(item.orderItemSeqId) = item.unitPrice;
serviceResults = dispatcher.runSync("convertUom",
serviceResults = runService('convertUom',
[uomId : orderCurrencyUomId, uomIdTo : ownerCurrencyUomId, originalValue : item.unitPrice]);
if (ServiceUtil.isError(serviceResults)) {
request.setAttribute("_ERROR_MESSAGE_", ServiceUtil.getErrorMessage(serviceResults));
@@ -229,7 +229,7 @@ if (ownerAcctgPref) {
purchaseOrderItems.each { orderItem ->
productId = orderItem.productId;
if (productId) {
result = dispatcher.runSync("getProductCost", [productId : productId, currencyUomId : ownerAcctgPref.baseCurrencyUomId,
result = runService('getProductCost', [productId : productId, currencyUomId : ownerAcctgPref.baseCurrencyUomId,
costComponentTypePrefix : 'EST_STD', userLogin : request.getAttribute("userLogin")]);
if (!ServiceUtil.isError(result)) {
standardCosts.put(productId, result.productCost);
@@ -240,7 +240,7 @@ if (ownerAcctgPref) {
// get the unit cost of a single product
if (productId) {
result = dispatcher.runSync("getProductCost", [productId : productId, currencyUomId : ownerAcctgPref.baseCurrencyUomId,
result = runService('getProductCost', [productId : productId, currencyUomId : ownerAcctgPref.baseCurrencyUomId,
costComponentTypePrefix : 'EST_STD', userLogin : request.getAttribute("userLogin")]);
if (!ServiceUtil.isError(result)) {
standardCosts.put(productId, result.productCost);
@@ -89,7 +89,7 @@ baseCurrencyUomId = null;
if (facility) {
owner = facility.getRelatedOne("OwnerParty", false);
if (owner) {
result = dispatcher.runSync("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;
}
@@ -161,7 +161,7 @@ orderItems.each { orderItemAndShipGroupAssoc ->
// Update the unit cost with the converted value, if any
if (baseCurrencyUomId && orderHeader.currencyUom) {
if (product) {
result = dispatcher.runSync("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;
}
@@ -40,7 +40,7 @@ serviceCtx.putAll(UtilMisc.toMap("userLogin", userLogin, "start", start, "numPer
if (context.entityExprList) {
serviceCtx.entityExprList = entityExprList;
}
Map result = dispatcher.runSync("getWorkEffortEventsByPeriod", serviceCtx);
Map result = runService('getWorkEffortEventsByPeriod', serviceCtx);
context.put("periods", result.get("periods"));
context.put("maxConcurrentEntries", result.get("maxConcurrentEntries"));
context.put("start", start);
@@ -62,7 +62,7 @@ serviceCtx.putAll(UtilMisc.toMap("userLogin", userLogin, "start", getFrom, "cale
if (context.entityExprList) {
serviceCtx.entityExprList = entityExprList;
}
result = dispatcher.runSync("getWorkEffortEventsByPeriod", serviceCtx);
result = runService('getWorkEffortEventsByPeriod', serviceCtx);
context.put("periods",result.get("periods"));
context.put("maxConcurrentEntries", result.get("maxConcurrentEntries"));
context.put("start", start);
@@ -43,7 +43,7 @@ if (workEffortTypeId != null) {
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 = dispatcher.runSync("getWorkEffortEventsByPeriod",serviceCtx);
Map result = runService('getWorkEffortEventsByPeriod',serviceCtx);
context.put("days", result.get("periods"));
context.put("start", start);
context.put("eventsParam", eventsParam);
@@ -41,7 +41,7 @@ serviceCtx.putAll(UtilMisc.toMap("userLogin", userLogin, "start", start, "numPer
if (context.entityExprList) {
serviceCtx.entityExprList = entityExprList;
}
Map result = dispatcher.runSync("getWorkEffortEventsByPeriod",serviceCtx);
Map result = runService('getWorkEffortEventsByPeriod',serviceCtx);
context.put("periods",result.get("periods"));
context.put("maxConcurrentEntries",result.get("maxConcurrentEntries"));
context.put("start",start);
@@ -19,7 +19,6 @@
import org.ofbiz.base.util.UtilMisc;
Map serviceCtx = UtilMisc.toMap("userLogin", userLogin);
Map requests = dispatcher.runSync("getCustRequestsByRole", serviceCtx);
Map requests = runService('getCustRequestsByRole', ["userLogin": userLogin]);
context.put("custRequestAndRoles", requests.get("custRequestAndRoles"));
@@ -33,7 +33,7 @@ portalPortlets = [];
if (listPortalPortlet.securityServiceName && listPortalPortlet.securityMainAction) {
inMap.mainAction = listPortalPortlet.securityMainAction;
inMap.userLogin = context.userLogin;
result = dispatcher.runSync(listPortalPortlet.securityServiceName, inMap)
result = runService(listPortalPortlet.securityServiceName, inMap)
hasPermission = result.hasPermission;
} else {
hasPermission = true;
@@ -51,7 +51,7 @@ if (parameters.productStoreId) {
userLogin = parameters.userLogin;
if (productStoreId) {
results = dispatcher.runSync("getEbayCategories", [categoryCode : categoryCode, userLogin : userLogin, productStoreId : productStoreId]);
results = runService('getEbayCategories', [categoryCode : categoryCode, userLogin : userLogin, productStoreId : productStoreId]);
}
if (results.categories) {
@@ -25,10 +25,7 @@ import java.util.Map;
import javolution.util.FastMap;
partyId = null
inMap = FastMap.newInstance();
inMap.put("productStoreId", parameters.productStoreId);
inMap.put("userLogin", context.get("userLogin"));
resultUser = dispatcher.runSync("getEbayStoreUser", inMap);
resultUser = runService('getEbayStoreUser', ["productStoreId": parameters.productStoreId, "userLogin": context.get("userLogin")]);
ownerUser = resultUser.get("userLoginId");
userLogin = delegator.findOne("UserLogin", UtilMisc.toMap("userLoginId", ownerUser), false);
if (userLogin) {
@@ -26,7 +26,7 @@ if (parameters.ebayStore) {
if (productStoreId != null) {
flag = null;
storeBasicThemes = null;
resultsBasicThemes = dispatcher.runSync("retrieveBasicThemeArray",["productStoreId":productStoreId, "userLogin": userLogin]);
resultsBasicThemes = runService('retrieveBasicThemeArray',["productStoreId":productStoreId, "userLogin": userLogin]);
if(resultsBasicThemes){
storeBasicThemes = resultsBasicThemes.get("storeThemeList");
//check what kind of theme?
@@ -41,7 +41,7 @@ if (productStoreId != null) {
}
storeAdvanceThemes = null;
storeAdvancedThemeColorOptList = null;
resultsAdvanceThemes = dispatcher.runSync("retrieveAdvancedThemeArray",["productStoreId":productStoreId, "userLogin": userLogin]);
resultsAdvanceThemes = runService('retrieveAdvancedThemeArray',["productStoreId":productStoreId, "userLogin": userLogin]);
if (resultsAdvanceThemes) {
storeAdvanceThemes = resultsAdvanceThemes.get("storeThemeList");
storeAdvancedThemeColorOptList = resultsAdvanceThemes.get("storeAdvancedThemeColorOptList");
@@ -56,7 +56,7 @@ if (productStoreId != null) {
}
}
}
resultsFontTheme = dispatcher.runSync("retrieveStoreFontTheme",["productStoreId":productStoreId, "userLogin": userLogin]);
resultsFontTheme = runService('retrieveStoreFontTheme',["productStoreId":productStoreId, "userLogin": userLogin]);
if (resultsFontTheme) {
storeFontTheme = resultsFontTheme.get("advanceFontTheme");
context.put("storeFontTheme",storeFontTheme);
@@ -51,12 +51,12 @@ if (miniProduct && productStoreId && prodCatalogId ) {
autoUserLogin : autoUserLogin,
productStoreId : productStoreId];
if (userLogin) priceParams.partyId = userLogin.partyId;
priceResult = dispatcher.runSync("calculateProductPrice", priceParams);
priceResult = runService('calculateProductPrice', priceParams);
// returns: isSale, price, orderItemPriceInfos
context.priceResult = priceResult;
// Check if Price has to be displayed with tax
if (productStore.get("showPricesWithVatTax").equals("Y")) {
Map priceMap = dispatcher.runSync("calcTaxForDisplay", UtilMisc.toMap("basePrice", priceResult.get("price"), "locale", locale, "productId", optProductId, "productStoreId", productStoreId));
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");
@@ -70,7 +70,7 @@ if (miniProduct && productStoreId && prodCatalogId ) {
// Check if Config Price has to be displayed with tax
if (productStore.get("showPricesWithVatTax").equals("Y")) {
BigDecimal totalPriceNoTax = configWrapper.getTotalPrice();
Map totalPriceMap = dispatcher.runSync("calcTaxForDisplay", UtilMisc.toMap("basePrice", totalPriceNoTax, "locale", locale, "productId", optProductId, "productStoreId", productStoreId));
Map totalPriceMap = runService('calcTaxForDisplay', ["basePrice": totalPriceNoTax, "locale": locale, "productId": optProductId, "productStoreId": productStoreId]);
context.totalPrice = totalPriceMap.get("priceWithTax");
} else {
context.totalPrice = configWrapper.getTotalPrice();
@@ -77,8 +77,7 @@ if (userLogin) {
// call the getOrderedSummaryInformation service to get the sub-total of valid orders in last X months
monthsToInclude = 12;
serviceIn = [partyId : partyId, roleTypeId : "PLACING_CUSTOMER", orderTypeId : "SALES_ORDER", statusId : "ORDER_COMPLETED", monthsToInclude : monthsToInclude, userLogin : userLogin];
result = dispatcher.runSync("getOrderedSummaryInformation", serviceIn);
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;
@@ -128,7 +128,7 @@ if (permissionType.equals("complex")) {
}
//org.ofbiz.base.util.Debug.logInfo("in permprep, mapIn:" + mapIn, null);
result = dispatcher.runSync("checkContentPermission", mapIn);
result = runService('checkContentPermission', mapIn);
permissionStatus = result.permissionStatus;
//org.ofbiz.base.util.Debug.logInfo("in permprep, permissionStatus:" + permissionStatus, null);
if ("granted".equals(permissionStatus)) {
@@ -79,7 +79,7 @@ mapIn.entityOperation = "_CREATE";
mapIn.contentPurposeList = ["RESPONSE"];
//org.ofbiz.base.util.Debug.logInfo("in permprep, mapIn:" + mapIn, null);
result = dispatcher.runSync("checkContentPermission", mapIn);
result = runService('checkContentPermission', mapIn);
permissionStatus = result.permissionStatus;
//org.ofbiz.base.util.Debug.logInfo("permissionStatus:" + permissionStatus, null);
if (!"granted".equals(permissionStatus)) {
@@ -34,7 +34,7 @@ returnReasons = delegator.findList("ReturnReason", null, null, ["sequenceId"], n
context.returnReasons = returnReasons;
if (orderId) {
returnRes = dispatcher.runSync("getReturnableItems", [orderId : orderId]);
returnRes = runService('getReturnableItems', [orderId : orderId]);
context.returnableItems = returnRes.returnableItems;
orderHeader = delegator.findOne("OrderHeader", [orderId : orderId], false);
context.orderHeader = orderHeader;
@@ -93,11 +93,8 @@ if (shoppingListId) {
product = shoppingListItem.getRelatedOne("Product", true);
calcPriceInMap = [product : product, quantity : shoppingListItem.quantity, currencyUomId : currencyUomId, userLogin : userLogin];
calcPriceInMap.webSiteId = webSiteId;
calcPriceInMap.prodCatalogId = prodCatalogId;
calcPriceInMap.productStoreId = productStoreId;
calcPriceOutMap = dispatcher.runSync("calculateProductPrice", calcPriceInMap);
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;
// similar code at ShoppingCartItem.java getRentalAdjustment
@@ -171,8 +168,7 @@ if (shoppingListId) {
childShoppingLists.each { childShoppingList ->
childShoppingListData = [:];
calcListPriceInMap = [shoppingListId : childShoppingList.shoppingListId, prodCatalogId : prodCatalogId, webSiteId : webSiteId, userLogin : userLogin, currencyUomId : currencyUomId];
childShoppingListPriceMap = dispatcher.runSync("calculateShoppingListDeepTotalPrice", calcListPriceInMap);
childShoppingListPriceMap = runService('calculateShoppingListDeepTotalPrice', [shoppingListId : childShoppingList.shoppingListId, prodCatalogId : prodCatalogId, webSiteId : webSiteId, userLogin : userLogin, currencyUomId : currencyUomId]);
totalPrice = childShoppingListPriceMap.totalPrice;
shoppingListChildTotal += totalPrice;
@@ -71,7 +71,7 @@ if (UtilValidate.isNotEmpty(productIds) && ("Y".equals(active) || "Y".equals(not
def notDiscontProdList = []
if(parameters.DISCONTINUED_PRODUCT == 'Y'){
productIds.each { value ->
def stockIsZero = dispatcher.runSync("isStoreInventoryAvailable", ["productId": value, "productStoreId": parameters.productStoreId, "quantity": BigDecimal.valueOf(1.00)]);
def stockIsZero = runService('isStoreInventoryAvailable', ["productId": value, "productStoreId": parameters.productStoreId, "quantity": BigDecimal.valueOf(1.00)]);
def thisProduct = delegator.findOne("Product", [productId : value], false);
if (stockIsZero.get("available") == 'Y'){
notDiscontProdList.add(value);
@@ -49,7 +49,7 @@ prodCatalogList.each { prodCatalogList ->
prodCatalogCategoryList = delegator.findByAnd("ProdCatalogCategory",["prodCatalogId":currentCatalogId, "prodCatalogCategoryTypeId":"PCCT_BROWSE_ROOT"], null, false);
topCategory = prodCatalogCategoryList.productCategoryId[0];
if (topCategory){
relatedCategories = dispatcher.runSync("getRelatedCategories", [parentProductCategoryId: topCategory, userLogin: userLogin]);
relatedCategories = runService('getRelatedCategories', [parentProductCategoryId: topCategory, userLogin: userLogin]);
categoryList = relatedCategories.categories
} else {
categoryIdsTemp.clear()
@@ -31,7 +31,7 @@ if (productId) {
context.product = product;
facilityId = request.getParameter("facilityId");
resultOutput = dispatcher.runSync("getInventoryAvailableByFacility", [productId : productId, facilityId : facilityId]);
resultOutput = runService('getInventoryAvailableByFacility', [productId : productId, facilityId : facilityId]);
quantitySummary = FastMap.newInstance();
quantitySummary.facilityId = facilityId;
quantitySummary.atp_qoh = ((Double)resultOutput.availableToPromiseTotal).intValue() + " / " +
@@ -80,7 +80,7 @@ if (productId) {
locationsIter = locations.keySet().iterator();
while (locationsIter.hasNext()) {
location = locationsIter.next();
resultOutput = dispatcher.runSync("getInventoryAvailableByLocation", [productId : productId, facilityId : facilityId, locationSeqId : location]);
resultOutput = runService('getInventoryAvailableByLocation', [productId : productId, facilityId : facilityId, locationSeqId : location]);
quantitySummary = FastMap.newInstance();
quantitySummary.productId = productId;
quantitySummary.facilityId = facilityId;
@@ -53,7 +53,7 @@ if (timesheetId) {
timesheet = entryIterator.next();
entryIterator.close();
if (timesheet == null) {
result = dispatcher.runSync("createProjectTimesheet", ["userLogin" : parameters.userLogin, "partyId" : partyId]);
result = runService('createProjectTimesheet', ["userLogin" : parameters.userLogin, "partyId" : partyId]);
if (result && result.timesheetId) {
timesheet = delegator.findOne("Timesheet", ["timesheetId" : result.timesheetId], false);
}
@@ -114,7 +114,7 @@ void retrieveWorkEffortData() {
// get project/phase information
entry.workEffortId = entryWorkEffort.workEffortId;
entry.workEffortName = entryWorkEffort.workEffortName;
result = dispatcher.runSync("getProjectIdAndNameFromTask", ["userLogin" : parameters.userLogin,"taskId" : entryWorkEffort.workEffortId]);
result = runService('getProjectIdAndNameFromTask', ["userLogin" : parameters.userLogin,"taskId" : entryWorkEffort.workEffortId]);
entry.phaseId = result.phaseId;
entry.phaseName = result.phaseName;
entry.projectId = result.projectId;
@@ -32,7 +32,7 @@ projectId = parameters.projectId;
userLogin = parameters.userLogin;
//project info
result = dispatcher.runSync("getProject", [projectId : projectId, userLogin : userLogin]);
result = runService('getProject', [projectId : projectId, userLogin : userLogin]);
project = result.projectInfo;
if (project && project.startDate)
context.chartStart = project.startDate;
@@ -46,7 +46,7 @@ else
if (project == null) return;
ganttList = new LinkedList();
result = dispatcher.runSync("getProjectPhaseList", [userLogin : userLogin , projectId : projectId]);
result = runService('getProjectPhaseList', [userLogin : userLogin , projectId : projectId]);
phases = result.phaseList;
if (phases) {
phases.each { phase ->
@@ -74,7 +74,7 @@ if (phases) {
tasks = delegator.findList("WorkEffort", cond, null, ["sequenceNum","workEffortName"], null, false);
if (tasks) {
tasks.each { task ->
resultTaskInfo = dispatcher.runSync("getProjectTask", [userLogin : userLogin , taskId : task.workEffortId]);
resultTaskInfo = runService('getProjectTask', [userLogin : userLogin , taskId : task.workEffortId]);
taskInfo = resultTaskInfo.taskInfo;
taskInfo.taskNr = task.workEffortId;
taskInfo.phaseNr = phase.phaseId;
@@ -27,7 +27,7 @@ allProjects = delegator.findList("WorkEffort", cond, (HashSet) ["workEffortId"],
projects = [];
allProjects.each { project ->
result = dispatcher.runSync("getProject", ["userLogin" : parameters.userLogin, "projectId" : project.workEffortId]);
result = runService('getProject', ["userLogin" : parameters.userLogin, "projectId" : project.workEffortId]);
if (result.projectInfo) {
resultAssign = delegator.findByAnd("WorkEffortPartyAssignment", ["partyId" : parameters.userLogin.partyId, "workEffortId" : project.workEffortId], null, false)
if (security.hasEntityPermission("PROJECTMGR", "_ADMIN", session)
@@ -36,7 +36,7 @@ allProjects = delegator.findList("WorkEffortAndPartyAssign", cond, (HashSet) ["w
projects = [];
allProjects.each { project ->
result = dispatcher.runSync("getProject", ["userLogin" : parameters.userLogin, "projectId" : project.workEffortId, partyId : parameters.partyId]);
result = runService('getProject', ["userLogin" : parameters.userLogin, "projectId" : project.workEffortId, partyId : parameters.partyId]);
projects.add(result.projectInfo);
}
if (projects) {
@@ -28,8 +28,6 @@ import sun.util.calendar.LocalGregorianCalendar.Date;
def module = "AddProductBacklogItem.groovy";
// find cust request and items
def performFindInMap = [:];
performFindInMap.entityName = "CustRequestAndCustRequestItem";
def inputFields = [:];
if(parameters.statusId == null){
@@ -39,9 +37,7 @@ if(parameters.statusId == null){
}
inputFields.putAll(parameters);
inputFields.custRequestTypeId = "RF_PROD_BACKLOG";
performFindInMap.inputFields = inputFields;
performFindInMap.orderBy = "custSequenceNum";
def performFindResults = dispatcher.runSync("performFind", performFindInMap);
def performFindResults = runService('performFind', ["entityName": "CustRequestAndCustRequestItem", "inputFields": inputFields, "orderBy": "custSequenceNum"]);
def custRequestAndItems = performFindResults.listIt.getCompleteList();
performFindResults.listIt.close();
@@ -58,7 +54,7 @@ custRequestAndItems.each() { custRequestAndItem ->
if (custWorkEffortList) {
actualHours = 0.00;
custWorkEffortList.each() { custWorkEffortMap ->
result = dispatcher.runSync("getScrumActualHour", ["taskId" : custWorkEffortMap.workEffortId,"partyId" : null, "userLogin" : userLogin]);
result = runService('getScrumActualHour', ["taskId" : custWorkEffortMap.workEffortId,"partyId" : null, "userLogin" : userLogin]);
actualHours += result.actualHours;
}
if(actualHours) {
@@ -117,7 +113,7 @@ unplannedList.each() { unplannedItem ->
if (unplanCustWorkEffortList) {
actualHours = 0.00;
unplanCustWorkEffortList.each() { custWorkEffortMap ->
result = dispatcher.runSync("getScrumActualHour", ["taskId" : custWorkEffortMap.workEffortId,"partyId" : null, "userLogin" : userLogin]);
result = runService('getScrumActualHour', ["taskId" : custWorkEffortMap.workEffortId,"partyId" : null, "userLogin" : userLogin]);
actualHours += result.actualHours;
}
if(actualHours) {
@@ -54,7 +54,7 @@ if (timesheetId) {
timesheet = entryIterator.next();
entryIterator.close();
if (timesheet == null) {
result = dispatcher.runSync("createProjectTimesheet", ["userLogin" : parameters.userLogin, "partyId" : partyId]);
result = runService('createProjectTimesheet', ["userLogin" : parameters.userLogin, "partyId" : partyId]);
if (result && result.timesheetId) {
timesheet = delegator.findOne("Timesheet", ["timesheetId" : result.timesheetId], false);
}
@@ -141,7 +141,7 @@ void retrieveWorkEffortData() {
// get project/phase information
entry.workEffortId = entryWorkEffort.workEffortId;
entry.workEffortName = entryWorkEffort.workEffortName;
result = dispatcher.runSync("getProjectInfoFromTask", ["userLogin" : parameters.userLogin,"taskId" : entryWorkEffort.workEffortId]);
result = runService('getProjectInfoFromTask', ["userLogin" : parameters.userLogin,"taskId" : entryWorkEffort.workEffortId]);
entry.phaseId = result.phaseId;
entry.phaseName = result.phaseName;
entry.projectId = result.projectId;
@@ -211,12 +211,8 @@ while (te.hasNext()) {
void retrieveEmplLeaveData() {
if (lastEmplLeaveEntry) {
//service get Hours
inputMap = [:];
inputMap.userLogin = parameters.userLogin;
inputMap.partyId = lastEmplLeaveEntry.partyId;
inputMap.leaveTypeId = lastEmplLeaveEntry.leaveTypeId;
inputMap.fromDate = lastEmplLeaveEntry.fromDate;
result = dispatcher.runSync("getPartyLeaveHoursForDate", inputMap);
result = runService('getPartyLeaveHoursForDate',
["userLogin": parameters.userLogin, "partyId": lastEmplLeaveEntry.partyId, "leaveTypeId": lastEmplLeaveEntry.leaveTypeId, "fromDate": lastEmplLeaveEntry.fromDate]);
if (result.hours) {
leaveEntry.plannedHours = result.hours;
leaveEntry.planHours = result.hours;
@@ -261,21 +257,13 @@ while ((emplLeaveMap = emplLeave.next())) {
!lastEmplLeaveEntry.partyId.equals(emplLeaveEntry.partyId))) {
retrieveEmplLeaveData();
}
input = [:];
input.userLogin = parameters.userLogin;
input.partyId = emplLeaveEntry.partyId;
input.leaveTypeId = emplLeaveEntry.leaveTypeId;
input.fromDate = emplLeaveEntry.fromDate;
resultHours = dispatcher.runSync("getPartyLeaveHoursForDate", input);
resultHours = runService('getPartyLeaveHoursForDate',
["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);
inputMap = [:];
inputMap.userLogin = parameters.userLogin;
inputMap.partyId = emplLeaveEntry.partyId;
inputMap.leaveTypeId = emplLeaveEntry.leaveTypeId;
inputMap.fromDate = emplLeaveEntry.fromDate;
resultHours = dispatcher.runSync("getPartyLeaveHoursForDate", inputMap);
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;
@@ -289,12 +277,8 @@ while ((emplLeaveMap = emplLeave.next())) {
}
if (resultHours.hours) {
leavePlanDay = "pd" + (emplLeaveEntry.fromDate.getTime() - timesheet.fromDate.getTime()) / (24*60*60*1000);
inputMap = [:];
inputMap.userLogin = parameters.userLogin;
inputMap.partyId = emplLeaveEntry.partyId;
inputMap.leaveTypeId = emplLeaveEntry.leaveTypeId;
inputMap.fromDate = emplLeaveEntry.fromDate;
resultPlanHours = dispatcher.runSync("getPartyLeaveHoursForDate", inputMap);
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;
@@ -364,12 +348,8 @@ timesheetsDb.each { timesheetDb ->
while ((emplLeaveMap = emplLeaveList.next())) {
emplLeaveEntry = emplLeaveMap;
inputData = [:];
inputData.userLogin = parameters.userLogin;
inputData.partyId = emplLeaveEntry.partyId;
inputData.leaveTypeId = emplLeaveEntry.leaveTypeId;
inputData.fromDate = emplLeaveEntry.fromDate;
resultHour = dispatcher.runSync("getPartyLeaveHoursForDate", inputData);
resultHour = runService('getPartyLeaveHoursForDate',
["userLogin": parameters.userLogin, "partyId": emplLeaveEntry.partyId, "leaveTypeId": emplLeaveEntry.leaveTypeId, "fromDate": emplLeaveEntry.fromDate]);
if (resultHour) {
leaveActualHours = resultHour.hours.doubleValue();
leaveHours += leaveActualHours;
@@ -53,7 +53,7 @@ if (timesheetId) {
timesheet = entryIterator.next();
entryIterator.close();
if (timesheet == null) {
result = dispatcher.runSync("createProjectTimesheet", ["userLogin" : parameters.userLogin, "partyId" : partyId]);
result = runService('createProjectTimesheet', ["userLogin" : parameters.userLogin, "partyId" : partyId]);
if (result && result.timesheetId) {
timesheet = delegator.findOne("Timesheet", ["timesheetId" : result.timesheetId], false);
}
@@ -114,7 +114,7 @@ void retrieveWorkEffortData() {
// get project/phase information
entry.workEffortId = entryWorkEffort.workEffortId;
entry.workEffortName = entryWorkEffort.workEffortName;
result = dispatcher.runSync("getProjectIdAndNameFromTask", ["userLogin" : parameters.userLogin,"taskId" : entryWorkEffort.workEffortId]);
result = runService('getProjectIdAndNameFromTask', ["userLogin" : parameters.userLogin,"taskId" : entryWorkEffort.workEffortId]);
entry.sprintId = result.phaseId;
entry.sprintName = result.phaseName;
entry.projectId = result.projectId;
@@ -109,7 +109,7 @@ if ((parameters.billed != null)||(parameters.parentCustRequestId != null)||(para
if (backlogCustWorkEffortList) {
actualHours = 0.00;
backlogCustWorkEffortList.each() { custWorkEffortMap ->
result = dispatcher.runSync("getScrumActualHour", ["taskId" : custWorkEffortMap.workEffortId,"partyId" : null, "userLogin" : userLogin]);
result = runService('getScrumActualHour', ["taskId" : custWorkEffortMap.workEffortId,"partyId" : null, "userLogin" : userLogin]);
actualHours += result.actualHours;
}
if(actualHours) {
@@ -41,7 +41,7 @@ performFindInMap.orderBy = parameters.sortField;
if (parameters.sortField) {
performFindInMap.orderBy = "lastName";
}
performFindResults = dispatcher.runSync("performFind", performFindInMap);
performFindResults = runService('performFind', performFindInMap);
resultList = performFindResults.listIt.getCompleteList();
performFindResults.listIt.close();
@@ -25,17 +25,13 @@ import org.ofbiz.base.util.UtilDateTime;
// get all timesheets of all user, including the planned hours
timesheets = [];
performFindInMap = [:];
inputFields = [:];
performFindInMap.entityName = "Timesheet";
if (!parameters.noConditionFind) {
parameters.noConditionFind = "N"
}
inputFields.putAll(parameters);
performFindInMap.inputFields = inputFields;
performFindInMap.orderBy = "fromDate DESC";
performFindResults = dispatcher.runSync("performFind", performFindInMap);
performFindResults = runService('performFind', ["entityName": "Timesheet", "inputFields": inputFields, "orderBy": "fromDate DESC"]);
if (performFindResults.listSize > 0) {
timesheetsDb = performFindResults.listIt.getCompleteList();
performFindResults.listIt.close();
@@ -52,12 +48,8 @@ if (performFindResults.listSize > 0) {
while ((emplLeaveMap = emplLeaveList.next())) {
emplLeaveEntry = emplLeaveMap;
inputData = [:];
inputData.userLogin = parameters.userLogin;
inputData.partyId = emplLeaveEntry.partyId;
inputData.leaveTypeId = emplLeaveEntry.leaveTypeId;
inputData.fromDate = emplLeaveEntry.fromDate;
resultHour = dispatcher.runSync("getPartyLeaveHoursForDate", inputData);
resultHour = runService('getPartyLeaveHoursForDate',
["userLogin": parameters.userLogin, "partyId": emplLeaveEntry.partyId, "leaveTypeId": emplLeaveEntry.leaveTypeId, "fromDate": emplLeaveEntry.fromDate]);
if (resultHour) {
leaveActualHours = resultHour.hours.doubleValue();
leaveHours += leaveActualHours;
@@ -51,14 +51,14 @@ try{
} else {
context.partyIdFrom = parentCom.partyIdTo;
}
resultsIdFrom = dispatcher.runSync("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;
}
// for team
defaultPartyIdTo = organizationPartyId;
resultsIdTo = dispatcher.runSync("getPartyEmail", ["partyId" : defaultPartyIdTo,"contactMechPurposeTypeId" :"SUPPORT_EMAIL", "userLogin" : userLogin]);
resultsIdTo = runService('getPartyEmail', ["partyId" : defaultPartyIdTo,"contactMechPurposeTypeId" :"SUPPORT_EMAIL", "userLogin" : userLogin]);
if (resultsIdTo.contactMechId != null) {
context.contactMechIdTo = resultsIdTo.contactMechId;
communicationEvent.contactMechIdTo = resultsIdTo.contactMechId;
@@ -72,7 +72,7 @@ try{
// for team
defaultPartyIdFrom = organizationPartyId;
context.partyIdFrom = defaultPartyIdFrom;
resultsIdFrom = dispatcher.runSync("getPartyEmail", ["partyId" : defaultPartyIdFrom,"contactMechPurposeTypeId" :"SUPPORT_EMAIL", "userLogin" : userLogin]);
resultsIdFrom = runService('getPartyEmail', ["partyId" : defaultPartyIdFrom,"contactMechPurposeTypeId" :"SUPPORT_EMAIL", "userLogin" : userLogin]);
if (resultsIdFrom.contactMechId != null) {
context.contactMechIdFrom = resultsIdFrom.contactMechId;
communicationEvent.contactMechIdFrom = resultsIdFrom.contactMechId;
@@ -86,7 +86,7 @@ try{
} else {
context.partyIdTo = parentCom.partyIdFrom;
}
resultsIdTo = dispatcher.runSync("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;