You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by mb...@apache.org on 2017/12/12 06:18:38 UTC
svn commit: r1817881 [3/3] - in
/ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/invoice:
InvoiceServices.java InvoiceWorker.java
Modified: ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/invoice/InvoiceWorker.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/invoice/InvoiceWorker.java?rev=1817881&r1=1817880&r2=1817881&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/invoice/InvoiceWorker.java (original)
+++ ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/invoice/InvoiceWorker.java Tue Dec 12 06:18:38 2017
@@ -62,7 +62,7 @@ public final class InvoiceWorker {
* Return the total amount of the invoice (including tax) using the the invoiceId as input.
* @param delegator the delegator
* @param invoiceId the invoice id
- * @return Return the total amount of the invoice
+ * @return Return the total amount of the invoice
*/
public static BigDecimal getInvoiceTotal(Delegator delegator, String invoiceId) {
return getInvoiceTotal(delegator, invoiceId, Boolean.TRUE);
@@ -115,7 +115,7 @@ public final class InvoiceWorker {
/** Method to get the taxable invoice item types as a List of invoiceItemTypeIds. These are identified in Enumeration with enumTypeId TAXABLE_INV_ITM_TY. */
public static List<String> getTaxableInvoiceItemTypeIds(Delegator delegator) throws GenericEntityException {
- List<String> typeIds = new LinkedList<String>();
+ List<String> typeIds = new LinkedList<>();
List<GenericValue> invoiceItemTaxTypes = EntityQuery.use(delegator).from("Enumeration").where("enumTypeId", "TAXABLE_INV_ITM_TY")
.cache().queryList();
for (GenericValue invoiceItemTaxType : invoiceItemTaxTypes) {
@@ -216,8 +216,9 @@ public final class InvoiceWorker {
} catch (GenericEntityException e) {
Debug.logError(e, "Trouble getting Party from InvoiceRole", module);
}
- if (party != null)
+ if (party != null) {
return party;
+ }
}
return null;
}
@@ -259,8 +260,9 @@ public final class InvoiceWorker {
} catch (GenericEntityException e) {
Debug.logError(e, "Trouble getting Party from InvoiceRole", module);
}
- if (party != null)
+ if (party != null) {
return party;
+ }
}
return null;
}
@@ -282,7 +284,7 @@ public final class InvoiceWorker {
public static GenericValue getSendFromAddress(GenericValue invoice) {
return getInvoiceAddressByType(invoice, "PAYMENT_LOCATION");
}
-
+
public static GenericValue getInvoiceAddressByType(GenericValue invoice, String contactMechPurposeTypeId) {
return getInvoiceAddressByType(invoice, contactMechPurposeTypeId, true);
}
@@ -301,10 +303,12 @@ public final class InvoiceWorker {
// if no locations found get it from the PartyAndContactMech using the from and to party on the invoice
String destinationPartyId = null;
Timestamp now = UtilDateTime.nowTimestamp();
- if ("SALES_INVOICE".equals(invoice.getString("invoiceTypeId")))
+ if ("SALES_INVOICE".equals(invoice.getString("invoiceTypeId"))) {
destinationPartyId = invoice.getString("partyId");
- if ("PURCHASE_INVOICE".equals(invoice.getString("invoiceTypeId")))
+ }
+ if ("PURCHASE_INVOICE".equals(invoice.getString("invoiceTypeId"))) {
destinationPartyId = invoice.getString("partyId");
+ }
try {
locations = EntityQuery.use(delegator).from("PartyContactWithPurpose")
.where("partyId", destinationPartyId, "contactMechPurposeTypeId", contactMechPurposeTypeId).queryList();
@@ -590,7 +594,7 @@ public final class InvoiceWorker {
@Deprecated
public static Map<String, Object> getInvoiceTaxByTaxAuthGeoAndParty(GenericValue invoice) {
BigDecimal taxGrandTotal = ZERO;
- List<Map<String, Object>> taxByTaxAuthGeoAndPartyList = new LinkedList<Map<String,Object>>();
+ List<Map<String, Object>> taxByTaxAuthGeoAndPartyList = new LinkedList<>();
List<GenericValue> invoiceItems = null;
if (invoice != null) {
try {
@@ -638,7 +642,7 @@ public final class InvoiceWorker {
}
}
}
- Map<String, Object> result = new HashMap<String, Object>();
+ Map<String, Object> result = new HashMap<>();
result.put("taxByTaxAuthGeoAndPartyList", taxByTaxAuthGeoAndPartyList);
result.put("taxGrandTotal", taxGrandTotal);
return result;
@@ -651,10 +655,11 @@ public final class InvoiceWorker {
* will not account for tax lines that do not contain a taxAuthPartyId
*/
public static Map<String, Set<String>> getInvoiceTaxAuthPartyAndGeos (GenericValue invoice) {
- Map<String, Set<String>> result = new HashMap<String, Set<String>>();
+ Map<String, Set<String>> result = new HashMap<>();
- if (invoice == null)
- throw new IllegalArgumentException("Invoice cannot be null.");
+ if (invoice == null) {
+ throw new IllegalArgumentException("Invoice cannot be null.");
+ }
List<GenericValue> invoiceTaxItems = null;
try {
Delegator delegator = invoice.getDelegator();
@@ -672,7 +677,7 @@ public final class InvoiceWorker {
String taxAuthGeoId = invoiceItem.getString("taxAuthGeoId");
if (UtilValidate.isNotEmpty(taxAuthPartyId)) {
if (!result.containsKey(taxAuthPartyId)) {
- Set<String> taxAuthGeos = new HashSet<String>();
+ Set<String> taxAuthGeos = new HashSet<>();
taxAuthGeos.add(taxAuthGeoId);
result.put(taxAuthPartyId, taxAuthGeos);
} else {