Modified: ofbiz/trunk/applications/party/groovyScripts/party/PartyFinancialHistory.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/groovyScripts/party/PartyFinancialHistory.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/applications/party/groovyScripts/party/PartyFinancialHistory.groovy (original) +++ ofbiz/trunk/applications/party/groovyScripts/party/PartyFinancialHistory.groovy Wed Nov 2 19:09:13 2016 @@ -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 } Modified: ofbiz/trunk/applications/party/groovyScripts/party/PartyGeoLocation.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/groovyScripts/party/PartyGeoLocation.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/applications/party/groovyScripts/party/PartyGeoLocation.groovy (original) +++ ofbiz/trunk/applications/party/groovyScripts/party/PartyGeoLocation.groovy Wed Nov 2 19:09:13 2016 @@ -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 } } Modified: ofbiz/trunk/applications/party/groovyScripts/party/SetRoleVars.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/groovyScripts/party/SetRoleVars.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/applications/party/groovyScripts/party/SetRoleVars.groovy (original) +++ ofbiz/trunk/applications/party/groovyScripts/party/SetRoleVars.groovy Wed Nov 2 19:09:13 2016 @@ -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 } } } Modified: ofbiz/trunk/applications/party/groovyScripts/party/StatusCondition.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/groovyScripts/party/StatusCondition.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/applications/party/groovyScripts/party/StatusCondition.groovy (original) +++ ofbiz/trunk/applications/party/groovyScripts/party/StatusCondition.groovy Wed Nov 2 19:09:13 2016 @@ -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) Modified: ofbiz/trunk/applications/party/groovyScripts/party/UnAppliedInvoicesForParty.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/groovyScripts/party/UnAppliedInvoicesForParty.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/applications/party/groovyScripts/party/UnAppliedInvoicesForParty.groovy (original) +++ ofbiz/trunk/applications/party/groovyScripts/party/UnAppliedInvoicesForParty.groovy Wed Nov 2 19:09:13 2016 @@ -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 Modified: ofbiz/trunk/applications/party/groovyScripts/party/UnAppliedPaymentsForParty.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/groovyScripts/party/UnAppliedPaymentsForParty.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/applications/party/groovyScripts/party/UnAppliedPaymentsForParty.groovy (original) +++ ofbiz/trunk/applications/party/groovyScripts/party/UnAppliedPaymentsForParty.groovy Wed Nov 2 19:09:13 2016 @@ -16,16 +16,16 @@ * specific language governing permissions and limitations * under the License. */ -import org.apache.ofbiz.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 Modified: ofbiz/trunk/applications/party/groovyScripts/party/ViewProfile.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/groovyScripts/party/ViewProfile.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/applications/party/groovyScripts/party/ViewProfile.groovy (original) +++ ofbiz/trunk/applications/party/groovyScripts/party/ViewProfile.groovy Wed Nov 2 19:09:13 2016 @@ -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() Modified: ofbiz/trunk/applications/party/groovyScripts/visit/ShowVisits.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/groovyScripts/visit/ShowVisits.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/applications/party/groovyScripts/visit/ShowVisits.groovy (original) +++ ofbiz/trunk/applications/party/groovyScripts/visit/ShowVisits.groovy Wed Nov 2 19:09:13 2016 @@ -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 Modified: ofbiz/trunk/applications/party/groovyScripts/visit/VisitDetails.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/groovyScripts/visit/VisitDetails.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/applications/party/groovyScripts/visit/VisitDetails.groovy (original) +++ ofbiz/trunk/applications/party/groovyScripts/visit/VisitDetails.groovy Wed Nov 2 19:09:13 2016 @@ -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.viewIndex = viewIndex; -context.viewSize = viewSize; -context.listSize = listSize; -context.lowIndex = lowIndex; -context.highIndex = highIndex; +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 Modified: ofbiz/trunk/applications/product/groovyScripts/catalog/ChooseTopCategory.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/groovyScripts/catalog/ChooseTopCategory.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/applications/product/groovyScripts/catalog/ChooseTopCategory.groovy (original) +++ ofbiz/trunk/applications/product/groovyScripts/catalog/ChooseTopCategory.groovy Wed Nov 2 19:09:13 2016 @@ -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 Modified: ofbiz/trunk/applications/product/groovyScripts/catalog/FastLoadCache.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/groovyScripts/catalog/FastLoadCache.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/applications/product/groovyScripts/catalog/FastLoadCache.groovy (original) +++ ofbiz/trunk/applications/product/groovyScripts/catalog/FastLoadCache.groovy Wed Nov 2 19:09:13 2016 @@ -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 Modified: ofbiz/trunk/applications/product/groovyScripts/catalog/GetSupplierInventories.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/groovyScripts/catalog/GetSupplierInventories.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/applications/product/groovyScripts/catalog/GetSupplierInventories.groovy (original) +++ ofbiz/trunk/applications/product/groovyScripts/catalog/GetSupplierInventories.groovy Wed Nov 2 19:09:13 2016 @@ -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 Modified: ofbiz/trunk/applications/product/groovyScripts/catalog/PrepareCreateShipMeth.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/groovyScripts/catalog/PrepareCreateShipMeth.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/applications/product/groovyScripts/catalog/PrepareCreateShipMeth.groovy (original) +++ ofbiz/trunk/applications/product/groovyScripts/catalog/PrepareCreateShipMeth.groovy Wed Nov 2 19:09:13 2016 @@ -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" } Modified: ofbiz/trunk/applications/product/groovyScripts/catalog/category/CategoryTree.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/groovyScripts/catalog/category/CategoryTree.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/applications/product/groovyScripts/catalog/category/CategoryTree.groovy (original) +++ ofbiz/trunk/applications/product/groovyScripts/catalog/category/CategoryTree.groovy Wed Nov 2 19:09:13 2016 @@ -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.Enti 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 Modified: ofbiz/trunk/applications/product/groovyScripts/catalog/category/CreateProductInCategoryCheckExisting.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/groovyScripts/catalog/category/CreateProductInCategoryCheckExisting.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/applications/product/groovyScripts/catalog/category/CreateProductInCategoryCheckExisting.groovy (original) +++ ofbiz/trunk/applications/product/groovyScripts/catalog/category/CreateProductInCategoryCheckExisting.groovy Wed Nov 2 19:09:13 2016 @@ -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 Modified: ofbiz/trunk/applications/product/groovyScripts/catalog/category/EditCategory.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/groovyScripts/catalog/category/EditCategory.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/applications/product/groovyScripts/catalog/category/EditCategory.groovy (original) +++ ofbiz/trunk/applications/product/groovyScripts/catalog/category/EditCategory.groovy Wed Nov 2 19:09:13 2016 @@ -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; - -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]); +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]) // 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() } } } Modified: ofbiz/trunk/applications/product/groovyScripts/catalog/category/EditCategoryContentContent.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/groovyScripts/catalog/category/EditCategoryContentContent.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/applications/product/groovyScripts/catalog/category/EditCategoryContentContent.groovy (original) +++ ofbiz/trunk/applications/product/groovyScripts/catalog/category/EditCategoryContentContent.groovy Wed Nov 2 19:09:13 2016 @@ -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}" } Modified: ofbiz/trunk/applications/product/groovyScripts/catalog/category/EditCategoryProducts.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/groovyScripts/catalog/category/EditCategoryProducts.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/applications/product/groovyScripts/catalog/category/EditCategoryProducts.groovy (original) +++ ofbiz/trunk/applications/product/groovyScripts/catalog/category/EditCategoryProducts.groovy Wed Nov 2 19:09:13 2016 @@ -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 Modified: ofbiz/trunk/applications/product/groovyScripts/catalog/category/EditCategorySEO.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/groovyScripts/catalog/category/EditCategorySEO.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/applications/product/groovyScripts/catalog/category/EditCategorySEO.groovy (original) +++ ofbiz/trunk/applications/product/groovyScripts/catalog/category/EditCategorySEO.groovy Wed Nov 2 19:09:13 2016 @@ -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 } } } Modified: ofbiz/trunk/applications/product/groovyScripts/catalog/config/EditProductConfigItemContent.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/groovyScripts/catalog/config/EditProductConfigItemContent.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/applications/product/groovyScripts/catalog/config/EditProductConfigItemContent.groovy (original) +++ ofbiz/trunk/applications/product/groovyScripts/catalog/config/EditProductConfigItemContent.groovy Wed Nov 2 19:09:13 2016 @@ -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() } } } Modified: ofbiz/trunk/applications/product/groovyScripts/catalog/config/EditProductConfigItemContentContent.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/groovyScripts/catalog/config/EditProductConfigItemContentContent.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/applications/product/groovyScripts/catalog/config/EditProductConfigItemContentContent.groovy (original) +++ ofbiz/trunk/applications/product/groovyScripts/catalog/config/EditProductConfigItemContentContent.groovy Wed Nov 2 19:09:13 2016 @@ -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 Modified: ofbiz/trunk/applications/product/groovyScripts/catalog/feature/EditFeatureCategoryFeatures.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/groovyScripts/catalog/feature/EditFeatureCategoryFeatures.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/applications/product/groovyScripts/catalog/feature/EditFeatureCategoryFeatures.groovy (original) +++ ofbiz/trunk/applications/product/groovyScripts/catalog/feature/EditFeatureCategoryFeatures.groovy Wed Nov 2 19:09:13 2016 @@ -23,52 +23,52 @@ import org.apache.ofbiz.entity.util.Enti 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 Modified: ofbiz/trunk/applications/product/groovyScripts/catalog/feature/EditFeatureGroups.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/groovyScripts/catalog/feature/EditFeatureGroups.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/applications/product/groovyScripts/catalog/feature/EditFeatureGroups.groovy (original) +++ ofbiz/trunk/applications/product/groovyScripts/catalog/feature/EditFeatureGroups.groovy Wed Nov 2 19:09:13 2016 @@ -19,4 +19,4 @@ context.hasPermission = security.hasEntityPermission("CATALOG", "_VIEW", session) -context.productFeatureGroups = from("ProductFeatureGroup").queryList(); +context.productFeatureGroups = from("ProductFeatureGroup").queryList() |
Free forum by Nabble | Edit this page |