Author: jleroux
Date: Sat Dec 16 09:28:37 2017 New Revision: 1818378 URL: http://svn.apache.org/viewvc?rev=1818378&view=rev Log: No functional change, just trivial formatting I began to reformat this supposed refactoring commit, but stopped and decided to rather discuss this in the related Jira. BTW automatically cutting lines at some narrow width does not make sense most of the time. See EntityQuery cases for instance, are they not easier to read when, IMO, rightly formatted, as I did here? Modified: ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/tax/TaxAuthorityServices.java Modified: ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/tax/TaxAuthorityServices.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/tax/TaxAuthorityServices.java?rev=1818378&r1=1818377&r2=1818378&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/tax/TaxAuthorityServices.java (original) +++ ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/tax/TaxAuthorityServices.java Sat Dec 16 09:28:37 2017 @@ -63,8 +63,7 @@ public class TaxAuthorityServices { public static final int salestaxRounding = UtilNumber.getBigDecimalRoundingMode("salestax.rounding"); public static final String resource = "AccountingUiLabels"; - public static Map<String, Object> rateProductTaxCalcForDisplay(DispatchContext dctx, - Map<String, ? extends Object> context) { + public static Map<String, Object> rateProductTaxCalcForDisplay(DispatchContext dctx, Map<String, ? extends Object> context) { Delegator delegator = dctx.getDelegator(); String productStoreId = (String) context.get("productStoreId"); String billToPartyId = (String) context.get("billToPartyId"); @@ -87,20 +86,27 @@ public class TaxAuthorityServices { } try { - GenericValue product = EntityQuery.use(delegator).from("Product").where("productId", productId).cache() + GenericValue product = EntityQuery.use(delegator) + .from("Product") + .where("productId", productId).cache() + .queryOne(); + GenericValue productStore = EntityQuery.use(delegator) + .from("ProductStore") + .where("productStoreId", productStoreId) + .cache() .queryOne(); - GenericValue productStore = EntityQuery.use(delegator).from("ProductStore").where("productStoreId", - productStoreId).cache().queryOne(); if (productStore == null) { - throw new IllegalArgumentException("Could not find ProductStore with ID [" + productStoreId - + "] for tax calculation"); + throw new IllegalArgumentException("Could not find ProductStore with ID [" + productStoreId + "] for tax calculation"); } if ("Y".equals(productStore.getString("showPricesWithVatTax"))) { Set<GenericValue> taxAuthoritySet = new HashSet<>(); if (productStore.get("vatTaxAuthPartyId") == null) { - List<GenericValue> taxAuthorityRawList = EntityQuery.use(delegator).from("TaxAuthority") - .where("taxAuthGeoId", productStore.get("vatTaxAuthGeoId")).cache().queryList(); + List<GenericValue> taxAuthorityRawList = EntityQuery.use(delegator) + .from("TaxAuthority") + .where("taxAuthGeoId", productStore.get("vatTaxAuthGeoId")) + .cache() + .queryList(); taxAuthoritySet.addAll(taxAuthorityRawList); } else { GenericValue taxAuthority = EntityQuery.use(delegator).from("TaxAuthority").where("taxAuthGeoId", @@ -175,7 +181,9 @@ public class TaxAuthorityServices { GenericValue facility = null; try { if (productStoreId != null) { - productStore = EntityQuery.use(delegator).from("ProductStore").where("productStoreId", productStoreId) + productStore = EntityQuery.use(delegator) + .from("ProductStore") + .where("productStoreId", productStoreId) .queryOne(); } if (facilityId != null) { |
Free forum by Nabble | Edit this page |